Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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.
 

Static Public Attributes

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

Public Member Functions

 ~ScopePath ()
 
 ScopePath ()
 Create an empty path.
 
 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).
 
 ScopePath (ScopePath const &)
 
ScopePathoperator= (ScopePath const &)
 Copy from existing path.
 
 operator bool () const
 
bool isValid () const
 a valid path consists of more than just the root element.
 
bool empty () const
 an empty path doesn't even contain a root element.
 
bool isRoot () const
 
size_t size () const
 
size_t length () const
 
size_t ref_count () const
 
 operator string () const
 ScopePath diagnostic self display.
 
iterator begin () const
 
iterator end () const
 
Scope const & getLeaf () const
 
bool endsAt (Scope const &) const
 verify the scope in question is equivalent to our leaf scope.
 
bool contains (Scope const &) const
 
bool contains (ScopePath const &) const
 
void clear ()
 
Scope const & moveUp ()
 
Scope const & goRoot ()
 
void navigate (Scope const &)
 

Friends

ScopePath commonPrefix (ScopePath const &, ScopePath const &)
 
bool disjoint (ScopePath const &, ScopePath const &)
 
bool operator== (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 *)
 

Private Types

typedef vector< Scope_VType
 
typedef _VType::const_reverse_iterator _VIter
 
typedef lib::RangeIter< _VIter_IterType
 

Private Member Functions

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

Private Attributes

size_t refcount_
 
std::vector< Scopepath_
 

Constructor & Destructor Documentation

◆ ~ScopePath()

~ScopePath ( )

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

References ScopePath::refcount_.

◆ ScopePath() [1/3]

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.

References ScopePath::clear().

+ Here is the call graph for this function:

◆ ScopePath() [2/3]

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 ScopePath::clear(), Scope::INVALID, and ScopePath::navigate().

+ Here is the call graph for this function:

◆ ScopePath() [3/3]

ScopePath ( ScopePath const &  o)

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

Member Typedef Documentation

◆ _VType

typedef vector<Scope> _VType
private

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

◆ _VIter

typedef _VType::const_reverse_iterator _VIter
private

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

◆ _IterType

typedef lib::RangeIter<_VIter> _IterType
private

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

◆ iterator

Iteration is always ascending from leaf to root.

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

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.

References ScopePath::path_, and ScopePath::refcount_.

◆ operator bool()

operator bool ( ) const
inlineexplicit

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

References ScopePath::isValid().

+ Here is the call graph for this function:

◆ 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 ScopePath::hasValidRoot(), and ScopePath::length().

Referenced by ScopePath_test::checkInvalidScopeDetection(), ScopePath::clear(), ScopePath::contains(), ScopePath::operator bool(), QueryFocusStack::push(), and ScopePath_test::rootPath().

+ 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.

References ScopePath::path_.

Referenced by steam::mobject::session::anonymous_namespace{scope-path.cpp}::___check_notBottom(), ScopePath_test::checkInvalidScopeDetection(), ScopePath::clear(), QueryFocusStack_test::clear(), ScopePath::contains(), ScopePath_test::invalidPath(), ScopePath::moveUp(), and ScopePath_test::rootPath().

+ Here is the caller graph for this function:

◆ isRoot()

bool isRoot ( ) const
inline

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

References ScopePath::path_, and ScopePath::size().

Referenced by QueryFocusStack_test::createStack().

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

◆ size()

size_t size ( ) const
inline

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

References ScopePath::path_.

Referenced by ScopePath::isRoot().

+ Here is the caller graph for this function:

◆ length()

size_t length ( ) const
inline

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

References ScopePath::path_.

Referenced by ScopePath::contains(), ScopePath::hasValidRoot(), ScopePath_test::invalidPath(), ScopePath::isValid(), ScopePath::moveUp(), and ScopePath_test::rootPath().

+ Here is the caller graph for this function:

◆ ref_count()

size_t ref_count ( ) const
inline

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

References ScopePath::refcount_.

Referenced by QueryFocusStack_test::automaticFrameHandling(), ScopePath_test::check_RefcountProtection(), QueryFocusStack_test::clear(), steam::mobject::session::test::anonymous_namespace{query-focus-test.cpp}::refs(), QueryFocusStack_test::usePushedFrame(), and QueryFocusStack_test::verify_errorHandling().

+ 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.

References ScopePath::path_.

Referenced by ScopePath_test::checkIteration(), ScopePath::contains(), ScopePath::contains(), and ScopeLocator::locate().

+ Here is the caller graph for this function:

◆ end()

ScopePath::iterator end ( ) const
inline

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

◆ getLeaf()

Scope const & getLeaf ( ) const

◆ 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::getLeaf().

Referenced by ScopePath_test::checkRelations(), ScopePath_test::invalidPath(), and ScopePath_test::navigate().

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

◆ contains() [1/2]

bool contains ( Scope const &  aScope) const

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

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

Referenced by ScopePath_test::buildPath(), ScopePath_test::check_Identity_and_Copy(), QueryFocus_test::checkNavigation(), ScopePath_test::checkRelations(), ScopePath::contains(), ScopePath_test::invalidPath(), and ScopePath_test::navigate().

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

◆ contains() [2/2]

bool contains ( ScopePath const &  otherPath) const

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

References ScopePath::begin(), ScopePath::contains(), ScopePath::empty(), ScopePath::isValid(), and ScopePath::length().

+ Here is the call graph for this function:

◆ clear()

void clear ( )

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

References ScopePath::currModelRoot(), ScopePath::empty(), ScopePath::hasValidRoot(), ScopePath::isValid(), and ScopePath::path_.

Referenced by ScopePath::ScopePath(), ScopePath::ScopePath(), and ScopePath_test::clear().

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

◆ moveUp()

Scope const & moveUp ( )

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

References ScopePath::empty(), Scope::INVALID, ScopePath::length(), and ScopePath::path_.

Referenced by ScopePath_test::check_Identity_and_Copy(), ScopePath_test::check_RefcountProtection(), ScopePath_test::checkRelations(), QueryFocusStack_test::clear(), ScopePath_test::invalidPath(), ScopePath_test::navigate(), and QueryFocusStack_test::usePushedFrame().

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

◆ goRoot()

Scope const & goRoot ( )

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

References ScopePath::hasValidRoot(), and ScopePath::path_.

Referenced by ScopePath_test::invalidPath(), ScopePath_test::navigate(), ScopePath_test::rootPath(), and QueryFocusStack_test::usePushedFrame().

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

◆ navigate()

void navigate ( Scope const &  target)

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

References Scope::isValid(), LERR_, and ScopePath::path_.

Referenced by ScopePath::ScopePath(), QueryFocusStack_test::automaticFrameHandling(), ScopePath_test::invalidPath(), ScopeLocator::locate(), ScopePath_test::navigate(), QueryFocusStack_test::usePushedFrame(), and QueryFocusStack_test::verify_errorHandling().

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

◆ hasValidRoot()

bool hasValidRoot ( ) const
private

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

References ScopePath::currModelRoot(), ScopePath::length(), and ScopePath::path_.

Referenced by ScopePath::clear(), ScopePath::goRoot(), and ScopePath::isValid().

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

◆ currModelRoot()

PlacementMO const & currModelRoot ( ) const
private

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

References SessionServiceExploreScope::getScopeRoot().

Referenced by ScopePath::clear(), and ScopePath::hasValidRoot().

+ Here is the call graph for this function:
+ Here is the caller 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.

References ScopePath::path_.

Member Data Documentation

◆ refcount_

size_t refcount_
private

◆ path_

◆ 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.

Referenced by ScopePath_test::check_Identity_and_Copy(), and ScopePath_test::invalidPath().

Friends And Related Symbol Documentation

◆ commonPrefix

ScopePath commonPrefix ( ScopePath const &  path1,
ScopePath const &  path2 
)
friend

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

◆ disjoint

bool disjoint ( ScopePath const &  path1,
ScopePath const &  path2 
)
friend

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

◆ operator==

bool operator== ( ScopePath const &  path1,
ScopePath const &  path2 
)
friend

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

◆ intrusive_ptr_add_ref

void intrusive_ptr_add_ref ( ScopePath pathFrame)
friend

management function for boost::intrusive_ptr to be picked up by ADL

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

◆ intrusive_ptr_release

void intrusive_ptr_release ( ScopePath pathFrame)
friend

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

+ Collaboration diagram for ScopePath:

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