YGP::Relation1_N< S, T > Class Template Reference

1-to-N relation without a limit for N. More...

Inherits YGP::IRelation.

List of all members.

Public Member Functions

 Relation1_N (const char *name)
virtual ~Relation1_N ()
void relate (const S &source, const T &target)
void relate (const S &source, const std::vector< T > &targets)
void unrelate (const S &source, const T &target)
void unrelateAll (const S &source)
void unrelateAll ()
bool isRelated (const S &owner) const
bool isRelated (const T &object) const
bool isRelated (const S &owner, const T &object) const
const std::vector< T > & getObjects (const S &owner) const
getParent (const T &object)
const S getParent (const T &object) const

Protected Attributes

std::map< S, std::vector< T >
, lessDereferenced< S > > 
objects


Detailed Description

template<class S, class T>
class YGP::Relation1_N< S, T >

1-to-N relation without a limit for N.

Each object can be connected to various others.


Constructor & Destructor Documentation

template<class S, class T>
YGP::Relation1_N< S, T >::Relation1_N ( const char *  name  )  [inline]

Creates an 1-to-n relation.

Parameters:
name Name of relation Defaultctr

template<class S, class T>
virtual YGP::Relation1_N< S, T >::~Relation1_N (  )  [inline, virtual]

Destructor.


Member Function Documentation

template<class S, class T>
const std::vector<T>& YGP::Relation1_N< S, T >::getObjects ( const S &  owner  )  const [inline]

Returns the childs which are related with the passed object.

Parameters:
owner Parent whose object should be returned
Returns:
T The related object
Remarks:
The object must be related

template<class S, class T>
const S YGP::Relation1_N< S, T >::getParent ( const T &  object  )  const [inline]

Returns the parent of the passed object.

Parameters:
object Child whose parent should be returned
Returns:
S The related parent
Remarks:
The object must be related

template<class S, class T>
S YGP::Relation1_N< S, T >::getParent ( const T &  object  )  [inline]

Returns the parent of the passed object.

Parameters:
object Child whose parent should be returned
Returns:
S The related parent
Remarks:
The object must be related

template<class S, class T>
bool YGP::Relation1_N< S, T >::isRelated ( const S &  owner,
const T &  object 
) const [inline]

Checks if the passed object is related to any other (within this relation).

Parameters:
owner Parent which should be checked for relations
object Child which should be checked for being related

template<class S, class T>
bool YGP::Relation1_N< S, T >::isRelated ( const T &  object  )  const [inline]

Checks if the passed object is related to any other (within this relation).

Parameters:
object Child which should be checked for being related

template<class S, class T>
bool YGP::Relation1_N< S, T >::isRelated ( const S &  owner  )  const [inline]

Checks if the passed object is related to any other (within this relation).

Parameters:
owner Parent which should be checked for relations

template<class S, class T>
void YGP::Relation1_N< S, T >::relate ( const S &  source,
const std::vector< T > &  targets 
) [inline]

Connects an object with a bunch of objects, replacing the previously related objects.

Parameters:
source Parent to relate
targets Children to relate with parent

Reimplemented in YGP::Relation1_X< S, T >.

template<class S, class T>
void YGP::Relation1_N< S, T >::relate ( const S &  source,
const T &  target 
) [inline]

Connects two objects.

Parameters:
source Parent to relate
target Child to relate with parent

template<class S, class T>
void YGP::Relation1_N< S, T >::unrelate ( const S &  source,
const T &  target 
) [inline]

Disconnects two objects.

Parameters:
source Parent to unrelate
target Child to unrelate from parent

template<class S, class T>
void YGP::Relation1_N< S, T >::unrelateAll (  )  [inline]

Disconnect all objects.

template<class S, class T>
void YGP::Relation1_N< S, T >::unrelateAll ( const S &  source  )  [inline]

Disconnect all objects from a parent.

Parameters:
source Parent to unrelate


Member Data Documentation

template<class S, class T>
std::map<S, std::vector<T>, lessDereferenced<S> > YGP::Relation1_N< S, T >::objects [protected]

Objects withing the relation; mapping parent objects to a list of child objects.


The documentation for this class was generated from the following file:

YGP Version 0.9.31 - Generated on Wed Nov 18 11:25:28 2009 by doxygen 1.5.8