Last change
on this file since 243 was
243,
checked in by landauf, 16 years ago
|
removed the "directParent" feature - it was a clever but unnecessary feature.
|
File size:
1.5 KB
|
Rev | Line | |
---|
[197] | 1 | #include "Identifier.h" |
---|
| 2 | |
---|
| 3 | namespace orxonox |
---|
| 4 | { |
---|
| 5 | // ############################### |
---|
| 6 | // ### Identifier ### |
---|
| 7 | // ############################### |
---|
[219] | 8 | int Identifier::hierarchyCreatingCounter_s = 0; |
---|
| 9 | |
---|
[197] | 10 | Identifier::Identifier() |
---|
| 11 | { |
---|
| 12 | this->bCreatedOneObject_ = false; |
---|
[239] | 13 | |
---|
[243] | 14 | this->children_ = new IdentifierList; |
---|
[197] | 15 | } |
---|
| 16 | |
---|
| 17 | Identifier::~Identifier() |
---|
| 18 | { |
---|
| 19 | delete &this->name_; |
---|
[239] | 20 | |
---|
[243] | 21 | delete this->children_; |
---|
[197] | 22 | } |
---|
| 23 | |
---|
[239] | 24 | void Identifier::initialize(const IdentifierList* parents) |
---|
[197] | 25 | { |
---|
[231] | 26 | #if HIERARCHY_VERBOSE |
---|
[197] | 27 | std::cout << "*** Initialize " << this->name_ << "-Singleton.\n"; |
---|
[231] | 28 | #endif |
---|
[197] | 29 | if (parents) |
---|
| 30 | { |
---|
| 31 | this->bCreatedOneObject_ = true; |
---|
| 32 | |
---|
[243] | 33 | IdentifierListElement* temp1 = parents->first_; |
---|
[197] | 34 | while (temp1) |
---|
| 35 | { |
---|
[243] | 36 | this->parents_.add(temp1->identifier_); |
---|
| 37 | temp1->identifier_->getChildren().add(this); |
---|
[197] | 38 | |
---|
| 39 | temp1 = temp1->next_; |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | } |
---|
| 43 | |
---|
[239] | 44 | bool Identifier::isA(const Identifier* identifier) const |
---|
[197] | 45 | { |
---|
[243] | 46 | return (identifier == this || this->parents_.isInList(identifier)); |
---|
[197] | 47 | } |
---|
| 48 | |
---|
[239] | 49 | bool Identifier::isDirectlyA(const Identifier* identifier) const |
---|
[197] | 50 | { |
---|
| 51 | return (identifier == this); |
---|
| 52 | } |
---|
| 53 | |
---|
[239] | 54 | bool Identifier::isChildOf(const Identifier* identifier) const |
---|
[197] | 55 | { |
---|
[243] | 56 | return this->parents_.isInList(identifier); |
---|
[197] | 57 | } |
---|
| 58 | |
---|
[239] | 59 | bool Identifier::isParentOf(const Identifier* identifier) const |
---|
[197] | 60 | { |
---|
[243] | 61 | return this->children_->isInList(identifier); |
---|
[197] | 62 | } |
---|
| 63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.