WIP stubbed some of the operations to implement on class Scope
This commit is contained in:
parent
a662b176bb
commit
3b1301be14
4 changed files with 67 additions and 3 deletions
|
|
@ -167,7 +167,7 @@ namespace mobject {
|
|||
bool operator!= (PlacementRef<O> const& o) const { return id_ != o; }
|
||||
|
||||
|
||||
typedef _Id PlacementRef::*__unspecified_bool_type;
|
||||
typedef _Id PlacementRef::*__unspecified_bool_type; ////////TICKET #178 : implement by lib::BoolCheckable?
|
||||
|
||||
/** implicit conversion to "bool" */
|
||||
operator __unspecified_bool_type() const { return isValid()? &PlacementRef::id_ : 0; } // never throws
|
||||
|
|
|
|||
|
|
@ -50,6 +50,44 @@ namespace session {
|
|||
|
||||
|
||||
|
||||
/** discover the enclosing scope of a given Placement */
|
||||
Scope const&
|
||||
Scope::containing (PlacementMO const& aPlacement)
|
||||
{
|
||||
UNIMPLEMENTED ("scope discovery");
|
||||
}
|
||||
|
||||
|
||||
/** retrieve the parent scope which encloses this scope.
|
||||
* @throw error::Invalid if this is the root scope
|
||||
*/
|
||||
Scope const&
|
||||
Scope::getParent() const
|
||||
{
|
||||
UNIMPLEMENTED ("retrieve the enclosing parent scope");
|
||||
}
|
||||
|
||||
|
||||
/** @return true if this is the outmost (root) scope */
|
||||
bool
|
||||
Scope::isRoot() const
|
||||
{
|
||||
UNIMPLEMENTED ("detection of root scope");
|
||||
}
|
||||
|
||||
|
||||
/** enumerate the path of nested scopes up to root scope.
|
||||
* @return an iterator which starts with this scope and
|
||||
* successively yields outer scopes, stopping at root.
|
||||
*/
|
||||
Scope::IterType_
|
||||
Scope::ascend() const
|
||||
{
|
||||
UNIMPLEMENTED ("ascend scope hierarchy up to root");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
//#include "proc/mobject/mobject.hpp"
|
||||
#include "proc/mobject/placement.hpp"
|
||||
#include "proc/mobject/placement-ref.hpp"
|
||||
#include "lib/iter-adapter.hpp"
|
||||
#include "lib/singleton.hpp"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
|
@ -41,6 +42,7 @@ namespace mobject {
|
|||
namespace session {
|
||||
|
||||
using boost::scoped_ptr;
|
||||
using lib::IterAdapter;
|
||||
|
||||
class ScopeLocator;
|
||||
class QueryFocusStack;
|
||||
|
|
@ -53,6 +55,8 @@ namespace session {
|
|||
{
|
||||
RefPlacement anchor_;
|
||||
|
||||
typedef IterAdapter<PlacementMO*, Scope> IterType_;
|
||||
|
||||
public:
|
||||
Scope (PlacementMO const& constitutingPlacement);
|
||||
|
||||
|
|
@ -60,6 +64,11 @@ namespace session {
|
|||
static Scope const& containing (RefPlacement const& refPlacement);
|
||||
|
||||
Scope const& getParent() const;
|
||||
PlacementMO& getTop() const;
|
||||
bool isRoot() const;
|
||||
|
||||
typedef IterType_ iterator;
|
||||
iterator ascend() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -74,5 +83,21 @@ namespace session {
|
|||
///////////////////////////TODO currently just fleshing the API
|
||||
|
||||
|
||||
|
||||
inline Scope const&
|
||||
Scope::containing (RefPlacement const& refPlacement)
|
||||
{
|
||||
return containing (*refPlacement);
|
||||
}
|
||||
|
||||
|
||||
inline PlacementMO&
|
||||
Scope::getTop() const
|
||||
{
|
||||
ASSERT (anchor_);
|
||||
return *anchor_;
|
||||
}
|
||||
|
||||
|
||||
}} // namespace mobject::session
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,12 +47,13 @@ namespace test {
|
|||
|
||||
// using namespace mobject::test;
|
||||
// typedef TestPlacement<TestSubMO21> PSub;
|
||||
using lumiera::error::LUMIERA_ERROR_INVALID;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* @test basic behaviour of the nested placement search scopes.
|
||||
* Using a pseudo-session (actually just a PlacementIndex), this test
|
||||
* creates some nested scopes and then...
|
||||
* Using a pseudo-session (actually just a PlacementIndex),
|
||||
* this test creates some nested scopes and then...
|
||||
* - discovers the scope of a placement
|
||||
* - finds the parent scope
|
||||
* - enumerates a scope path up to root
|
||||
|
|
|
|||
Loading…
Reference in a new issue