Changeset 9610 for code/branches/core6
- Timestamp:
- Apr 1, 2013, 10:57:34 AM (12 years ago)
- Location:
- code/branches/core6
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/object/Context.cc
r9609 r9610 37 37 namespace orxonox 38 38 { 39 Context::Context(Context* context) : parentContext_(context)39 Context::Context(Context* context) : Listable(this), parentContext_(context) 40 40 { 41 // we have to call Listable(this) to avoid circular initialization when creating a Context because Listable calls Context::getRootContext() by 42 // default AND we have to set the context again in the constructor because of other classes inheriting from Context (Listable is a virtual base 43 // and each subclass must call its constructor individually, so either all subclasses add Listable(this) to their initialization list or we call 44 // setContext(this) here). 45 this->setContext(this); 41 46 } 42 47 43 48 Context::~Context() 44 49 { 50 // unregister context from object lists before object lists are destroyed 51 this->unregisterObject(); 45 52 for (size_t i = 0; i < this->objectLists_.size(); ++i) 46 53 delete this->objectLists_[i]; -
code/branches/core6/src/libraries/core/object/Context.h
r9608 r9610 39 39 #include <vector> 40 40 41 #include "Listable.h" 42 41 43 namespace orxonox 42 44 { 43 class _CoreExport Context 45 class _CoreExport Context : virtual public Listable 44 46 { 45 47 public: -
code/branches/core6/src/libraries/core/object/Listable.cc
r9608 r9610 48 48 49 49 /** 50 @brief Constructor: Allocates space in the element list and assignes the context 51 */ 52 Listable::Listable(Context* context) 53 { 54 this->context_ = context; 55 this->elements_.reserve(6); 56 } 57 58 /** 50 59 @brief Destructor: Removes the object from the object-lists 51 60 */ -
code/branches/core6/src/libraries/core/object/Listable.h
r9608 r9610 53 53 public: 54 54 Listable(); 55 Listable(Context* context); 55 56 virtual ~Listable(); 56 57 -
code/branches/core6/test/core/CMakeLists.txt
r9605 r9610 16 16 command/CommandTest.cc 17 17 object/ClassFactoryTest.cc 18 object/ContextTest.cc 18 19 object/DestroyableTest.cc 19 20 object/IteratorTest.cc
Note: See TracChangeset
for help on using the changeset viewer.