Inherits YGP::IRelation.
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 |
S | getParent (const T &object) |
const S | getParent (const T &object) const |
Protected Attributes | |
std::map< S, std::vector< T > , lessDereferenced< S > > | objects |
Each object can be connected to various others.
YGP::Relation1_N< S, T >::Relation1_N | ( | const char * | name | ) | [inline] |
Creates an 1-to-n relation.
name | Name of relation Defaultctr |
virtual YGP::Relation1_N< S, T >::~Relation1_N | ( | ) | [inline, virtual] |
Destructor.
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.
owner | Parent whose object should be returned |
const S YGP::Relation1_N< S, T >::getParent | ( | const T & | object | ) | const [inline] |
Returns the parent of the passed object.
object | Child whose parent should be returned |
S YGP::Relation1_N< S, T >::getParent | ( | const T & | object | ) | [inline] |
Returns the parent of the passed object.
object | Child whose parent should be returned |
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).
owner | Parent which should be checked for relations | |
object | Child which should be checked for being related |
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).
object | Child which should be checked for being related |
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).
owner | Parent which should be checked for relations |
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.
source | Parent to relate | |
targets | Children to relate with parent |
Reimplemented in YGP::Relation1_X< S, T >.
void YGP::Relation1_N< 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::Relation1_N< 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::Relation1_N< S, T >::unrelateAll | ( | ) | [inline] |
Disconnect all objects.
void YGP::Relation1_N< 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::Relation1_N< S, T >::objects [protected] |
Objects withing the relation; mapping parent objects to a list of child objects.