NvParamUtils.h
00001 //
00002 // Redistribution and use in source and binary forms, with or without
00003 // modification, are permitted provided that the following conditions
00004 // are met:
00005 //  * Redistributions of source code must retain the above copyright
00006 //    notice, this list of conditions and the following disclaimer.
00007 //  * Redistributions in binary form must reproduce the above copyright
00008 //    notice, this list of conditions and the following disclaimer in the
00009 //    documentation and/or other materials provided with the distribution.
00010 //  * Neither the name of NVIDIA CORPORATION nor the names of its
00011 //    contributors may be used to endorse or promote products derived
00012 //    from this software without specific prior written permission.
00013 //
00014 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
00015 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017 // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00018 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 //
00026 // Copyright (c) 2008-2018 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 Sat Dec 1 2018 15:52:05

Copyright © 2012-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.