UTIL::LCRelationNavigator Class Reference

The LCRelationNavigator makes repeated lookup of relations more conveneient and efficient. More...

#include <UTIL/LCRelationNavigator.h>

List of all members.

Public Member Functions

 LCRelationNavigator (const std::string &fromType, const std::string &toType)
 Default constructor.
 LCRelationNavigator (const EVENT::LCCollection *col)
 Create the navigator object from an existing collection of relations.
virtual ~LCRelationNavigator ()
 Destructor.
virtual const std::string & getFromType () const
 The type of the 'from' objects in this relation.
virtual const std::string & getToType () const
 The type of the 'to' objects in this relation.
virtual const EVENT::LCObjectVecgetRelatedToObjects (EVENT::LCObject *from) const
 All objects that the given from-object is related to.
virtual const EVENT::LCObjectVecgetRelatedFromObjects (EVENT::LCObject *to) const
 All from-objects related to the given object ( the inverse relationship).
virtual const EVENT::FloatVecgetRelatedToWeights (EVENT::LCObject *from) const
 The weights of the relations returned by a call to getRelatedToObjects(from).
virtual const EVENT::FloatVecgetRelatedFromWeights (EVENT::LCObject *to) const
 The weights of the relations returned by a call to getRelatedFromObjects(to).
virtual void addRelation (EVENT::LCObject *from, EVENT::LCObject *to, float weight=1.0)
 Adds a relation.
virtual void removeRelation (EVENT::LCObject *from, EVENT::LCObject *to)
 Remove a given relation.
virtual EVENT::LCCollectioncreateLCCollection ()
 Remove a given relation.

Protected Member Functions

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

std::string _from
std::string _to

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

Member Function Documentation

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.

References addRelation().

Referenced by addRelation().

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.

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

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().

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
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().

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

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Friends

Generated on 6 Mar 2020 for LCIO by  doxygen 1.6.1