attributeid.cc
Go to the documentation of this file.00001 //------------------------------------------------------------------------------ 00002 // 00003 // attr/attributeid.cc 00004 // (C) 2005 Radon Labs GmbH 00005 // 00006 //------------------------------------------------------------------------------ 00007 #include "attr/attributeid.h" 00008 00009 #include "attr/voidattributeid.h" 00010 #include "attr/boolattributeid.h" 00011 #include "attr/intattributeid.h" 00012 #include "attr/floatattributeid.h" 00013 #include "attr/stringattributeid.h" 00014 #include "attr/vector3attributeid.h" 00015 #include "attr/vector4attributeid.h" 00016 #include "attr/matrix44attributeid.h" 00017 00018 namespace Attr 00019 { 00020 00021 using namespace attr; 00022 00023 //------------------------------------------------------------------------------ 00027 AttributeID 00028 AttributeID::FindAttributeID( const nString& name ) 00029 { 00030 AttributeID attributeID; 00031 00032 attributeID = _attridTyped<VoidT>::Find( name ); 00033 if ( attributeID.IsValid() ) return attributeID; 00034 00035 attributeID = _attridTyped<BoolT>::Find( name ); 00036 if ( attributeID.IsValid() ) return attributeID; 00037 00038 attributeID = _attridTyped<IntT>::Find( name ); 00039 if ( attributeID.IsValid() ) return attributeID; 00040 00041 attributeID = _attridTyped<FloatT>::Find( name ); 00042 if ( attributeID.IsValid() ) return attributeID; 00043 00044 attributeID = _attridTyped<StringT>::Find( name ); 00045 if ( attributeID.IsValid() ) return attributeID; 00046 00047 attributeID = _attridTyped<Vector3T>::Find( name ); 00048 if ( attributeID.IsValid() ) return attributeID; 00049 00050 attributeID = _attridTyped<Vector4T>::Find( name ); 00051 if ( attributeID.IsValid() ) return attributeID; 00052 00053 attributeID = _attridTyped<Matrix44T>::Find( name ); 00054 if ( attributeID.IsValid() ) return attributeID; 00055 00056 // not found, return the invalid attributeID 00057 return attributeID; 00058 } 00059 00060 //------------------------------------------------------------------------------ 00065 VoidAttributeID 00066 VoidAttributeID::FindVoidAttributeID( const nString& name ) 00067 { 00068 VoidAttributeID attributeID; 00069 00070 attributeID = _attridTyped<VoidT>::Find( name ); 00071 return attributeID; 00072 } 00073 00074 //------------------------------------------------------------------------------ 00079 BoolAttributeID 00080 BoolAttributeID::FindBoolAttributeID( const nString& name ) 00081 { 00082 BoolAttributeID attributeID; 00083 00084 attributeID = _attridTyped<BoolT>::Find( name ); 00085 return attributeID; 00086 } 00087 00088 //------------------------------------------------------------------------------ 00093 IntAttributeID 00094 IntAttributeID::FindIntAttributeID( const nString& name ) 00095 { 00096 IntAttributeID attributeID; 00097 00098 attributeID = _attridTyped<IntT>::Find( name ); 00099 return attributeID; 00100 } 00101 00102 //------------------------------------------------------------------------------ 00107 FloatAttributeID 00108 FloatAttributeID::FindFloatAttributeID( const nString& name ) 00109 { 00110 FloatAttributeID attributeID; 00111 00112 attributeID = _attridTyped<FloatT>::Find( name ); 00113 return attributeID; 00114 } 00115 00116 //------------------------------------------------------------------------------ 00121 StringAttributeID 00122 StringAttributeID::FindStringAttributeID( const nString& name ) 00123 { 00124 StringAttributeID attributeID; 00125 00126 attributeID = _attridTyped<StringT>::Find( name ); 00127 return attributeID; 00128 } 00129 00130 //------------------------------------------------------------------------------ 00135 Vector3AttributeID 00136 Vector3AttributeID::FindVector3AttributeID( const nString& name ) 00137 { 00138 Vector3AttributeID attributeID; 00139 00140 attributeID = _attridTyped<Vector3T>::Find( name ); 00141 return attributeID; 00142 } 00143 00144 //------------------------------------------------------------------------------ 00149 Vector4AttributeID 00150 Vector4AttributeID::FindVector4AttributeID( const nString& name ) 00151 { 00152 Vector4AttributeID attributeID; 00153 00154 attributeID = _attridTyped<Vector4T>::Find( name ); 00155 return attributeID; 00156 } 00157 00158 //------------------------------------------------------------------------------ 00163 Matrix44AttributeID 00164 Matrix44AttributeID::FindMatrix44AttributeID( const nString& name ) 00165 { 00166 Matrix44AttributeID attributeID; 00167 00168 attributeID = _attridTyped<Matrix44T>::Find( name ); 00169 return attributeID; 00170 } 00171 00172 } // namespace 00173 00174 #if 0 00175 00176 //------------------------------------------------------------------------------ 00180 AttributeID 00181 attr::FindAttributeID(const nString& name) 00182 { 00183 AttributeID attributeID; 00184 00185 attributeID = _attridTyped<VoidT>::Find(name); 00186 if (0 != attributeID) return attributeID; 00187 00188 attributeID = _attridTyped<BoolT>::Find(name); 00189 if (0 != attributeID) return attributeID; 00190 00191 attributeID = _attridTyped<IntT>::Find(name); 00192 if (0 != attributeID) return attributeID; 00193 00194 attributeID = _attridTyped<FloatT>::Find(name); 00195 if (0 != attributeID) return attributeID; 00196 00197 attributeID = _attridTyped<StringT>::Find(name); 00198 if (0 != attributeID) return attributeID; 00199 00200 attributeID = _attridTyped<Vector3T>::Find(name); 00201 if (0 != attributeID) return attributeID; 00202 00203 attributeID = _attridTyped<Vector4T>::Find(name); 00204 if (0 != attributeID) return attributeID; 00205 00206 attributeID = _attridTyped<Matrix44T>::Find(name); 00207 if (0 != attributeID) return attributeID; 00208 00209 // not found, let caller decide if this is an error 00210 return 0; 00211 } 00212 00213 //------------------------------------------------------------------------------ 00218 VoidAttributeID 00219 attr::FindVoidAttributeID(const nString& name) 00220 { 00221 VoidAttributeID attributeID; 00222 00223 attributeID = _attridTyped<VoidT>::Find(name); 00224 return attributeID; 00225 } 00226 00227 //------------------------------------------------------------------------------ 00232 BoolAttributeID 00233 attr::FindBoolAttributeID(const nString& name) 00234 { 00235 BoolAttributeID attributeID; 00236 00237 attributeID = _attridTyped<BoolT>::Find(name); 00238 return attributeID; 00239 } 00240 00241 //------------------------------------------------------------------------------ 00246 IntAttributeID 00247 attr::FindIntAttributeID(const nString& name) 00248 { 00249 IntAttributeID attributeID; 00250 00251 attributeID = _attridTyped<IntT>::Find(name); 00252 return attributeID; 00253 } 00254 00255 //------------------------------------------------------------------------------ 00260 FloatAttributeID 00261 attr::FindFloatAttributeID(const nString& name) 00262 { 00263 FloatAttributeID attributeID; 00264 00265 attributeID = _attridTyped<FloatT>::Find(name); 00266 return attributeID; 00267 } 00268 00269 //------------------------------------------------------------------------------ 00274 StringAttributeID 00275 attr::FindStringAttributeID(const nString& name) 00276 { 00277 StringAttributeID attributeID; 00278 00279 attributeID = _attridTyped<StringT>::Find(name); 00280 return attributeID; 00281 } 00282 00283 //------------------------------------------------------------------------------ 00288 Vector3AttributeID 00289 attr::FindVector3AttributeID(const nString& name) 00290 { 00291 Vector3AttributeID attributeID; 00292 00293 attributeID = _attridTyped<Vector3T>::Find(name); 00294 return attributeID; 00295 } 00296 00297 //------------------------------------------------------------------------------ 00302 Vector4AttributeID 00303 attr::FindVector4AttributeID(const nString& name) 00304 { 00305 Vector4AttributeID attributeID; 00306 00307 attributeID = _attridTyped<Vector4T>::Find(name); 00308 return attributeID; 00309 } 00310 00311 //------------------------------------------------------------------------------ 00316 Matrix44AttributeID 00317 attr::FindMatrix44AttributeID(const nString& name) 00318 { 00319 Matrix44AttributeID attributeID; 00320 00321 attributeID = _attridTyped<Matrix44T>::Find(name); 00322 return attributeID; 00323 } 00324 00325 #endif 00326