47 using lib::append_all;
68 throw error::Logic (operation_descr+
" an empty placement scope path" 69 , LERR_(EMPTY_SCOPE_PATH));
125 throw error::Logic (
"Attempt to overwrite a ScopePath with nonzero refcount");
127 if (!isSameObject (*
this, ref))
130 ENSURE (0 == refcount_);
136 ScopePath::~ScopePath()
138 WARN_IF (refcount_,
session,
"Destroying a scope path frame with ref-count=%zu", refcount_);
150 ScopePath::operator string()
const 152 if (isnil (path_))
return "!";
153 if (1 == length())
return "/";
156 vector<Scope>::const_iterator node (path_.begin());
157 while (++node != path_.end())
160 res += string (*node);
172 return (1 < length())
180 ScopePath::hasValidRoot()
const 182 REQUIRE (0 < length());
183 return path_[0] == currModelRoot();
187 ScopePath::currModelRoot()
const 199 ScopePath::getLeaf()
const 201 ___check_notBottom (
this,
"Inspecting");
214 return aScope == getLeaf();
219 ScopePath::contains (
Scope const& aScope)
const 232 ScopePath::contains (
ScopePath const& otherPath)
const 234 if (!otherPath.
isValid())
return true;
235 if (
empty())
return false;
238 ASSERT (1 < length());
239 ASSERT (1 < otherPath.length());
242 if (!this->contains (*ii))
253 uint len = std::min (path1.length(), path2.length());
254 for (uint pos = 0; pos<len; ++pos)
255 if (path1.path_[pos] == path2.path_[pos])
264 if (path1.
empty() || path2.
empty())
return false;
267 && (path1.path_[1] != path2.path_[1])
280 path_.push_back (currModelRoot());
284 ENSURE ( hasValidRoot());
291 ___check_notBottom (
this,
"Navigating");
293 path_.resize (length()-1);
296 else return path_.back();
303 ___check_notBottom (
this,
"Navigating");
304 ENSURE (hasValidRoot());
312 ScopePath::navigate (
Scope const& target)
314 ___check_notBottom (
this,
"Navigating");
316 throw error::Invalid (
"can't navigate to a target scope outside the model" 317 , LERR_(INVALID_SCOPE));
319 std::vector<Scope> otherPath;
321 reverse (otherPath.begin(), otherPath.end());
323 ASSERT (path_[0] == otherPath[0]);
324 this->path_ = otherPath;
336 path_.push_back (child);
Implementation level session API: query a scope.
ScopePath & operator=(ScopePath const &)
Copy from existing path.
bool endsAt(Scope const &) const
verify the scope in question is equivalent to our leaf scope.
bool empty() const
an empty path doesn't even contain a root element.
static const ScopePath INVALID
constant invalid path token.
inline string literal This is a marker type to indicate that
ScopeQuery< MObject >::iterator discoverScopePath(Scope const &leaf)
issue a query to discover the (raw) path to root, starting with the given scope
This header is for including and configuring NoBug.
Core abstraction of the Session model: a media object.
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Sequence of nested scopes within the high-level model.
A Placement scope within the high-level-model.
static PlacementMO & getScopeRoot()
bool isValid() const
check if this scope can be located.
Derived specific exceptions within Lumiera's exception hierarchy.
Marker types to indicate a literal string and a Symbol.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
bool isValid() const
a valid path consists of more than just the root element.
static const Scope INVALID
constant invalid scope token.
Lumiera error handling (C++ interface).
void appendScope(Scope const &)
Service to build the notion of a current location within the Sesison model.
An Object representing a sequence of nested scopes within the Session.
static lib::Depend< ScopeLocator > instance
Storage holding the single ScopeLocator instance.
Accessing a STL element range through a Lumiera forward iterator, An instance of this iterator adapte...
Adapter for building an implementation of the »Lumiera Forward Iterator« concept. ...
ScopePath()
Create an empty path.
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.