APEX Framework: NvParameterized.h Source File

NVIDIA APEX

NvParameterized.h
Go to the documentation of this file.
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_PARAMETERIZED_H
00029 #define NV_PARAMETERIZED_H
00030 
00048 #include "foundation/PxVec2.h"
00049 #include "foundation/PxVec3.h"
00050 #include "foundation/PxVec4.h"
00051 #include "foundation/PxQuat.h"
00052 #include "foundation/PxBounds3.h"
00053 #include "foundation/PxMat44.h"
00054 #include <stdio.h>
00055 #include <stdarg.h>
00056 #include <new> // for placement new
00057 
00058 PX_PUSH_PACK_DEFAULT
00059 
00061 namespace NvParameterized
00062 {
00063 
00064 class Interface;
00065 class Traits;
00066 
00070 enum ErrorType
00071 {
00072    ERROR_NONE = 0,
00073    ERROR_TYPE_NOT_SUPPORTED,
00074    ERROR_INDEX_OUT_OF_RANGE,
00075    ERROR_INVALID_PARAMETER_NAME,
00076    ERROR_INVALID_PARAMETER_HANDLE,
00077    ERROR_CAST_FAILED,
00078    ERROR_INVALID_ENUM_VAL,
00079    ERROR_SYNTAX_ERROR_IN_NAME,
00080    ERROR_IS_LEAF_NODE,
00081    ERROR_RESULT_BUFFER_OVERFLOW,
00082    ERROR_NAME_DOES_NOT_MATCH_DEFINITION,
00083    ERROR_NOT_AN_ARRAY,
00084    ERROR_ARRAY_SIZE_IS_FIXED,
00085    ERROR_ARRAY_RESIZING_IS_NOT_SUPPORTED,
00086    ERROR_ARRAY_IS_TOO_SMALL,
00087    ERROR_INVALID_ARRAY_DIMENSION,
00088    ERROR_INVALID_ARRAY_SIZE,
00089    ERROR_PARAMETER_HANDLE_DOES_NOT_MATCH_CLASS,
00090    ERROR_MEMORY_ALLOCATION_FAILURE,
00091    ERROR_INVALID_REFERENCE_INCLUDE_HINT,
00092    ERROR_INVALID_REFERENCE_VALUE,
00093    ERROR_PARAMETER_HANDLE_NOT_INITIALIZED,
00094    ERROR_PARAMETER_DEFINITIONS_DO_NOT_MATCH,
00095    ERROR_HANDLE_MISSING_INTERFACE_POINTER,
00096    ERROR_HANDLE_INVALID_INTERFACE_POINTER,
00097    ERROR_INVALID_CALL_ON_NAMED_REFERENCE,
00098    ERROR_NOT_IMPLEMENTED,
00099    ERROR_OBJECT_CONSTRUCTION_FAILED,
00100    ERROR_MODIFY_CONST_HANDLE
00101 };
00102 
00107 enum DataType
00108 {
00109     TYPE_UNDEFINED = 0,
00110 
00115     TYPE_ARRAY = 1,
00116 
00117     TYPE_STRUCT = 2,
00118 
00119     TYPE_BOOL = 3,
00124     TYPE_STRING = 4,
00125 
00130     TYPE_ENUM = 5,
00131 
00143     TYPE_REF = 6,
00144 
00145     TYPE_I8 = 7,
00146     TYPE_I16 = 8,
00147     TYPE_I32 = 9,
00148     TYPE_I64 = 10,
00149 
00150     TYPE_U8 = 11,
00151     TYPE_U16 = 12,
00152     TYPE_U32 = 13,
00153     TYPE_U64 = 14,
00154 
00155     TYPE_F32 = 15,
00156     TYPE_F64 = 16,
00157 
00158     TYPE_VEC2 = 17,
00159     TYPE_VEC3 = 18,
00160     TYPE_VEC4 = 19,
00161     TYPE_QUAT = 20,
00162     TYPE_MAT33 = 21,
00163     TYPE_BOUNDS3 = 23,
00164     TYPE_MAT44 = 24,
00165 
00166     TYPE_POINTER = 25,
00167 
00168     TYPE_TRANSFORM = 26,
00169 
00170     TYPE_MAT34 = 27,
00171 
00172     TYPE_LAST
00173 };
00174 
00180 class Hint
00181 {
00182     public:
00183 
00187     virtual ~Hint() {}
00191     virtual const char *    name(void) const = 0;
00192 
00196     virtual DataType         type(void) const = 0;
00197 
00202     virtual    uint64_t             asUInt(void) const = 0;
00203     
00208     virtual double             asFloat(void) const = 0;
00209 
00214     virtual const char *    asString(void) const = 0;
00215 
00219     virtual bool setAsUInt(uint64_t v) = 0;
00220 
00221     private:
00222 };
00223 
00227 class Definition
00228 {
00229 public:
00230 
00234     virtual ~Definition() {}
00235 
00239     virtual void destroy() = 0;
00240 
00244     virtual int32_t                             numHints(void) const = 0;
00245 
00250     virtual const Hint *                    hint(int32_t index) const = 0;
00251 
00256     virtual const Hint *                    hint(const char *name) const = 0;
00257 
00262     virtual void                            setHints(const Hint **hints, int32_t n) = 0;
00263 
00268     virtual void                            addHint(Hint *hint) = 0;
00269     
00274     virtual const Definition *    parent(void) const = 0;
00275 
00279     virtual const Definition *    root(void) const = 0;
00280 
00284     virtual const char *                    name(void) const = 0;
00285 
00291     virtual const char *                    longName(void) const = 0;
00292 
00297     virtual const char *                    structName(void) const = 0;
00298 
00302     virtual DataType                        type(void) const = 0;
00303 
00307     virtual const char*                     typeString() const = 0;
00308 
00314     virtual    int32_t                             numRefVariants(void) const = 0;
00315 
00320     virtual    int32_t                             refVariantValIndex( const char * ref_val ) const = 0;
00321 
00325     virtual    const char *                     refVariantVal(int32_t index) const = 0;
00326 
00330     virtual int32_t                             numEnumVals(void) const = 0;
00331 
00336     virtual    int32_t                             enumValIndex( const char * enum_val ) const = 0;
00337 
00342     virtual const char *                    enumVal(int32_t index) const = 0;
00343 
00348     virtual void                             setEnumVals(const char **enum_vals, int32_t n) = 0;
00349 
00354     virtual void                             addEnumVal(const char *enum_val) = 0;
00355 
00359     virtual uint32_t alignment(void) const = 0;
00360 
00364     virtual uint32_t padding(void) const = 0;
00365 
00369     virtual int32_t arrayDimension(void) const = 0;
00370 
00375     virtual int32_t arraySize(int32_t dimension = 0) const = 0;
00376 
00380     virtual bool arraySizeIsFixed(void) const = 0;
00381 
00386     virtual bool setArraySize(int32_t size) = 0; // -1 if the size is not fixed
00387 
00391     virtual bool isLeaf(void) const = 0;
00392     
00396     virtual bool isIncludedRef(void) const = 0;
00397 
00401     virtual int32_t numChildren(void) const = 0;
00402 
00406     virtual const Definition *child(int32_t index) const = 0;
00407 
00412     virtual const Definition *child(const char *name, int32_t &index) const = 0;
00413 
00418     virtual void setChildren(Definition **children, int32_t n) = 0;
00419 
00424     virtual void addChild(Definition *child) = 0;
00425 
00429     virtual void setDynamicHandleIndicesMap(const uint8_t *indices, uint32_t numIndices) = 0;
00430 
00434     virtual const uint8_t * getDynamicHandleIndicesMap(uint32_t &outNumIndices) const = 0;
00435 
00441     virtual bool isSimpleType(bool simpleStructs = true, bool simpleStrings = true) const = 0;
00442 };
00443 
00447 class Handle
00448 {
00449 public:
00450 
00451     enum { MAX_DEPTH = 16 };
00452 
00456     PX_INLINE Handle(::NvParameterized::Interface *iface);
00457 
00461     PX_INLINE Handle(::NvParameterized::Interface &iface);
00462 
00467     PX_INLINE Handle(const ::NvParameterized::Interface &iface);
00468 
00472     PX_INLINE Handle(const Handle &param_handle);
00473 
00477     PX_INLINE Handle(::NvParameterized::Interface &instance, const char *longName);
00478 
00483     PX_INLINE Handle(const ::NvParameterized::Interface &instance, const char *longName);
00484 
00488     PX_INLINE const Definition *parameterDefinition(void) const { return(mParameterDefinition); }
00489     
00493     PX_INLINE int32_t numIndexes(void) const { return(mNumIndexes); }
00494 
00498     PX_INLINE int32_t index(int32_t i) const { return(mIndexList[i]); }
00499 
00503     PX_INLINE int32_t popIndex(int32_t levels = 1);
00504 
00508     PX_INLINE ErrorType set(const ::NvParameterized::Interface *instance, const Definition *root, const char *child_long_name);
00509 
00513     PX_INLINE ErrorType set(const ::NvParameterized::Interface *instance, const char *child_long_name);
00514     
00522     PX_INLINE ErrorType getParameter(const char *longName);
00523 
00530     PX_INLINE ErrorType set(int32_t child_index);
00531 
00537     PX_INLINE ErrorType getChildHandle(const ::NvParameterized::Interface *instance, const char *child_long_name, Handle &outHandle);
00538 
00543     PX_INLINE ErrorType getChildHandle(int32_t index, Handle &outHandle);
00544 
00549     PX_INLINE bool getLongName(char *str, uint32_t max_str_len) const;
00550 
00554     PX_INLINE void reset();
00555 
00559     PX_INLINE bool isConst(void) const { return(mIsConst); }
00560 
00564     PX_INLINE bool isValid(void) const { return(mIsValid); }
00565 
00569     PX_INLINE operator bool() const { return(isValid()); }
00570 
00574     PX_INLINE const void *userData(void) const { return(mUserData); }
00575 
00579     PX_INLINE void *userData(void) { return(mUserData); }
00580 
00584     PX_INLINE void setUserData(void *user_data) { mUserData = user_data; }
00585 
00590     PX_INLINE ::NvParameterized::Interface * getInterface(void) const { return mIsConst ? 0 : mInterface; }
00591 
00595     PX_INLINE const ::NvParameterized::Interface * getConstInterface(void) const { return mInterface; }
00596 
00600     PX_INLINE void setInterface(::NvParameterized::Interface *iface) { mIsConst = false; mInterface = iface; }
00601 
00605     PX_INLINE void setInterface(const ::NvParameterized::Interface *iface) { mIsConst = true; mInterface = (::NvParameterized::Interface *)iface; }
00606 
00617     PX_INLINE ErrorType initParamRef(const char *chosenRefStr = 0, bool doDestroyOld = false);
00618 
00626     PX_INLINE ErrorType valueToStr(char *buf, uint32_t bufSize, const char *&ret);
00627     
00633     PX_INLINE ErrorType strToValue(const char *str, const char **endptr);
00634 
00638     ErrorType resizeArray(int32_t new_size);
00639 
00643     PX_INLINE ErrorType getArraySize(int32_t &size, int32_t dimension = 0) const;
00644 
00648     PX_INLINE ErrorType swapArrayElements(uint32_t firstElement, uint32_t secondElement);
00649 
00650     // These functions wrap the raw(Get|Set)XXXXX() methods.  They deal with
00651     // error handling and casting.
00652     
00656     PX_INLINE ErrorType getParamBool(bool &val) const ;
00657 
00661     PX_INLINE ErrorType setParamBool(bool val) ;
00662 
00666     PX_INLINE ErrorType getParamBoolArray(bool *array, int32_t n, int32_t offset = 0) const ;
00667 
00671     PX_INLINE ErrorType setParamBoolArray(const bool *array, int32_t n, int32_t offset = 0) ;
00672 
00676     PX_INLINE ErrorType getParamString(const char *&val) const ;
00677 
00681     PX_INLINE ErrorType setParamString(const char *val) ;
00682 
00686     PX_INLINE ErrorType getParamStringArray(char **array, int32_t n, int32_t offset = 0) const ;
00687 
00691     PX_INLINE ErrorType setParamStringArray(const char **array, int32_t n, int32_t offset = 0) ;
00692 
00696     PX_INLINE ErrorType getParamEnum(const char *&val) const ;
00697 
00701     PX_INLINE ErrorType setParamEnum(const char *val) ;
00702 
00706     PX_INLINE ErrorType getParamEnumArray(char **array, int32_t n, int32_t offset = 0) const ;
00707 
00711     PX_INLINE ErrorType setParamEnumArray(const char **array, int32_t n, int32_t offset = 0) ;
00712 
00716     PX_INLINE ErrorType getParamRef(::NvParameterized::Interface *&val) const ;
00717 
00721     PX_INLINE ErrorType getParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset = 0) const ;
00722 
00726     PX_INLINE ErrorType setParamRef(::NvParameterized::Interface * val, bool doDestroyOld = false) ;
00727 
00731     PX_INLINE ErrorType setParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset = 0, bool doDestroyOld = false) ;
00732 
00736     PX_INLINE ErrorType getParamI8(int8_t &val) const ;
00737 
00741     PX_INLINE ErrorType setParamI8(int8_t val) ;
00742 
00746     PX_INLINE ErrorType getParamI8Array(int8_t *array, int32_t n, int32_t offset = 0) const ;
00747 
00751     PX_INLINE ErrorType setParamI8Array(const int8_t *val, int32_t n, int32_t offset = 0) ;
00752 
00756     PX_INLINE ErrorType getParamI16(int16_t &val) const ;
00757 
00761     PX_INLINE ErrorType setParamI16(int16_t val) ;
00762 
00766     PX_INLINE ErrorType getParamI16Array(int16_t *array, int32_t n, int32_t offset = 0) const ;
00767 
00771     PX_INLINE ErrorType setParamI16Array(const int16_t *val, int32_t n, int32_t offset = 0) ;
00772 
00776     PX_INLINE ErrorType getParamI32(int32_t &val) const ;
00777 
00781     PX_INLINE ErrorType setParamI32(int32_t val) ;
00782 
00786     PX_INLINE ErrorType getParamI32Array(int32_t *array, int32_t n, int32_t offset = 0) const ;
00787 
00791     PX_INLINE ErrorType setParamI32Array(const int32_t *val, int32_t n, int32_t offset = 0) ;
00792 
00796     PX_INLINE ErrorType getParamI64(int64_t &val) const ;
00797 
00801     PX_INLINE ErrorType setParamI64(int64_t val) ;
00802 
00806     PX_INLINE ErrorType getParamI64Array(int64_t *array, int32_t n, int32_t offset = 0) const ;
00807 
00811     PX_INLINE ErrorType setParamI64Array(const int64_t *val, int32_t n, int32_t offset = 0) ;
00812 
00816     PX_INLINE ErrorType getParamU8(uint8_t &val) const ;
00817 
00821     PX_INLINE ErrorType setParamU8(uint8_t val) ;
00822     
00826     PX_INLINE ErrorType getParamU8Array(uint8_t *array, int32_t n, int32_t offset = 0) const ;
00827 
00831     PX_INLINE ErrorType setParamU8Array(const uint8_t *val, int32_t n, int32_t offset = 0) ;
00832 
00836     PX_INLINE ErrorType getParamU16(uint16_t &val) const ;
00837 
00841     PX_INLINE ErrorType setParamU16(uint16_t val) ;
00842 
00846     PX_INLINE ErrorType getParamU16Array(uint16_t *array, int32_t n, int32_t offset = 0) const ;
00847 
00851     PX_INLINE ErrorType setParamU16Array(const uint16_t *array, int32_t n, int32_t offset = 0) ;
00852 
00856     PX_INLINE ErrorType getParamU32(uint32_t &val) const ;
00857 
00861     PX_INLINE ErrorType setParamU32(uint32_t val) ;
00862 
00866     PX_INLINE ErrorType getParamU32Array(uint32_t *array, int32_t n, int32_t offset = 0) const ;
00867 
00871     PX_INLINE ErrorType setParamU32Array(const uint32_t *array, int32_t n, int32_t offset = 0) ;
00872 
00876     PX_INLINE ErrorType getParamU64(uint64_t &val) const ;
00877 
00881     PX_INLINE ErrorType setParamU64(uint64_t val) ;
00882 
00886     PX_INLINE ErrorType getParamU64Array(uint64_t *array, int32_t n, int32_t offset = 0) const ;
00887 
00891     PX_INLINE ErrorType setParamU64Array(const uint64_t *array, int32_t n, int32_t offset = 0) ;
00892 
00896     PX_INLINE ErrorType getParamF32(float &val) const ;
00897 
00901     PX_INLINE ErrorType setParamF32(float val) ;
00902 
00906     PX_INLINE ErrorType getParamF32Array(float *array, int32_t n, int32_t offset = 0) const ;
00907 
00911     PX_INLINE ErrorType setParamF32Array(const float *array, int32_t n, int32_t offset = 0) ;
00912 
00916     PX_INLINE ErrorType getParamF64(double &val) const ;
00917 
00921     PX_INLINE ErrorType setParamF64(double val) ;
00922 
00926     PX_INLINE ErrorType getParamF64Array(double *array, int32_t n, int32_t offset = 0) const ;
00927 
00931     PX_INLINE ErrorType setParamF64Array(const double *array, int32_t n, int32_t offset = 0) ;
00932 
00936     PX_INLINE ErrorType setParamVec2(const physx::PxVec2 &val) ;
00937 
00941     PX_INLINE ErrorType getParamVec2(physx::PxVec2 &val) const ;
00942 
00946     PX_INLINE ErrorType getParamVec2Array(physx::PxVec2 *array, int32_t n, int32_t offset = 0) const ;
00947 
00951     PX_INLINE ErrorType setParamVec2Array(const physx::PxVec2 *array, int32_t n, int32_t offset = 0) ;
00952 
00956     PX_INLINE ErrorType setParamVec3(const physx::PxVec3 &val) ;
00957 
00961     PX_INLINE ErrorType getParamVec3(physx::PxVec3 &val) const ;
00962 
00966     PX_INLINE ErrorType getParamVec3Array(physx::PxVec3 *array, int32_t n, int32_t offset = 0) const ;
00967 
00971     PX_INLINE ErrorType setParamVec3Array(const physx::PxVec3 *array, int32_t n, int32_t offset = 0) ;
00972 
00976     PX_INLINE ErrorType setParamVec4(const physx::PxVec4 &val) ;
00977 
00981     PX_INLINE ErrorType getParamVec4(physx::PxVec4 &val) const ;
00982 
00986     PX_INLINE ErrorType getParamVec4Array(physx::PxVec4 *array, int32_t n, int32_t offset = 0) const ;
00987 
00991     PX_INLINE ErrorType setParamVec4Array(const physx::PxVec4 *array, int32_t n, int32_t offset = 0) ;
00992 
00996     PX_INLINE ErrorType setParamQuat(const physx::PxQuat &val) ;
00997 
01001     PX_INLINE ErrorType getParamQuat(physx::PxQuat &val) const ;
01002 
01006     PX_INLINE ErrorType getParamQuatArray(physx::PxQuat *array, int32_t n, int32_t offset = 0) const ;
01007 
01011     PX_INLINE ErrorType setParamQuatArray(const physx::PxQuat *array, int32_t n, int32_t offset = 0) ;
01012 
01016     PX_INLINE ErrorType setParamMat33(const physx::PxMat33 &val) ;
01017 
01021     PX_INLINE ErrorType getParamMat33(physx::PxMat33 &val) const ;
01022 
01026     PX_INLINE ErrorType getParamMat33Array(physx::PxMat33 *array, int32_t n, int32_t offset = 0) const ;
01027 
01031     PX_INLINE ErrorType setParamMat33Array(const physx::PxMat33 *array, int32_t n, int32_t offset = 0) ;
01032 
01036     PX_INLINE ErrorType setParamMat44(const physx::PxMat44 &val) ;
01037 
01041     PX_INLINE ErrorType getParamMat44(physx::PxMat44 &val) const ;
01042     
01046     PX_INLINE ErrorType getParamMat44Array(physx::PxMat44 *array, int32_t n, int32_t offset = 0) const ;
01047 
01051     PX_INLINE ErrorType setParamMat44Array(const physx::PxMat44 *array, int32_t n, int32_t offset = 0) ;
01052 
01056     PX_INLINE ErrorType setParamMat34Legacy(const float (&val)[12]) ;
01057 
01061     PX_INLINE ErrorType getParamMat34Legacy(float (&val)[12]) const ;
01062     
01066     PX_INLINE ErrorType getParamMat34LegacyArray(float* array, int32_t n, int32_t offset = 0) const ;
01067 
01071     PX_INLINE ErrorType setParamMat34LegacyArray(const float *array, int32_t n, int32_t offset = 0) ;
01072 
01076     PX_INLINE ErrorType setParamBounds3(const physx::PxBounds3 &val) ;
01077 
01081     PX_INLINE ErrorType getParamBounds3(physx::PxBounds3 &val) const ;
01082 
01086     PX_INLINE ErrorType getParamBounds3Array(physx::PxBounds3 *array, int32_t n, int32_t offset = 0) const ;
01087 
01091     PX_INLINE ErrorType setParamBounds3Array(const physx::PxBounds3 *array, int32_t n, int32_t offset = 0) ;
01092 
01096     PX_INLINE ErrorType setParamTransform(const physx::PxTransform &val) ;
01097 
01101     PX_INLINE ErrorType getParamTransform(physx::PxTransform &val) const ;
01102     
01106     PX_INLINE ErrorType getParamTransformArray(physx::PxTransform *array, int32_t n, int32_t offset = 0) const ;
01107 
01111     PX_INLINE ErrorType setParamTransformArray(const physx::PxTransform *array, int32_t n, int32_t offset = 0) ;
01112 
01113 
01115     template <typename T> PX_INLINE ErrorType setParam(const T &val);
01116 
01118     template <typename T> PX_INLINE ErrorType getParam(T &val) const;
01119 
01121     template <typename T> PX_INLINE ErrorType getParamArray(T *array, int32_t n, int32_t offset = 0) const;
01122 
01124     template <typename T> PX_INLINE ErrorType setParamArray(const T *array, int32_t n, int32_t offset = 0);
01125 
01126 private:
01127 
01128     PX_INLINE void pushIndex(int32_t index);
01129 
01130     bool mIsValid, mIsConst;
01131     int32_t mNumIndexes;
01132     int32_t mIndexList[MAX_DEPTH];
01133     const Definition *mParameterDefinition;
01134     void *mUserData;
01135     ::NvParameterized::Interface    *mInterface;
01136 };
01137 
01139 class SerializationCallback
01140 {
01141 public:
01142     virtual ~SerializationCallback() {}
01144     virtual void preSerialize(void* userData = NULL) = 0;
01145 };
01146 
01147 
01151 class Interface
01152 {
01153     friend class Handle;
01154 public:
01155 
01159     virtual ~Interface() {}
01160 
01164     virtual void destroy() = 0;
01165 
01169     virtual void initDefaults(void) = 0;
01170 
01174     virtual void initRandom(void) = 0;
01175 
01179     virtual const char * className(void) const = 0;
01180     
01187     virtual void setClassName(const char *name) = 0;
01188 
01193     virtual const char * name(void) const = 0;
01194     
01199     virtual void setName(const char *name) = 0;
01200 
01204     virtual uint32_t version(void) const = 0;
01205 
01209     virtual uint16_t getMajorVersion(void) const = 0;
01210 
01214     virtual uint16_t getMinorVersion(void) const = 0;
01215 
01221     virtual const uint32_t * checksum(uint32_t &bits) const = 0;
01222 
01226     virtual int32_t numParameters(void) = 0;
01227 
01231     virtual const Definition *parameterDefinition(int32_t index) = 0;
01232 
01236     virtual const Definition *rootParameterDefinition(void) = 0;
01237 
01241     virtual const Definition *rootParameterDefinition(void) const = 0;
01242 
01250     virtual ErrorType getParameterHandle(const char *longName, Handle  &handle) const = 0;
01251 
01259     virtual ErrorType getParameterHandle(const char *longName, Handle  &handle) = 0;
01260 
01262     virtual void setSerializationCallback(SerializationCallback *cb, void *userData = NULL) = 0;
01263 
01265     virtual ErrorType callPreSerializeCallback() const = 0;
01266 
01267 
01276     virtual bool equals(const ::NvParameterized::Interface &obj, Handle* handlesOfInequality = NULL, uint32_t numHandlesOfInequality = 0, bool doCompareNotSerialized = true) const = 0;
01277 
01284     virtual bool areParamsOK(Handle *invalidHandles = NULL, uint32_t numInvalidHandles = 0) = 0;
01285 
01290     virtual ErrorType copy(const ::NvParameterized::Interface &src) = 0;
01291 
01296     virtual ErrorType clone(Interface *&nullDestObject) const = 0;
01297 
01302     virtual bool checkAlignments() const = 0;
01303 
01304 protected:
01310     virtual ErrorType initParamRef(const Handle &handle, const char *chosenRefStr = 0, bool doDestroyOld = false) = 0;
01311 
01312     // These functions wrap the raw(Get|Set)XXXXX() methods.  They deal with
01313     // error handling and casting.
01314 
01318     virtual ErrorType getParamBool(const Handle &handle, bool &val) const = 0;
01319 
01323     virtual ErrorType setParamBool(const Handle &handle, bool val) = 0;
01324 
01328     virtual ErrorType getParamBoolArray(const Handle &handle, bool *array, int32_t n, int32_t offset = 0) const = 0;
01329 
01333     virtual ErrorType setParamBoolArray(const Handle &handle, const bool *array, int32_t n, int32_t offset = 0) = 0;
01334 
01338     virtual ErrorType getParamString(const Handle &handle, const char *&val) const = 0;
01339 
01343     virtual ErrorType setParamString(const Handle &handle, const char *val) = 0;
01344 
01348     virtual ErrorType getParamStringArray(const Handle &handle, char **array, int32_t n, int32_t offset = 0) const = 0;
01349 
01353     virtual ErrorType setParamStringArray(const Handle &handle, const char **array, int32_t n, int32_t offset = 0) = 0;
01354 
01358     virtual ErrorType getParamEnum(const Handle &handle, const char *&val) const = 0;
01359 
01363     virtual ErrorType setParamEnum(const Handle &handle, const char *val) = 0;
01364 
01368     virtual ErrorType getParamEnumArray(const Handle &handle, char **array, int32_t n, int32_t offset = 0) const = 0;
01369 
01373     virtual ErrorType setParamEnumArray(const Handle &handle, const char **array, int32_t n, int32_t offset = 0) = 0;
01374 
01378     virtual ErrorType getParamRef(const Handle &handle, ::NvParameterized::Interface *&val) const = 0;
01379 
01383     virtual ErrorType getParamRefArray(const Handle &handle, ::NvParameterized::Interface **array, int32_t n, int32_t offset = 0) const = 0;
01384 
01388     virtual ErrorType setParamRef(const Handle &handle, ::NvParameterized::Interface * val, bool doDestroyOld = false) = 0;
01389 
01393     virtual ErrorType setParamRefArray(const Handle &handle, /*const*/ ::NvParameterized::Interface **array, int32_t n, int32_t offset = 0, bool doDestroyOld = false) = 0;
01394 
01398     virtual ErrorType getParamI8(const Handle &handle, int8_t &val) const = 0;
01399 
01403     virtual ErrorType setParamI8(const Handle &handle, int8_t val) = 0;
01404 
01408     virtual ErrorType getParamI8Array(const Handle &handle, int8_t *array, int32_t n, int32_t offset = 0) const = 0;
01409 
01413     virtual ErrorType setParamI8Array(const Handle &handle, const int8_t *val, int32_t n, int32_t offset = 0) = 0;
01414 
01418     virtual ErrorType getParamI16(const Handle &handle, int16_t &val) const = 0;
01419 
01423     virtual ErrorType setParamI16(const Handle &handle, int16_t val) = 0;
01424 
01428     virtual ErrorType getParamI16Array(const Handle &handle, int16_t *array, int32_t n, int32_t offset = 0) const = 0;
01429 
01433     virtual ErrorType setParamI16Array(const Handle &handle, const int16_t *val, int32_t n, int32_t offset = 0) = 0;
01434 
01438     virtual ErrorType getParamI32(const Handle &handle, int32_t &val) const = 0;
01439 
01443     virtual ErrorType setParamI32(const Handle &handle, int32_t val) = 0;
01444 
01448     virtual ErrorType getParamI32Array(const Handle &handle, int32_t *array, int32_t n, int32_t offset = 0) const = 0;
01449 
01453     virtual ErrorType setParamI32Array(const Handle &handle, const int32_t *val, int32_t n, int32_t offset = 0) = 0;
01454 
01458     virtual ErrorType getParamI64(const Handle &handle, int64_t &val) const = 0;
01459 
01463     virtual ErrorType setParamI64(const Handle &handle, int64_t val) = 0;
01464 
01468     virtual ErrorType getParamI64Array(const Handle &handle, int64_t *array, int32_t n, int32_t offset = 0) const = 0;
01469 
01473     virtual ErrorType setParamI64Array(const Handle &handle, const int64_t *val, int32_t n, int32_t offset = 0) = 0;
01474 
01478     virtual ErrorType getParamU8(const Handle &handle, uint8_t &val) const = 0;
01479 
01483     virtual ErrorType setParamU8(const Handle &handle, uint8_t val) = 0;
01484 
01488     virtual ErrorType getParamU8Array(const Handle &handle, uint8_t *array, int32_t n, int32_t offset = 0) const = 0;
01489 
01493     virtual ErrorType setParamU8Array(const Handle &handle, const uint8_t *val, int32_t n, int32_t offset = 0) = 0;
01494 
01498     virtual ErrorType getParamU16(const Handle &handle, uint16_t &val) const = 0;
01499 
01503     virtual ErrorType setParamU16(const Handle &handle, uint16_t val) = 0;
01504 
01508     virtual ErrorType getParamU16Array(const Handle &handle, uint16_t *array, int32_t n, int32_t offset = 0) const = 0;
01509 
01513     virtual ErrorType setParamU16Array(const Handle &handle, const uint16_t *array, int32_t n, int32_t offset = 0) = 0;
01514 
01518     virtual ErrorType getParamU32(const Handle &handle, uint32_t &val) const = 0;
01519 
01523     virtual ErrorType setParamU32(const Handle &handle, uint32_t val) = 0;
01524 
01528     virtual ErrorType getParamU32Array(const Handle &handle, uint32_t *array, int32_t n, int32_t offset = 0) const = 0;
01529 
01533     virtual ErrorType setParamU32Array(const Handle &handle, const uint32_t *array, int32_t n, int32_t offset = 0) = 0;
01534 
01538     virtual ErrorType getParamU64(const Handle &handle, uint64_t &val) const = 0;
01539 
01543     virtual ErrorType setParamU64(const Handle &handle, uint64_t val) = 0;
01544 
01548     virtual ErrorType getParamU64Array(const Handle &handle, uint64_t *array, int32_t n, int32_t offset = 0) const = 0;
01549 
01553     virtual ErrorType setParamU64Array(const Handle &handle, const uint64_t *array, int32_t n, int32_t offset = 0) = 0;
01554 
01558     virtual ErrorType getParamF32(const Handle &handle, float &val) const = 0;
01559 
01563     virtual ErrorType setParamF32(const Handle &handle, float val) = 0;
01564 
01568     virtual ErrorType getParamF32Array(const Handle &handle, float *array, int32_t n, int32_t offset = 0) const = 0;
01569 
01573     virtual ErrorType setParamF32Array(const Handle &handle, const float *array, int32_t n, int32_t offset = 0) = 0;
01574 
01578     virtual ErrorType getParamF64(const Handle &handle, double &val) const = 0;
01579 
01583     virtual ErrorType setParamF64(const Handle &handle, double val) = 0;
01584 
01588     virtual ErrorType getParamF64Array(const Handle &handle, double *array, int32_t n, int32_t offset = 0) const = 0;
01589 
01593     virtual ErrorType setParamF64Array(const Handle &handle, const double *array, int32_t n, int32_t offset = 0) = 0;
01594 
01598     virtual ErrorType setParamVec2(const Handle &handle, const physx::PxVec2 &val) = 0;
01599 
01603     virtual ErrorType getParamVec2(const Handle &handle, physx::PxVec2 &val) const = 0;
01604 
01608     virtual ErrorType getParamVec2Array(const Handle &handle, physx::PxVec2 *array, int32_t n, int32_t offset = 0) const = 0;
01609 
01613     virtual ErrorType setParamVec2Array(const Handle &handle, const physx::PxVec2 *array, int32_t n, int32_t offset = 0) = 0;
01614 
01618     virtual ErrorType setParamVec3(const Handle &handle, const physx::PxVec3 &val) = 0;
01619 
01623     virtual ErrorType getParamVec3(const Handle &handle, physx::PxVec3 &val) const = 0;
01624 
01628     virtual ErrorType getParamVec3Array(const Handle &handle, physx::PxVec3 *array, int32_t n, int32_t offset = 0) const = 0;
01629 
01633     virtual ErrorType setParamVec3Array(const Handle &handle, const physx::PxVec3 *array, int32_t n, int32_t offset = 0) = 0;
01634 
01638     virtual ErrorType setParamVec4(const Handle &handle, const physx::PxVec4 &val) = 0;
01639 
01643     virtual ErrorType getParamVec4(const Handle &handle, physx::PxVec4 &val) const = 0;
01644 
01648     virtual ErrorType getParamVec4Array(const Handle &handle, physx::PxVec4 *array, int32_t n, int32_t offset = 0) const = 0;
01649 
01653     virtual ErrorType setParamVec4Array(const Handle &handle, const physx::PxVec4 *array, int32_t n, int32_t offset = 0) = 0;
01654 
01658     virtual ErrorType setParamQuat(const Handle &handle, const physx::PxQuat &val) = 0;
01659 
01663     virtual ErrorType getParamQuat(const Handle &handle, physx::PxQuat &val) const = 0;
01664 
01668     virtual ErrorType getParamQuatArray(const Handle &handle, physx::PxQuat *array, int32_t n, int32_t offset = 0) const = 0;
01669 
01673     virtual ErrorType setParamQuatArray(const Handle &handle, const physx::PxQuat *array, int32_t n, int32_t offset = 0) = 0;
01674 
01678     virtual ErrorType setParamMat33(const Handle &handle, const physx::PxMat33 &val) = 0;
01679 
01683     virtual ErrorType getParamMat33(const Handle &handle, physx::PxMat33 &val) const = 0;
01684 
01688     virtual ErrorType getParamMat33Array(const Handle &handle, physx::PxMat33 *array, int32_t n, int32_t offset = 0) const = 0;
01689 
01693     virtual ErrorType setParamMat33Array(const Handle &handle, const physx::PxMat33 *array, int32_t n, int32_t offset = 0) = 0;
01694 
01698     virtual ErrorType setParamMat44(const Handle &handle, const physx::PxMat44 &val) = 0;
01699     
01703     virtual ErrorType getParamMat44(const Handle &handle, physx::PxMat44 &val) const = 0;
01704 
01708     virtual ErrorType getParamMat44Array(const Handle &handle, physx::PxMat44 *array, int32_t n, int32_t offset = 0) const = 0;
01709 
01713     virtual ErrorType setParamMat44Array(const Handle &handle, const physx::PxMat44 *array, int32_t n, int32_t offset = 0) = 0;
01714 
01718     virtual ErrorType setParamMat34Legacy(const Handle &handle, const float (&val)[12]) = 0;
01719     
01723     virtual ErrorType getParamMat34Legacy(const Handle &handle, float (&val)[12]) const = 0;
01724 
01728     virtual ErrorType getParamMat34LegacyArray(const Handle &handle, float *array, int32_t n, int32_t offset = 0) const = 0;
01729 
01733     virtual ErrorType setParamMat34LegacyArray(const Handle &handle, const float *array, int32_t n, int32_t offset = 0) = 0;
01734 
01738     virtual ErrorType setParamBounds3(const Handle &handle, const physx::PxBounds3 &val) = 0;
01739 
01743     virtual ErrorType getParamBounds3(const Handle &handle, physx::PxBounds3 &val) const = 0;
01744 
01748     virtual ErrorType getParamBounds3Array(const Handle &handle, physx::PxBounds3 *array, int32_t n, int32_t offset = 0) const = 0;
01749 
01753     virtual ErrorType setParamTransform(const Handle &handle, const physx::PxTransform &val) = 0;
01754     
01758     virtual ErrorType getParamTransform(const Handle &handle, physx::PxTransform &val) const = 0;
01759 
01763     virtual ErrorType getParamTransformArray(const Handle &handle, physx::PxTransform *array, int32_t n, int32_t offset = 0) const = 0;
01764 
01768     virtual ErrorType setParamTransformArray(const Handle &handle, const physx::PxTransform *array, int32_t n, int32_t offset = 0) = 0;
01769 
01773     virtual ErrorType setParamBounds3Array(const Handle &handle, const physx::PxBounds3 *array, int32_t n, int32_t offset = 0) = 0;
01774 
01779     virtual ErrorType valueToStr(const Handle &handle, char *buf, uint32_t bufSize, const char *&ret) = 0;
01780 
01785     virtual ErrorType strToValue(Handle &handle,const char *str, const char **endptr) = 0; // assigns this string to the value
01786 
01791     virtual ErrorType resizeArray(const Handle &array_handle, int32_t new_size) = 0;
01792 
01797     virtual ErrorType getArraySize(const Handle &array_handle, int32_t &size, int32_t dimension = 0) const = 0;
01798 
01803     virtual ErrorType swapArrayElements(const Handle &array_handle, uint32_t firstElement, uint32_t secondElement) = 0;
01804 };
01805 
01806 } // end of namespace
01807 
01808 #include "NvParameterized.inl" // inline the NvParamterHandle methods.
01809 
01810 PX_POP_PACK
01811 
01812 #endif // NV_PARAMETERIZED_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.