2009-11-07 02:49:55 +01:00
|
|
|
/*
|
2009-11-09 07:35:08 +01:00
|
|
|
PLACEMENT-INDEX-QUERY-RESOLVER.hpp - using PlacementIndex to resolve scope queries
|
2009-11-07 02:49:55 +01:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2009-11-09 07:35:08 +01:00
|
|
|
/** @file placement-index-query-resolver.hpp
|
2009-11-18 04:11:27 +01:00
|
|
|
** Implementing resolution of "discover contents"-queries based on PlacementIndex.
|
|
|
|
|
** This wrapper adds a service to resolve queries for exploring the contents or
|
|
|
|
|
** the parent path of a given scope; the actual implementation is based on the
|
|
|
|
|
** basic operations provided by the PlacementIndex; usually this wrapper is
|
|
|
|
|
** instantiated as one of the SessionServices for use by Proc-Layer internals.
|
|
|
|
|
** The PlacementIndex to use for the implementation is handed in to the ctor.
|
|
|
|
|
**
|
|
|
|
|
** As any of the QueryResolver services, the actual resolution is completely
|
|
|
|
|
** decoupled from the querying client code, which retrieves the query results
|
|
|
|
|
** through an iterator. Parametrisation is transmitted to the resolver using a
|
|
|
|
|
** special subclass of Goal, a ScopeQuery. Especially, besides a filter to apply
|
|
|
|
|
** on the results to retrieve, the direction and way* to search can be parametrised:
|
|
|
|
|
** - ascending to the parents of the start scope
|
|
|
|
|
** - enumerating the immediate child elements of the scope
|
|
|
|
|
** - exhaustive depth-first search to get any content of the scope
|
|
|
|
|
**
|
|
|
|
|
** \par how the actual result set is created
|
|
|
|
|
** On initialisation, a table with preconfigured resolution functions is built,
|
|
|
|
|
** in order to re-gain the fully typed context when receiving a query. From within
|
|
|
|
|
** this context, the concrete Query instance can be investigated to define a
|
|
|
|
|
** constructor function for the actual result set, to determine the way how further
|
|
|
|
|
** results will be searched and extracted. The further exploration is driven by the
|
|
|
|
|
** client pulling values from the iterator until exhaustion.
|
2009-11-07 02:49:55 +01:00
|
|
|
**
|
|
|
|
|
** @see PlacementRef
|
|
|
|
|
** @see PlacementIndex_test
|
|
|
|
|
**
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-09 07:35:08 +01:00
|
|
|
#ifndef MOBJECT_SESSION_PLACEMENT_INDEX_QUERY_RESOLVER_H
|
|
|
|
|
#define MOBJECT_SESSION_PLACEMENT_INDEX_QUERY_RESOLVER_H
|
2009-11-07 02:49:55 +01:00
|
|
|
|
|
|
|
|
//#include "pre.hpp"
|
2009-11-09 07:35:08 +01:00
|
|
|
#include "proc/mobject/session/placement-index.hpp"
|
2009-11-07 02:49:55 +01:00
|
|
|
#include "proc/mobject/session/query-resolver.hpp"
|
2009-11-18 04:11:27 +01:00
|
|
|
#include "lib/symbol.hpp"
|
2009-11-07 02:49:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace mobject {
|
|
|
|
|
namespace session {
|
|
|
|
|
|
2009-11-18 04:11:27 +01:00
|
|
|
using lib::Literal;
|
2009-11-17 03:01:18 +01:00
|
|
|
|
2009-11-18 04:11:27 +01:00
|
|
|
class Explorer;
|
2009-11-07 02:49:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-11-18 04:11:27 +01:00
|
|
|
* Wrapper for the PlacementIndex, allowing to resolve scope contents discovery
|
|
|
|
|
* - handles queries for placements of
|
|
|
|
|
* * MObjcect
|
|
|
|
|
* * Clip
|
|
|
|
|
* * Effect
|
|
|
|
|
* - is able to process
|
|
|
|
|
* * ContentsQuery for retrieving full contents of a scope depth-first
|
|
|
|
|
* * PathQuery for retrieving all the parent scopes
|
|
|
|
|
* * more generally, any ScopeQuery with these properties, in some variations
|
2009-11-07 02:49:55 +01:00
|
|
|
*/
|
2009-11-09 07:35:08 +01:00
|
|
|
class PlacementIndexQueryResolver
|
|
|
|
|
: public session::QueryResolver
|
2009-11-07 02:49:55 +01:00
|
|
|
{
|
2009-11-13 16:32:22 +01:00
|
|
|
PPIdx index_;
|
|
|
|
|
|
2009-11-15 01:08:29 +01:00
|
|
|
|
2009-11-18 04:11:27 +01:00
|
|
|
virtual bool canHandleQuery(Goal::QueryID const&) const;
|
2009-11-15 01:08:29 +01:00
|
|
|
|
2009-11-18 04:11:27 +01:00
|
|
|
virtual operator string() const { return "PlacementIndex"; }
|
2009-11-15 01:08:29 +01:00
|
|
|
|
|
|
|
|
|
2009-11-18 04:11:27 +01:00
|
|
|
Explorer* setupExploration (PlacementIndex::ID startID, Literal direction);
|
2009-11-15 01:08:29 +01:00
|
|
|
|
|
|
|
|
template<typename MO>
|
2009-11-18 04:11:27 +01:00
|
|
|
void defineHandling();
|
2009-11-15 01:08:29 +01:00
|
|
|
|
2009-11-13 16:32:22 +01:00
|
|
|
template<typename MO>
|
2009-11-18 04:11:27 +01:00
|
|
|
Resolution* resolutionFunction (Goal const& goal);
|
2009-11-15 01:08:29 +01:00
|
|
|
|
2009-11-17 03:01:18 +01:00
|
|
|
|
2009-11-13 16:32:22 +01:00
|
|
|
public:
|
2009-11-18 04:11:27 +01:00
|
|
|
PlacementIndexQueryResolver (PPIdx theIndex);
|
2009-11-09 07:35:08 +01:00
|
|
|
};
|
2009-11-07 02:49:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}} // namespace mobject::session
|
|
|
|
|
#endif
|