- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# FUtils/FUParameter.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005-2007 Feeling Software Inc.
    00003     Portions of the code are:
    00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
    00005
    00006     MIT License: http://www.opensource.org/licenses/mit-license.php
    00007 */
    00008
    00009 #ifndef _FU_PARAMETER_H_
    00010 #define _FU_PARAMETER_H_
    00011
    00019 #ifdef WIN32
    00020 #pragma warning(disable:4355) // 'this' : used in base member initializer list.
    00021 #endif // WIN32
    00022
    00024 namespace FUParameterQualifiers
    00025 {
    00027     enum Qualifiers
    00028     {
    00029         SIMPLE = 0,
    00030         VECTOR = 0,
    00031         COLOR = 1
    00032     };
    00033 };
    00034
    00035
    00047 template <class TYPE>
    00048 class FUParameterT
    00049 {
    00050 private:
    00051     TYPE value;
    00052
    00053 public:
    00055     FUParameterT() {}
    00057     FUParameterT(const TYPE& defaultValue) : value(defaultValue) {}
    00059     virtual ~FUParameterT() {}
    00061     inline operator TYPE&() { return value; }
    00062     inline operator const TYPE&() const { return value; }
    00063     inline TYPE& operator *() { return value; }
    00064     inline const TYPE& operator *() const { return value; }
    00065     inline TYPE* operator->() { return &value; }
    00066     inline const TYPE* operator->() const { return &value; }
    00068     FUParameterT<TYPE>& operator= (const TYPE& copy) { value = copy; return *this; }
    00069 };
    00070
    00071 typedef FUParameterT<bool> FUParameterBoolean;
    00072 typedef FUParameterT<float> FUParameterFloat;
    00073 typedef FUParameterT<FMVector2> FUParameterVector2;
    00074 typedef FUParameterT<FMVector3> FUParameterVector3;
    00075 typedef FUParameterT<FMVector3> FUParameterColor3;
    00076 typedef FUParameterT<FMVector4> FUParameterVector4;
    00077 typedef FUParameterT<FMVector4> FUParameterColor4;
    00078 typedef FUParameterT<FMMatrix44> FUParameterMatrix44;
    00079 typedef FUParameterT<int32> FUParameterInt32;
    00080 typedef FUParameterT<uint32> FUParameterUInt32;
    00081 typedef FUParameterT<fm::string> FUParameterString;
    00082 typedef FUParameterT<fstring> FUParameterFString;
    00084 typedef fm::vector<float, true> FUParameterFloatList;
    00085 typedef fm::vector<FMVector2, true> FUParameterVector2List;
    00086 typedef fm::vector<FMVector3, true> FUParameterVector3List;
    00087 typedef fm::vector<FMVector3, true> FUParameterColor3List;
    00088 typedef fm::vector<FMVector4, true> FUParameterVector4List;
    00089 typedef fm::vector<FMVector4, true> FUParameterColor4List;
    00090 typedef fm::vector<FMMatrix44, true> FUParameterMatrix44List;
    00091 typedef fm::vector<int32, true> FUParameterInt32List;
    00092 typedef fm::vector<uint32, true> FUParameterUInt32List;
    00093 typedef fm::vector<fm::string, false> FUParameterStringList;
    00094 typedef fm::vector<fstring, false> FUParameterFStringList;
    00111 #define DeclareParameter(type, qual, parameterName, niceName) \
    00112     class Parameter_##parameterName : public FUParameterT<type> { \
    00113     public: Parameter_##parameterName() : FUParameterT<type>() {} \
    00114     Parameter_##parameterName(const type& defaultValue) : FUParameterT<type>(defaultValue) {} \
    00115     virtual ~Parameter_##parameterName() {} \
    00116     inline Parameter_##parameterName& operator= (const type& copy) { FUParameterT<type>::operator=(copy); return *this; } \
    00117     } parameterName;
    00118
    00120 #define DeclareParameterPtr(type, parameterName, niceName) FUTrackedPtr<type> parameterName;
    00121
    00122 #define DeclareParameterRef(type, parameterName, niceName) FUObjectRef<type> parameterName;
    00123
    00124 #define DeclareParameterList(list_type, parameterName, niceName) FUParameter##list_type##List parameterName;
    00125
    00126 #define DeclareParameterTrackList(type, parameterName, niceName) FUTrackedList<type> parameterName;
    00127
    00128 #define DeclareParameterContainer(type, parameterName, niceName) FUObjectContainer<type> parameterName;
    00129
    00145 #define ImplementParameterObject(objectClassName, parameterClassName, parameterName, ...)
    00146
    00147 #define ImplementParameterObjectNoArg(objectClassName, parameterClassName, parameterName)
    00148
    00149 #define ImplementParameterObjectNoCtr(objectClassName, parameterClassName, parameterName)
    00150
    00151 #define ImplementParameterObjectT(objectClassName, parameterClassName, parameterName, ...)
    00152
    00153 #define ImplementParameterObjectNoArgT(objectClassName, parameterClassName, parameterName)
    00154
    00155 #define ImplementParameterObjectNoCtrT(objectClassName, parameterClassName, parameterName)
    00156
    00166 #define InitializeParameterNoArg(parameterName) parameterName()
    00167
    00168 #define InitializeParameter(parameterName, ...) parameterName(__VA_ARGS__)
    00169
    00170 #if defined(__APPLE__) || defined(LINUX)
    00171 #include "FUtils/FUParameter.hpp"
    00172 #endif // __APPLE__
    00173
    00174 #endif // _FCD_PARAMETER_H
    00175