Commits

Anonymous committed 18c7961

clean up first implementation

Comments (0)

Files changed (8)

Navigation/DefaultChildColl.h

-#ifndef NAVIGATION_DEFAULTCHILDCOLL_H
-#define NAVIGATION_DEFAULTCHILDCOLL_H
-///////////////////////////////////////////////////////////////////////////////
-//
-// Implements default collection types for navigable objects. Used in the
-// templated Navigable base class.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include <utility>
-#include <vector>
-
-#include "DataModel/ElementLink.h"
-
-#include "Navigation/DefaultWeight.h"
-
-#ifndef DATAMODEL_TOOLS_GENERATEINDEXINGPOLICY_H
-# include "DataModel/tools/GenerateIndexingPolicy.h"
-#endif
-
-////////////////////////////////////////////////////
-// Navigation of Relational Trees with Parameters //
-////////////////////////////////////////////////////
-
-template <typename CONT, typename RPAR>
-struct DefaultChildColl
-{
-  // default container is a vector of (ElementLink,RPAR) pairs
-  typedef std::pair< ElementLink<CONT>, RPAR > value_type;
-  typedef std::vector< typename data >         type;
-
-  // object pointer (key) access 
-  static const typename CONT::value_type* getChildPtr(typename 
-						      type::const_iterator 
-						      thisIter) 
-  { return *((*thisIter).first); } // note that * operates on an ElementLink!
-
-  // relational parameter (data) access
-  static RPAR getChildPar(typename type::const_iterator thisIter) 
-  { return (*thisIter).second; }
-
-  // insertion of ElementLink by object pointer
-  static void
-  insert(type& cont, const CONT& aChildContainer,
-	 const typename CONT::value_type* aChild, 
-	 const RPAR& aPar=RPAR()) 
-  {
-    ElementLink<CONT> theLink;
-    theLink.toContainedElement(aChildContainer,aChild);
-    value_type theEntry(theLink,aPar);
-    cont.push_back(theEntry); 
-  }
-
-  // insertion of ELementLink by object index
-  static void
-  insert(type& cont, const CONT& aChildContainer,
-	 const typename SG::GenerateIndexingPolicy<CONT>::type::index anIndex,
-	 const RPAR& aPar=RPAR())
-  {
-    ElementLink<CONT> theLink;
-    theLink.toIndexedElement(aChildContainer,anIndex);
-    value_type theEntry(theLink,aPar);
-    cont.push_back(theEntry);
-  }
-
-  // find method implementation for const_iterator
-  static typename type::const_iterator 
-  find(const type& cont, const typename CONT::value_type* aChild)
-  {
-    type::const_iterator firstEntry = cont.begin();
-    type::const_iterator lastEntry  = cont.end();
-    for ( ; firstEntry != lastEntry ; firstEntry++ )
-      {
-	if ( *((*firstEntry).first) == aChild ) break;
-      }
-    return firstEntry;
-  }
-
-  // find method for iterator
-  static typename type::iterator
-  find(type& cont, const typename CONT::value_type* aChild)
-  {
-    type::iterator firstEntry = cont.begin();
-    type::iterator lastEntry  = cont.end();
-    for ( ; firstEntry != lastEntry; firstEntry++ )
-      {
-	if ( *((*firstEntry).first) == aChild ) break;
-      }
-    return firstEntry;
-  }  
-
-  // removal 
-  static bool
-  remove(type& cont, const typename CONT::value_type* aChild)
-  {
-    type::iterator found = find(cont,aChild);
-    if ( found != cont.end() )
-      {
-	cont.erase(found);
-	return true;
-      }
-    else
-      {
-	return false;
-      }
-  }
-
-  // test on containment
-  static bool
-  contains(type& cont, const typename CONT::value_type* aChild)
-  {
-    return find(cont,aChild) != cont.end();
-  }
-
-};
-
-///////////////////////////////////////////////////////
-// Navigation of Relational Trees without Parameters //
-///////////////////////////////////////////////////////
-
-template <typename CONT>
-struct DefaultChildColl<CONT,
-			typename CONT::value_type, 
-			DefaultWeight> 
-{
-  // default container is a vector
-  typedef std::vector< ElementLink<CONT> > type;
-
-  // object pointer access
-  static const typename CONT::value_type* 
-  getChildPtr(typename type::const_iterator iter) 
-  { return *(*iter); }
-
-  // default weight is dummy
-  static DefaultWeight 
-  getChildPar(typename type::const_iterator) { return DefaultWeight(); }
-
-  // insertion of ElementLink by object pointer 
-  static void
-  insert(type& cont, const CONT& aChildContainer,
-	 const typename CONT::value_type* aChild, 
-	 const DefaultWeight&) 
-  {
-    ElementLink<CONT> theLink;
-    theLink.toContainedElement(aChildContainer,aChild);
-    cont.push_back(theLink); 
-  }
-
-  // insertion of ElementLink by object index
-  static void
-  insert(type& cont, const CONT& aChildConstainer,
-	 const typename SG::GenerateIndexingPolicy<CONT>::type::index anIndex,
-	 const DefaultWeight&)
-  {
-    ElementLink<CONT> theLink;
-    theLink.toIndexedElement(aChildContainer,aChild);
-    cont.push_back(theLink);
-  }
-    
-  // allocation of object pointer in list
-  static typename type::const_iterator 
-  find(const type& cont, const typename CONT::value_type* aChild) 
-  {
-    type::const_iterator firstEntry = cont.begin();
-    type::const_iterator lastEntry  = cont.end();
-    for ( ; firstEntry != lastEntry; firstEntry++ )
-      {
-	if ( *(*firstEntry) == aChild ) break;
-      }
-    return firstEntry;
-  }
-
-  //
-  static typename type::iterator
-  find(type& cont, const typename CONT::value_type* aChild) 
-  {
-    type::iterator firstEntry = cont.begin();
-    type::iterator lastEntry  = cont.end();
-    for ( ; firstEntry != lastEntry; firstEntry++ )
-      {
-	if ( *(*firstEntry) == aChild ) break;
-      }
-    return firstEntry;
-  }
-
-  // removal 
-  static bool
-  remove(type& cont, const typename CONT::value_type* aChild)
-  {
-    type::iterator found = find(cont,aChild);
-    if ( found != cont.end() )
-      {
-	cont.erase(found);
-	return true;
-      }
-    else
-      {
-	return false;
-      }
-  }
-
-  // test on containment
-  static bool
-  contains(type& cont, const typename CONT::value_type* aChild)
-  {
-    return find(cont,aChild) != cont.end();
-  }
-};
-#endif
-

Navigation/DefaultWeight.h

-#ifndef NAVIGATION_DEFAULTWEIGHT_H
-#define NAVIGATION_DEFAULTWEIGHT_H 1
-struct DefaultWeight {
-  DefaultWeight() {}
-  DefaultWeight& operator=(const DefaultWeight&) {return *this;}
-  const DefaultWeight& operator+(const DefaultWeight&) const {return *this;}
-  const DefaultWeight& operator*(const DefaultWeight&) const {return *this;}
-  bool operator==(DefaultWeight&) const {return true;}
-  operator double() {return 1.0;}
-};
-#endif

Navigation/Navigable.h

  *         the container of children
  *
  * @author ATLAS Collaboration
- * $Id: Navigable.h,v 1.2 2004-02-11 00:00:39 lochp Exp $
+ * $Id: Navigable.h,v 1.3 2004-02-17 16:52:32 lochp Exp $
  **/
 
 // package includes for the template
 #include "Navigation/NavigableIterator.h"
 #include "Navigation/INavigable.h"
-#include "Navigation/DefaultWeight.h"
-#include "Navigation/DefaultChildColl.h"
+#include "Navigation/NavigationDefaults.h"
 
 // navigation token management
 #include "Navigation/INavigationToken.h"
 #include "Navigation/NavigationToken.h"
 
 // services etc.
+#include "DataModel/DataVector.h"
 #ifndef DATAMODEL_TOOLS_GENERATEINDEXINGPOLICY_H
 # include "DataModel/tools/GenerateIndexingPolicy.h"
 #endif
 // Base class for implementation of Navigation token handling //
 ////////////////////////////////////////////////////////////////
 
-// do-nothing class for Navigation termination implementation
-class NavTerminator{};
-
-template < typename CONT=NavTerminator,
-	   typename RPAR=DefaultWeight,
-           typename COLL=typename DefaultChildColl<CONT, RPAR>::type >     
+template < 
+  typename CONT=typename 
+  NavigationDefaults::TerminalNode,
+  typename RPAR=typename 
+  NavigationDefaults::DefaultWeight,
+  typename COLL=typename 
+  NavigationDefaults::DefaultChildColl<CONT, RPAR>::type 
+	 >     
 class Navigable : virtual public INavigable 
 {
   public:
   //////////////////////
 
   // internal collection management helper types
-  typedef COLL                                child_coll;
-  typedef typename child_coll::iterator       child_iter;
-  typedef typename child_coll::const_iterator const_child_iter;
+  typedef COLL                                                constituent_coll;
+  typedef typename constituent_coll::iterator                 constituent_iter;
+  typedef typename constituent_coll::const_iterator     constituent_const_iter;
 
-  // constituent object type
-  typedef typename CONT::value_type           child_type
+  ////////////////////////////////////////////////////////////////////////////
+  //                                                                        //
+  // At this point we try to avoid an additional template parameter         //
+  // specifying the object type in addition to the object container type.   //
+  // We expect DataVector or any other object container to provide this     //
+  // object type. Note that this is NOT DataVector<T>::value_type, which is //
+  // actually T*. We introduced another typedef                             // 
+  // DataVector<T>::base_value_type, which is T.                            //
+  //                                                                        //
+  // Within the Navigable the following types are available:                //
+  //                                                                        //
+  // constituent_type          object type                                  //
+  // constituent_ptr_ref       object pointer reference                     //
+  //                           (constituent_type*&)                         //
+  // constituent_const_ptr_ref object const pointer reference               //
+  // constituent_ptr           object pointer (constituent_type*)           //
+  // external_index_type       object container index type                  //
+  // object_iter               internal object container iterator           //
+  //                                                                        //
+  // Note that the internal object container is used to store pointers to   //
+  // the constituents of a composite object, while the (external) object    //
+  // container just holds a collection of objects.                          //
+  //                                                                        //
+  // Template Parameters:   Defaults:                                       //
+  //                                                                        //
+  // CONT                   --none--         external object collection     //
+  // RPAR                   DefaultWeight    relational parameter type      //
+  // COLL                   DefaultChildColl internal object collection     //
+  //                                                                        //
+  ////////////////////////////////////////////////////////////////////////////
+
+  // some typedefs from the object container
+  typedef typename CONT::base_value_type constituent_type;
+  typedef typename CONT::reference       constituent_ptr_ref;
+  typedef typename CONT::const_reference constituent_const_ptr_ref;
+  typedef typename CONT::value_type      constituent_ptr;
+
+  // container index type
+  typedef typename SG::GenerateIndexingPolicy<CONT>::type::index_type
+                                         external_index_type;
+
+  // external iterator access
+  typedef NavigableIterator<constituent_type,COLL> object_iter;
 
   /////////////////////////////////
   // Constructors and Destructor //
   //////////////////////////////////
 
   // add element to the Navigable: use element pointer (linear search!)
-  void putElement(const CONT&       objectContainer, 
-		  const child_type* constituentObject,
-		  const RPAR&       objectParameter=RPAR());
+  //  template<typename OBJT>
+  void putElement(const CONT& objectContainer, 
+		  const constituent_type* constituentObject,
+		  const RPAR& objectParameter=RPAR());
   // add element to the Navigable: use element index (direct access!)
-  void putElement(const CONT& objectContainer, 
-		  typename SG::GenerateIndexingPolicy<CONT>::type::index_type
-		  index,
-		  const RPAR& objectParameter=RPAR());
+  void putElement(const CONT&          objectContainer,
+		  external_index_type& theIndex,
+		  const RPAR&          objectParameter=RPAR());
 
   ///////////////////////
   // Data manipulation //
   ///////////////////////
 
   // remove object from the Navigable
-  bool remove(const child_type* aChild);
+  bool remove(const constituent_type* aConstituent);
+  bool remove(const CONT& objectContainer, external_index_type& theIndex);
 
-  // check if child is already there  
-  bool contains(const child_type* aChild) const;
+  // check if constituent is already there  
+  bool contains(const constituent_type* aConstituent) const;
+  bool contains(const CONT& objectContainer,
+		external_index_type& theIndex) const;
 
   ////////////////////////////
   // Access to Constituents //
   ////////////////////////////
 
-  // public container access: iterators
-  NavigableIterator<typename child_type, COLL>& begin();    
-  NavigableIterator<typename child_type, COLL>& end();
+  // public container access: iterators, sizes etc.
+  virtual object_iter& begin() const;    
+  virtual object_iter& end()   const;
+  virtual unsigned int size()  const;
 
   // public container access: relational parameter retrieval
-  const RPAR& getParameter(const child_type* aChild) const;
+  RPAR getParameter(const constituent_type* aConstituent) const;
+  RPAR getParameter(const CONT& objectContainer,
+		    external_index_type& theIndex) const;
 
   ///////////////////////////
   // Protected data access //
 
   protected:
 
-  // get collection of children
-  const child_coll& getChildren() const { return m_children; }
-  child_coll& getChildren() { return m_children; }
+  // get collection of constituents
+  const constituent_coll& getConstituents() const { return m_constituents; }
+  constituent_coll& getConstituents()             { return m_constituents; }
 
-  // get pointer to child given its collection iterator 
-  virtual const child_type* 
-  getChildPtr(const_child_iter iter) const;
+  // get pointers to collection
+  const constituent_coll* getPtrToConstituents() const 
+  { return &m_constituents; }
+  constituent_coll* getPtrToConstituents() 
+  { return &m_constituents; }
+
+  // get pointer to constituent given its collection iterator 
+  virtual const constituent_type* getConstituentPtr(constituent_iter 
+						    iter) const;
+  virtual const constituent_type* getConstituentPtr(constituent_const_iter 
+						    iter) const;
 
   // get the parameter associated with the child, if any
-  virtual RPAR getChildPar(const_child_iter iter) const;
+  virtual RPAR getConstituentPar(constituent_iter iter)       const;
+  virtual RPAR getConstituentPar(constituent_const_iter iter) const;
 
   /////////////////////////////
   // Internal query handling //
 
   private:
 
+  //////
+  // to be checked: constituent type is T* -> NavigationToken expects T!
+  /////
+
   // honoring the query: filling token if type matches w/o parameter
-  virtual void apply(NavigationToken<typename child_type>& navToken) const;
+  virtual void apply(NavigationToken<constituent_type>& navToken) const;
 
   // honoring the query: filling token if type matches w/ parameter
-  virtual void apply(NavigationToken<typename child_type, RPAR>& navToken,
+  virtual void apply(NavigationToken<constituent_type, RPAR>& navToken,
 		     const RPAR& aParameter) const;
 
   // forwarding the query to constituents: w/o parameter
 
   private:
 
-  child_coll m_children;
+  constituent_coll m_constituents;
 
 };
 
 // Termination handling //
 //////////////////////////
 
-// dummy type for dummy child collections
-class ErrorType{};
-
 template<>
-class Navigable<NavTerminator> : public INavigable 
+class Navigable< NavigationDefaults::TerminalNode > 
+: public INavigable 
 {
  public:
 
   // suppress compiler warnings
-  typedef ErrorType child_coll;
-  typedef ErrorType child_iter;
+  typedef NavigationDefaults::DefaultType constituent_coll;
+  typedef NavigationDefaults::DefaultType constituent_iter;
+  typedef NavigationDefaults::DefaultType constituent_const_iter;
 
   Navigable() { }
   virtual ~Navigable() { }

Navigation/Navigable.icc

 Navigable<CONT, RPAR, COLL>::fillToken(INavigationToken& navToken) const 
 {
   // check on request for child_type type objects
-  NavigationToken<typename child_type>* pNoWTok = 
-    dynamic_cast< NavigationToken<typename child_type>* >(&navToken);
+  NavigationToken<constituent_type>* noParToken = 
+    dynamic_cast< NavigationToken<constituent_type>* >(&navToken);
 
   // honored: fill children object pointers into token
-  if (0 != pNoWTok) 
+  if ( noParToken != 0 ) 
     { 
-      apply(*pNoWTok);
+      this->apply(*noParToken);
     } 
   // wrong object type requested
   else 
     {
       // check if query formulated with parameter type
-      NavigationToken<typename child_type, RPAR>* pWTok = 
-	dynamic_cast< NavigationToken<typename child_type, RPAR>* >(&navToken);
+      NavigationToken<constituent_type, RPAR>* parToken = 
+	dynamic_cast< NavigationToken<constituent_type, RPAR>* >(&navToken);
 
       // honored: fill children object pointers and parameters into token
-      if (0 != pWTok) 
+      if ( parToken != 0 ) 
 	{
-	  apply(*pWTok, RPAR());
+	  this->apply(*parToken, RPAR());
 	}
     }
 
   // forward query
-  toKids(navToken);
+  this->toKids(navToken);
 }
 
 /////////////////////////////////////////////
 				       const boost::any& aParameter) const 
 {
   // first check on object type query alone
-  NavigationToken<typename child_type>* pNoWTok =
-    dynamic_cast< NavigationToken<typename child_type>* >(&navToken);
+  NavigationToken<constituent_type>* noParToken =
+    dynamic_cast< NavigationToken<constituent_type>* >(&navToken);
 
   // honored
-  if (0 != pNoWTok) 
+  if ( noParToken != 0 )
     { 
-      apply(*pNoWTok);
+      this->apply(*noParToken);
     } 
   // not this request, check with parameter
   else 
     {
-      NavigationToken<typename child_type, RPAR>* pWTok = 
-	dynamic_cast< NavigationToken<typename child_type, RPAR>* >(&navToken);
-      if (0 != pWTok) 
+      NavigationToken<constituent_type, RPAR>* parToken = 
+	dynamic_cast< NavigationToken<constituent_type, RPAR>* >(&navToken);
+      if ( parToken != 0 ) 
 	{
-	  apply(*pWTok, boost::any_cast<RPAR>(aParameter));
+	  this->apply(*parToken, boost::any_cast<RPAR>(aParameter));
 	}
     }
 
   // forward query in any case
-  toKids(navToken, aParameter);
+  this->toKids(navToken, aParameter);
 }
 
 /////////////////////////
 // insert by object pointer
 template <typename CONT, typename RPAR, typename COLL>
 void
-Navigable<CONT, RPAR, COLL>::putElement(const CONT& objectContainer,
-					const child_type* constituentObject,
-					const RPAR& objectParameter)
+Navigable<CONT, RPAR, COLL>::putElement(const CONT&          
+					refObjectContainer,
+					const constituent_type* 
+					ptrObject,
+					const RPAR&      
+					refParameter)
 {
-  DefaultChildColl<CONT, RPAR>::insert(getChildren(), 
-				       objectContainer,
-				       constituentObject,
-				       objectParameter);
+  NavigationDefaults::DefaultChildColl<CONT, RPAR>::insert(
+						    this->getConstituents(), 
+						    refObjectContainer,
+						    ptrObject,
+						    refParameter
+						           );
 }
 
 // insert by object index
 template <typename CONT, typename RPAR, typename COLL>
 void 
-Navigable<CONT, RPAR, COLL>::putElement(const CONT& objectContainer,
-					typename 
-					SG::GenerateIndexingPolicy<CONT>::type::index_type constituentIndex,
-					const RPAR& /*aPar=CHILDPAR()*/) 
+Navigable<CONT, RPAR, COLL>::putElement(const CONT& 
+					refObjectContainer,
+					external_index_type& 
+					refIndex,
+					const RPAR& 
+					refParameter) 
 						  
 {
-  DefaultChildColl<CONT, RPAR>::insert(getChildren(),
-				       objectContainer,
-				       constituentIndex);
+  NavigationDefaults::DefaultChildColl<CONT, RPAR>::insert(
+						    this->getConstituents(),
+						    refObjectContainer,
+						    refIndex,
+						    refParameter
+						          );
 }
 
 ////////////////////////////////
 // Object Removal and Finding //
 ////////////////////////////////
 
-// remove object
+// remove object by pointer
 template<typename CONT, typename RPAR, typename COLL>
 bool
-Navigable<CONT, RPAR, COLL>::remove(const typename child_type* 
-				    constituentObject)
+Navigable<CONT, RPAR, COLL>::remove(const constituent_type* ptrObject)
 {
-  return DefaultChildColl<CONT, RPAR>::remove(getChildren(),constituentObject);
+  // needs to be the non-const ref!
+  constituent_coll& refConstituents = this->getConstituents();
+  return 
+    NavigationDefaults::DefaultChildColl<CONT, RPAR>::remove(refConstituents,
+							     ptrObject);
+}
+
+// remove object by collection index
+template<typename CONT, typename RPAR, typename COLL>
+bool
+Navigable<CONT, RPAR, COLL>::remove( const CONT& refObjectContainer,
+				     external_index_type& refIndex)
+{
+  return this->remove(refObjectContainer[refIndex]);
 }
 
 // test if object is in internal container
 template<typename CONT, typename RPAR, typename COLL>
 bool
-Navigable<CONT, RPAR, COLL>::contains(const typename child_type*
-				      constituentObject)
+Navigable<CONT, RPAR, COLL>::contains(const constituent_type* ptrObject) const
 {
-  return DefaultChildColl<CONT, RPAR>::contains(getChildren(),
-						constituentObject);
+  return 
+    NavigationDefaults::DefaultChildColl<CONT, RPAR>::contains(
+						      this->getConstituents(),
+						      ptrObject
+                                                              );
+}
+
+// test if object is in internal container using index in external collection
+template<typename CONT, typename RPAR, typename COLL>
+bool
+Navigable<CONT, RPAR, COLL>::contains( const CONT& refObjectContainer,
+				       external_index_type& 
+				       refIndex) const
+{
+  const constituent_type* ptrObject = refObjectContainer[refIndex]; 
+  return this->contains(ptrObject);
 }
 
 //////////////////////////
 
 // begin() iterator
 template<typename CONT, typename RPAR, typename COLL>
-NavigableIterator<typename child_type, COLL>&
-Navigable<CONT, RPAR, COLL>::begin()
+typename Navigable<CONT, RPAR, COLL>::object_iter& 
+Navigable<CONT, RPAR, COLL>::begin() const
 {
-  return NavigableIterator(m_children).begin();
+  const constituent_coll* ptrToConstituents = this->getPtrToConstituents();
+  return 
+    ( NavigableIterator<typename Navigable<CONT, RPAR, COLL>::constituent_type,
+    COLL>( ptrToConstituents ) ).begin();
 }
 
 // end() iterator
 template<typename CONT, typename RPAR, typename COLL>
-NavigableIterator<typename child_type, COLL>&
-Navigable<CONT, RPAR, COLL>::end()
+typename Navigable<CONT, RPAR, COLL>::object_iter& 
+Navigable<CONT, RPAR, COLL>::end() const
 {
-  return NavigableIterator(m_children).end();
+  const constituent_coll* ptrToConstituents = this->getPtrToConstituents();
+  return 
+    ( NavigableIterator<typename Navigable<CONT, RPAR, COLL>::constituent_type,
+    COLL>( ptrToConstituents ) ).end();
+}
+
+// size 
+template<typename CONT, typename RPAR, typename COLL>
+unsigned int
+Navigable<CONT, RPAR, COLL>::size() const
+{
+  return this->getConstituents().size();
 }
 
 /////////////////////////
 // Retrieve Parameters //
 /////////////////////////
 
+// by object pointer
 template<typename CONT, typename RPAR, typename COLL>
-const RPAR&
-Navigable<CONT, RPAR, COLL>::getParameter(const typename 
-					  child_type* constituentObject) const
+RPAR
+Navigable<CONT, RPAR, COLL>::getParameter(const constituent_type* 
+					  ptrObject) const
 {
-  return getChildPar(DefaultChildColl<CONT, RPAR>::find(getChildren(),
-							constituentObject));
+  return 
+    getConstituentPar(
+      NavigationDefaults::DefaultChildColl<CONT, RPAR>::find(getConstituents(),
+							     ptrObject)
+                     );
+}
+
+// by collection index
+template<typename CONT, typename RPAR, typename COLL>
+RPAR
+Navigable<CONT, RPAR, COLL>::getParameter(const CONT& refObjectContainer,
+					  external_index_type& 
+					  refIndex) const
+{
+  const constituent_type* ptrObject = refObjectContainer[refIndex];
+  return this->getParameter(ptrObject);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // fill token with object pointers (no parameters)
 template <typename CONT, typename RPAR, typename COLL>
 void 
-Navigable<CONT, RPAR, COLL>::apply(NavigationToken<typename child_type>& 
+Navigable<CONT, RPAR, COLL>::apply(NavigationToken<constituent_type>& 
 				   navToken) const
 {
   // loop on children
-  const_child_iter iCtr(getChildren().begin());
-  const_child_iter iEnd(getChildren().end());
+  constituent_const_iter iCtr((this->getConstituents()).begin());
+  constituent_const_iter iEnd((this->getConstituents()).end());
   for (; iCtr != iEnd; ++iCtr) 
     {
-      navToken.setObject(getChildPtr(iCtr));
+      const constituent_type* ptrObject = this->getConstituentPtr(iCtr);
+      navToken.setObject( ptrObject );		 
     }
 }
 
 // fill with parameter
 template <typename CONT, typename RPAR, typename COLL>
 void 
-Navigable<CONT, RPAR, COLL>::apply(NavigationToken<CONT, RPAR>&
+Navigable<CONT, RPAR, COLL>::apply(NavigationToken<constituent_type, RPAR>&
 				   navToken,
-				   const RPAR& aParameter) const 
+				   const RPAR& aParameter) const
 {
   // loop children
-  const_child_iter iCtr(getChildren().begin());
-  const_child_iter iEnd(getChildren().end());
+  constituent_const_iter iCtr((this->getConstituents()).begin());
+  constituent_const_iter iEnd((this->getConstituents()).end());
   for (; iCtr != iEnd; ++iCtr) 
     {
-      navToken.setObject(getChildPtr(iCtr), aParameter * getChildPar(iCtr));
+      const constituent_type* ptrObject = this->getConstituentPtr(iCtr);
+      navToken.setObject(ptrObject, 
+			 aParameter * this->getConstituentPar(iCtr));
     }
 }
 
 // no parameter
 template <typename CONT, typename RPAR, typename COLL>
 void 
-Navigable<CONT, RPAR,COLL>::toKids(INavigationToken& navToken) const 
+Navigable<CONT, RPAR,COLL>::toKids(INavigationToken& navToken) const
 {
   // loop on children
-  const_child_iter iCtr(getChildren().begin());
-  const_child_iter iEnd(getChildren().end());
-  for (; iCtr != iEnd; ++iCtr) {
-    navToken.trySetObject(getChildPtr(iCtr)); // navigating inheritance
-    getChildPtr(iCtr)->fillToken(navToken);   // forward query
+  constituent_const_iter iCtr((this->getConstituents()).begin());
+  constituent_const_iter iEnd((this->getConstituents()).end());
+  for (; iCtr != iEnd; ++iCtr) 
+    {
+      const constituent_type* ptrObject = this->getConstituentPtr(iCtr);
+      navToken.trySetObject( ptrObject );  // navigating inheritance
+      ptrObject->fillToken( navToken );    // forward query
   }
 }
 
 template <typename CONT, typename RPAR, typename COLL>
 void 
 Navigable<CONT, RPAR, COLL>::toKids(INavigationToken& navToken,
-				    const boost::any& aParameter) const 
+				    const boost::any& aParameter) const
 {
   // loop on children
-  const_child_iter iCtr(getChildren().begin());
-  const_child_iter iEnd(getChildren().end());
+  constituent_const_iter iCtr((this->getConstituents()).begin());
+  constituent_const_iter iEnd((this->getConstituents()).end());
   // catch exception thrown by boost::any_cast 
   try {
     // only identical parameter types can be forwarded!
-    RPAR parentWeight(boost::any_cast<RPAR>(aParameter));
+    RPAR parentPar(boost::any_cast<RPAR>(aParameter));
     for (; iCtr != iEnd; ++iCtr) 
       {
-	navToken.trySetObject(getChildPtr(iCtr),
-			      boost::any(parentWeight * getChildPar(iCtr)));
-	getChildPtr(iCtr)->fillToken(navToken, 
-				     parentWeight * getChildPar(iCtr)); 
+	const constituent_type* ptrObject = this->getConstituentPtr(iCtr);
+	navToken.trySetObject(ptrObject,
+			      boost::any( parentPar * 
+					  this->getConstituentPar(iCtr) ));
+	ptrObject->fillToken(navToken, 
+			     parentPar * this->getConstituentPar(iCtr)); 
+					   
       } 
   } catch(...) {
     // parameter type mismatch: terminate parameter forwarding only
-    for (; iCtr != iEnd; ++iCtr) {
-      getChildPtr(iCtr)->fillToken(navToken, aParameter); //FIXME no weight?
-    }
+    for (; iCtr != iEnd; ++iCtr) 
+      { //FIXME no weight?
+	const constituent_type* ptrObject = this->getConstituentPtr(iCtr);
+	ptrObject->fillToken(navToken, aParameter);
+      }
   }
 }
 
 // Internal data object handling //
 ///////////////////////////////////
 
+// non-const access data objects by iterator
+template <typename CONT, typename RPAR, typename COLL>
+const typename Navigable<CONT, RPAR, COLL>::constituent_type*
+Navigable<CONT, RPAR, COLL>::getConstituentPtr(constituent_iter 
+					       iter) const
+{ 
+  return NavigationDefaults::DefaultChildColl<CONT, RPAR>::getChildPtr(iter); 
+}
+
 // access data objects by iterator
 template <typename CONT, typename RPAR, typename COLL>
-const typename child_type*
-Navigable<CONT, RPAR, COLL>::getChildPtr(const_child_iter iter) const
+const typename Navigable<CONT, RPAR, COLL>::constituent_type*
+Navigable<CONT, RPAR, COLL>::getConstituentPtr(constituent_const_iter 
+					       iter) const
 { 
-  return DefaultChildColl<CONT, RPAR>::getChildPtr(iter); 
+  return 
+    NavigationDefaults::DefaultChildColl<CONT, RPAR>::getChildPtr(iter); 
 }
 
 // access relational parameter by iterator
 template <typename CONT, typename RPAR, typename COLL>
 RPAR
-Navigable<CONT, RPAR, COLL>::getChildPar(const_child_iter iter) const
+Navigable<CONT, RPAR, COLL>::getConstituentPar(constituent_const_iter 
+					      iter) const
 { 
-  return DefaultChildColl<CONT, RPAR>::getChildPar(iter); 
+  return NavigationDefaults::DefaultChildColl<CONT, RPAR>::getChildPar(iter); 
 }
+
+// access relational parameter by iterator
+template <typename CONT, typename RPAR, typename COLL>
+RPAR
+Navigable<CONT, RPAR, COLL>::getConstituentPar(constituent_iter 
+					      iter) const
+{ 
+  return NavigationDefaults::DefaultChildColl<CONT, RPAR>::getChildPar(iter); 
+}

Navigation/NavigableIterator.h

 #ifndef NAVIGATION_NAVIGABLEITERATOR_H
 #define NAVIGATION_NAVIGABLEITERATOR_H
 
-template <typename CHILD,
-	  typename CHILDCOLL>
+template <typename CHILD, typename CHILDCOLL>
 class NavigableIterator
 {
  public:
 
+  typedef CHILDCOLL                          coll_type;
+  typedef typename coll_type::iterator       coll_iterator;
+  typedef typename coll_type::const_iterator coll_const_iterator;
+  typedef CHILD                              child_type;
+
   ////////////////////////////////
   // Constructor and Destructor //
   ////////////////////////////////
 
-  NavigableIterator(const CHILDCOLL* theCollection)
+  NavigableIterator(const coll_type* theCollection)
     : m_collection(theCollection)
     { }
 
   NavigableIterator  operator++(int) { this->next(); }
   NavigableIterator& operator--()    { this->previous(); }
   NavigableIterator  operator--(int) { this->previous(); }
-  bool operator==( NavigableIterator<CHILD,CHILDCOLL>& anOtherIterator) const
+  bool operator==( NavigableIterator<child_type, coll_type>& 
+		   anOtherIterator) const
     { return m_actual == anOtherIterator.m_actual; }
-  bool operator!=( NavigableIterator<CHILD,CHILDCOLL>& anOtherIterator) const
+  bool operator!=( NavigableIterator<child_type, coll_type>& 
+		   anOtherIterator) const
     { return !( *this == anOtherIterator ); }
 
   // operators for value retrieval
-  const CHILD* operator*() const
+  child_type operator*() const
     {
       return ( m_actual != m_collection->end() )
 	? m_collection->getChildPtr(m_actual)
 	: 0;
     }
-  const CHILD* operator->() const
+  child_type operator->() const
     {
       return m_actual != m_collection->end() 
 	? m_collection->getChildPtr(m_actual)
 
  protected:
 
-  CHILDCOLL::iterator m_actual;
-  CHILDCOLL* m_collection;
+  coll_const_iterator m_actual;
+  const coll_type*    m_collection;
 
 };  
 #endif

Navigation/NavigationDefaults.h

+#ifndef NAVIGATION_NAVIGATIONDEFAULTS_H
+#define NAVIGATION_NAVIGATIONDEFAULTS_H
+///////////////////////////////////////////////////////////////////////////////
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "DataModel/ElementLink.h"
+#ifndef DATAMODEL_TOOLS_GENERATEINDEXINGPOLICY_H
+# include "DataModel/tools/GenerateIndexingPolicy.h"
+#endif
+
+#include <utility>
+#include <vector>
+
+namespace NavigationDefaults
+{
+  ////////////////////////////////
+  // Namespace Type Definitions //
+  ////////////////////////////////
+
+  //  typedef unsigned int external_index_type;
+
+  //////////////////
+  // Default Type //
+  //////////////////
+
+  struct DefaultType{};   // completely dummy
+
+  //////////////////////
+  // DefaultContainer //
+  //////////////////////
+
+  struct DefaultContainer // needs to provide a "type"
+  {
+    public:
+      typedef DefaultType type;
+  };
+
+  typedef DefaultContainer TerminalNode;
+
+  ////////////////////////////////
+  // Default Relation Parameter //
+  ////////////////////////////////
+
+  struct DefaultWeight {
+    public:
+    DefaultWeight() {}
+    DefaultWeight& operator=(const DefaultWeight&) {return *this;}
+    const DefaultWeight& operator+(const DefaultWeight&) const {return *this;}
+    const DefaultWeight& operator*(const DefaultWeight&) const {return *this;}
+    bool operator==(DefaultWeight&) const {return true;}
+    operator double() {return 1.0;}
+  };
+
+  typedef DefaultWeight DefaultParameter;
+
+  //////////////////////////////////////////////////////////////////////
+  // Default Constituent Collections: Including Relational Parameters //
+  //////////////////////////////////////////////////////////////////////
+
+  template <typename CONT, typename RPAR>
+    struct DefaultChildColl
+    {
+      // default container is a vector of (ElementLink,RPAR) pairs
+      typedef typename std::pair< ElementLink<CONT>, RPAR > value_type;
+      typedef typename std::vector< value_type >                  type;
+      typedef typename type::iterator                    type_iterator;
+      typedef typename type::const_iterator        type_const_iterator;
+      //      typedef typename CONT::const_reference           const_child_ptr;
+      //      typedef typename CONT::reference                       child_ptr;
+      typedef typename CONT::base_value_type*                child_ptr;
+      typedef const typename CONT::base_value_type*    const_child_ptr;
+      typedef typename SG::GenerateIndexingPolicy<CONT>::type::index_type
+                                                   external_index_type;
+    
+      // object pointer (key) access (note: outer *() operates on ElementLink!)
+      static const_child_ptr getChildPtr(type_const_iterator thisIter)
+      { 
+        child_ptr thePointer = *((*thisIter).first);
+	return (const_child_ptr) thePointer; }
+
+      // relational parameter (data) access
+      static RPAR getChildPar(type_const_iterator thisIter) 
+      { return (*thisIter).second; }
+
+      // insertion of ElementLink by object pointer
+      //      template<typename OBJT>
+      static void insert(type& cont, 
+			 const CONT& aChildContainer,
+			 const_child_ptr aChild, 
+			 const RPAR& aPar=RPAR()) 
+      {
+	ElementLink<CONT> theLink;
+	theLink.toContainedElement(aChildContainer,
+				   ( child_ptr ) aChild );
+	value_type theEntry(theLink,aPar);
+	cont.push_back(theEntry); 
+      }
+
+      // insertion of ElementLink by object index
+      static void insert(type& cont, const CONT& aChildContainer,
+			 external_index_type& anIndex,
+			 const RPAR& aPar=RPAR())
+      {
+	ElementLink<CONT> theLink;
+	theLink.toIndexedElement(aChildContainer,anIndex);
+	value_type theEntry(theLink,aPar);
+	cont.push_back(theEntry);
+      }
+
+      // find method implementation for const_iterator
+      static type_const_iterator 
+      find(const type& cont, const_child_ptr aChild)
+      {
+	type_const_iterator firstEntry = cont.begin();
+	type_const_iterator lastEntry  = cont.end();
+	for ( ; firstEntry != lastEntry ; firstEntry++ )
+	  {
+	    const_child_ptr ptrChild = *((*firstEntry).first);
+	    if ( ptrChild == aChild ) break;
+	  }
+	return firstEntry;
+      }
+      
+      // find method for iterator
+      static type_iterator
+      find(type& cont, const_child_ptr aChild)
+      {
+	type_iterator firstEntry = cont.begin();
+	type_iterator lastEntry  = cont.end();
+	for ( ; firstEntry != lastEntry; firstEntry++ )
+	  {
+	   const_child_ptr ptrChild = *((*firstEntry).first);
+	    if ( ptrChild == aChild ) break;
+	  }
+	return firstEntry;
+      }  
+
+      // removal 
+      static bool
+      remove(type& cont, const_child_ptr aChild)
+      {
+	type_iterator found = find(cont,aChild);
+	if ( found != cont.end() )
+	  {
+	    cont.erase(found);
+	    return true;
+	  }
+	else
+	  {
+	    return false;
+	  }
+      }
+
+      // test on containment
+      static bool
+      contains(const type& cont, const_child_ptr aChild)
+      {
+	return find(cont,aChild) != cont.end();
+      }
+      
+    };
+
+  ///////////////////////////////////////////////////////////////
+  // Default Constituent Collections: No Relational Parameters //
+  ///////////////////////////////////////////////////////////////
+
+  template <typename CONT>
+    struct DefaultChildColl<CONT, DefaultWeight> 
+    {
+      // default container is a vector of ElementLinks
+      typedef ElementLink<CONT>                      value_type;
+      typedef typename std::vector< value_type >           type;
+      typedef typename type::iterator             type_iterator;
+      typedef typename type::const_iterator type_const_iterator;
+      typedef typename CONT::const_reference    const_child_ptr;
+      typedef typename CONT::reference                child_ptr;
+      typedef typename SG::GenerateIndexingPolicy<CONT>::type::index_type
+                                            external_index_type;
+
+      // object pointer access
+      static const_child_ptr  getChildPtr(type_const_iterator iter) 
+      { return *(*iter); }
+
+      // default weight is dummy
+      static DefaultWeight getChildPar(type_const_iterator /*iter*/) 
+      { return DefaultWeight(); }
+
+      // insertion of ElementLink by object pointer 
+      static void insert(type& cont, const CONT& aChildContainer,
+			 const_child_ptr aChild, 
+			 const DefaultWeight&) 
+      {
+	ElementLink<CONT> theLink;
+	// ugly fix!
+	theLink.toContainedElement(aChildContainer,
+				   ( child_ptr ) aPtr);
+	cont.push_back(theLink); 
+      }
+
+      // insertion of ElementLink by object index
+      static void insert(type& cont, const CONT& aChildConstainer,
+			 const external_index_type& anIndex,
+			 const DefaultWeight&)
+      {
+	ElementLink<CONT> theLink;
+	theLink.toIndexedElement(aChildContainer,aChild);
+	cont.push_back(theLink);
+      }
+    
+      // allocation of object pointer in list
+      static type_const_iterator find(const type& cont, 
+				      const_child_ptr aChild) 
+      {
+	type_const_iterator firstEntry = cont.begin();
+	type_const_iterator lastEntry  = cont.end();
+	for ( ; firstEntry != lastEntry; firstEntry++ )
+	  {
+	    if ( *(*firstEntry) == aChild ) break;
+	  }
+	return firstEntry;
+      }
+
+      // same but return iterator 
+      static type_iterator find(type& cont, child_ptr aChild) 
+      {
+	type_iterator firstEntry = cont.begin();
+	type_iterator lastEntry  = cont.end();
+	for ( ; firstEntry != lastEntry; firstEntry++ )
+	  {
+	    if ( *(*firstEntry) == aChild ) break;
+	  }
+	return firstEntry;
+      }
+
+      // removal 
+      static bool remove(type& cont, const_child_ptr aChild)
+      {
+	type_iterator found = find(cont,aChild);
+	if ( found != cont.end() )
+	  {
+	    cont.erase(found);
+	    return true;
+	  }
+	else
+	  {
+	    return false;
+	  }
+      }
+
+      // test on containment
+      static bool
+      contains(type& cont, const_child_ptr aChild)
+      {
+	return find(cont,aChild) != cont.end();
+      }
+    };
+
+  ////////////////////////////////////////////////////////////
+  // Default Constituent Collections: Terminal Node (Dummy) //
+  ////////////////////////////////////////////////////////////
+
+  template<>
+    struct DefaultChildColl< DefaultContainer, DefaultWeight >
+    {
+      public:
+        typedef DefaultType type;
+    };
+
+}; // end of namespace
+#endif
+
+
+  

Navigation/NavigationToken.h

 #include "Navigation/INavigationSelector.h"
 #include "Navigation/INavigationCondition.h"
 
-#include "Navigation/DefaultWeight.h"
+#include "Navigation/NavigationDefaults.h"
 
 #include <map>
 #include <list>
 
 #include <boost/any.hpp>
 
-template <typename CHILD, typename CHILDPAR=DefaultWeight>
+template <typename CHILD, typename CHILDPAR=NavigationDefaults::DefaultWeight>
 class NavigationToken : public INavigationToken
 {
 
  public:
 
- typedef std::map<const CHILD*, CHILDPAR>    tokenStore; 
+ typedef const CHILD*                        const_child_ptr;
+ typedef std::map<const_child_ptr, CHILDPAR> tokenStore; 
  typedef typename tokenStore::iterator       tokenIterator;
  typedef typename tokenStore::const_iterator tokenConstIterator;
 
  tokenConstIterator lastMappedObject()  { return m_data.end(); };
 
  // return weight for a given object in container
- const CHILDPAR& getParameter( const CHILD* data );
+ const CHILDPAR& getParameter( const_child_ptr data );
   
  // clear/reset token
  void clear();
  void reset() { this->clear(); }
 
  // find out if a certain object is stored in the token
- bool contains( const CHILD* data ) 
+ bool contains( const_child_ptr data ) 
    { 
      return ( m_data.find(data) != m_data.end() );
    }
  ///////////////////////
 
  // objects with default weight
- void setObject( const CHILD* data )
+ void setObject( const_child_ptr data )
    {
      this->setObject( data, CHILDPAR() );
    }
 
+ void setObject( CHILD data ) { };
+ void setObject( CHILD data, CHILDPAR weight ) { };
+
  // objects with variable weight FIXME!!!!!!!!!!
- void setObject( const CHILD* data, CHILDPAR weight );
+ void setObject( const_child_ptr data, CHILDPAR weight );
 
  // check if queried object is of requested type itself
  virtual bool trySetObject( const INavigable* theObject );

Navigation/NavigationToken.icc

 // relational parameter access
 template<typename CHILD, typename CHILDPAR>
 const CHILDPAR& 
-NavigationToken<CHILD,CHILDPAR>::getParameter(const CHILD* data )
+NavigationToken<CHILD,CHILDPAR>::getParameter( const_child_ptr data )
 {
   NavigationToken<CHILD,CHILDPAR>::tokenIterator found = m_data.find(data);
   return ( found != m_data.end() 
 
 // set object in token
 template <typename CHILD, typename CHILDPAR>
-void NavigationToken<CHILD,CHILDPAR>::setObject(const CHILD* data, 
+void NavigationToken<CHILD,CHILDPAR>::setObject(const_child_ptr data, 
 						CHILDPAR weight )
 {
   // check pointer validity
 
 // check if queried object is of requested type itself
 template <typename CHILD, typename CHILDPAR>
-bool NavigationToken<CHILD,CHILDPAR>::trySetObject(const INavigable* theObject)
+bool NavigationToken<CHILD,CHILDPAR>::trySetObject(const 
+						   INavigable* theObject)
 {
-  const CHILD* thePtr = dynamic_cast<const CHILD*>(theObject);
+  const_child_ptr thePtr = dynamic_cast<const_child_ptr>(theObject);
   if ( thePtr != 0 ) 
     {
       this->setObject(thePtr);
 
 // check if queried object is of requested type itself, including parameters
 template <typename CHILD, typename CHILDPAR> 
-bool NavigationToken<CHILD,CHILDPAR>::trySetObject(const INavigable* theObject,
+bool NavigationToken<CHILD,CHILDPAR>::trySetObject(const
+						   INavigable* theObject,
 						   const boost::any& theWeight)
 {
-  const CHILD* thePtr = dynamic_cast<const CHILD*>(theObject);
+  const_child_ptr thePtr = dynamic_cast<const_child_ptr>(theObject);
   try {
     CHILDPAR myWeight(boost::any_cast<CHILDPAR>(theWeight));
     if ( thePtr != 0 )