Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3145 for code/branches


Ignore:
Timestamp:
Jun 11, 2009, 6:22:15 PM (15 years ago)
Author:
rgrieder
Message:

Added a few inline keywords to template functions (Visual Studio does not seem to inline the small ones if defined outside of the class)
Added FORCEINLINE (which expands to forceinline for msvc) to all conversion functions (except the larger ones of course).

Location:
code/branches/pch/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pch/src/core/ClassFactory.h

    r2171 r3145  
    8888    */
    8989    template <class T>
    90     BaseObject* ClassFactory<T>::fabricate(BaseObject* creator)
     90    inline BaseObject* ClassFactory<T>::fabricate(BaseObject* creator)
    9191    {
    9292        return ClassFactory<T>::createNewObject(creator);
     
    9898    */
    9999    template <class T>
    100     T* ClassFactory<T>::createNewObject(BaseObject* creator)
     100    inline T* ClassFactory<T>::createNewObject(BaseObject* creator)
    101101    {
    102102        return new T(creator);
  • code/branches/pch/src/core/Identifier.h

    r2784 r3145  
    383383    */
    384384    template <class T>
    385     ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()
     385    inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()
    386386    {
    387387        // check if the static field has already been filled
     
    398398    */
    399399    template <class T>
    400     ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier(const std::string& name)
     400    inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier(const std::string& name)
    401401    {
    402402        ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
     
    435435    */
    436436    template <class T>
    437     void ClassIdentifier<T>::addObject(T* object)
     437    inline void ClassIdentifier<T>::addObject(T* object)
    438438    {
    439439        COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
  • code/branches/pch/src/orxonox/tools/BulletConversions.h

    r2662 r3145  
    4343    struct ConverterExplicit<orxonox::Vector3, btVector3>
    4444    {
    45         static bool convert(btVector3* output, const orxonox::Vector3& input)
     45        FORCEINLINE static bool convert(btVector3* output, const orxonox::Vector3& input)
    4646        {
    4747            output->setX(input.x);
     
    5656    struct ConverterExplicit<btVector3, orxonox::Vector3>
    5757    {
    58         static bool convert(orxonox::Vector3* output, const btVector3& input)
     58        FORCEINLINE static bool convert(orxonox::Vector3* output, const btVector3& input)
    5959        {
    6060            output->x = input.x();
     
    6969    struct ConverterExplicit<orxonox::Quaternion, btQuaternion>
    7070    {
    71         static bool convert(btQuaternion* output, const orxonox::Quaternion& input)
     71        FORCEINLINE static bool convert(btQuaternion* output, const orxonox::Quaternion& input)
    7272        {
    7373            output->setW(input.w);
     
    8383    struct ConverterExplicit<btQuaternion, orxonox::Quaternion>
    8484    {
    85         static bool convert(orxonox::Quaternion* output, const btQuaternion& input)
     85        FORCEINLINE static bool convert(orxonox::Quaternion* output, const btQuaternion& input)
    8686        {
    8787            output->w = input.w();
  • code/branches/pch/src/orxonox/tools/TextureGenerator.cc

    r3131 r3145  
    4242{
    4343    template <>
    44     bool less<orxonox::ColourValue>::operator()(const orxonox::ColourValue& __x, const orxonox::ColourValue& __y) const
     44    inline bool less<orxonox::ColourValue>::operator()(const orxonox::ColourValue& __x, const orxonox::ColourValue& __y) const
    4545    {
    4646        if (__x.r == __y.r)
  • code/branches/pch/src/util/Convert.h

    r3125 r3145  
    139139    struct ConverterFallback
    140140    {
    141         static bool convert(ToType* output, const FromType& input)
     141        FORCEINLINE static bool convert(ToType* output, const FromType& input)
    142142        {
    143143            COUT(2) << "Could not convert value of type " << typeid(FromType).name()
     
    151151    struct ConverterFallback<FromType*, ToType*>
    152152    {
    153         static bool convert(ToType** output, FromType* const input)
     153        FORCEINLINE static bool convert(ToType** output, FromType* const input)
    154154        {
    155155            ToType* temp = dynamic_cast<ToType*>(input);
     
    174174struct ConverterStringStream
    175175{
    176     static bool convert(ToType* output, const FromType& input)
     176    FORCEINLINE static bool convert(ToType* output, const FromType& input)
    177177    {
    178178        return orxonox::ConverterFallback<FromType, ToType>::convert(output, input);
     
    188188{
    189189    template <class FromType>
    190     inline bool operator <<(std::ostream& outstream,  const FromType& input)
     190    FORCEINLINE bool operator <<(std::ostream& outstream,  const FromType& input)
    191191    {
    192192        std::string temp;
     
    205205struct ConverterStringStream<FromType, std::string>
    206206{
    207     static bool convert(std::string* output, const FromType& input)
     207    FORCEINLINE static bool convert(std::string* output, const FromType& input)
    208208    {
    209209        using namespace fallbackTemplates;
     
    228228{
    229229    template <class ToType>
    230     inline bool operator >>(std::istream& instream, ToType& output)
     230    FORCEINLINE bool operator >>(std::istream& instream, ToType& output)
    231231    {
    232232        return orxonox::ConverterFallback<std::string, ToType>
     
    239239struct ConverterStringStream<std::string, ToType>
    240240{
    241     static bool convert(ToType* output, const std::string& input)
     241    FORCEINLINE static bool convert(ToType* output, const std::string& input)
    242242    {
    243243        using namespace fallbackTemplates;
     
    262262    // implicit cast not possible, try stringstream conversion next
    263263    template <class FromType, class ToType>
    264     inline bool convertImplicitely(ToType* output, const FromType& input, orxonox::Int2Type<false>)
     264    FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, orxonox::Int2Type<false>)
    265265    {
    266266        return ConverterStringStream<FromType, ToType>::convert(output, input);
     
    269269    // We can cast implicitely
    270270    template <class FromType, class ToType>
    271     inline bool convertImplicitely(ToType* output, const FromType& input, orxonox::Int2Type<true>)
     271    FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, orxonox::Int2Type<true>)
    272272    {
    273273        (*output) = static_cast<ToType>(input);
     
    284284    struct ConverterExplicit
    285285    {
    286         static bool convert(ToType* output, const FromType& input)
     286        FORCEINLINE static bool convert(ToType* output, const FromType& input)
    287287        {
    288288            // Try implict cast and probe first. If a simple cast is not possible, it will not compile
     
    306306    */
    307307    template <class FromType, class ToType>
    308     inline bool convertValue(ToType* output, const FromType& input)
     308    FORCEINLINE bool convertValue(ToType* output, const FromType& input)
    309309    {
    310310        return ConverterExplicit<FromType, ToType>::convert(output, input);
     
    313313    // For compatibility reasons. The same, but with capital ConvertValue
    314314    template<class FromType, class ToType>
    315     inline bool ConvertValue(ToType* output, const FromType& input)
     315    FORCEINLINE bool ConvertValue(ToType* output, const FromType& input)
    316316    {
    317317        return convertValue(output, input);
     
    331331    */
    332332    template<class FromType, class ToType>
    333     inline bool convertValue(ToType* output, const FromType& input, const ToType& fallback)
     333    FORCEINLINE bool convertValue(ToType* output, const FromType& input, const ToType& fallback)
    334334    {
    335335        if (convertValue(output, input))
     
    344344    // for compatibility reason. (capital 'c' in ConvertValue)
    345345    template<class FromType, class ToType>
    346     inline bool ConvertValue(ToType* output, const FromType& input, const ToType& fallback)
     346    FORCEINLINE bool ConvertValue(ToType* output, const FromType& input, const ToType& fallback)
    347347    {
    348348        return convertValue(output, input, fallback);
     
    351351    // Directly returns the converted value, even if the conversion was not successful.
    352352    template<class FromType, class ToType>
    353     inline ToType getConvertedValue(const FromType& input)
     353    FORCEINLINE ToType getConvertedValue(const FromType& input)
    354354    {
    355355        ToType output;
     
    360360    // Directly returns the converted value, but uses the fallback on failure.
    361361    template<class FromType, class ToType>
    362     inline ToType getConvertedValue(const FromType& input, const ToType& fallback)
     362    FORCEINLINE ToType getConvertedValue(const FromType& input, const ToType& fallback)
    363363    {
    364364        ToType output;
     
    370370    // That means you can call it exactly like static_cast<ToType>(fromTypeValue).
    371371    template<class ToType, class FromType>
    372     inline ToType multi_cast(const FromType& input)
     372    FORCEINLINE ToType multi_cast(const FromType& input)
    373373    {
    374374        ToType output;
     
    379379    // convert to string Shortcut
    380380    template <class FromType>
    381     inline std::string convertToString(FromType value)
     381    FORCEINLINE std::string convertToString(FromType value)
    382382    {
    383383      return getConvertedValue<FromType, std::string>(value);
     
    386386    // convert from string Shortcut
    387387    template <class ToType>
    388     inline ToType convertFromString(std::string str)
     388    FORCEINLINE ToType convertFromString(std::string str)
    389389    {
    390390      return getConvertedValue<std::string, ToType>(str);
     
    399399    struct ConverterExplicit<const char*, ToType>
    400400    {
    401         static bool convert(ToType* output, const char* input)
     401        FORCEINLINE static bool convert(ToType* output, const char* input)
    402402        {
    403403            return convertValue<std::string, ToType>(output, input);
     
    409409    struct ConverterExplicit<char, std::string>
    410410    {
    411         static bool convert(std::string* output, const char input)
     411        FORCEINLINE static bool convert(std::string* output, const char input)
    412412        {
    413413            *output = std::string(1, input);
     
    418418    struct ConverterExplicit<unsigned char, std::string>
    419419    {
    420         static bool convert(std::string* output, const unsigned char input)
     420        FORCEINLINE static bool convert(std::string* output, const unsigned char input)
    421421        {
    422422            *output = std::string(1, input);
     
    427427    struct ConverterExplicit<std::string, char>
    428428    {
    429         static bool convert(char* output, const std::string input)
     429        FORCEINLINE static bool convert(char* output, const std::string input)
    430430        {
    431431            if (input != "")
     
    439439    struct ConverterExplicit<std::string, unsigned char>
    440440    {
    441         static bool convert(unsigned char* output, const std::string input)
     441        FORCEINLINE static bool convert(unsigned char* output, const std::string input)
    442442        {
    443443            if (input != "")
     
    454454    struct ConverterExplicit<bool, std::string>
    455455    {
    456         static bool convert(std::string* output, const bool& input)
     456        FORCEINLINE static bool convert(std::string* output, const bool& input)
    457457        {
    458458            if (input)
  • code/branches/pch/src/util/MathConvert.h

    r2171 r3145  
    5050    struct ConverterExplicit<orxonox::Vector2, std::string>
    5151    {
    52         static bool convert(std::string* output, const orxonox::Vector2& input)
     52        FORCEINLINE static bool convert(std::string* output, const orxonox::Vector2& input)
    5353        {
    5454            std::ostringstream ostream;
     
    6666    struct ConverterExplicit<orxonox::Vector3, std::string>
    6767    {
    68         static bool convert(std::string* output, const orxonox::Vector3& input)
     68        FORCEINLINE static bool convert(std::string* output, const orxonox::Vector3& input)
    6969        {
    7070            std::ostringstream ostream;
     
    8282    struct ConverterExplicit<orxonox::Vector4, std::string>
    8383    {
    84         static bool convert(std::string* output, const orxonox::Vector4& input)
     84        FORCEINLINE static bool convert(std::string* output, const orxonox::Vector4& input)
    8585        {
    8686            std::ostringstream ostream;
     
    9898    struct ConverterExplicit<orxonox::Quaternion, std::string>
    9999    {
    100         static bool convert(std::string* output, const orxonox::Quaternion& input)
     100        FORCEINLINE static bool convert(std::string* output, const orxonox::Quaternion& input)
    101101        {
    102102            std::ostringstream ostream;
     
    114114    struct ConverterExplicit<orxonox::ColourValue, std::string>
    115115    {
    116         static bool convert(std::string* output, const orxonox::ColourValue& input)
     116        FORCEINLINE static bool convert(std::string* output, const orxonox::ColourValue& input)
    117117        {
    118118            std::ostringstream ostream;
     
    156156    struct ConverterFallback<orxonox::Radian, ToType>
    157157    {
    158         static bool convert(ToType* output, const orxonox::Radian& input)
     158        FORCEINLINE static bool convert(ToType* output, const orxonox::Radian& input)
    159159        {
    160160            return convertValue<Ogre::Real, ToType>(output, input.valueRadians());
     
    166166    struct ConverterFallback<orxonox::Degree, ToType>
    167167    {
    168         static bool convert(ToType* output, const orxonox::Degree& input)
     168        FORCEINLINE static bool convert(ToType* output, const orxonox::Degree& input)
    169169        {
    170170            return convertValue<Ogre::Real, ToType>(output, input.valueDegrees());
     
    176176    struct ConverterFallback<FromType, orxonox::Radian>
    177177    {
    178         static bool convert(orxonox::Radian* output, const FromType& input)
     178        FORCEINLINE static bool convert(orxonox::Radian* output, const FromType& input)
    179179        {
    180180            float temp;
     
    193193    struct ConverterFallback<FromType, orxonox::Degree>
    194194    {
    195         static bool convert(orxonox::Degree* output, const FromType& input)
     195        FORCEINLINE static bool convert(orxonox::Degree* output, const FromType& input)
    196196        {
    197197            float temp;
Note: See TracChangeset for help on using the changeset viewer.