Changeset 9629 for code/branches/core6/src/libraries/core
- Timestamp:
- Aug 9, 2013, 9:26:46 PM (11 years ago)
- Location:
- code/branches/core6/src/libraries/core
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/BaseObject.cc
r9590 r9629 55 55 @brief Constructor: Registers the object in the BaseObject-list. 56 56 */ 57 BaseObject::BaseObject( BaseObject* creator) : bInitialized_(false)57 BaseObject::BaseObject(Context* context) : bInitialized_(false) 58 58 { 59 59 RegisterRootObject(BaseObject); … … 70 70 this->mainStateFunctor_ = 0; 71 71 72 if (context) 73 this->setContext(context); 74 75 BaseObject* creator = orxonox_cast<BaseObject*>(context); 72 76 this->setCreator(creator); 73 77 if (this->creator_) … … 201 205 { 202 206 this->networkTemplateNames_.insert(temp->getLink()); 203 207 204 208 Template* link; 205 209 assert(!(link = Template::getTemplate(temp->getLink())) || !link->isLink()); -
code/branches/core6/src/libraries/core/BaseObject.h
r9607 r9629 65 65 66 66 public: 67 BaseObject( BaseObject* creator);67 BaseObject(Context* context); 68 68 virtual ~BaseObject(); 69 69 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); -
code/branches/core6/src/libraries/core/Loader.cc
r9557 r9629 209 209 210 210 orxout(verbose, context::loader) << " creating root-namespace..." << endl; 211 Namespace* rootNamespace = new Namespace( 0);211 Namespace* rootNamespace = new Namespace(Context::getRootContext()); 212 212 rootNamespace->setLoaderIndentation(" "); 213 213 rootNamespace->setFile(file); -
code/branches/core6/src/libraries/core/Namespace.cc
r7401 r9629 40 40 CreateFactory(Namespace); 41 41 42 Namespace::Namespace( BaseObject* creator) : BaseObject(creator),42 Namespace::Namespace(Context* context) : BaseObject(context), Context(context), 43 43 bAutogeneratedFileRootNamespace_(false), 44 44 bRoot_(false), -
code/branches/core6/src/libraries/core/Namespace.h
r7401 r9629 40 40 #include <string> 41 41 #include "BaseObject.h" 42 #include "object/Context.h" 42 43 43 44 namespace orxonox 44 45 { 45 class Namespace : public BaseObject 46 class Namespace : public BaseObject, public Context 46 47 { 47 48 public: 48 Namespace( BaseObject* creator);49 Namespace(Context* context); 49 50 virtual ~Namespace(); 50 51 -
code/branches/core6/src/libraries/core/Template.cc
r9564 r9629 40 40 CreateFactory(Template); 41 41 42 Template::Template( BaseObject* creator) : BaseObject(creator)42 Template::Template(Context* context) : BaseObject(context) 43 43 { 44 44 this->xmlelement_ = new TiXmlElement(""); -
code/branches/core6/src/libraries/core/Template.h
r7401 r9629 51 51 { 52 52 public: 53 Template( BaseObject* creator);53 Template(Context* context); 54 54 virtual ~Template(); 55 55 -
code/branches/core6/src/libraries/core/XMLPort.cc
r9564 r9629 89 89 orxout(verbose, context::xml) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << endl; 90 90 91 BaseObject* newObject = orxonox_cast<BaseObject*>(identifier->fabricate(object ));91 BaseObject* newObject = orxonox_cast<BaseObject*>(identifier->fabricate(object->getContext())); 92 92 newObject->setLoaderIndentation(object->getLoaderIndentation() + " "); 93 93 -
code/branches/core6/src/libraries/core/class/Identifier.cc
r9606 r9629 174 174 @return The new object 175 175 */ 176 OrxonoxClass* Identifier::fabricate( BaseObject* creator)176 OrxonoxClass* Identifier::fabricate(Context* context) 177 177 { 178 178 if (this->factory_) 179 179 { 180 return this->factory_->fabricate(c reator);180 return this->factory_->fabricate(context); 181 181 } 182 182 else -
code/branches/core6/src/libraries/core/class/Identifier.h
r9626 r9629 125 125 inline bool hasFactory() const { return (this->factory_ != 0); } 126 126 127 OrxonoxClass* fabricate( BaseObject* creator);127 OrxonoxClass* fabricate(Context* context); 128 128 129 129 /// Returns true if the class can be loaded through XML. -
code/branches/core6/src/libraries/core/class/SubclassIdentifier.h
r9563 r9629 163 163 164 164 /// Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T. 165 T* fabricate( BaseObject* creator) const166 { 167 OrxonoxClass* newObject = this->identifier_->fabricate(c reator);165 T* fabricate(Context* context) const 166 { 167 OrxonoxClass* newObject = this->identifier_->fabricate(context); 168 168 169 169 // Check if the creation was successful -
code/branches/core6/src/libraries/core/object/ClassFactory.h
r9602 r9629 55 55 public: 56 56 virtual ~Factory() {}; 57 virtual OrxonoxClass* fabricate( BaseObject* creator) = 0;57 virtual OrxonoxClass* fabricate(Context* context) = 0; 58 58 }; 59 59 … … 82 82 @return The new object 83 83 */ 84 inline OrxonoxClass* fabricate( BaseObject* creator)84 inline OrxonoxClass* fabricate(Context* context) 85 85 { 86 return static_cast<OrxonoxClass*>(new T(c reator));86 return static_cast<OrxonoxClass*>(new T(context)); 87 87 } 88 88 }; -
code/branches/core6/src/libraries/core/object/Context.cc
r9610 r9629 56 56 /*static*/ Context* Context::getRootContext() 57 57 { 58 static Context rootContext ;58 static Context rootContext(NULL); 59 59 return &rootContext; 60 60 } -
code/branches/core6/src/libraries/core/object/Context.h
r9610 r9629 48 48 static Context* getRootContext(); 49 49 50 Context(Context* context = NULL);50 Context(Context* context); 51 51 virtual ~Context(); 52 52
Note: See TracChangeset
for help on using the changeset viewer.