38 using lib::append_all;
59 throw error::Logic (operation_descr+
" an empty placement scope path" 60 , LERR_(EMPTY_SCOPE_PATH));
116 throw error::Logic (
"Attempt to overwrite a ScopePath with nonzero refcount");
118 if (!isSameObject (*
this, ref))
121 ENSURE (0 == refcount_);
127 ScopePath::~ScopePath()
129 WARN_IF (refcount_,
session,
"Destroying a scope path frame with ref-count=%zu", refcount_);
141 ScopePath::operator string()
const 143 if (isnil (path_))
return "!";
144 if (1 == length())
return "/";
147 vector<Scope>::const_iterator node (path_.begin());
148 while (++node != path_.end())
151 res += string (*node);
163 return (1 < length())
171 ScopePath::hasValidRoot()
const 173 REQUIRE (0 < length());
174 return path_[0] == currModelRoot();
178 ScopePath::currModelRoot()
const 190 ScopePath::getLeaf()
const 192 ___check_notBottom (
this,
"Inspecting");
205 return aScope == getLeaf();
210 ScopePath::contains (
Scope const& aScope)
const 223 ScopePath::contains (
ScopePath const& otherPath)
const 225 if (!otherPath.
isValid())
return true;
226 if (
empty())
return false;
229 ASSERT (1 < length());
230 ASSERT (1 < otherPath.length());
233 if (!this->contains (*ii))
244 uint len = std::min (path1.length(), path2.length());
245 for (uint pos = 0; pos<len; ++pos)
246 if (path1.path_[pos] == path2.path_[pos])
255 if (path1.
empty() || path2.
empty())
return false;
258 && (path1.path_[1] != path2.path_[1])
271 path_.push_back (currModelRoot());
275 ENSURE ( hasValidRoot());
282 ___check_notBottom (
this,
"Navigating");
284 path_.resize (length()-1);
287 else return path_.back();
294 ___check_notBottom (
this,
"Navigating");
295 ENSURE (hasValidRoot());
303 ScopePath::navigate (
Scope const& target)
305 ___check_notBottom (
this,
"Navigating");
307 throw error::Invalid (
"can't navigate to a target scope outside the model" 308 , LERR_(INVALID_SCOPE));
310 std::vector<Scope> otherPath;
312 reverse (otherPath.begin(), otherPath.end());
314 ASSERT (path_[0] == otherPath[0]);
315 this->path_ = otherPath;
327 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, based directly on the referee's memory identities. ...