Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/objecthierarchie/src/Identifier.cc @ 243

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
Line 
1#include "Identifier.h"
2
3namespace orxonox
4{
5    // ###############################
6    // ###       Identifier        ###
7    // ###############################
8    int Identifier::hierarchyCreatingCounter_s = 0;
9
10    Identifier::Identifier()
11    {
12        this->bCreatedOneObject_ = false;
13
14        this->children_ = new IdentifierList;
15    }
16
17    Identifier::~Identifier()
18    {
19        delete &this->name_;
20
21        delete this->children_;
22    }
23
24    void Identifier::initialize(const IdentifierList* parents)
25    {
26#if HIERARCHY_VERBOSE
27        std::cout << "*** Initialize " << this->name_ << "-Singleton.\n";
28#endif
29        if (parents)
30        {
31            this->bCreatedOneObject_ = true;
32
33            IdentifierListElement* temp1 = parents->first_;
34            while (temp1)
35            {
36                this->parents_.add(temp1->identifier_);
37                temp1->identifier_->getChildren().add(this);
38
39                temp1 = temp1->next_;
40            }
41        }
42    }
43
44    bool Identifier::isA(const Identifier* identifier) const
45    {
46        return (identifier == this || this->parents_.isInList(identifier));
47    }
48
49    bool Identifier::isDirectlyA(const Identifier* identifier) const
50    {
51        return (identifier == this);
52    }
53
54    bool Identifier::isChildOf(const Identifier* identifier) const
55    {
56        return this->parents_.isInList(identifier);
57    }
58
59    bool Identifier::isParentOf(const Identifier* identifier) const
60    {
61        return this->children_->isInList(identifier);
62    }
63}
Note: See TracBrowser for help on using the repository browser.