NvParamUtils.h
00001 // This code contains NVIDIA Confidential Information and is disclosed to you 00002 // under a form of NVIDIA software license agreement provided separately to you. 00003 // 00004 // Notice 00005 // NVIDIA Corporation and its licensors retain all intellectual property and 00006 // proprietary rights in and to this software and related documentation and 00007 // any modifications thereto. Any use, reproduction, disclosure, or 00008 // distribution of this software and related documentation without an express 00009 // license agreement from NVIDIA Corporation is strictly prohibited. 00010 // 00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES 00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO 00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, 00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. 00015 // 00016 // Information and code furnished is believed to be accurate and reliable. 00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such 00018 // information or for any infringement of patents or other rights of third parties that may 00019 // result from its use. No license is granted by implication or otherwise under any patent 00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice. 00021 // This code supersedes and replaces all information previously supplied. 00022 // NVIDIA Corporation products are not authorized for use as critical 00023 // components in life support devices or systems without express written approval of 00024 // NVIDIA Corporation. 00025 // 00026 // Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. 00027 00028 #ifndef NV_PARAM_UTILS_H 00029 #define NV_PARAM_UTILS_H 00030 00031 #include "NvParameterized.h" 00032 00033 // utility methods to operate on NvParameterized data. 00034 00035 namespace NvParameterized 00036 { 00037 00053 PX_INLINE const Interface * findParam(const Interface &i,const char *longName, Handle &outHandle); 00054 00055 00071 PX_INLINE Interface * findParam(Interface &i,const char *longName, Handle &outHandle); 00072 00076 struct ParamResult 00077 { 00078 public: 00082 ParamResult(const char *name, 00083 const char *longName, 00084 const char *className, 00085 const char *instanceName, 00086 const Handle &handle, 00087 int32_t arraySize, 00088 DataType type) 00089 : mArraySize(arraySize), 00090 mInstanceName(instanceName), 00091 mClassName(className), 00092 mName(name), 00093 mLongName(longName), 00094 mHandle(handle), 00095 mDataType(type) 00096 {} 00097 00101 int32_t mArraySize; 00102 00106 const char *mInstanceName; 00107 00111 const char *mClassName; 00112 00116 const char *mName; 00117 00121 const char *mLongName; 00122 00126 Handle mHandle; 00127 00131 DataType mDataType; 00132 }; 00133 00148 PX_INLINE const ParamResult * getParamList(const Interface &i, 00149 const char *className, // name of class to match 00150 const char *paramName, // name of parameter to match 00151 uint32_t &count, 00152 bool recursive, 00153 bool classesOnly, 00154 NvParameterized::Traits *traits); 00155 00157 PX_INLINE void releaseParamList(uint32_t resultCount,const ParamResult *results,NvParameterized::Traits *traits); 00158 00160 PX_INLINE bool getParamArraySize(const Interface &pm, const char *name, int32_t &arraySize); 00161 00163 PX_INLINE bool resizeParamArray(Interface &pm, const char *name, int32_t newSize); 00164 00168 class NamedReferenceInterface 00169 { 00170 public: 00174 virtual ~NamedReferenceInterface() {} 00182 virtual const char * namedReferenceCallback(const char *className,const char *namedReference,Handle &handle) = 0; 00183 }; 00184 00186 PX_INLINE uint32_t getNamedReferences(const Interface &i, 00187 NamedReferenceInterface &namedReference, 00188 bool recursive); 00189 00193 class ReferenceInterface 00194 { 00195 public: 00199 virtual ~ReferenceInterface() {} 00205 virtual void referenceCallback(Handle &handle) = 0; 00206 }; 00207 00209 PX_INLINE void getReferences(const Interface &iface, 00210 ReferenceInterface &cb, 00211 bool named, 00212 bool included, 00213 bool recursive); 00214 00216 PX_INLINE bool getParamBool(const Interface &pm, const char *name, bool &val); 00218 PX_INLINE bool setParamBool(Interface &pm, const char *name, bool val) ; 00219 00221 PX_INLINE bool getParamString(const Interface &pm, const char *name, const char *&val); 00223 PX_INLINE bool setParamString(Interface &pm, const char *name, const char *val) ; 00224 00226 PX_INLINE bool getParamEnum(const Interface &pm, const char *name, const char *&val); 00228 PX_INLINE bool setParamEnum(Interface &pm, const char *name, const char *val) ; 00229 00231 PX_INLINE bool getParamRef(const Interface &pm, const char *name, NvParameterized::Interface *&val); 00233 PX_INLINE bool setParamRef(Interface &pm, const char *name, NvParameterized::Interface *val, bool doDestroyOld = false) ; 00234 00236 PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, bool doDestroyOld = false); 00238 PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, const char *objName, bool doDestroyOld = false); 00239 00241 PX_INLINE bool getParamI8(const Interface &pm, const char *name, int8_t &val); 00243 PX_INLINE bool setParamI8(Interface &pm, const char *name, int8_t val) ; 00244 00246 PX_INLINE bool getParamI16(const Interface &pm, const char *name, int16_t &val); 00248 PX_INLINE bool setParamI16(Interface &pm, const char *name, int16_t val) ; 00249 00251 PX_INLINE bool getParamI32(const Interface &pm, const char *name, int32_t &val); 00253 PX_INLINE bool setParamI32(Interface &pm, const char *name, int32_t val) ; 00254 00256 PX_INLINE bool getParamI64(const Interface &pm, const char *name, int64_t &val); 00258 PX_INLINE bool setParamI64(Interface &pm, const char *name, int64_t val) ; 00259 00261 PX_INLINE bool getParamU8(const Interface &pm, const char *name, uint8_t &val); 00263 PX_INLINE bool setParamU8(Interface &pm, const char *name, uint8_t val) ; 00264 00266 PX_INLINE bool getParamU16(const Interface &pm, const char *name, uint16_t &val); 00268 PX_INLINE bool setParamU16(Interface &pm, const char *name, uint16_t val) ; 00269 00271 PX_INLINE bool getParamU32(const Interface &pm, const char *name, uint32_t &val); 00273 PX_INLINE bool setParamU32(Interface &pm, const char *name, uint32_t val) ; 00274 00276 PX_INLINE bool getParamU64(const Interface &pm, const char *name, uint64_t &val); 00278 PX_INLINE bool setParamU64(Interface &pm, const char *name, uint64_t val) ; 00279 00281 PX_INLINE bool getParamF32(const Interface &pm, const char *name, float &val); 00283 PX_INLINE bool setParamF32(Interface &pm, const char *name, float val) ; 00284 00286 PX_INLINE bool getParamF64(const Interface &pm, const char *name, double &val); 00288 PX_INLINE bool setParamF64(Interface &pm, const char *name, double val) ; 00289 00291 PX_INLINE bool getParamVec2(const Interface &pm, const char *name, physx::PxVec2 &val); 00293 PX_INLINE bool setParamVec2(Interface &pm, const char *name, const physx::PxVec2 &val) ; 00294 00296 PX_INLINE bool getParamVec3(const Interface &pm, const char *name, physx::PxVec3 &val); 00298 PX_INLINE bool setParamVec3(Interface &pm, const char *name, const physx::PxVec3 &val) ; 00299 00301 PX_INLINE bool getParamVec4(const Interface &pm, const char *name, physx::PxVec4 &val); 00303 PX_INLINE bool setParamVec4(Interface &pm, const char *name, const physx::PxVec4 &val) ; 00304 00306 PX_INLINE bool getParamQuat(const Interface &pm, const char *name, physx::PxQuat &val); 00308 PX_INLINE bool setParamQuat(Interface &pm, const char *name, const physx::PxQuat &val) ; 00309 00311 PX_INLINE bool getParamMat33(const Interface &pm, const char *name, physx::PxMat33 &val); 00313 PX_INLINE bool setParamMat33(Interface &pm, const char *name, const physx::PxMat33 &val) ; 00314 00316 PX_INLINE bool getParamMat44(const Interface &pm, const char *name, physx::PxMat44 &val); 00318 PX_INLINE bool setParamMat44(Interface &pm, const char *name, const physx::PxMat44 &val) ; 00319 00321 PX_INLINE bool getParamBounds3(const Interface &pm, const char *name, physx::PxBounds3 &val); 00323 PX_INLINE bool setParamBounds3(Interface &pm, const char *name, const physx::PxBounds3 &val) ; 00324 00326 PX_INLINE bool getParamTransform(const Interface &pm, const char *name, physx::PxTransform &val); 00328 PX_INLINE bool setParamTransform(Interface &pm, const char *name, const physx::PxTransform &val) ; 00329 00330 } // namespace NvParameterized 00331 00332 00333 #include "NvParamUtils.inl" 00334 00335 #endif // NV_PARAM_UTILS_H
Generated on Fri Dec 15 2017 13:58:35 Copyright © 2012-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.