Lumiera  0.pre.03
»edit your freedom«
ScopePath Class Reference

#include "steam/mobject/session/scope-path.hpp"

Description

Sequence of nested scopes within the high-level model.

Implemented as vector of Scope elements. Providing state and relation predicates, and the ability to navigate the current location, as represented by the current leaf element of the path.

Incorporates a ref count to be utilised by ScopeLocator and QueryFocus to establish the current focus (path).

Definition at line 126 of file scope-path.hpp.

Public Types

typedef _IterType iterator
 Iteration is always ascending from leaf to root.
 

Public Member Functions

 ScopePath ()
 Create an empty path. More...
 
 ScopePath (Scope const &leaf)
 When creating a path to a given (leaf) scope, the complete sequence of nested scopes leading to this special scope is discovered, using the query service exposed by the session (through ScopeLocator). More...
 
 ScopePath (ScopePath const &)
 
iterator begin () const
 
void clear ()
 
bool contains (Scope const &) const
 
bool contains (ScopePath const &) const
 
bool empty () const
 an empty path doesn't even contain a root element. More...
 
iterator end () const
 
bool endsAt (Scope const &) const
 verify the scope in question is equivalent to our leaf scope. More...
 
Scope const & getLeaf () const
 
Scope const & goRoot ()
 
bool isRoot () const
 
bool isValid () const
 a valid path consists of more than just the root element. More...
 
size_t length () const
 
Scope const & moveUp ()
 
void navigate (Scope const &)
 
 operator bool () const
 
 operator string () const
 ScopePath diagnostic self display. More...
 
ScopePathoperator= (ScopePath const &)
 Copy from existing path. More...
 
size_t ref_count () const
 
size_t size () const
 

Static Public Attributes

static const ScopePath INVALID = ScopePath(Scope())
 constant invalid path token. More...
 

Friends

ScopePath commonPrefix (ScopePath const &, ScopePath const &)
 
bool disjoint (ScopePath const &, ScopePath const &)
 
void intrusive_ptr_add_ref (ScopePath *)
 management function for boost::intrusive_ptr to be picked up by ADL
 
void intrusive_ptr_release (ScopePath *)
 
bool operator== (ScopePath const &, ScopePath const &)
 

Private Types

typedef lib::RangeIter< _VIter > _IterType
 
typedef _VType::const_reverse_iterator _VIter
 
typedef vector< Scope_VType
 

Private Member Functions

void appendScope (Scope const &)
 
PlacementMO const & currModelRoot () const
 
bool hasValidRoot () const
 

Private Attributes

std::vector< Scopepath_
 
size_t refcount_
 

Constructor & Destructor Documentation

◆ ScopePath() [1/2]

ScopePath ( )

Create an empty path.

By default, a scope path just contains the root scope of the current session (PlacementIndex).

Note
invoking this function accesses the session and thus may cause an empty default session to be created.

Definition at line 74 of file scope-path.cpp.

Referenced by ScopePath::ScopePath().

+ Here is the caller graph for this function:

◆ ScopePath() [2/2]

ScopePath ( Scope const &  leaf)

When creating a path to a given (leaf) scope, the complete sequence of nested scopes leading to this special scope is discovered, using the query service exposed by the session (through ScopeLocator).

Note
when locating the default (invalid) scope, a special empty ScopePath is created
Exceptions
error::Invalidif the given target scope can't be connected to the (implicit) root

Definition at line 92 of file scope-path.cpp.

References Scope::INVALID, and ScopePath::ScopePath().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator=()

ScopePath & operator= ( ScopePath const &  ref)

Copy from existing path.

Exceptions
error::Logicwhen current path has nonzero refcount

Definition at line 113 of file scope-path.cpp.

◆ isValid()

bool isValid ( ) const

a valid path consists of more than just the root element.

Note
contrary to this, an empty path doesn't even contain a root element

Definition at line 161 of file scope-path.cpp.

References SessionServiceExploreScope::getScopeRoot().

Referenced by ScopePath::endsAt(), and QueryFocusStack::push().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty()

bool empty ( ) const
inline

an empty path doesn't even contain a root element.

Many operations throw when invoked on such a path. Navigating up from an root path creates an empty path.

Definition at line 256 of file scope-path.hpp.

Referenced by ScopePath::endsAt().

+ Here is the caller graph for this function:

◆ operator string()

operator string ( ) const

ScopePath diagnostic self display.

Implemented similar to a filesystem path, where the path elements are based on the self-display of the MObject attached through the respective scope top placement.

Definition at line 141 of file scope-path.cpp.

◆ begin()

ScopePath::iterator begin ( ) const
inline
Note
actually this is an Lumiera Forward Iterator, yielding the path up to root as a sequence of const Scope elements

Definition at line 277 of file scope-path.hpp.

Referenced by ScopePath::endsAt().

+ Here is the caller graph for this function:

◆ endsAt()

bool endsAt ( Scope const &  aScope) const

verify the scope in question is equivalent to our leaf scope.

Equivalence of scopes means they are defined by the same scope top placement, i.e. registered with the same Placement-ID.

Definition at line 203 of file scope-path.cpp.

References ScopePath::begin(), ScopePath::empty(), Scope::INVALID, and ScopePath::isValid().

+ Here is the call graph for this function:

◆ appendScope()

void appendScope ( Scope const &  child)
private
Parameters
child

backdoor for #commonPrefix

Definition at line 325 of file scope-path.cpp.

Member Data Documentation

◆ INVALID

const ScopePath INVALID = ScopePath(Scope())
static

constant invalid path token.

Created by locating an invalid scope

Definition at line 144 of file scope-path.hpp.

+ Collaboration diagram for ScopePath:

The documentation for this class was generated from the following files: