add a refcount field (for intrusive refcounting) to ScopePath
This commit is contained in:
parent
36e342fc11
commit
46eae1c03a
2 changed files with 20 additions and 2 deletions
|
|
@ -83,7 +83,8 @@ namespace session {
|
|||
* may cause an empty default session to be created.
|
||||
*/
|
||||
ScopePath::ScopePath ()
|
||||
: path_()
|
||||
: refcount_(0)
|
||||
, path_()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
|
@ -100,7 +101,8 @@ namespace session {
|
|||
* can't be connected to the (implicit) root
|
||||
*/
|
||||
ScopePath::ScopePath (Scope const& leaf)
|
||||
: path_()
|
||||
: refcount_(0)
|
||||
, path_()
|
||||
{
|
||||
if (!leaf.isValid()) return; // invalid leaf defines invalid path....
|
||||
|
||||
|
|
@ -109,6 +111,12 @@ namespace session {
|
|||
}
|
||||
|
||||
|
||||
ScopePath::~ScopePath()
|
||||
{
|
||||
WARN_IF (refcount_, "Destroying a scope path frame with ref-count=%u", refcount_);
|
||||
}
|
||||
|
||||
|
||||
/** constant \em invalid path token. Created by locating an invalid scope */
|
||||
const ScopePath ScopePath::INVALID = ScopePath(Scope());
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ namespace session {
|
|||
class ScopePath
|
||||
: public lib::BoolCheckable<ScopePath>
|
||||
{
|
||||
size_t refcount_;
|
||||
std::vector<Scope> path_;
|
||||
|
||||
typedef vector<Scope> _VType;
|
||||
|
|
@ -117,6 +118,7 @@ namespace session {
|
|||
typedef lib::RangeIter<_VIter> _IterType;
|
||||
|
||||
public:
|
||||
~ScopePath ();
|
||||
ScopePath ();
|
||||
ScopePath (Scope const& leaf);
|
||||
|
||||
|
|
@ -127,6 +129,7 @@ namespace session {
|
|||
bool empty() const;
|
||||
size_t size() const;
|
||||
size_t length() const;
|
||||
size_t ref_count()const;
|
||||
////////////////////////////////////////TICKET #429 : diagnostic output to be added later
|
||||
|
||||
/// Iteration is always ascending from leaf to root
|
||||
|
|
@ -179,6 +182,13 @@ namespace session {
|
|||
}
|
||||
|
||||
|
||||
inline size_t
|
||||
ScopePath::ref_count() const
|
||||
{
|
||||
return refcount_;
|
||||
}
|
||||
|
||||
|
||||
inline size_t
|
||||
ScopePath::length() const
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue