NxParamUtils.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-2014 NVIDIA Corporation. All rights reserved.
00027 
00028 #ifndef NX_PARAM_UTILS_H
00029 #define NX_PARAM_UTILS_H
00030 
00031 #include "NxParameterized.h"
00032 
00033 // utility methods to operate on NxParameterized data.
00034 
00035 namespace NxParameterized
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                 physx::PxI32 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     physx::PxI32 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                                  physx::PxU32 &count,
00152                                  bool recursive,
00153                                  bool classesOnly,
00154                                  NxParameterized::Traits *traits);
00155 
00157 PX_INLINE void              releaseParamList(physx::PxU32 resultCount,const ParamResult *results,NxParameterized::Traits *traits);
00158 
00160 PX_INLINE bool getParamArraySize(const Interface &pm, const char *name, physx::PxI32 &arraySize);
00161 
00163 PX_INLINE bool resizeParamArray(Interface &pm, const char *name, physx::PxI32 newSize);
00164 
00168 class NamedReferenceInterface
00169 {
00170 public:
00178     virtual const char * namedReferenceCallback(const char *className,const char *namedReference,Handle &handle) = 0;
00179 };
00180 
00182 PX_INLINE physx::PxU32 getNamedReferences(const Interface &i,
00183                                           NamedReferenceInterface &namedReference,
00184                                           bool recursive);
00185 
00189 class ReferenceInterface
00190 {
00191 public:
00197     virtual void referenceCallback(Handle &handle) = 0;
00198 };
00199 
00201 PX_INLINE void getReferences(const Interface &iface,
00202                                           ReferenceInterface &cb,
00203                                           bool named,
00204                                           bool included,
00205                                           bool recursive);
00206 
00208 PX_INLINE bool getParamBool(const Interface &pm, const char *name, bool &val);
00210 PX_INLINE bool setParamBool(Interface &pm, const char *name, bool val) ;
00211 
00213 PX_INLINE bool getParamString(const Interface &pm, const char *name, const char *&val);
00215 PX_INLINE bool setParamString(Interface &pm, const char *name, const char *val) ;
00216 
00218 PX_INLINE bool getParamEnum(const Interface &pm, const char *name, const char *&val);
00220 PX_INLINE bool setParamEnum(Interface &pm, const char *name, const char *val) ;
00221 
00223 PX_INLINE bool getParamRef(const Interface &pm, const char *name, NxParameterized::Interface *&val);
00225 PX_INLINE bool setParamRef(Interface &pm, const char *name, NxParameterized::Interface *val, bool doDestroyOld = false) ;
00226 
00228 PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, bool doDestroyOld = false);
00230 PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, const char *objName, bool doDestroyOld = false);
00231 
00233 PX_INLINE bool getParamI8(const Interface &pm, const char *name, physx::PxI8 &val);
00235 PX_INLINE bool setParamI8(Interface &pm, const char *name, physx::PxI8 val) ;
00236 
00238 PX_INLINE bool getParamI16(const Interface &pm, const char *name, physx::PxI16 &val);
00240 PX_INLINE bool setParamI16(Interface &pm, const char *name, physx::PxI16 val) ;
00241 
00243 PX_INLINE bool getParamI32(const Interface &pm, const char *name, physx::PxI32 &val);
00245 PX_INLINE bool setParamI32(Interface &pm, const char *name, physx::PxI32 val) ;
00246 
00248 PX_INLINE bool getParamI64(const Interface &pm, const char *name, physx::PxI64 &val);
00250 PX_INLINE bool setParamI64(Interface &pm, const char *name, physx::PxI64 val) ;
00251 
00253 PX_INLINE bool getParamU8(const Interface &pm, const char *name, physx::PxU8 &val);
00255 PX_INLINE bool setParamU8(Interface &pm, const char *name, physx::PxU8 val) ;
00256 
00258 PX_INLINE bool getParamU16(const Interface &pm, const char *name, physx::PxU16 &val);
00260 PX_INLINE bool setParamU16(Interface &pm, const char *name, physx::PxU16 val) ;
00261 
00263 PX_INLINE bool getParamU32(const Interface &pm, const char *name, physx::PxU32 &val);
00265 PX_INLINE bool setParamU32(Interface &pm, const char *name, physx::PxU32 val) ;
00266 
00268 PX_INLINE bool getParamU64(const Interface &pm, const char *name, physx::PxU64 &val);
00270 PX_INLINE bool setParamU64(Interface &pm, const char *name, physx::PxU64 val) ;
00271 
00273 PX_INLINE bool getParamF32(const Interface &pm, const char *name, physx::PxF32 &val);
00275 PX_INLINE bool setParamF32(Interface &pm, const char *name, physx::PxF32 val) ;
00276 
00278 PX_INLINE bool getParamF64(const Interface &pm, const char *name, physx::PxF64 &val);
00280 PX_INLINE bool setParamF64(Interface &pm, const char *name, physx::PxF64 val) ;
00281 
00283 PX_INLINE bool getParamVec2(const Interface &pm, const char *name, physx::PxVec2 &val);
00285 PX_INLINE bool setParamVec2(Interface &pm, const char *name, const physx::PxVec2 &val) ;
00286 
00288 PX_INLINE bool getParamVec3(const Interface &pm, const char *name, physx::PxVec3 &val);
00290 PX_INLINE bool setParamVec3(Interface &pm, const char *name, const physx::PxVec3 &val) ;
00291 
00293 PX_INLINE bool getParamVec4(const Interface &pm, const char *name, physx::PxVec4 &val);
00295 PX_INLINE bool setParamVec4(Interface &pm, const char *name, const physx::PxVec4 &val) ;
00296 
00298 PX_INLINE bool getParamQuat(const Interface &pm, const char *name, physx::PxQuat &val);
00300 PX_INLINE bool setParamQuat(Interface &pm, const char *name, const physx::PxQuat &val) ;
00301 
00303 PX_INLINE bool getParamMat33(const Interface &pm, const char *name, physx::PxMat33 &val);
00305 PX_INLINE bool setParamMat33(Interface &pm, const char *name, const physx::PxMat33 &val) ;
00306 
00308 PX_INLINE bool getParamMat34(const Interface &pm, const char *name, physx::PxMat44 &val);
00310 PX_INLINE bool setParamMat34(Interface &pm, const char *name, const physx::PxMat44 &val) ;
00311 
00313 PX_INLINE bool getParamMat44(const Interface &pm, const char *name, physx::PxMat44 &val);
00315 PX_INLINE bool setParamMat44(Interface &pm, const char *name, const physx::PxMat44 &val) ;
00316 
00318 PX_INLINE bool getParamBounds3(const Interface &pm, const char *name, physx::PxBounds3 &val);
00320 PX_INLINE bool setParamBounds3(Interface &pm, const char *name, const physx::PxBounds3 &val) ;
00321 
00323 PX_INLINE bool getParamTransform(const Interface &pm, const char *name, physx::PxTransform &val);
00325 PX_INLINE bool setParamTransform(Interface &pm, const char *name, const physx::PxTransform &val) ;
00326 
00327 } // namespace NxParameterized
00328 
00329 
00330 #include "NxParamUtils.inl"
00331 
00332 #endif // NX_PARAM_UTILS_H

Generated on Mon Apr 28 2014 08:01:35

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