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-10-16 21:20:30 +02:00
|
|
|
#include "proc/mobject/session/query-focus-stack.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-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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 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
|