Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

UTIL::LCRelationNavigator Class Reference

#include <LCRelationNavigator.h>

List of all members.

Public Member Functions

 LCRelationNavigator (const std::string &fromType, const std::string &toType)
 LCRelationNavigator (const EVENT::LCCollection *col)
virtual ~LCRelationNavigator ()
 Destructor.
virtual const std::string & getFromType () const
virtual const std::string & getToType () const
virtual const EVENT::LCObjectVecgetRelatedToObjects (EVENT::LCObject *from) const
virtual const EVENT::LCObjectVecgetRelatedFromObjects (EVENT::LCObject *to) const
virtual const EVENT::FloatVecgetRelatedToWeights (EVENT::LCObject *from) const
virtual const EVENT::FloatVecgetRelatedFromWeights (EVENT::LCObject *to) const
virtual void addRelation (EVENT::LCObject *from, EVENT::LCObject *to, float weight=1.0)
virtual void removeRelation (EVENT::LCObject *from, EVENT::LCObject *to)
virtual EVENT::LCCollectioncreateLCCollection ()

Protected Member Functions

 LCRelationNavigator ()
virtual void initialize (const EVENT::LCCollection *col)
void removeRelation (EVENT::LCObject *from, EVENT::LCObject *to, RelMap &map)
void addRelation (EVENT::LCObject *from, EVENT::LCObject *to, float weight, RelMap &map)

Protected Attributes

RelMap _map
RelMap _rMap
std::string _from
std::string _to

Private Types

typedef std::map< EVENT::LCObject *,
std::pair< EVENT::LCObjectVec,
EVENT::FloatVec > > 
RelMap


Detailed Description

The LCRelationNavigator makes repeated lookup of relations more conveneient and efficient. The relations are treated symmetrical, i.e. lookup of relations is equally efficient and fast for either direction (from-to and to-from) at the price of a slower (by a factor of ~2) modification speed.

Author:
gaede
Version:
Id
LCRelationNavigator.h,v 1.2 2004/09/06 14:35:51 gaede Exp

Definition at line 23 of file LCRelationNavigator.h.


Member Typedef Documentation

typedef std::map< EVENT::LCObject* , std::pair< EVENT::LCObjectVec , EVENT::FloatVec > > UTIL::LCRelationNavigator::RelMap [private]
 

Definition at line 25 of file LCRelationNavigator.h.


Constructor & Destructor Documentation

UTIL::LCRelationNavigator::LCRelationNavigator const std::string &  fromType,
const std::string &  toType
[inline]
 

Default constructor

Definition at line 32 of file LCRelationNavigator.h.

UTIL::LCRelationNavigator::LCRelationNavigator const EVENT::LCCollection col  ) 
 

Create the navigator object from an existing collection of relations

Definition at line 19 of file LCRelationNavigator.cc.

References initialize(), RELATIONFROMTYPESTR, and RELATIONTOTYPESTR.

virtual UTIL::LCRelationNavigator::~LCRelationNavigator  )  [inline, virtual]
 

Destructor.

Definition at line 41 of file LCRelationNavigator.h.

UTIL::LCRelationNavigator::LCRelationNavigator  )  [protected]
 


Member Function Documentation

void UTIL::LCRelationNavigator::addRelation EVENT::LCObject from,
EVENT::LCObject to,
float  weight,
RelMap map
[protected]
 

Definition at line 78 of file LCRelationNavigator.cc.

References EVENT::FloatVec, and EVENT::LCObjectVec.

void UTIL::LCRelationNavigator::addRelation EVENT::LCObject from,
EVENT::LCObject to,
float  weight = 1.0
[virtual]
 

Adds a relation. If there is already an existing relation between the two given objects the weight (or default weight 1.0) is added to that relationship's weight.

Definition at line 71 of file LCRelationNavigator.cc.

References _map, and _rMap.

Referenced by initialize(), and marlin::SimpleFastMCProcessor::processEvent().

EVENT::LCCollection * UTIL::LCRelationNavigator::createLCCollection  )  [virtual]
 

Remove a given relation. To reduce the weight of the relationship, call addRelation( from, to, weight ) with weight<0.

Definition at line 142 of file LCRelationNavigator.cc.

References _map, IMPL::LCCollectionVec::addElement(), EVENT::FloatVec, IMPL::LCFlagImpl::getFlag(), getFromType(), getToType(), EVENT::LCObjectVec, IMPL::LCCollectionVec::parameters(), RELATIONFROMTYPESTR, RELATIONTOTYPESTR, IMPL::LCFlagImpl::setBit(), IMPL::LCCollectionVec::setFlag(), and EVENT::LCParameters::setValue().

Referenced by marlin::SimpleFastMCProcessor::processEvent().

const std::string & UTIL::LCRelationNavigator::getFromType  )  const [virtual]
 

The type of the 'from' objects in this relation.

Definition at line 46 of file LCRelationNavigator.cc.

Referenced by createLCCollection().

const EVENT::LCObjectVec & UTIL::LCRelationNavigator::getRelatedFromObjects EVENT::LCObject to  )  const [virtual]
 

All from-objects related to the given object ( the inverse relationship). LCObjects are of type getFromType().

Definition at line 56 of file LCRelationNavigator.cc.

References _rMap.

const EVENT::FloatVec & UTIL::LCRelationNavigator::getRelatedFromWeights EVENT::LCObject to  )  const [virtual]
 

The weights of the relations returned by a call to getRelatedFromObjects(to).

See also:
getRelatedFromObjects

Definition at line 66 of file LCRelationNavigator.cc.

References _rMap.

const EVENT::LCObjectVec & UTIL::LCRelationNavigator::getRelatedToObjects EVENT::LCObject from  )  const [virtual]
 

All objects that the given from-object is related to. LCObjects are of type getToType().

Definition at line 50 of file LCRelationNavigator.cc.

References _map.

Referenced by marlin::SimpleFastMCProcessor::check().

const EVENT::FloatVec & UTIL::LCRelationNavigator::getRelatedToWeights EVENT::LCObject from  )  const [virtual]
 

The weights of the relations returned by a call to getRelatedToObjects(from).

See also:
getRelatedToObjects

Definition at line 61 of file LCRelationNavigator.cc.

References _map.

const std::string & UTIL::LCRelationNavigator::getToType  )  const [virtual]
 

The type of the 'to' objects in this relation.

Definition at line 47 of file LCRelationNavigator.cc.

Referenced by createLCCollection().

void UTIL::LCRelationNavigator::initialize const EVENT::LCCollection col  )  [protected, virtual]
 

Definition at line 27 of file LCRelationNavigator.cc.

References addRelation(), EVENT::LCCollection::getElementAt(), EVENT::LCRelation::getFrom(), EVENT::LCCollection::getNumberOfElements(), EVENT::LCRelation::getTo(), EVENT::LCCollection::getTypeName(), and EVENT::LCRelation::getWeight().

Referenced by LCRelationNavigator().

void UTIL::LCRelationNavigator::removeRelation EVENT::LCObject from,
EVENT::LCObject to,
RelMap map
[protected]
 

Definition at line 110 of file LCRelationNavigator.cc.

References EVENT::FloatVec, and EVENT::LCObjectVec.

void UTIL::LCRelationNavigator::removeRelation EVENT::LCObject from,
EVENT::LCObject to
[virtual]
 

Remove a given relation.

Definition at line 103 of file LCRelationNavigator.cc.

References _map, and _rMap.


Member Data Documentation

std::string UTIL::LCRelationNavigator::_from [protected]
 

Definition at line 96 of file LCRelationNavigator.h.

RelMap UTIL::LCRelationNavigator::_map [mutable, protected]
 

Definition at line 94 of file LCRelationNavigator.h.

Referenced by addRelation(), createLCCollection(), getRelatedToObjects(), getRelatedToWeights(), and removeRelation().

RelMap UTIL::LCRelationNavigator::_rMap [mutable, protected]
 

Definition at line 95 of file LCRelationNavigator.h.

Referenced by addRelation(), getRelatedFromObjects(), getRelatedFromWeights(), and removeRelation().

std::string UTIL::LCRelationNavigator::_to [protected]
 

Definition at line 97 of file LCRelationNavigator.h.


The documentation for this class was generated from the following files:
Generated on Sun Jun 3 06:32:40 2007 for A TPC Tracking Environment by  doxygen 1.3.9.1