Changeset 896
- Timestamp:
- Mar 17, 2008, 5:05:54 PM (17 years ago)
- Location:
- code/branches/core2/src/orxonox/core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/ClassTreeMask.cc
r876 r896 561 561 562 562 /** 563 @brief Compares the mask with another mask and returns true if they represent the same logic. 564 @param other The other mask 565 @return True if both masks represent the same logic 566 */ 567 bool ClassTreeMask::operator==(const ClassTreeMask& other) const 568 { 569 ClassTreeMask temp1 = other; 570 ClassTreeMask temp2 = (*this); 571 572 temp1.clean(); 573 temp2.clean(); 574 575 ClassTreeMaskIterator it1 = temp1.root_; 576 ClassTreeMaskIterator it2 = temp2.root_; 577 578 for ( ; it1 && it2; ++it1, ++it2) 579 if (it1->getClass() != it2->getClass()) 580 return false; 581 582 return true; 583 } 584 585 /** 586 @brief Compares the mask with another mask and returns true if they represent different logics. 587 @param other The other mask 588 @return True if the masks represent different logics 589 */ 590 bool ClassTreeMask::operator!=(const ClassTreeMask& other) const 591 { 592 return (!((*this) == other)); 593 } 594 595 /** 563 596 @brief Prefix operator + does nothing. 564 597 @return A reference to the mask itself -
code/branches/core2/src/orxonox/core/ClassTreeMask.h
r871 r896 179 179 ClassTreeMask& operator=(const ClassTreeMask& other); 180 180 181 bool operator==(const ClassTreeMask& other) const; 182 bool operator!=(const ClassTreeMask& other) const; 183 181 184 ClassTreeMask& operator+(); 182 185 ClassTreeMask operator-() const; -
code/branches/core2/src/orxonox/core/Loader.cc
r878 r896 115 115 ticpp::Document xmlfile(level->getFile()); 116 116 xmlfile.LoadFile(); 117 ticpp::Element rootElement; 118 rootElement.SetAttribute("name", "rootNamespace"); 117 119 118 120 for (ticpp::Iterator<ticpp::Element> child = xmlfile.FirstChildElement(false); child != child.end(); child++) 119 { 120 Identifier* identifier = ID(child->Value()); 121 if (identifier) 122 { 123 if (identifier->isA(Class(Namespace)) || Loader::currentMask_s.isIncluded(identifier)) 124 { 125 COUT(4) << " fabricating " << child->Value() << "..." << std::endl; 126 BaseObject* newObject = identifier->fabricate(); 127 newObject->setLoaderIndentation(" "); 128 newObject->setLevel(level); 129 newObject->XMLPort(*child, true); 130 COUT(5) << " ...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl; 131 } 132 } 133 else 134 { 135 COUT(2) << " Warning: '" << child->Value() << "' is not a valid classname." << std::endl; 136 } 137 } 121 rootElement.InsertEndChild(*child); 122 123 Namespace* rootNamespace = new Namespace(); 124 rootNamespace->setLoaderIndentation(" "); 125 rootNamespace->setLevel(level); 126 rootNamespace->deleteNamespaceNodesAfterDestruction(true); 127 rootNamespace->XMLPort(rootElement, true); 138 128 139 129 COUT(0) << "Finished loading " << level->getFile() << "." << std::endl; -
code/branches/core2/src/orxonox/core/Namespace.cc
r895 r896 41 41 42 42 this->bAutogeneratedFileRootNamespace_ = false; 43 this->bDeleteNamespaceNodesAfterDestruction_ = false; 43 44 this->operator_ = "or"; 44 45 } … … 46 47 Namespace::~Namespace() 47 48 { 49 if (this->bDeleteNamespaceNodesAfterDestruction_) 50 for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it) 51 delete (*it); 48 52 } 49 53 -
code/branches/core2/src/orxonox/core/Namespace.h
r895 r896 62 62 bool isIncludedIn(const Namespace* ns) const { return ns->includes(this); } 63 63 64 void deleteNamespaceNodesAfterDestruction(bool bDelete) 65 { this->bDeleteNamespaceNodesAfterDestruction_ = bDelete; } 66 64 67 private: 65 68 std::set<NamespaceNode*> representingNamespaces_; 66 69 bool bAutogeneratedFileRootNamespace_; 70 bool bDeleteNamespaceNodesAfterDestruction_; 67 71 std::string operator_; 68 72 };
Note: See TracChangeset
for help on using the changeset viewer.