2009-10-16 03:13:57 +02:00
|
|
|
/*
|
|
|
|
|
Scope - nested search scope for properties of placement
|
|
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2009, Hermann Vosseler <Ichthyostega@web.de>
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
|
published by the Free Software Foundation; either version 2 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
|
|
* *****************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "proc/mobject/session/scope.hpp"
|
2009-11-06 18:42:15 +01:00
|
|
|
#include "proc/mobject/session/scope-locator.hpp"
|
2009-10-16 21:20:30 +02:00
|
|
|
#include "proc/mobject/session/query-focus-stack.hpp"
|
2009-11-20 19:58:22 +01:00
|
|
|
#include "proc/mobject/session/session-service-explore-scope.hpp"
|
2009-10-16 03:13:57 +02:00
|
|
|
#include "proc/mobject/mobject.hpp"
|
|
|
|
|
//#include "proc/mobject/session/track.hpp"
|
|
|
|
|
//#include "proc/mobject/placement.hpp"
|
|
|
|
|
//#include "proc/mobject/session/mobjectfactory.hpp"
|
|
|
|
|
//#include "proc/asset/track.hpp"
|
|
|
|
|
|
|
|
|
|
namespace mobject {
|
|
|
|
|
namespace session {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** TODO??? */
|
|
|
|
|
Scope::Scope (PlacementMO const& constitutingPlacement)
|
|
|
|
|
: anchor_(constitutingPlacement)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-10-18 01:30:43 +02:00
|
|
|
Scope::Scope ()
|
|
|
|
|
: anchor_()
|
|
|
|
|
{
|
|
|
|
|
REQUIRE (!anchor_.isValid());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-10-29 04:32:00 +01:00
|
|
|
Scope::Scope (Scope const& o)
|
|
|
|
|
: anchor_(o.anchor_)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Scope&
|
|
|
|
|
Scope::operator= (Scope const& o)
|
|
|
|
|
{
|
|
|
|
|
anchor_ = o.anchor_; ////////////////////////////TODO verify correctness
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-10-16 03:13:57 +02:00
|
|
|
ScopeLocator::ScopeLocator()
|
2009-10-16 21:20:30 +02:00
|
|
|
: focusStack_(new QueryFocusStack)
|
2009-10-16 03:13:57 +02:00
|
|
|
{
|
2009-11-22 01:15:31 +01:00
|
|
|
TODO ("anything in initialise here?");
|
2009-10-16 03:13:57 +02:00
|
|
|
}
|
|
|
|
|
|
2009-11-22 01:15:31 +01:00
|
|
|
ScopeLocator::~ScopeLocator() { }
|
|
|
|
|
|
|
|
|
|
|
2009-11-06 18:42:15 +01:00
|
|
|
/** Storage holding the single ScopeLocator instance */
|
|
|
|
|
lib::Singleton<ScopeLocator> ScopeLocator::instance;
|
|
|
|
|
|
2009-10-16 03:13:57 +02:00
|
|
|
|
2009-11-20 19:58:22 +01:00
|
|
|
/** @internal the one (and only) access point
|
|
|
|
|
* actually to link the system of Scope and QueryFocus
|
|
|
|
|
* to the current session, by delegating resolution
|
|
|
|
|
* of contents discovery queries to the PlacementIndex
|
|
|
|
|
* managed within the session
|
|
|
|
|
*/
|
|
|
|
|
QueryResolver const&
|
|
|
|
|
ScopeLocator::theResolver()
|
|
|
|
|
{
|
|
|
|
|
return SessionServiceExploreScope::getResolver();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-11-20 22:00:15 +01:00
|
|
|
/** establishes the \em current query focus location.
|
|
|
|
|
* Relies on the state of the QueryFocusStack.
|
|
|
|
|
* If there is no current focus location, a new
|
|
|
|
|
* one is created, referring to the root Scope.
|
|
|
|
|
* @return the current path corresponding to the
|
|
|
|
|
* most recently used QueryFocus, which is
|
|
|
|
|
* actually still referred from somewhere.
|
|
|
|
|
* @note may cause the QueryFocusStack to pop
|
|
|
|
|
* path entries no longer in use.
|
|
|
|
|
*/
|
|
|
|
|
ScopePath&
|
|
|
|
|
ScopeLocator::currPath()
|
2009-11-20 19:58:22 +01:00
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("how to access and handle the current focus");
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-16 03:13:57 +02:00
|
|
|
|
2009-10-17 02:16:19 +02:00
|
|
|
/** discover the enclosing scope of a given Placement */
|
|
|
|
|
Scope const&
|
|
|
|
|
Scope::containing (PlacementMO const& aPlacement)
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("scope discovery");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-10-18 19:08:21 +02:00
|
|
|
Scope const&
|
|
|
|
|
Scope::containing (RefPlacement const& refPlacement)
|
|
|
|
|
{
|
|
|
|
|
return containing (*refPlacement);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlacementMO&
|
|
|
|
|
Scope::getTop() const
|
|
|
|
|
{
|
|
|
|
|
ASSERT (anchor_);
|
|
|
|
|
return *anchor_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-10-17 02:16:19 +02:00
|
|
|
/** 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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-11-21 20:55:14 +01:00
|
|
|
/** check if this scope can be located.
|
|
|
|
|
* An default constructed Scope (i.e without
|
|
|
|
|
* defining Placement) can't be located and returns false here */
|
|
|
|
|
bool
|
|
|
|
|
Scope::isValid() const
|
|
|
|
|
{
|
|
|
|
|
return anchor_.isValid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-10-17 02:16:19 +02:00
|
|
|
/** 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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-10-16 03:13:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}} // namespace mobject::session
|