1#ifndef DATAMODEL_ELEMENTLINK_H
2#define DATAMODEL_ELEMENTLINK_H
4#ifndef DATAMODEL_TOOLS_GENERATEINDEXINGPOLICY_H
5# include "DataModel/tools/GenerateIndexingPolicy.h"
8#ifndef DATAMODEL_TOOLS_DATAPROXYSTORAGE_H
9# include "DataModel/tools/DataProxyStorage.h"
35template <
typename STORABLE,
class StoragePolicy = DataProxyStorage<STORABLE>,
36 class IndexingPolicy =
typename SG::GenerateIndexingPolicy<STORABLE>::type>
37class ElementLink :
public StoragePolicy,
public IndexingPolicy {
39 typedef typename IndexingPolicy::pointer pointer;
54 ElementLink( IProxyDict* sg = StoragePolicy::defaultDataSource() )
55 : StoragePolicy( sg ), IndexingPolicy(), m_element( 0 ) {}
59 IProxyDict* sg = StoragePolicy::defaultDataSource() )
60 : StoragePolicy(
dataID, sg ), IndexingPolicy( elemID ), m_element( 0 ) {}
64 : StoragePolicy(
dataID, 0 ), IndexingPolicy( elemID ), m_element( pEl ) {}
69 IProxyDict* sg = StoragePolicy::defaultDataSource() )
70 : StoragePolicy(
data, sg ), IndexingPolicy( elemID ), m_element( 0 ) {}
113template <
class OS,
typename STORABLE,
class DLB,
class IDX>
116template <
class IS,
typename STORABLE,
class DLB,
class IDX>
119#include "DataModel/ElementLink.icc"
121#ifndef DATAMODEL_TOOLS_PLAINPTRSTORAGE_H
122# include "DataModel/tools/PlainPtrStorage.h"
128template <
typename STORABLE,
OS & operator<<(OS &os, ElementLink< STORABLE, DLB, IDX > &link)
IS & operator>>(IS &is, ElementLink< STORABLE, DLB, IDX > &link)
const ID_type & dataID() const
a persistable pointer to an element of a STORABLE (data object)
IndexingPolicy::ElementConstPointer ElementConstPointer
IndexingPolicy::ElementPointer ElementPointer
ElementConstPointer operator->() const
ElementConstReference operator*() const
IndexingPolicy::ElementConstReference ElementConstReference
ElementLink(const ID_type &dataID, index_type elemID, ElementPointer pEl)
const STORABLE & BaseConstReference
void toIndexedElement(BaseConstReference data, index_type elementID)
set link to point to given index: FAST
IndexingPolicy::index_type index_type
void setStorableObject(BaseConstReference data)
set link storable to data object pointed by data
IndexingPolicy::ElementParameter ElementParameter
ElementLink(BaseConstReference data, index_type elemID, IProxyDict *sg=StoragePolicy::defaultDataSource())
ElementLink(const ID_type &dataID, index_type elemID, IProxyDict *sg=StoragePolicy::defaultDataSource())
o(1) version: provide storable key and element index
ElementConstPointer cptr() const
bool toContainedElement(BaseConstReference data, ElementParameter element)
set link to point to given element: O(n) for sequences!
ElementLink(IProxyDict *sg=StoragePolicy::defaultDataSource())
default
helper struct to be used as type generator e.g. PlainPtrElementLink<vector<int> >type
ElementLink< STORABLE, PlainPtrStorage< STORABLE >, IndexingPolicy > type
boost::detail::if_true<(isSTLSequence)>::template then< ForwardIndexingPolicy< CONTAINER >, typenameDefaultIndexingPolicy< CONTAINER >::type >::type type