Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 6, 2008, 4:21:56 PM (16 years ago)
Author:
landauf
Message:

Added new 'MultiType', replacing MultiTypePrimitive, MultiTypeString and MultiTypeMath. MultiType can hold all types MultiTypeMath was able to hold, namely all primitives, pointers, string and several math objects (vector2, 3 and 4, quaternion, colourvalue, radian, degree).

The new MultiType has a completely changed behaviour, I'll explain this on a wiki page somewhen.
But to say the most important things in a few words:
The MultiType has a fixed type. This type is determined by the first assigned value (by using setValue(value), operator=(value) or MultiType(value)). Every other value getting assigned later, will be converted to the first type. But you can change the type (setType<T>()), convert the value (convert<T>()) or force the type of a newly assigned value manually (setValue<T>(value)) by using template functions.

In contrast, the old MultiTypeMath changed it's internal type whenever a new type was assigned. So be aware of this important change.

At the moment I can't see any issues, but there might very well be several problems yet to discover, so further tests will be done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/core/XMLPort.h

    r1610 r1716  
    3434#include "util/Debug.h"
    3535#include "util/XMLIncludes.h"
    36 #include "util/MultiTypeMath.h"
     36#include "util/MultiType.h"
    3737#include "tinyxml/ticpp.h"
    3838#include "Executor.h"
     
    107107            virtual const std::string& getDescription() = 0;
    108108
    109             virtual XMLPortParamContainer& defaultValue(unsigned int index, const MultiTypeMath& param) = 0;
    110             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1) = 0;
    111             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2) = 0;
    112             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3) = 0;
    113             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4) = 0;
    114             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5) = 0;
     109            virtual XMLPortParamContainer& defaultValue(unsigned int index, const MultiType& param) = 0;
     110            virtual XMLPortParamContainer& defaultValues(const MultiType& param1) = 0;
     111            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2) = 0;
     112            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3) = 0;
     113            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4) = 0;
     114            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) = 0;
    115115
    116116        protected:
     
    197197                { return this->loadexecutor_->getDescription(); }
    198198
    199             virtual XMLPortParamContainer& defaultValue(unsigned int index, const MultiTypeMath& param)
     199            virtual XMLPortParamContainer& defaultValue(unsigned int index, const MultiType& param)
    200200            {
    201201                if (!this->loadexecutor_->defaultValueSet(index))
     
    203203                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    204204            }
    205             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1)
     205            virtual XMLPortParamContainer& defaultValues(const MultiType& param1)
    206206            {
    207207                if (!this->loadexecutor_->defaultValueSet(0))
     
    209209                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    210210            }
    211             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2)
     211            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2)
    212212            {
    213213                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)))
     
    215215                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    216216            }
    217             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3)
     217            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)
    218218            {
    219219                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)) || (!this->loadexecutor_->defaultValueSet(2)))
     
    221221                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    222222            }
    223             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4)
     223            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)
    224224            {
    225225                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)) || (!this->loadexecutor_->defaultValueSet(2)) || (!this->loadexecutor_->defaultValueSet(3)))
     
    227227                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    228228            }
    229             virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5)
     229            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)
    230230            {
    231231                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)) || (!this->loadexecutor_->defaultValueSet(2)) || (!this->loadexecutor_->defaultValueSet(3)) || (!this->loadexecutor_->defaultValueSet(4)))
Note: See TracChangeset for help on using the changeset viewer.