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/Executor.cc

    r1505 r1716  
    6565    }
    6666
    67     bool Executor::evaluate(const std::string& params, MultiTypeMath param[5], const std::string& delimiter) const
     67    bool Executor::evaluate(const std::string& params, MultiType param[5], const std::string& delimiter) const
    6868    {
    6969        unsigned int paramCount = this->functor_->getParamCount();
     
    171171    }
    172172
    173     Executor& Executor::setDefaultValues(const MultiTypeMath& param1)
    174     {
    175         this->defaultValue_[0] = param1;
    176         this->bAddedDefaultValue_[0] = true;
    177 
    178         return (*this);
    179     }
    180 
    181     Executor& Executor::setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2)
    182     {
    183         this->defaultValue_[0] = param1;
    184         this->bAddedDefaultValue_[0] = true;
    185         this->defaultValue_[1] = param2;
    186         this->bAddedDefaultValue_[1] = true;
    187 
    188         return (*this);
    189     }
    190 
    191     Executor& Executor::setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3)
     173    Executor& Executor::setDefaultValues(const MultiType& param1)
     174    {
     175        this->defaultValue_[0] = param1;
     176        this->bAddedDefaultValue_[0] = true;
     177
     178        return (*this);
     179    }
     180
     181    Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2)
     182    {
     183        this->defaultValue_[0] = param1;
     184        this->bAddedDefaultValue_[0] = true;
     185        this->defaultValue_[1] = param2;
     186        this->bAddedDefaultValue_[1] = true;
     187
     188        return (*this);
     189    }
     190
     191    Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)
    192192    {
    193193        this->defaultValue_[0] = param1;
     
    201201    }
    202202
    203     Executor& Executor::setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4)
     203    Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)
    204204    {
    205205        this->defaultValue_[0] = param1;
     
    215215    }
    216216
    217     Executor& Executor::setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5)
     217    Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)
    218218    {
    219219        this->defaultValue_[0] = param1;
     
    231231    }
    232232
    233     Executor& Executor::setDefaultValue(unsigned int index, const MultiTypeMath& param)
     233    Executor& Executor::setDefaultValue(unsigned int index, const MultiType& param)
    234234    {
    235235        if (index >= 0 && index < MAX_FUNCTOR_ARGUMENTS)
Note: See TracChangeset for help on using the changeset viewer.