code up the remaining Scope operations. Closes #430
This commit is contained in:
parent
6dd18f96c6
commit
bba9ce2570
3 changed files with 33 additions and 41 deletions
|
|
@ -259,7 +259,10 @@ namespace session {
|
|||
}
|
||||
|
||||
|
||||
inline ScopePath::iterator
|
||||
/** @note actually this is an Lumiera Forward Iterator,
|
||||
* yielding the path up to root as a sequence of
|
||||
* const Scope elements */
|
||||
inline ScopePath::iterator
|
||||
ScopePath::begin() const
|
||||
{
|
||||
return iterator (path_.rbegin(), path_.rend());
|
||||
|
|
|
|||
|
|
@ -27,10 +27,7 @@
|
|||
#include "proc/mobject/session/session-service-explore-scope.hpp"
|
||||
#include "proc/mobject/mobject.hpp"
|
||||
#include "lib/iter-source.hpp" ////////////////////TICKET #493 : using the IterSource adapters here
|
||||
//#include "proc/mobject/session/track.hpp"
|
||||
|
||||
//#include "proc/mobject/placement.hpp"
|
||||
//#include "proc/mobject/session/mobjectfactory.hpp"
|
||||
#include <vector>
|
||||
|
||||
using std::vector;
|
||||
|
|
@ -42,17 +39,16 @@ namespace session {
|
|||
|
||||
|
||||
LUMIERA_ERROR_DEFINE (INVALID_SCOPE, "Placement scope invalid and not locatable within model");
|
||||
LUMIERA_ERROR_DEFINE (NO_PARENT_SCOPE, "Parent scope of root not accessible");
|
||||
|
||||
|
||||
|
||||
|
||||
/** conversion of a scope top (placement) into a Scope.
|
||||
* only allowed if the given Placement is actually attached
|
||||
* to the session, which will be checked by index access */
|
||||
Scope::Scope (PlacementMO const& constitutingPlacement)
|
||||
: anchor_(constitutingPlacement)
|
||||
{
|
||||
|
||||
}
|
||||
{ }
|
||||
|
||||
|
||||
Scope::Scope ()
|
||||
|
|
@ -64,7 +60,9 @@ namespace session {
|
|||
|
||||
Scope::Scope (Scope const& o)
|
||||
: anchor_(o.anchor_)
|
||||
{ }
|
||||
{
|
||||
ENSURE (anchor_.isValid());
|
||||
}
|
||||
|
||||
|
||||
Scope&
|
||||
|
|
@ -78,9 +76,7 @@ namespace session {
|
|||
|
||||
ScopeLocator::ScopeLocator()
|
||||
: focusStack_(new QueryFocusStack)
|
||||
{
|
||||
TODO ("anything to initialise here?");
|
||||
}
|
||||
{ }
|
||||
|
||||
ScopeLocator::~ScopeLocator() { }
|
||||
|
||||
|
|
@ -129,7 +125,7 @@ namespace session {
|
|||
return focusStack_->push (SessionServiceExploreScope::getScopeRoot());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** navigate the \em current QueryFocus scope location. The resulting
|
||||
* access path to the new location is chosen such as to be most closely related
|
||||
* to the original location; this includes picking a timeline or meta-clip
|
||||
|
|
@ -149,18 +145,18 @@ namespace session {
|
|||
currentPath.navigate (scope);
|
||||
return wrapIter (currentPath.begin());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** discover the enclosing scope of a given Placement */
|
||||
Scope const&
|
||||
Scope
|
||||
Scope::containing (PlacementMO const& aPlacement)
|
||||
{
|
||||
UNIMPLEMENTED ("scope discovery");
|
||||
return SessionServiceExploreScope::getScope (aPlacement);
|
||||
}
|
||||
|
||||
|
||||
Scope const&
|
||||
Scope
|
||||
Scope::containing (RefPlacement const& refPlacement)
|
||||
{
|
||||
return containing (*refPlacement);
|
||||
|
|
@ -178,10 +174,14 @@ namespace session {
|
|||
/** retrieve the parent scope which encloses this scope.
|
||||
* @throw error::Invalid if this is the root scope
|
||||
*/
|
||||
Scope const&
|
||||
Scope
|
||||
Scope::getParent() const
|
||||
{
|
||||
UNIMPLEMENTED ("retrieve the enclosing parent scope");
|
||||
if (isRoot())
|
||||
throw lumiera::error::Invalid ("can't get parent of root scope"
|
||||
, LUMIERA_ERROR_NO_PARENT_SCOPE);
|
||||
|
||||
return SessionServiceExploreScope::getScope (*anchor_);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ namespace session {
|
|||
bool
|
||||
Scope::isRoot() const
|
||||
{
|
||||
UNIMPLEMENTED ("detection of root scope");
|
||||
return *anchor_ == SessionServiceExploreScope::getScopeRoot();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,30 +24,19 @@
|
|||
#ifndef MOBJECT_SESSION_SCOPE_H
|
||||
#define MOBJECT_SESSION_SCOPE_H
|
||||
|
||||
//#include "proc/mobject/mobject.hpp"
|
||||
#include "proc/mobject/placement.hpp"
|
||||
#include "proc/mobject/placement-ref.hpp"
|
||||
//#include "proc/mobject/session/query-resolver.hpp" ///////////TODO: really?
|
||||
//#include "lib/iter-adapter.hpp"
|
||||
#include "lib/error.hpp"
|
||||
//#include "lib/singleton.hpp"
|
||||
|
||||
//#include <boost/operators.hpp>
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
//#include <tr1/memory>
|
||||
//#include <vector>
|
||||
//#include <string>
|
||||
|
||||
//using std::vector;
|
||||
//using std::string;
|
||||
|
||||
namespace mobject {
|
||||
namespace session {
|
||||
|
||||
LUMIERA_ERROR_DECLARE (INVALID_SCOPE); ///< Placement scope invalid and not locatable within model
|
||||
LUMIERA_ERROR_DECLARE (NO_PARENT_SCOPE); ///< Parent scope of root not accessible
|
||||
LUMIERA_ERROR_DECLARE (INVALID_SCOPE); ///< Placement scope invalid and not locatable within model
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* TODO type comment
|
||||
* @note Scope is a passive entity,
|
||||
|
|
@ -66,10 +55,10 @@ namespace session {
|
|||
Scope (Scope const&);
|
||||
Scope& operator= (Scope const&);
|
||||
|
||||
static Scope const& containing (PlacementMO const& aPlacement); //////////////TODO really returning a const& here??
|
||||
static Scope const& containing (RefPlacement const& refPlacement);
|
||||
static Scope containing (PlacementMO const& aPlacement);
|
||||
static Scope containing (RefPlacement const& refPlacement);
|
||||
|
||||
Scope const& getParent() const;
|
||||
Scope getParent() const;
|
||||
PlacementMO& getTop() const;
|
||||
bool isValid() const;
|
||||
bool isRoot() const;
|
||||
|
|
@ -79,9 +68,9 @@ namespace session {
|
|||
};
|
||||
|
||||
|
||||
///////////////////////////TODO currently just fleshing the API
|
||||
|
||||
|
||||
|
||||
|
||||
/** as scopes are constituted by a "scope top" element (placement)
|
||||
* registered within the PlacementIndex of the current session,
|
||||
* equality is defined in terms of this defining placement.
|
||||
|
|
@ -89,13 +78,13 @@ namespace session {
|
|||
inline bool
|
||||
operator== (Scope const& scope1, Scope const& scope2)
|
||||
{
|
||||
return scope1.anchor_ == scope2.anchor_;
|
||||
return scope1.anchor_ == scope2.anchor_;
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator!= (Scope const& scope1, Scope const& scope2)
|
||||
{
|
||||
return scope1.anchor_ != scope2.anchor_;
|
||||
return scope1.anchor_ != scope2.anchor_;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue