LUMIERA.clone/src/proc/mobject/placement-index.hpp

91 lines
2.2 KiB
C++
Raw Normal View History

/*
PLACEMENT-INDEX.hpp - tracking individual Placements and their relations
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-05-09 17:32:29 +02:00
/** @file placement-index.hpp
**
2009-05-09 17:32:29 +02:00
** @see PlacementRef
** @see PlacementIndex_test
**
*/
2009-05-09 17:32:29 +02:00
#ifndef MOBJECT_PLACEMENT_INDEX_H
#define MOBJECT_PLACEMENT_INDEX_H
//#include "pre.hpp"
//#include "proc/mobject/session/locatingpin.hpp"
//#include "proc/asset/pipe.hpp"
2009-05-13 03:46:08 +02:00
#include "proc/mobject/placement-ref.hpp"
//#include <tr1/memory>
2009-05-13 03:46:08 +02:00
#include <vector>
namespace mobject {
// using std::tr1::shared_ptr;
2009-05-13 03:46:08 +02:00
using std::vector;
/**
*/
2009-05-09 17:32:29 +02:00
class PlacementIndex
{
2009-05-13 03:46:08 +02:00
public:
typedef Placement<MObject> PlacementMO;
typedef PlacementRef PRef;
typedef PRef::ID ID;
PlacementMO& find (ID) const;
template<class MO>
Placement<MO>& find (PRef::IDp<MO>) const;
PlacementMO& getScope (PlacementMO&) const;
PlacementMO& getScope (ID) const;
vector<PRef> getReferrers (ID) const;
/** diagnostic: number of indexed entries */
size_t size() const;
/* == mutating operations == */
ID insert (PlacementMO& newObj, PlacementMO& targetScope);
bool remove (PlacementMO&);
bool remove (ID);
};
////////////////TODO currently just fleshing out the API; probably have to split off an impl.class
} // namespace mobject
#endif