Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 19, 2015, 10:04:35 PM (10 years ago)
Author:
landauf
Message:

added flag to define if a class should be used as a virtual parent (i.e. inherit with 'virtual public <classname>')

Location:
code/branches/core7/src/libraries/core
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/CoreIncludes.h

    r10362 r10374  
    255255                { this->parents_.push_back(new InheritsFromClass<T>()); return *this; }
    256256
     257            inline StaticallyInitializedIdentifier& virtualBase()
     258                { this->identifier_->setVirtualBase(true); return *this; }
     259
    257260        private:
    258261            Identifier* identifier_;
  • code/branches/core7/src/libraries/core/class/Identifiable.cc

    r9667 r10374  
    4141namespace orxonox
    4242{
    43     RegisterClassNoArgs(Identifiable);
     43    RegisterClassNoArgs(Identifiable).virtualBase();
    4444
    4545    /**
  • code/branches/core7/src/libraries/core/class/Identifier.cc

    r10372 r10374  
    5656        this->bInitialized_ = false;
    5757        this->bLoadable_ = false;
     58        this->bIsVirtualBase_ = false;
    5859
    5960        this->bHasConfigValues_ = false;
  • code/branches/core7/src/libraries/core/class/Identifier.h

    r10373 r10374  
    138138            /// Set the class to be loadable through XML or not.
    139139            inline void setLoadable(bool bLoadable) { this->bLoadable_ = bLoadable; }
     140
     141            /// Returns true if child classes should inherit virtually from this class.
     142            inline bool isVirtualBase() const { return this->bIsVirtualBase_; }
     143            /// Defines if child classes should inherit virtually from this class.
     144            inline void setVirtualBase(bool bIsVirtualBase) { this->bIsVirtualBase_ = bIsVirtualBase; }
    140145
    141146            /// Returns true if the Identifier was completely initialized.
     
    218223            bool bInitialized_;                                            //!< Is true if the Identifier was completely initialized
    219224            bool bLoadable_;                                               //!< False = it's not permitted to load the object through XML
     225            bool bIsVirtualBase_;                                          //!< If true, it is recommended to inherit virtually from this class. This changes the order of initialization of child classes, thus this information is necessary to check the class hierarchy.
    220226            std::string name_;                                             //!< The name of the class the Identifier belongs to
    221227            Factory* factory_;                                             //!< The Factory, able to create new objects of the given class (if available)
  • code/branches/core7/src/libraries/core/class/OrxonoxInterface.cc

    r9667 r10374  
    3232namespace orxonox
    3333{
    34     RegisterClassNoArgs(OrxonoxInterface);
     34    RegisterClassNoArgs(OrxonoxInterface).virtualBase();
    3535
    3636    OrxonoxInterface::OrxonoxInterface()
  • code/branches/core7/src/libraries/core/config/Configurable.cc

    r9667 r10374  
    3232namespace orxonox
    3333{
    34     RegisterClassNoArgs(Configurable);
     34    RegisterClassNoArgs(Configurable).virtualBase();
    3535
    3636    Configurable::Configurable()
  • code/branches/core7/src/libraries/core/object/Listable.cc

    r9667 r10374  
    3939namespace orxonox
    4040{
    41     RegisterClass(Listable);
     41    RegisterClass(Listable).virtualBase();
    4242
    4343    /**
Note: See TracChangeset for help on using the changeset viewer.