Inherits YGP::IRelation.
Public Member Functions | |
RelationN_M (const char *name) | |
virtual | ~RelationN_M () |
void | relate (const S &source, const T &target) |
void | relate (const S &source, const std::vector< T > &targets) |
void | relate (const std::vector< S > &sources, const T &target) |
void | unrelate (const S &source, const T &target) |
void | unrelateAll (const S &source) |
void | unrelateAll (const T &target) |
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 |
const std::vector< S > & | getParents (const T &object) const |
Protected Attributes | |
std::map< S, std::vector< T > , lessDereferenced< S > > | objects |
std::map< T, std::vector< S > , lessDereferenced< T > > | parents |
Each object can be connected to various others, which themself can be related to various of the first.
YGP::RelationN_M< S, T >::RelationN_M | ( | const char * | name | ) | [inline] |
Creates an 1-to-n relation.
name | Name of relation Defaultctr |
virtual YGP::RelationN_M< S, T >::~RelationN_M | ( | ) | [inline, virtual] |
Destructor.
const std::vector<T>& YGP::RelationN_M< S, T >::getObjects | ( | const S & | owner | ) | const [inline] |
Returns the childs which are related with the passed object.
owner | Parent whose object should be returned |
const std::vector<S>& YGP::RelationN_M< S, T >::getParents | ( | const T & | object | ) | const [inline] |
Returns the parents of the passed object.
object | Child whose parent should be returned |
bool YGP::RelationN_M< S, T >::isRelated | ( | const S & | owner, | |
const T & | object | |||
) | const [inline] |
Checks if the passed object is related to any other (within this relation).
owner | Parent which should be checked for relations | |
object | Child which should be checked for being related |
bool YGP::RelationN_M< S, T >::isRelated | ( | const T & | object | ) | const [inline] |
Checks if the passed object is related to any other (within this relation).
object | Child which should be checked for being related |
bool YGP::RelationN_M< S, T >::isRelated | ( | const S & | owner | ) | const [inline] |
Checks if the passed object is related to any other (within this relation).
owner | Parent which should be checked for relations |
void YGP::RelationN_M< S, T >::relate | ( | const std::vector< S > & | sources, | |
const T & | target | |||
) | [inline] |
Connects an object with a bunch of objects, replacing the previously related objects.
sources | Parents to relate | |
target | Child to relate with parents |
void YGP::RelationN_M< 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.
source | Parent to relate | |
targets | Children to relate with parent |
void YGP::RelationN_M< S, T >::relate | ( | const S & | source, | |
const T & | target | |||
) | [inline] |
Connects two objects.
source | Parent to relate | |
target | Child to relate with parent |
void YGP::RelationN_M< S, T >::unrelate | ( | const S & | source, | |
const T & | target | |||
) | [inline] |
Disconnects two objects.
source | Parent to unrelate | |
target | Child to unrelate from parent |
void YGP::RelationN_M< S, T >::unrelateAll | ( | ) | [inline] |
Disconnect all objects.
void YGP::RelationN_M< S, T >::unrelateAll | ( | const T & | target | ) | [inline] |
Disconnect all parents from an object.
target | Parent to unrelate |
void YGP::RelationN_M< S, T >::unrelateAll | ( | const S & | source | ) | [inline] |
Disconnect all objects from a parent.
source | Parent to unrelate |
std::map<S, std::vector<T>, lessDereferenced<S> > YGP::RelationN_M< S, T >::objects [protected] |
Objects withing the relation; mapping parent objects to a list of child objects.
std::map<T, std::vector<S>, lessDereferenced<T> > YGP::RelationN_M< S, T >::parents [protected] |
Parents withing the relation; mapping child objects to a list of parent objects.