diff options
| author | Bryan Galdrikian <[email protected]> | 2018-05-31 11:36:08 -0700 |
|---|---|---|
| committer | Bryan Galdrikian <[email protected]> | 2018-05-31 11:36:08 -0700 |
| commit | 7115f60b91b5717d90f643fd692010905c7004db (patch) | |
| tree | effd68c6978751c517d54c2f2bb5bb6e7dc93e18 /sdk/extensions/import/apexmodules/nvparutils | |
| parent | Updating BlastTool zip (diff) | |
| download | blast-7115f60b91b5717d90f643fd692010905c7004db.tar.xz blast-7115f60b91b5717d90f643fd692010905c7004db.zip | |
Blast 1.1.3. See docs/release_notes.txt.v1.1.3_rc1
Diffstat (limited to 'sdk/extensions/import/apexmodules/nvparutils')
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.h | 670 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.inl | 2734 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.h | 3624 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.inl | 2458 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedMacroses.h | 272 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedTraits.h | 746 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized_types.h | 214 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.h | 926 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.inl | 354 |
9 files changed, 5999 insertions, 5999 deletions
diff --git a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.h b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.h index 1492f92..780035a 100644..100755 --- a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.h +++ b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.h @@ -1,335 +1,335 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. - -#ifndef NV_PARAM_UTILS_H -#define NV_PARAM_UTILS_H - -#include "NvParameterized.h" - -// utility methods to operate on NvParameterized data. - -namespace NvParameterized -{ - -/** -\brief Recursively finds a parameter with the given name - -This method will recursively search through not only this parameterized but all referenced -parameterized objects as well. It sets the handle and returns the NvParameterized::Interface in which the name was found. - -\param i the parameterized object that will be searched - -\param longName contains the name of the parameter to be found -the longName will work with arrays, structs, and included references - -\param outHandle will contain the output handle that provides read-only access to the specified parameter - -\returns the NvParameterized::Interface pointer in which the parameter is contained (this could be different than the top level NvParameterized::Interface if the parameter is contained in an included reference) -*/ -PX_INLINE const Interface * findParam(const Interface &i,const char *longName, Handle &outHandle); - - -/** -\brief Recursively finds a parameter with the given name - -This method will recursively search through not only this parameterized but all referenced -parameterized objects as well. It sets the handle and returns the NvParameterized::Interface in which the name was found. - -\param i the parameterized object that will be searched - -\param longName contains the name of the parameter to be found -the longName will work with arrays, structs, and included references - -\param outHandle will contain the output handle that provides read-write access to the specified parameter - -\returns the NvParameterized::Interface pointer in which the parameter is contained (this could be different than the top level NvParameterized::Interface if the parameter is contained in an included reference) -*/ -PX_INLINE Interface * findParam(Interface &i,const char *longName, Handle &outHandle); - -/** -\brief Container for results of getParamList -*/ -struct ParamResult -{ -public: - /** - \brief Constructor - */ - ParamResult(const char *name, - const char *longName, - const char *className, - const char *instanceName, - const Handle &handle, - int32_t arraySize, - DataType type) - : mArraySize(arraySize), - mInstanceName(instanceName), - mClassName(className), - mName(name), - mLongName(longName), - mHandle(handle), - mDataType(type) - {} - - /** - \brief size of array (if parameter is array) - */ - int32_t mArraySize; - - /** - \brief Name of parameter's parent object - */ - const char *mInstanceName; - - /** - \brief Name of NvParameterized-class of parameter's parent object - */ - const char *mClassName; - - /** - \brief The name of the parameter - */ - const char *mName; - - /** - \brief The fully qualified 'long' name of the parameter - */ - const char *mLongName; - - /** - \brief Use this handle to access the parameter in question - */ - Handle mHandle; - - /** - \brief The type of parameter - */ - DataType mDataType; -}; - -/** -\brief A helper method to retrieve the list of all parameters relative to an interface. - -\param [in] i the input interface -\param [in] className is an optional class name to match to. If this is null, it will return all parameters. -\param [in] paramName is an optional parameter name to match to. If this is null, it will return all parameters. -\param [out] count the number of parameters found -\param [in] recursive if true the search will recurse into every included reference, not just the top parameterized class -\param [in] classesOnly if true the search will only match against class names -\param [in] traits typically the APEX traits class, used to allocate the ParamResult, see ApexSDK::getParameterizedTraits() - -\note The return pointer is allocated by the NvParameterized Traits class and should be freed by calling releaseParamList() - -*/ -PX_INLINE const ParamResult * getParamList(const Interface &i, - const char *className, // name of class to match - const char *paramName, // name of parameter to match - uint32_t &count, - bool recursive, - bool classesOnly, - NvParameterized::Traits *traits); - -/// helper function to free the parameter list returned from getParamList -PX_INLINE void releaseParamList(uint32_t resultCount,const ParamResult *results,NvParameterized::Traits *traits); - -/// helper function to get an NvParameterized array size -PX_INLINE bool getParamArraySize(const Interface &pm, const char *name, int32_t &arraySize); - -/// helper function to resize an NvParameterized array -PX_INLINE bool resizeParamArray(Interface &pm, const char *name, int32_t newSize); - -/** -\brief Callback container for getNamedReferences -*/ -class NamedReferenceInterface -{ -public: - /** - \brief Destructor - */ - virtual ~NamedReferenceInterface() {} - /** - \brief Callback - - Calls back to the user with any named reference (not included references) in the NvParameterized::Interface - If the user returns a NULL pointer, than the original named reference is left alone. - If the user returns a non-NULL pointer, than the named reference is replaced with the 'const char *' returned. - */ - virtual const char * namedReferenceCallback(const char *className,const char *namedReference,Handle &handle) = 0; -}; - -/// Calls back for every non-included named reference. -PX_INLINE uint32_t getNamedReferences(const Interface &i, - NamedReferenceInterface &namedReference, - bool recursive); - -/** -\brief Callback container for getReferences -*/ -class ReferenceInterface -{ -public: - /** - \brief Destructor - */ - virtual ~ReferenceInterface() {} - /** - \brief Callback - - Calls back to the user with any reference (named or included or both) in the NvParameterized::Interface. - */ - virtual void referenceCallback(Handle &handle) = 0; -}; - -/// Calls back for every reference (named or included or both). -PX_INLINE void getReferences(const Interface &iface, - ReferenceInterface &cb, - bool named, - bool included, - bool recursive); - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamBool(const Interface &pm, const char *name, bool &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamBool(Interface &pm, const char *name, bool val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamString(const Interface &pm, const char *name, const char *&val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamString(Interface &pm, const char *name, const char *val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamEnum(const Interface &pm, const char *name, const char *&val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamEnum(Interface &pm, const char *name, const char *val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamRef(const Interface &pm, const char *name, NvParameterized::Interface *&val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamRef(Interface &pm, const char *name, NvParameterized::Interface *val, bool doDestroyOld = false) ; - -/// helper function to init an NvParameterized value -PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, bool doDestroyOld = false); -/// helper function to init an NvParameterized value -PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, const char *objName, bool doDestroyOld = false); - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamI8(const Interface &pm, const char *name, int8_t &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamI8(Interface &pm, const char *name, int8_t val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamI16(const Interface &pm, const char *name, int16_t &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamI16(Interface &pm, const char *name, int16_t val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamI32(const Interface &pm, const char *name, int32_t &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamI32(Interface &pm, const char *name, int32_t val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamI64(const Interface &pm, const char *name, int64_t &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamI64(Interface &pm, const char *name, int64_t val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamU8(const Interface &pm, const char *name, uint8_t &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamU8(Interface &pm, const char *name, uint8_t val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamU16(const Interface &pm, const char *name, uint16_t &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamU16(Interface &pm, const char *name, uint16_t val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamU32(const Interface &pm, const char *name, uint32_t &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamU32(Interface &pm, const char *name, uint32_t val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamU64(const Interface &pm, const char *name, uint64_t &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamU64(Interface &pm, const char *name, uint64_t val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamF32(const Interface &pm, const char *name, float &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamF32(Interface &pm, const char *name, float val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamF64(const Interface &pm, const char *name, double &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamF64(Interface &pm, const char *name, double val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamVec2(const Interface &pm, const char *name, physx::PxVec2 &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamVec2(Interface &pm, const char *name, const physx::PxVec2 &val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamVec3(const Interface &pm, const char *name, physx::PxVec3 &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamVec3(Interface &pm, const char *name, const physx::PxVec3 &val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamVec4(const Interface &pm, const char *name, physx::PxVec4 &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamVec4(Interface &pm, const char *name, const physx::PxVec4 &val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamQuat(const Interface &pm, const char *name, physx::PxQuat &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamQuat(Interface &pm, const char *name, const physx::PxQuat &val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamMat33(const Interface &pm, const char *name, physx::PxMat33 &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamMat33(Interface &pm, const char *name, const physx::PxMat33 &val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamMat44(const Interface &pm, const char *name, physx::PxMat44 &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamMat44(Interface &pm, const char *name, const physx::PxMat44 &val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamBounds3(const Interface &pm, const char *name, physx::PxBounds3 &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamBounds3(Interface &pm, const char *name, const physx::PxBounds3 &val) ; - -/// helper function to get an NvParameterized value -PX_INLINE bool getParamTransform(const Interface &pm, const char *name, physx::PxTransform &val); -/// helper function to set an NvParameterized value -PX_INLINE bool setParamTransform(Interface &pm, const char *name, const physx::PxTransform &val) ; - -} // namespace NvParameterized - - -#include "NvParamUtils.inl" - -#endif // NV_PARAM_UTILS_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef NV_PARAM_UTILS_H
+#define NV_PARAM_UTILS_H
+
+#include "NvParameterized.h"
+
+// utility methods to operate on NvParameterized data.
+
+namespace NvParameterized
+{
+
+/**
+\brief Recursively finds a parameter with the given name
+
+This method will recursively search through not only this parameterized but all referenced
+parameterized objects as well. It sets the handle and returns the NvParameterized::Interface in which the name was found.
+
+\param i the parameterized object that will be searched
+
+\param longName contains the name of the parameter to be found
+the longName will work with arrays, structs, and included references
+
+\param outHandle will contain the output handle that provides read-only access to the specified parameter
+
+\returns the NvParameterized::Interface pointer in which the parameter is contained (this could be different than the top level NvParameterized::Interface if the parameter is contained in an included reference)
+*/
+PX_INLINE const Interface * findParam(const Interface &i,const char *longName, Handle &outHandle);
+
+
+/**
+\brief Recursively finds a parameter with the given name
+
+This method will recursively search through not only this parameterized but all referenced
+parameterized objects as well. It sets the handle and returns the NvParameterized::Interface in which the name was found.
+
+\param i the parameterized object that will be searched
+
+\param longName contains the name of the parameter to be found
+the longName will work with arrays, structs, and included references
+
+\param outHandle will contain the output handle that provides read-write access to the specified parameter
+
+\returns the NvParameterized::Interface pointer in which the parameter is contained (this could be different than the top level NvParameterized::Interface if the parameter is contained in an included reference)
+*/
+PX_INLINE Interface * findParam(Interface &i,const char *longName, Handle &outHandle);
+
+/**
+\brief Container for results of getParamList
+*/
+struct ParamResult
+{
+public:
+ /**
+ \brief Constructor
+ */
+ ParamResult(const char *name,
+ const char *longName,
+ const char *className,
+ const char *instanceName,
+ const Handle &handle,
+ int32_t arraySize,
+ DataType type)
+ : mArraySize(arraySize),
+ mInstanceName(instanceName),
+ mClassName(className),
+ mName(name),
+ mLongName(longName),
+ mHandle(handle),
+ mDataType(type)
+ {}
+
+ /**
+ \brief size of array (if parameter is array)
+ */
+ int32_t mArraySize;
+
+ /**
+ \brief Name of parameter's parent object
+ */
+ const char *mInstanceName;
+
+ /**
+ \brief Name of NvParameterized-class of parameter's parent object
+ */
+ const char *mClassName;
+
+ /**
+ \brief The name of the parameter
+ */
+ const char *mName;
+
+ /**
+ \brief The fully qualified 'long' name of the parameter
+ */
+ const char *mLongName;
+
+ /**
+ \brief Use this handle to access the parameter in question
+ */
+ Handle mHandle;
+
+ /**
+ \brief The type of parameter
+ */
+ DataType mDataType;
+};
+
+/**
+\brief A helper method to retrieve the list of all parameters relative to an interface.
+
+\param [in] i the input interface
+\param [in] className is an optional class name to match to. If this is null, it will return all parameters.
+\param [in] paramName is an optional parameter name to match to. If this is null, it will return all parameters.
+\param [out] count the number of parameters found
+\param [in] recursive if true the search will recurse into every included reference, not just the top parameterized class
+\param [in] classesOnly if true the search will only match against class names
+\param [in] traits typically the APEX traits class, used to allocate the ParamResult, see ApexSDK::getParameterizedTraits()
+
+\note The return pointer is allocated by the NvParameterized Traits class and should be freed by calling releaseParamList()
+
+*/
+PX_INLINE const ParamResult * getParamList(const Interface &i,
+ const char *className, // name of class to match
+ const char *paramName, // name of parameter to match
+ uint32_t &count,
+ bool recursive,
+ bool classesOnly,
+ NvParameterized::Traits *traits);
+
+/// helper function to free the parameter list returned from getParamList
+PX_INLINE void releaseParamList(uint32_t resultCount,const ParamResult *results,NvParameterized::Traits *traits);
+
+/// helper function to get an NvParameterized array size
+PX_INLINE bool getParamArraySize(const Interface &pm, const char *name, int32_t &arraySize);
+
+/// helper function to resize an NvParameterized array
+PX_INLINE bool resizeParamArray(Interface &pm, const char *name, int32_t newSize);
+
+/**
+\brief Callback container for getNamedReferences
+*/
+class NamedReferenceInterface
+{
+public:
+ /**
+ \brief Destructor
+ */
+ virtual ~NamedReferenceInterface() {}
+ /**
+ \brief Callback
+
+ Calls back to the user with any named reference (not included references) in the NvParameterized::Interface
+ If the user returns a NULL pointer, than the original named reference is left alone.
+ If the user returns a non-NULL pointer, than the named reference is replaced with the 'const char *' returned.
+ */
+ virtual const char * namedReferenceCallback(const char *className,const char *namedReference,Handle &handle) = 0;
+};
+
+/// Calls back for every non-included named reference.
+PX_INLINE uint32_t getNamedReferences(const Interface &i,
+ NamedReferenceInterface &namedReference,
+ bool recursive);
+
+/**
+\brief Callback container for getReferences
+*/
+class ReferenceInterface
+{
+public:
+ /**
+ \brief Destructor
+ */
+ virtual ~ReferenceInterface() {}
+ /**
+ \brief Callback
+
+ Calls back to the user with any reference (named or included or both) in the NvParameterized::Interface.
+ */
+ virtual void referenceCallback(Handle &handle) = 0;
+};
+
+/// Calls back for every reference (named or included or both).
+PX_INLINE void getReferences(const Interface &iface,
+ ReferenceInterface &cb,
+ bool named,
+ bool included,
+ bool recursive);
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamBool(const Interface &pm, const char *name, bool &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamBool(Interface &pm, const char *name, bool val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamString(const Interface &pm, const char *name, const char *&val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamString(Interface &pm, const char *name, const char *val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamEnum(const Interface &pm, const char *name, const char *&val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamEnum(Interface &pm, const char *name, const char *val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamRef(const Interface &pm, const char *name, NvParameterized::Interface *&val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamRef(Interface &pm, const char *name, NvParameterized::Interface *val, bool doDestroyOld = false) ;
+
+/// helper function to init an NvParameterized value
+PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, bool doDestroyOld = false);
+/// helper function to init an NvParameterized value
+PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, const char *objName, bool doDestroyOld = false);
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamI8(const Interface &pm, const char *name, int8_t &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamI8(Interface &pm, const char *name, int8_t val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamI16(const Interface &pm, const char *name, int16_t &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamI16(Interface &pm, const char *name, int16_t val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamI32(const Interface &pm, const char *name, int32_t &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamI32(Interface &pm, const char *name, int32_t val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamI64(const Interface &pm, const char *name, int64_t &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamI64(Interface &pm, const char *name, int64_t val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamU8(const Interface &pm, const char *name, uint8_t &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamU8(Interface &pm, const char *name, uint8_t val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamU16(const Interface &pm, const char *name, uint16_t &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamU16(Interface &pm, const char *name, uint16_t val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamU32(const Interface &pm, const char *name, uint32_t &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamU32(Interface &pm, const char *name, uint32_t val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamU64(const Interface &pm, const char *name, uint64_t &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamU64(Interface &pm, const char *name, uint64_t val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamF32(const Interface &pm, const char *name, float &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamF32(Interface &pm, const char *name, float val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamF64(const Interface &pm, const char *name, double &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamF64(Interface &pm, const char *name, double val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamVec2(const Interface &pm, const char *name, physx::PxVec2 &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamVec2(Interface &pm, const char *name, const physx::PxVec2 &val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamVec3(const Interface &pm, const char *name, physx::PxVec3 &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamVec3(Interface &pm, const char *name, const physx::PxVec3 &val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamVec4(const Interface &pm, const char *name, physx::PxVec4 &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamVec4(Interface &pm, const char *name, const physx::PxVec4 &val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamQuat(const Interface &pm, const char *name, physx::PxQuat &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamQuat(Interface &pm, const char *name, const physx::PxQuat &val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamMat33(const Interface &pm, const char *name, physx::PxMat33 &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamMat33(Interface &pm, const char *name, const physx::PxMat33 &val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamMat44(const Interface &pm, const char *name, physx::PxMat44 &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamMat44(Interface &pm, const char *name, const physx::PxMat44 &val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamBounds3(const Interface &pm, const char *name, physx::PxBounds3 &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamBounds3(Interface &pm, const char *name, const physx::PxBounds3 &val) ;
+
+/// helper function to get an NvParameterized value
+PX_INLINE bool getParamTransform(const Interface &pm, const char *name, physx::PxTransform &val);
+/// helper function to set an NvParameterized value
+PX_INLINE bool setParamTransform(Interface &pm, const char *name, const physx::PxTransform &val) ;
+
+} // namespace NvParameterized
+
+
+#include "NvParamUtils.inl"
+
+#endif // NV_PARAM_UTILS_H
diff --git a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.inl b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.inl index cb82f8b..b27b9c9 100644..100755 --- a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.inl +++ b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParamUtils.inl @@ -1,1367 +1,1367 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. -#include "NvParameterized.h" -#include "NvParameterizedTraits.h" - -namespace NvParameterized -{ - -#if PX_VC && !PX_PS4 - #pragma warning(push) - #pragma warning(disable: 4996) -#endif //!PX_PS4 - -#define MAX_SEARCH_NAME 1024 -#define MAX_SEARCH_NAMES 32 - -/// local_strcmp -int32_t local_strcmp(const char* s1, const char* s2); -/// local_stricmp -int32_t local_stricmp(const char* s1, const char* s2); - -/// Finds parameter in NvParameterized -struct ParameterFind -{ - /// Contructor - ParameterFind(const NvParameterized::Interface &iface) : mNameIndex(0), mNameCount(0), mResult(iface), mInterface(NULL), mError(false) - { - - } - - /// isDigit - bool isDigit(char c) const - { - return (c>='0' && c <='9'); - } - - /// setSearchName - bool setSearchName(const char *str) - { - bool ret = true; - - mNameIndex = 0; - mNameCount = 0; - mInterface = 0; - mError = false; - char *dest = mSearchName; - char *stop = &mSearchName[MAX_SEARCH_NAME-1]; - - char *head = mSearchName; - mArrayIndex[0] = -1; - - while ( *str && dest < stop ) - { - if ( *str == '[' ) - { - *dest++ = 0; - str++; - if ( isDigit(*str) ) - { - int32_t v = 0; - while ( isDigit(*str) ) - { - int32_t iv = *str-'0'; - v = v*10+iv; - str++; - } - if ( *str == ']' ) - { - mArrayIndex[mNameCount] = v; - } - else - { - ret = false; - break; - } - } - else - { - ret = false; - break; - } - } - else - { - if ( *str == '.' ) - { - if ( mNameCount < MAX_SEARCH_NAMES ) - { - mSearchNames[mNameCount] = head; - mNameCount++; - if ( mNameCount < MAX_SEARCH_NAMES ) - { - mArrayIndex[mNameCount] = -1; - } - *dest++ = 0; - str++; - head = dest; - } - else - { - ret = false; - break; - } - } - else - { - *dest++ = *str++; - } - } - } - - *dest = 0; - - if ( head && *head ) - { - if ( mNameCount < MAX_SEARCH_NAMES ) - { - mSearchNames[mNameCount] = head; - mNameCount++; - *dest++ = 0; - str++; - head = dest; - } - else - { - ret = false; - } - } - - return ret; - } - - /// done - bool done(void) const - { - bool ret = false; - if ( mInterface || mError ) ret = true; - return ret; - } - - /// getArrayIndex - int32_t getArrayIndex(void) - { - return mArrayIndex[mNameIndex]; - } - - /// nameMatch - bool nameMatch(const char *longName) const - { - bool ret = true; - - if (longName && strlen(longName)) - { -#if PX_GCC || PX_LINUX || PX_PS4 || PX_ANDROID || PX_OSX || PX_CLANG - if ( local_stricmp(longName,mSearchNames[mNameIndex]) == 0 ) -#else -#pragma warning(push) -#pragma warning(disable: 4996) - - if ( _stricmp(longName,mSearchNames[mNameIndex]) == 0 ) - -#pragma warning(pop) -#endif - { - ret = true; - } - else - { - ret = false; - } - } - - return ret; - } - - /// isCompleete - bool isComplete(void) const - { - return (mNameIndex+1) == mNameCount; - } - - /// pushNameMatch - bool pushNameMatch(void) - { - bool ret = false; - - if ( (mNameIndex+1) < mNameCount ) - { - mNameIndex++; - ret = true; - } - return ret; - } - - /// popNameMatch - void popNameMatch(void) - { - if ( mNameIndex ) - { - mNameIndex--; - } - } - - uint32_t mNameIndex; ///< mNameIndex - uint32_t mNameCount; ///< mNameCount - Handle mResult; ///< mResult - const NvParameterized::Interface *mInterface; ///< mInterface - bool mError; ///< mError; - char mSearchName[MAX_SEARCH_NAME]; ///< mSearchName - char *mSearchNames[MAX_SEARCH_NAMES]; ///< mSearchNames - int32_t mArrayIndex[MAX_SEARCH_NAMES]; ///< mArrayIndex -}; - -/// findParameter -PX_INLINE void findParameter(const NvParameterized::Interface &obj, - Handle &handle, - ParameterFind &pf, - bool fromArray=false) -{ - if ( pf.done() ) return; - - if ( handle.numIndexes() < 1 ) - { - obj.getParameterHandle("",handle); - } - - const Definition *pd = handle.parameterDefinition(); - const char *name = pd->name(); - DataType t = pd->type(); - - if ( fromArray || pf.nameMatch(name) ) - { - NvParameterized::Interface *paramPtr = 0; - if ( t == TYPE_REF ) - { - handle.getParamRef(paramPtr); - if ( paramPtr ) - { - if ( pf.pushNameMatch() ) - { - Handle newHandle(*paramPtr, ""); - findParameter(*paramPtr,newHandle,pf); - pf.popNameMatch(); - } - } - if ( pf.isComplete() ) - { - pf.mInterface = &obj; - pf.mResult = handle; - } - } - if ( t == TYPE_STRUCT ) - { - bool pushed = false; - if ( strlen(name) ) - { - pf.pushNameMatch(); - pushed = true; - } - int32_t count = pd->numChildren(); - for (int32_t i=0; i<count; i++) - { - handle.set(i); - findParameter(obj,handle,pf); - handle.popIndex(); - if ( pf.done() ) break; - } - if ( pushed ) - { - pf.popNameMatch(); - } - } - else if ( t == TYPE_ARRAY ) - { - int32_t arraySize; - handle.getArraySize(arraySize); - int32_t arrayIndex = pf.getArrayIndex(); - if ( arrayIndex == -1 && pf.isComplete() ) - { - pf.mInterface = &obj; - pf.mResult = handle; - } - else if ( arrayIndex >= 0 && arrayIndex < arraySize ) - { - handle.set(arrayIndex); - if ( pf.isComplete() ) - { - pf.mInterface = &obj; - pf.mResult = handle; - } - else - { - findParameter(obj,handle,pf,true); - } - handle.popIndex(); - } - else - { - - pf.mError = true; - } - } - else if ( pf.isComplete() ) - { - pf.mInterface = &obj; - pf.mResult = handle; - } - } -} - -PX_INLINE const Interface *findParam(const Interface &i,const char *long_name, Handle &result) -{ - const Interface *ret = 0; - result.setInterface((const NvParameterized::Interface *)0); - - ParameterFind pf(i); - if ( pf.setSearchName(long_name) ) - { - Handle handle(i); - findParameter(i,handle,pf); - result = pf.mResult; - ret = pf.mInterface; - } - return ret; -} - -PX_INLINE Interface *findParam(Interface &i,const char *long_name, Handle &result) -{ - Interface *ret = const_cast<Interface *>( - findParam(const_cast<const Interface &>(i),long_name,result)); - result.setInterface(ret); // Give write access to handle - return ret; -} - -/// Parameter list -struct ParameterList -{ - /// Constructor - ParameterList(const NvParameterized::Interface &iface,const char *className,const char *paramName,bool recursive,bool classesOnly,NvParameterized::Traits *traits) - : mNameIndex(0), - mResult(iface), - mInterface(NULL), - mClassName(className), - mParamName(paramName), - mRecursive(recursive), - mClassesOnly(classesOnly), - mTraits(traits), - mResultCount(0), - mMaxResults(0), - mResults(NULL) - { - - } - - ~ParameterList(void) - { - } - - /// nameMatch - bool nameMatch(const Interface *iface,const char * name,int32_t arrayIndex,DataType type,Handle &handle) - { - size_t slen = strlen(name); - - if ( mClassesOnly ) - { - if ( slen > 0 ) return true; - } - else - { - if ( slen == 0 ) return true; - } - - bool match = true; - if ( mClassName ) - { - const char *cname = iface->className(); - if ( local_strcmp(cname,mClassName) != 0 || strlen(name) ) - { - match = false; - } - } - if ( mParamName ) // if we specified a parameter name, than only include exact matches of this parameter name. - { - if (local_strcmp(mParamName,name) != 0 ) - { - match = false; - } - - } - if ( match ) - { - // ok..let's build the long name... - const char *longName = NULL; - char scratch[1024]; - scratch[0] = 0; - - if ( slen > 0 ) - { - - for (uint32_t i=0; i<mNameIndex; i++) - { - local_strcat_s(scratch, sizeof(scratch), mSearchName[i]); - if ( mArrayIndex[i] > 0 ) - { - char arrayIndexStr[32]; - arrayIndexStr[0] = 0; - local_strcat_s(arrayIndexStr, sizeof(arrayIndexStr), "[0]"); - //sprintf_s(arrayIndexStr, sizeof(arrayIndexStr), "[%d]", 0); //mArrayIndex[i]); - local_strcat_s(scratch, sizeof(scratch), arrayIndexStr); - } - local_strcat_s(scratch, sizeof(scratch),"."); - } - - local_strcat_s(scratch, sizeof(scratch),name); - uint32_t len = (uint32_t)strlen(scratch); - char *temp = (char *)mTraits->alloc(len+1); - temp[0] = 0; - local_strcat_s(temp, len+1, scratch); - longName = temp; - if ( type == TYPE_ARRAY ) - { - handle.getArraySize(arrayIndex); - } - } - - ParamResult pr(name,longName,iface->className(),iface->name(), handle, arrayIndex, type ); - - if ( mResultCount >= mMaxResults ) - { - mMaxResults = mMaxResults ? mMaxResults*2 : 32; - ParamResult *results = (ParamResult *)mTraits->alloc(sizeof(ParamResult)*mMaxResults); - if ( mResults ) - { - for (uint32_t i=0; i<mResultCount; i++) - { - results[i] = mResults[i]; - } - } - mResults = results; - } - mResults[mResultCount] = pr; - mResultCount++; - } - - return true; // always matches.... - } - - /// pushName - bool pushName(const char *name,int32_t arrayIndex) - { - mSearchName[mNameIndex] = name; - mArrayIndex[mNameIndex] = arrayIndex; - mNameIndex++; - return true; - } - - /// popNameMatch - void popNameMatch(void) - { - if ( mNameIndex ) - { - mNameIndex--; - } - } - - /// isRecursive - bool isRecursive(void) const { return mRecursive; } - - /// getResultCount - uint32_t getResultCount(void) const { return mResultCount; } - - /// getResults - ParamResult * getResults(void) const { return mResults; } - - uint32_t mNameIndex; ///< mNameIndex - Handle mResult; ///< mResult - const NvParameterized::Interface *mInterface; ///< mInterface - const char * mClassName; ///< mClassName - const char * mParamName; ///< mParamName - bool mRecursive; ///< mRecursive - bool mClassesOnly; ///< mClassesOnly - NvParameterized::Traits *mTraits; ///< mTraits - uint32_t mResultCount; ///< mResultCount - uint32_t mMaxResults; ///< mMaxResults - ParamResult *mResults; ///< mResults - const char *mSearchName[MAX_SEARCH_NAME]; ///< mSearchName - int32_t mArrayIndex[MAX_SEARCH_NAME]; ///< mArrayIndex - -}; - -/// listParameters -PX_INLINE void listParameters(const NvParameterized::Interface &obj, - Handle &handle, - ParameterList &pf, - int32_t parentArraySize) -{ - if ( handle.numIndexes() < 1 ) - { - obj.getParameterHandle("",handle); - } - - const Definition *pd = handle.parameterDefinition(); - const char *name = pd->name(); - DataType t = pd->type(); - - if ( pf.nameMatch(&obj,name,parentArraySize,t,handle) ) - { - NvParameterized::Interface *paramPtr = 0; - if ( t == TYPE_REF ) - { - handle.getParamRef(paramPtr); - } - if ( t == TYPE_STRUCT ) - { - bool pushed=false; - if ( strlen(name) ) - { - pf.pushName(name,parentArraySize); - pushed = true; - } - int32_t count = pd->numChildren(); - for (int32_t i=0; i<count; i++) - { - handle.set(i); - listParameters(obj,handle,pf,0); - handle.popIndex(); - } - if ( pushed ) - { - pf.popNameMatch(); - } - } - else if ( t == TYPE_ARRAY ) - { - int32_t arraySize; - handle.getArraySize(arraySize); - if ( arraySize > 0 ) - { - for (int32_t i=0; i<arraySize; i++) - { - handle.set(i); - listParameters(obj,handle,pf,arraySize); - const Definition *elemPd = handle.parameterDefinition(); - DataType elemType = elemPd->type(); - handle.popIndex(); - if ( !(elemType == TYPE_STRUCT || elemType == TYPE_ARRAY || elemType == TYPE_REF) ) - { - break; - } - } - } - } - else if ( t == TYPE_REF && pf.isRecursive() ) - { - if ( paramPtr && pd->isIncludedRef() ) - { - if ( pf.pushName(name,parentArraySize) ) - { - Handle newHandle(*paramPtr, ""); - listParameters(*paramPtr,newHandle,pf,0); - pf.popNameMatch(); - } - } - } - } -} - - -/** -\brief Gets every parameter in an NvParameterized Interface class -\note The return pointer is allocated by the NvParameterized Traits class and should be freed by calling releaseParamList -*/ -PX_INLINE const ParamResult * getParamList(const Interface &i,const char *className,const char *paramName,uint32_t &count,bool recursive,bool classesOnly,NvParameterized::Traits *traits) -{ - - PX_UNUSED(className); - - ParameterList pl(i,className,paramName,recursive,classesOnly,traits); - - Handle handle(i); - listParameters(i,handle,pl,0); - - count = pl.getResultCount(); - - return pl.getResults(); -} - -PX_INLINE void releaseParamList(uint32_t resultCount,const ParamResult *results,NvParameterized::Traits *traits) -{ - if ( results ) - { - for (uint32_t i=0; i<resultCount; i++) - { - const ParamResult &r = results[i]; - if ( r.mLongName ) - { - traits->free( (void *)r.mLongName ); - } - } - traits->free((void *)results); - } -} - -/// Calls back for every reference. -PX_INLINE void getReferences(const Interface &iface, - Handle &handle, - ReferenceInterface &cb, - bool named, - bool included, - bool recursive) -{ - if ( handle.numIndexes() < 1 ) - iface.getParameterHandle("",handle); - - NvParameterized::Interface *paramPtr = 0; - - const Definition *pd = handle.parameterDefinition(); - switch( pd->type() ) - { - case TYPE_REF: - handle.getParamRef(paramPtr); - if ( !paramPtr ) - break; - - if ( !pd->isIncludedRef() ) - { - if( named ) - cb.referenceCallback(handle); - } - else - { - if( included ) - cb.referenceCallback(handle); - - if ( recursive ) - { - Handle newHandle(*paramPtr, ""); - getReferences(*paramPtr,newHandle,cb,named,included,recursive); - } - } - break; - - case TYPE_STRUCT: - { - int32_t count = pd->numChildren(); - for (int32_t i=0; i<count; i++) - { - handle.set(i); - getReferences(iface,handle,cb,named,included,recursive); - handle.popIndex(); - } - - break; - } - - case TYPE_ARRAY: - { - int32_t arraySize; - handle.getArraySize(arraySize); - if ( arraySize <= 0 ) - break; - - const Definition *elemPd = pd->child(0); - bool scan = elemPd->type() == TYPE_ARRAY || elemPd->type() == TYPE_REF || elemPd->type() == TYPE_STRUCT; - - if ( scan ) - { - for (int32_t i=0; i<arraySize; i++) - { - handle.set(i); - getReferences(iface,handle,cb,named,included,recursive); - handle.popIndex(); - } - } - - break; - } -NV_PARAMETRIZED_NO_AGGREGATE_AND_REF_DATATYPE_LABELS - default: - break; - } -} - -PX_INLINE void getReferences(const Interface &i, - ReferenceInterface &cb, - bool named, - bool included, - bool recursive) -{ - Handle handle(i); - getReferences(i,handle,cb,named,included,recursive); -} - -/// WrappedNamedReference -class WrappedNamedReference: public ReferenceInterface -{ - NamedReferenceInterface &wrappedReference; - - ///Silence warnings on unable to generate assignment operator - template<typename T> void operator =(T) {} - void operator =(WrappedNamedReference) {} -public: - - /// refCount - uint32_t refCount; - - virtual ~WrappedNamedReference() {} - - /// Constructor - WrappedNamedReference(NamedReferenceInterface &wrappedReference_): wrappedReference(wrappedReference_), refCount(0) {} - - /// referenceCallback - void referenceCallback(Handle &handle) - { - Interface *iface; - handle.getParamRef(iface); - const char *name = wrappedReference.namedReferenceCallback(iface->className(), iface->name(), handle); - if( name ) - { - iface->setName(name); - ++refCount; - } - } -}; - -PX_INLINE uint32_t getNamedReferences(const Interface &i, - NamedReferenceInterface &namedReference, - bool recursive) -{ - WrappedNamedReference reference(namedReference); - getReferences(i, reference, true, false, recursive); - return reference.refCount; -} - - -PX_INLINE bool getParamBool(const Interface &pm, const char *name, bool &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamBool(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamBool(Interface &pm, const char *name, bool value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamBool(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// string -PX_INLINE bool getParamString(const Interface &pm, const char *name, const char *&value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamString(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamString(Interface &pm, const char *name, const char *value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamString(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// enum -PX_INLINE bool getParamEnum(const Interface &pm, const char *name, const char *&value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamEnum(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamEnum(Interface &pm, const char *name, const char *value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamEnum(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// reference -PX_INLINE bool getParamRef(const Interface &pm, const char *name, NvParameterized::Interface *&value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamRef(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamRef(Interface &pm, const char *name, NvParameterized::Interface *value, bool doDestroyOld) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamRef(value, doDestroyOld); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, bool doDestroyOld) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.initParamRef(className, doDestroyOld); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, const char *objName, bool doDestroyOld) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.initParamRef(className, doDestroyOld); - NvParameterized::Interface *ref; - handle.getParamRef(ref); - if (ref) - ref->setName(objName); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// I8 -PX_INLINE bool getParamI8(const Interface &pm, const char *name, int8_t &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamI8(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamI8(Interface &pm, const char *name, int8_t value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamI8(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// I16 -PX_INLINE bool getParamI16(const Interface &pm, const char *name, int16_t &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamI16(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamI16(Interface &pm, const char *name, int16_t value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamI16(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// I32 -PX_INLINE bool getParamI32(const Interface &pm, const char *name, int32_t &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamI32(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamI32(Interface &pm, const char *name, int32_t value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamI32(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// I64 -PX_INLINE bool getParamI64(const Interface &pm, const char *name, int64_t &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamI64(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamI64(Interface &pm, const char *name, int64_t value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamI64(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// U8 -PX_INLINE bool getParamU8(const Interface &pm, const char *name, uint8_t &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamU8(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamU8(Interface &pm, const char *name, uint8_t value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamU8(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// U16 -PX_INLINE bool getParamU16(const Interface &pm, const char *name, uint16_t &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamU16(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamU16(Interface &pm, const char *name, uint16_t value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamU16(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// U32 -PX_INLINE bool getParamU32(const Interface &pm, const char *name, uint32_t &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamU32(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamU32(Interface &pm, const char *name, uint32_t value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamU32(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// U64 -PX_INLINE bool getParamU64(const Interface &pm, const char *name, uint64_t &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamU64(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamU64(Interface &pm, const char *name, uint64_t value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamU64(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// F32 -PX_INLINE bool getParamF32(const Interface &pm, const char *name, float &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamF32(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamF32(Interface &pm, const char *name, float value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamF32(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// F64 -PX_INLINE bool getParamF64(const Interface &pm, const char *name, double &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamF64(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamF64(Interface &pm, const char *name, double value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamF64(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// Vec2 -PX_INLINE bool getParamVec2(const Interface &pm, const char *name, physx::PxVec2 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamVec2(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamVec2(Interface &pm, const char *name, const physx::PxVec2 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamVec2(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// Vec3 -PX_INLINE bool getParamVec3(const Interface &pm, const char *name, physx::PxVec3 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamVec3(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamVec3(Interface &pm, const char *name, const physx::PxVec3 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamVec3(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// Vec4 -PX_INLINE bool getParamVec4(const Interface &pm, const char *name, physx::PxVec4 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamVec4(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamVec4(Interface &pm, const char *name, const physx::PxVec4 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamVec4(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// Quat -PX_INLINE bool getParamQuat(const Interface &pm, const char *name, physx::PxQuat &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamQuat(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamQuat(Interface &pm, const char *name, const physx::PxQuat &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamQuat(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// Bounds3 -PX_INLINE bool getParamBounds3(const Interface &pm, const char *name, physx::PxBounds3 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamBounds3(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamBounds3(Interface &pm, const char *name, const physx::PxBounds3 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamBounds3(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// Mat33 -PX_INLINE bool getParamMat33(const Interface &pm, const char *name, physx::PxMat33 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamMat33(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamMat33(Interface &pm, const char *name, const physx::PxMat33 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamMat33(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// Mat44 -PX_INLINE bool getParamMat44(const Interface &pm, const char *name, physx::PxMat44 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamMat44(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamMat44(Interface &pm, const char *name, const physx::PxMat44 &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.setParamMat44(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -// Transform -PX_INLINE bool getParamTransform(const Interface &pm, const char *name, physx::PxTransform &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getParamTransform(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool setParamTransform(Interface &pm, const char *name, const physx::PxTransform &value) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - handle.setInterface( iface ); // set mIsConst to false - ret = handle.setParamTransform(value); - } - return (ret == NvParameterized::ERROR_NONE); -} - - -PX_INLINE bool getParamArraySize(const Interface &pm, const char *name, int32_t &arraySize) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - const NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.getArraySize(arraySize); - } - return (ret == NvParameterized::ERROR_NONE); -} - -PX_INLINE bool resizeParamArray(Interface &pm, const char *name, int32_t newSize) -{ - ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME; - NvParameterized::Handle handle(pm); - NvParameterized::Interface *iface = findParam(pm,name,handle); - if ( iface ) - { - ret = handle.resizeArray(newSize); - } - return (ret == NvParameterized::ERROR_NONE); -} - -#if PX_VC && !PX_PS4 - #pragma warning(pop) -#endif //!PX_PS4 - -} +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+#include "NvParameterized.h"
+#include "NvParameterizedTraits.h"
+
+namespace NvParameterized
+{
+
+#if PX_VC && !PX_PS4
+ #pragma warning(push)
+ #pragma warning(disable: 4996)
+#endif //!PX_PS4
+
+#define MAX_SEARCH_NAME 1024
+#define MAX_SEARCH_NAMES 32
+
+/// local_strcmp
+int32_t local_strcmp(const char* s1, const char* s2);
+/// local_stricmp
+int32_t local_stricmp(const char* s1, const char* s2);
+
+/// Finds parameter in NvParameterized
+struct ParameterFind
+{
+ /// Contructor
+ ParameterFind(const NvParameterized::Interface &iface) : mNameIndex(0), mNameCount(0), mResult(iface), mInterface(NULL), mError(false)
+ {
+
+ }
+
+ /// isDigit
+ bool isDigit(char c) const
+ {
+ return (c>='0' && c <='9');
+ }
+
+ /// setSearchName
+ bool setSearchName(const char *str)
+ {
+ bool ret = true;
+
+ mNameIndex = 0;
+ mNameCount = 0;
+ mInterface = 0;
+ mError = false;
+ char *dest = mSearchName;
+ char *stop = &mSearchName[MAX_SEARCH_NAME-1];
+
+ char *head = mSearchName;
+ mArrayIndex[0] = -1;
+
+ while ( *str && dest < stop )
+ {
+ if ( *str == '[' )
+ {
+ *dest++ = 0;
+ str++;
+ if ( isDigit(*str) )
+ {
+ int32_t v = 0;
+ while ( isDigit(*str) )
+ {
+ int32_t iv = *str-'0';
+ v = v*10+iv;
+ str++;
+ }
+ if ( *str == ']' )
+ {
+ mArrayIndex[mNameCount] = v;
+ }
+ else
+ {
+ ret = false;
+ break;
+ }
+ }
+ else
+ {
+ ret = false;
+ break;
+ }
+ }
+ else
+ {
+ if ( *str == '.' )
+ {
+ if ( mNameCount < MAX_SEARCH_NAMES )
+ {
+ mSearchNames[mNameCount] = head;
+ mNameCount++;
+ if ( mNameCount < MAX_SEARCH_NAMES )
+ {
+ mArrayIndex[mNameCount] = -1;
+ }
+ *dest++ = 0;
+ str++;
+ head = dest;
+ }
+ else
+ {
+ ret = false;
+ break;
+ }
+ }
+ else
+ {
+ *dest++ = *str++;
+ }
+ }
+ }
+
+ *dest = 0;
+
+ if ( head && *head )
+ {
+ if ( mNameCount < MAX_SEARCH_NAMES )
+ {
+ mSearchNames[mNameCount] = head;
+ mNameCount++;
+ *dest++ = 0;
+ str++;
+ head = dest;
+ }
+ else
+ {
+ ret = false;
+ }
+ }
+
+ return ret;
+ }
+
+ /// done
+ bool done(void) const
+ {
+ bool ret = false;
+ if ( mInterface || mError ) ret = true;
+ return ret;
+ }
+
+ /// getArrayIndex
+ int32_t getArrayIndex(void)
+ {
+ return mArrayIndex[mNameIndex];
+ }
+
+ /// nameMatch
+ bool nameMatch(const char *longName) const
+ {
+ bool ret = true;
+
+ if (longName && strlen(longName))
+ {
+#if PX_GCC || PX_LINUX || PX_PS4 || PX_ANDROID || PX_OSX || PX_CLANG
+ if ( local_stricmp(longName,mSearchNames[mNameIndex]) == 0 )
+#else
+#pragma warning(push)
+#pragma warning(disable: 4996)
+
+ if ( _stricmp(longName,mSearchNames[mNameIndex]) == 0 )
+
+#pragma warning(pop)
+#endif
+ {
+ ret = true;
+ }
+ else
+ {
+ ret = false;
+ }
+ }
+
+ return ret;
+ }
+
+ /// isCompleete
+ bool isComplete(void) const
+ {
+ return (mNameIndex+1) == mNameCount;
+ }
+
+ /// pushNameMatch
+ bool pushNameMatch(void)
+ {
+ bool ret = false;
+
+ if ( (mNameIndex+1) < mNameCount )
+ {
+ mNameIndex++;
+ ret = true;
+ }
+ return ret;
+ }
+
+ /// popNameMatch
+ void popNameMatch(void)
+ {
+ if ( mNameIndex )
+ {
+ mNameIndex--;
+ }
+ }
+
+ uint32_t mNameIndex; ///< mNameIndex
+ uint32_t mNameCount; ///< mNameCount
+ Handle mResult; ///< mResult
+ const NvParameterized::Interface *mInterface; ///< mInterface
+ bool mError; ///< mError;
+ char mSearchName[MAX_SEARCH_NAME]; ///< mSearchName
+ char *mSearchNames[MAX_SEARCH_NAMES]; ///< mSearchNames
+ int32_t mArrayIndex[MAX_SEARCH_NAMES]; ///< mArrayIndex
+};
+
+/// findParameter
+PX_INLINE void findParameter(const NvParameterized::Interface &obj,
+ Handle &handle,
+ ParameterFind &pf,
+ bool fromArray=false)
+{
+ if ( pf.done() ) return;
+
+ if ( handle.numIndexes() < 1 )
+ {
+ obj.getParameterHandle("",handle);
+ }
+
+ const Definition *pd = handle.parameterDefinition();
+ const char *name = pd->name();
+ DataType t = pd->type();
+
+ if ( fromArray || pf.nameMatch(name) )
+ {
+ NvParameterized::Interface *paramPtr = 0;
+ if ( t == TYPE_REF )
+ {
+ handle.getParamRef(paramPtr);
+ if ( paramPtr )
+ {
+ if ( pf.pushNameMatch() )
+ {
+ Handle newHandle(*paramPtr, "");
+ findParameter(*paramPtr,newHandle,pf);
+ pf.popNameMatch();
+ }
+ }
+ if ( pf.isComplete() )
+ {
+ pf.mInterface = &obj;
+ pf.mResult = handle;
+ }
+ }
+ if ( t == TYPE_STRUCT )
+ {
+ bool pushed = false;
+ if ( strlen(name) )
+ {
+ pf.pushNameMatch();
+ pushed = true;
+ }
+ int32_t count = pd->numChildren();
+ for (int32_t i=0; i<count; i++)
+ {
+ handle.set(i);
+ findParameter(obj,handle,pf);
+ handle.popIndex();
+ if ( pf.done() ) break;
+ }
+ if ( pushed )
+ {
+ pf.popNameMatch();
+ }
+ }
+ else if ( t == TYPE_ARRAY )
+ {
+ int32_t arraySize;
+ handle.getArraySize(arraySize);
+ int32_t arrayIndex = pf.getArrayIndex();
+ if ( arrayIndex == -1 && pf.isComplete() )
+ {
+ pf.mInterface = &obj;
+ pf.mResult = handle;
+ }
+ else if ( arrayIndex >= 0 && arrayIndex < arraySize )
+ {
+ handle.set(arrayIndex);
+ if ( pf.isComplete() )
+ {
+ pf.mInterface = &obj;
+ pf.mResult = handle;
+ }
+ else
+ {
+ findParameter(obj,handle,pf,true);
+ }
+ handle.popIndex();
+ }
+ else
+ {
+
+ pf.mError = true;
+ }
+ }
+ else if ( pf.isComplete() )
+ {
+ pf.mInterface = &obj;
+ pf.mResult = handle;
+ }
+ }
+}
+
+PX_INLINE const Interface *findParam(const Interface &i,const char *long_name, Handle &result)
+{
+ const Interface *ret = 0;
+ result.setInterface((const NvParameterized::Interface *)0);
+
+ ParameterFind pf(i);
+ if ( pf.setSearchName(long_name) )
+ {
+ Handle handle(i);
+ findParameter(i,handle,pf);
+ result = pf.mResult;
+ ret = pf.mInterface;
+ }
+ return ret;
+}
+
+PX_INLINE Interface *findParam(Interface &i,const char *long_name, Handle &result)
+{
+ Interface *ret = const_cast<Interface *>(
+ findParam(const_cast<const Interface &>(i),long_name,result));
+ result.setInterface(ret); // Give write access to handle
+ return ret;
+}
+
+/// Parameter list
+struct ParameterList
+{
+ /// Constructor
+ ParameterList(const NvParameterized::Interface &iface,const char *className,const char *paramName,bool recursive,bool classesOnly,NvParameterized::Traits *traits)
+ : mNameIndex(0),
+ mResult(iface),
+ mInterface(NULL),
+ mClassName(className),
+ mParamName(paramName),
+ mRecursive(recursive),
+ mClassesOnly(classesOnly),
+ mTraits(traits),
+ mResultCount(0),
+ mMaxResults(0),
+ mResults(NULL)
+ {
+
+ }
+
+ ~ParameterList(void)
+ {
+ }
+
+ /// nameMatch
+ bool nameMatch(const Interface *iface,const char * name,int32_t arrayIndex,DataType type,Handle &handle)
+ {
+ size_t slen = strlen(name);
+
+ if ( mClassesOnly )
+ {
+ if ( slen > 0 ) return true;
+ }
+ else
+ {
+ if ( slen == 0 ) return true;
+ }
+
+ bool match = true;
+ if ( mClassName )
+ {
+ const char *cname = iface->className();
+ if ( local_strcmp(cname,mClassName) != 0 || strlen(name) )
+ {
+ match = false;
+ }
+ }
+ if ( mParamName ) // if we specified a parameter name, than only include exact matches of this parameter name.
+ {
+ if (local_strcmp(mParamName,name) != 0 )
+ {
+ match = false;
+ }
+
+ }
+ if ( match )
+ {
+ // ok..let's build the long name...
+ const char *longName = NULL;
+ char scratch[1024];
+ scratch[0] = 0;
+
+ if ( slen > 0 )
+ {
+
+ for (uint32_t i=0; i<mNameIndex; i++)
+ {
+ local_strcat_s(scratch, sizeof(scratch), mSearchName[i]);
+ if ( mArrayIndex[i] > 0 )
+ {
+ char arrayIndexStr[32];
+ arrayIndexStr[0] = 0;
+ local_strcat_s(arrayIndexStr, sizeof(arrayIndexStr), "[0]");
+ //sprintf_s(arrayIndexStr, sizeof(arrayIndexStr), "[%d]", 0); //mArrayIndex[i]);
+ local_strcat_s(scratch, sizeof(scratch), arrayIndexStr);
+ }
+ local_strcat_s(scratch, sizeof(scratch),".");
+ }
+
+ local_strcat_s(scratch, sizeof(scratch),name);
+ uint32_t len = (uint32_t)strlen(scratch);
+ char *temp = (char *)mTraits->alloc(len+1);
+ temp[0] = 0;
+ local_strcat_s(temp, len+1, scratch);
+ longName = temp;
+ if ( type == TYPE_ARRAY )
+ {
+ handle.getArraySize(arrayIndex);
+ }
+ }
+
+ ParamResult pr(name,longName,iface->className(),iface->name(), handle, arrayIndex, type );
+
+ if ( mResultCount >= mMaxResults )
+ {
+ mMaxResults = mMaxResults ? mMaxResults*2 : 32;
+ ParamResult *results = (ParamResult *)mTraits->alloc(sizeof(ParamResult)*mMaxResults);
+ if ( mResults )
+ {
+ for (uint32_t i=0; i<mResultCount; i++)
+ {
+ results[i] = mResults[i];
+ }
+ }
+ mResults = results;
+ }
+ mResults[mResultCount] = pr;
+ mResultCount++;
+ }
+
+ return true; // always matches....
+ }
+
+ /// pushName
+ bool pushName(const char *name,int32_t arrayIndex)
+ {
+ mSearchName[mNameIndex] = name;
+ mArrayIndex[mNameIndex] = arrayIndex;
+ mNameIndex++;
+ return true;
+ }
+
+ /// popNameMatch
+ void popNameMatch(void)
+ {
+ if ( mNameIndex )
+ {
+ mNameIndex--;
+ }
+ }
+
+ /// isRecursive
+ bool isRecursive(void) const { return mRecursive; }
+
+ /// getResultCount
+ uint32_t getResultCount(void) const { return mResultCount; }
+
+ /// getResults
+ ParamResult * getResults(void) const { return mResults; }
+
+ uint32_t mNameIndex; ///< mNameIndex
+ Handle mResult; ///< mResult
+ const NvParameterized::Interface *mInterface; ///< mInterface
+ const char * mClassName; ///< mClassName
+ const char * mParamName; ///< mParamName
+ bool mRecursive; ///< mRecursive
+ bool mClassesOnly; ///< mClassesOnly
+ NvParameterized::Traits *mTraits; ///< mTraits
+ uint32_t mResultCount; ///< mResultCount
+ uint32_t mMaxResults; ///< mMaxResults
+ ParamResult *mResults; ///< mResults
+ const char *mSearchName[MAX_SEARCH_NAME]; ///< mSearchName
+ int32_t mArrayIndex[MAX_SEARCH_NAME]; ///< mArrayIndex
+
+};
+
+/// listParameters
+PX_INLINE void listParameters(const NvParameterized::Interface &obj,
+ Handle &handle,
+ ParameterList &pf,
+ int32_t parentArraySize)
+{
+ if ( handle.numIndexes() < 1 )
+ {
+ obj.getParameterHandle("",handle);
+ }
+
+ const Definition *pd = handle.parameterDefinition();
+ const char *name = pd->name();
+ DataType t = pd->type();
+
+ if ( pf.nameMatch(&obj,name,parentArraySize,t,handle) )
+ {
+ NvParameterized::Interface *paramPtr = 0;
+ if ( t == TYPE_REF )
+ {
+ handle.getParamRef(paramPtr);
+ }
+ if ( t == TYPE_STRUCT )
+ {
+ bool pushed=false;
+ if ( strlen(name) )
+ {
+ pf.pushName(name,parentArraySize);
+ pushed = true;
+ }
+ int32_t count = pd->numChildren();
+ for (int32_t i=0; i<count; i++)
+ {
+ handle.set(i);
+ listParameters(obj,handle,pf,0);
+ handle.popIndex();
+ }
+ if ( pushed )
+ {
+ pf.popNameMatch();
+ }
+ }
+ else if ( t == TYPE_ARRAY )
+ {
+ int32_t arraySize;
+ handle.getArraySize(arraySize);
+ if ( arraySize > 0 )
+ {
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ handle.set(i);
+ listParameters(obj,handle,pf,arraySize);
+ const Definition *elemPd = handle.parameterDefinition();
+ DataType elemType = elemPd->type();
+ handle.popIndex();
+ if ( !(elemType == TYPE_STRUCT || elemType == TYPE_ARRAY || elemType == TYPE_REF) )
+ {
+ break;
+ }
+ }
+ }
+ }
+ else if ( t == TYPE_REF && pf.isRecursive() )
+ {
+ if ( paramPtr && pd->isIncludedRef() )
+ {
+ if ( pf.pushName(name,parentArraySize) )
+ {
+ Handle newHandle(*paramPtr, "");
+ listParameters(*paramPtr,newHandle,pf,0);
+ pf.popNameMatch();
+ }
+ }
+ }
+ }
+}
+
+
+/**
+\brief Gets every parameter in an NvParameterized Interface class
+\note The return pointer is allocated by the NvParameterized Traits class and should be freed by calling releaseParamList
+*/
+PX_INLINE const ParamResult * getParamList(const Interface &i,const char *className,const char *paramName,uint32_t &count,bool recursive,bool classesOnly,NvParameterized::Traits *traits)
+{
+
+ PX_UNUSED(className);
+
+ ParameterList pl(i,className,paramName,recursive,classesOnly,traits);
+
+ Handle handle(i);
+ listParameters(i,handle,pl,0);
+
+ count = pl.getResultCount();
+
+ return pl.getResults();
+}
+
+PX_INLINE void releaseParamList(uint32_t resultCount,const ParamResult *results,NvParameterized::Traits *traits)
+{
+ if ( results )
+ {
+ for (uint32_t i=0; i<resultCount; i++)
+ {
+ const ParamResult &r = results[i];
+ if ( r.mLongName )
+ {
+ traits->free( (void *)r.mLongName );
+ }
+ }
+ traits->free((void *)results);
+ }
+}
+
+/// Calls back for every reference.
+PX_INLINE void getReferences(const Interface &iface,
+ Handle &handle,
+ ReferenceInterface &cb,
+ bool named,
+ bool included,
+ bool recursive)
+{
+ if ( handle.numIndexes() < 1 )
+ iface.getParameterHandle("",handle);
+
+ NvParameterized::Interface *paramPtr = 0;
+
+ const Definition *pd = handle.parameterDefinition();
+ switch( pd->type() )
+ {
+ case TYPE_REF:
+ handle.getParamRef(paramPtr);
+ if ( !paramPtr )
+ break;
+
+ if ( !pd->isIncludedRef() )
+ {
+ if( named )
+ cb.referenceCallback(handle);
+ }
+ else
+ {
+ if( included )
+ cb.referenceCallback(handle);
+
+ if ( recursive )
+ {
+ Handle newHandle(*paramPtr, "");
+ getReferences(*paramPtr,newHandle,cb,named,included,recursive);
+ }
+ }
+ break;
+
+ case TYPE_STRUCT:
+ {
+ int32_t count = pd->numChildren();
+ for (int32_t i=0; i<count; i++)
+ {
+ handle.set(i);
+ getReferences(iface,handle,cb,named,included,recursive);
+ handle.popIndex();
+ }
+
+ break;
+ }
+
+ case TYPE_ARRAY:
+ {
+ int32_t arraySize;
+ handle.getArraySize(arraySize);
+ if ( arraySize <= 0 )
+ break;
+
+ const Definition *elemPd = pd->child(0);
+ bool scan = elemPd->type() == TYPE_ARRAY || elemPd->type() == TYPE_REF || elemPd->type() == TYPE_STRUCT;
+
+ if ( scan )
+ {
+ for (int32_t i=0; i<arraySize; i++)
+ {
+ handle.set(i);
+ getReferences(iface,handle,cb,named,included,recursive);
+ handle.popIndex();
+ }
+ }
+
+ break;
+ }
+NV_PARAMETRIZED_NO_AGGREGATE_AND_REF_DATATYPE_LABELS
+ default:
+ break;
+ }
+}
+
+PX_INLINE void getReferences(const Interface &i,
+ ReferenceInterface &cb,
+ bool named,
+ bool included,
+ bool recursive)
+{
+ Handle handle(i);
+ getReferences(i,handle,cb,named,included,recursive);
+}
+
+/// WrappedNamedReference
+class WrappedNamedReference: public ReferenceInterface
+{
+ NamedReferenceInterface &wrappedReference;
+
+ ///Silence warnings on unable to generate assignment operator
+ template<typename T> void operator =(T) {}
+ void operator =(WrappedNamedReference) {}
+public:
+
+ /// refCount
+ uint32_t refCount;
+
+ virtual ~WrappedNamedReference() {}
+
+ /// Constructor
+ WrappedNamedReference(NamedReferenceInterface &wrappedReference_): wrappedReference(wrappedReference_), refCount(0) {}
+
+ /// referenceCallback
+ void referenceCallback(Handle &handle)
+ {
+ Interface *iface;
+ handle.getParamRef(iface);
+ const char *name = wrappedReference.namedReferenceCallback(iface->className(), iface->name(), handle);
+ if( name )
+ {
+ iface->setName(name);
+ ++refCount;
+ }
+ }
+};
+
+PX_INLINE uint32_t getNamedReferences(const Interface &i,
+ NamedReferenceInterface &namedReference,
+ bool recursive)
+{
+ WrappedNamedReference reference(namedReference);
+ getReferences(i, reference, true, false, recursive);
+ return reference.refCount;
+}
+
+
+PX_INLINE bool getParamBool(const Interface &pm, const char *name, bool &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamBool(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamBool(Interface &pm, const char *name, bool value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamBool(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// string
+PX_INLINE bool getParamString(const Interface &pm, const char *name, const char *&value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamString(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamString(Interface &pm, const char *name, const char *value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamString(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// enum
+PX_INLINE bool getParamEnum(const Interface &pm, const char *name, const char *&value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamEnum(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamEnum(Interface &pm, const char *name, const char *value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamEnum(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// reference
+PX_INLINE bool getParamRef(const Interface &pm, const char *name, NvParameterized::Interface *&value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamRef(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamRef(Interface &pm, const char *name, NvParameterized::Interface *value, bool doDestroyOld)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamRef(value, doDestroyOld);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, bool doDestroyOld)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.initParamRef(className, doDestroyOld);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool initParamRef(Interface &pm, const char *name, const char *className, const char *objName, bool doDestroyOld)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.initParamRef(className, doDestroyOld);
+ NvParameterized::Interface *ref;
+ handle.getParamRef(ref);
+ if (ref)
+ ref->setName(objName);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// I8
+PX_INLINE bool getParamI8(const Interface &pm, const char *name, int8_t &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamI8(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamI8(Interface &pm, const char *name, int8_t value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamI8(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// I16
+PX_INLINE bool getParamI16(const Interface &pm, const char *name, int16_t &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamI16(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamI16(Interface &pm, const char *name, int16_t value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamI16(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// I32
+PX_INLINE bool getParamI32(const Interface &pm, const char *name, int32_t &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamI32(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamI32(Interface &pm, const char *name, int32_t value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamI32(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// I64
+PX_INLINE bool getParamI64(const Interface &pm, const char *name, int64_t &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamI64(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamI64(Interface &pm, const char *name, int64_t value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamI64(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// U8
+PX_INLINE bool getParamU8(const Interface &pm, const char *name, uint8_t &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamU8(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamU8(Interface &pm, const char *name, uint8_t value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamU8(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// U16
+PX_INLINE bool getParamU16(const Interface &pm, const char *name, uint16_t &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamU16(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamU16(Interface &pm, const char *name, uint16_t value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamU16(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// U32
+PX_INLINE bool getParamU32(const Interface &pm, const char *name, uint32_t &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamU32(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamU32(Interface &pm, const char *name, uint32_t value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamU32(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// U64
+PX_INLINE bool getParamU64(const Interface &pm, const char *name, uint64_t &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamU64(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamU64(Interface &pm, const char *name, uint64_t value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamU64(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// F32
+PX_INLINE bool getParamF32(const Interface &pm, const char *name, float &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamF32(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamF32(Interface &pm, const char *name, float value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamF32(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// F64
+PX_INLINE bool getParamF64(const Interface &pm, const char *name, double &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamF64(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamF64(Interface &pm, const char *name, double value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamF64(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// Vec2
+PX_INLINE bool getParamVec2(const Interface &pm, const char *name, physx::PxVec2 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamVec2(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamVec2(Interface &pm, const char *name, const physx::PxVec2 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamVec2(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// Vec3
+PX_INLINE bool getParamVec3(const Interface &pm, const char *name, physx::PxVec3 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamVec3(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamVec3(Interface &pm, const char *name, const physx::PxVec3 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamVec3(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// Vec4
+PX_INLINE bool getParamVec4(const Interface &pm, const char *name, physx::PxVec4 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamVec4(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamVec4(Interface &pm, const char *name, const physx::PxVec4 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamVec4(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// Quat
+PX_INLINE bool getParamQuat(const Interface &pm, const char *name, physx::PxQuat &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamQuat(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamQuat(Interface &pm, const char *name, const physx::PxQuat &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamQuat(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// Bounds3
+PX_INLINE bool getParamBounds3(const Interface &pm, const char *name, physx::PxBounds3 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamBounds3(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamBounds3(Interface &pm, const char *name, const physx::PxBounds3 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamBounds3(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// Mat33
+PX_INLINE bool getParamMat33(const Interface &pm, const char *name, physx::PxMat33 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamMat33(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamMat33(Interface &pm, const char *name, const physx::PxMat33 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamMat33(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// Mat44
+PX_INLINE bool getParamMat44(const Interface &pm, const char *name, physx::PxMat44 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamMat44(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamMat44(Interface &pm, const char *name, const physx::PxMat44 &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.setParamMat44(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+// Transform
+PX_INLINE bool getParamTransform(const Interface &pm, const char *name, physx::PxTransform &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getParamTransform(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool setParamTransform(Interface &pm, const char *name, const physx::PxTransform &value)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ handle.setInterface( iface ); // set mIsConst to false
+ ret = handle.setParamTransform(value);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+
+PX_INLINE bool getParamArraySize(const Interface &pm, const char *name, int32_t &arraySize)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ const NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.getArraySize(arraySize);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+PX_INLINE bool resizeParamArray(Interface &pm, const char *name, int32_t newSize)
+{
+ ErrorType ret = NvParameterized::ERROR_INVALID_PARAMETER_NAME;
+ NvParameterized::Handle handle(pm);
+ NvParameterized::Interface *iface = findParam(pm,name,handle);
+ if ( iface )
+ {
+ ret = handle.resizeArray(newSize);
+ }
+ return (ret == NvParameterized::ERROR_NONE);
+}
+
+#if PX_VC && !PX_PS4
+ #pragma warning(pop)
+#endif //!PX_PS4
+
+}
diff --git a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.h b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.h index 902a52b..e584947 100644..100755 --- a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.h +++ b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.h @@ -1,1812 +1,1812 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. - -#ifndef NV_PARAMETERIZED_H -#define NV_PARAMETERIZED_H - -/** - * APEX uses a framework called NvParameterized for storing asset and actor data. - * NvParameterized classes provide reflection on every parameter they include making it - * effective for serialization and auto-generation of user interfaces for tools.<br> - * - * NvParameterized stores data in C++ classes which are auto-generated from their - * descriptions written in a special domain specific language (DSL). Description files - * contain information on internal layout and various high-level metadata of corresponding - * classes and their members. All generated classes implement special interface for - * run time reflection and modification of data. - * */ - -/*! -\file -\brief NvParameterized classes -*/ - -#include "foundation/PxVec2.h" -#include "foundation/PxVec3.h" -#include "foundation/PxVec4.h" -#include "foundation/PxQuat.h" -#include "foundation/PxBounds3.h" -#include "foundation/PxMat44.h" -#include <stdio.h> -#include <stdarg.h> -#include <new> // for placement new - -PX_PUSH_PACK_DEFAULT - -//! \brief NvParameterized namespace -namespace NvParameterized -{ - -class Interface; -class Traits; - -/** -\brief Various errors that may be returned from NvParameterized calls -*/ -enum ErrorType -{ - ERROR_NONE = 0, - ERROR_TYPE_NOT_SUPPORTED, - ERROR_INDEX_OUT_OF_RANGE, - ERROR_INVALID_PARAMETER_NAME, - ERROR_INVALID_PARAMETER_HANDLE, - ERROR_CAST_FAILED, - ERROR_INVALID_ENUM_VAL, - ERROR_SYNTAX_ERROR_IN_NAME, - ERROR_IS_LEAF_NODE, - ERROR_RESULT_BUFFER_OVERFLOW, - ERROR_NAME_DOES_NOT_MATCH_DEFINITION, - ERROR_NOT_AN_ARRAY, - ERROR_ARRAY_SIZE_IS_FIXED, - ERROR_ARRAY_RESIZING_IS_NOT_SUPPORTED, - ERROR_ARRAY_IS_TOO_SMALL, - ERROR_INVALID_ARRAY_DIMENSION, - ERROR_INVALID_ARRAY_SIZE, - ERROR_PARAMETER_HANDLE_DOES_NOT_MATCH_CLASS, - ERROR_MEMORY_ALLOCATION_FAILURE, - ERROR_INVALID_REFERENCE_INCLUDE_HINT, - ERROR_INVALID_REFERENCE_VALUE, - ERROR_PARAMETER_HANDLE_NOT_INITIALIZED, - ERROR_PARAMETER_DEFINITIONS_DO_NOT_MATCH, - ERROR_HANDLE_MISSING_INTERFACE_POINTER, - ERROR_HANDLE_INVALID_INTERFACE_POINTER, - ERROR_INVALID_CALL_ON_NAMED_REFERENCE, - ERROR_NOT_IMPLEMENTED, - ERROR_OBJECT_CONSTRUCTION_FAILED, - ERROR_MODIFY_CONST_HANDLE -}; - -/** -\brief These types are supported in NvParameterized schemas -\warning Do not change values of enums! -*/ -enum DataType -{ - TYPE_UNDEFINED = 0, - - /** - \brief Array type, size may be static or dynamic - \see Definition::arraySizeIsFixed(), Handle::resizeArray(), Handle::getArraySize() - */ - TYPE_ARRAY = 1, - - TYPE_STRUCT = 2, - - TYPE_BOOL = 3, - /** - \brief String type, represented by a const char pointer - \see Handle::getParamString(), Handle::setParamString() - */ - TYPE_STRING = 4, - - /** - \brief Enum type, represented by a const char pointer - \see Definition::numEnumVals(), Definition::enumVal(), Handle::getParamEnum(), Handle::setParamEnum() - */ - TYPE_ENUM = 5, - - /** - \brief Reference type, may be a named or included reference - - References are intended to be used in instances where a class needs either a - named reference (an emitter asset references an IOFX and IOS asset), or an - included reference (a destructible asset that serializes an APEX render mesh). - References may also used to create a unions within a class. Each reference will - contain one or more variants to allow for unions. - - \see Handle::initParamRef(), Definition::numRefVariants(), Definition::refVariantVal(), Handle::initParamRef(), Handle::getParamRef(), Handle::setParamRef() - */ - TYPE_REF = 6, - - TYPE_I8 = 7, - TYPE_I16 = 8, - TYPE_I32 = 9, - TYPE_I64 = 10, - - TYPE_U8 = 11, - TYPE_U16 = 12, - TYPE_U32 = 13, - TYPE_U64 = 14, - - TYPE_F32 = 15, - TYPE_F64 = 16, - - TYPE_VEC2 = 17, - TYPE_VEC3 = 18, - TYPE_VEC4 = 19, - TYPE_QUAT = 20, - TYPE_MAT33 = 21, - TYPE_BOUNDS3 = 23, - TYPE_MAT44 = 24, - - TYPE_POINTER = 25, - - TYPE_TRANSFORM = 26, - - TYPE_MAT34 = 27, - - TYPE_LAST -}; - -/** -\brief Provides hints about the parameter definition - -\see Definition -*/ -class Hint -{ - public: - - /** - \brief Destructor - */ - virtual ~Hint() {} - /** - \brief Returns the name of the hint - */ - virtual const char * name(void) const = 0; - - /** - \brief Returns the type of the hint - */ - virtual DataType type(void) const = 0; - - /** - \brief Returns the unsigned 64-bit value of the hint - \note Undefined results if the type != TYPE_U64 - */ - virtual uint64_t asUInt(void) const = 0; - - /** - \brief Returns the 64-bit floating point value of the hint - \note Undefined results if the type != TYPE_FU64 - */ - virtual double asFloat(void) const = 0; - - /** - \brief Returns the const character pointer for hint - \note Undefined results if the type != TYPE_STRING - */ - virtual const char * asString(void) const = 0; - - /** - \brief Set the value if the hint is a 64bit unsigned type - */ - virtual bool setAsUInt(uint64_t v) = 0; - - private: -}; - -/** -\brief Provides information about a parameter -*/ -class Definition -{ -public: - - /** - \brief Destructor - */ - virtual ~Definition() {} - - /** - \brief Destroys the Definition object and all nested dynamic objects contained within - */ - virtual void destroy() = 0; - - /** - \brief Returns the number of hints in the parameter Definition - */ - virtual int32_t numHints(void) const = 0; - - /** - \brief Returns the Hint located at the index - \returns NULL if index >= Hint::numHints() - */ - virtual const Hint * hint(int32_t index) const = 0; - - /** - \brief Returns the Hint that matches the input name - \returns NULL if name does not match any of the Definition's hints - */ - virtual const Hint * hint(const char *name) const = 0; - - /** - \brief Store parameter hints - \warning Only for internal use - */ - virtual void setHints(const Hint **hints, int32_t n) = 0; - - /** - \brief Add parameter hint - \warning Only for internal use - */ - virtual void addHint(Hint *hint) = 0; - - /** - \brief Returns this Definition's parent Definition - \returns NULL if at the top level - */ - virtual const Definition * parent(void) const = 0; - - /** - \brief Returns this Definition's top most ancestor - */ - virtual const Definition * root(void) const = 0; - - /** - \brief Returns the name of the parameter - */ - virtual const char * name(void) const = 0; - - /** - \brief Returns the long name of the parameter - If the parameter is a member of a struct or an array the long name will contain these - parent names - */ - virtual const char * longName(void) const = 0; - - /** - \brief Returns the name of parameter's struct type - \returns NULL if not struct - */ - virtual const char * structName(void) const = 0; - - /** - \brief Returns the parameter type - */ - virtual DataType type(void) const = 0; - - /** - \brief Return the parameter type in string form - */ - virtual const char* typeString() const = 0; - - /** - \brief Returns the number of variants this parameter could be - A reference is sometimes a union of different types, each different type is referred to as - a "variant". Variants can be used in either included or named references. - */ - virtual int32_t numRefVariants(void) const = 0; - - /** - \brief Given the ref variant name, get its val index - \returns -1 if input ref_val is not found - */ - virtual int32_t refVariantValIndex( const char * ref_val ) const = 0; - - /** - \brief Get the string value of the reference variant - */ - virtual const char * refVariantVal(int32_t index) const = 0; - - /** - \brief Returns the number of enums for the parameter - */ - virtual int32_t numEnumVals(void) const = 0; - - /** - \brief Given the enum string, get the enum val index - \returns -1 if input enum_val is not found - */ - virtual int32_t enumValIndex( const char * enum_val ) const = 0; - - /** - \brief Returns the Enum string located at the index - \returns NULL if index >= Hint::numEnumVals() - */ - virtual const char * enumVal(int32_t index) const = 0; - - /** - \brief Store possible enum values for TYPE_ENUM parameter - \warning Only for internal use - */ - virtual void setEnumVals(const char **enum_vals, int32_t n) = 0; - - /** - \brief Add new enum value to a list of possible enum values for TYPE_ENUM parameter - \warning Only for internal use - */ - virtual void addEnumVal(const char *enum_val) = 0; - - /** - \brief Returns custom alignment if parameter uses it; otherwise returns 0 - */ - virtual uint32_t alignment(void) const = 0; - - /** - \brief Returns custom padding if parameter uses it; otherwise returns 0 - */ - virtual uint32_t padding(void) const = 0; - - /** - \brief Returns the number of dimensions of a static array - */ - virtual int32_t arrayDimension(void) const = 0; - - /** - \brief Returns the array size of a static array - \returns 0 for dynamic arrays - */ - virtual int32_t arraySize(int32_t dimension = 0) const = 0; - - /** - \brief Used to determine if an array is static or dynamic - */ - virtual bool arraySizeIsFixed(void) const = 0; - - /** - \brief Set size of static array - \warning Only for internal use - */ - virtual bool setArraySize(int32_t size) = 0; // -1 if the size is not fixed - - /** - \brief Used to determine if parameter is aggregate (TYPE_STRUCT or TYPE_ARRAY) or not. - */ - virtual bool isLeaf(void) const = 0; - - /** - \brief Used to determine if reference is included or not. - */ - virtual bool isIncludedRef(void) const = 0; - - /** - \brief Returns the number of children (for a struct or static array) - */ - virtual int32_t numChildren(void) const = 0; - - /** - \brief Access definition of i-th child parameter. - */ - virtual const Definition *child(int32_t index) const = 0; - - /** - \brief Access definition of child parameter with given name - \warning Only used with TYPE_STRUCT - */ - virtual const Definition *child(const char *name, int32_t &index) const = 0; - - /** - \brief Store definitions of child parameters - \warning Only for internal use - */ - virtual void setChildren(Definition **children, int32_t n) = 0; - - /** - \brief Add definition of one morechild parameter - \warning Only for internal use - */ - virtual void addChild(Definition *child) = 0; - - /** - \brief Set indices of child handles which must be released when downsizing array - */ - virtual void setDynamicHandleIndicesMap(const uint8_t *indices, uint32_t numIndices) = 0; - - /** - \brief Get indices of child handles which must be released when downsizing array - */ - virtual const uint8_t * getDynamicHandleIndicesMap(uint32_t &outNumIndices) const = 0; - - /** - \brief Used to determine whether type is not an aggregate (array, ref or struct) - \param [in] simpleStructs structure of simple types is also considered simple - \param [in] simpleStrings strings are considered simple - */ - virtual bool isSimpleType(bool simpleStructs = true, bool simpleStrings = true) const = 0; -}; - -/** -\brief Provides access to individual parameters within the NvParameterized object -*/ -class Handle -{ -public: - - enum { MAX_DEPTH = 16 }; - - /** - \brief The constructor takes a pointer (if the user requires an instance before the ::NvParameterized::Interface exists) - */ - PX_INLINE Handle(::NvParameterized::Interface *iface); - - /** - \brief The constructor takes a reference - */ - PX_INLINE Handle(::NvParameterized::Interface &iface); - - /** - \brief The constructor takes a const interface - \note Handles which are constructed from const objects are not allowed to modify them. - */ - PX_INLINE Handle(const ::NvParameterized::Interface &iface); - - /** - \brief Copy constructor - */ - PX_INLINE Handle(const Handle ¶m_handle); - - /** - \brief This constructor allows the user to create a handle that initially points at a particular parameter in the instance - */ - PX_INLINE Handle(::NvParameterized::Interface &instance, const char *longName); - - /** - \brief This constructor allows the user to create a handle that initially points at a particular parameter in the instance - \note Handles which are constructed from const objects are not allowed to modify them. - */ - PX_INLINE Handle(const ::NvParameterized::Interface &instance, const char *longName); - - /** - \brief Get the parameter Definition for the handle's parameter - */ - PX_INLINE const Definition *parameterDefinition(void) const { return(mParameterDefinition); } - - /** - \brief Get the depth of the handle within the NvParameterized object - */ - PX_INLINE int32_t numIndexes(void) const { return(mNumIndexes); } - - /** - \brief Get the index at the specified depth within the NvParameterized object - */ - PX_INLINE int32_t index(int32_t i) const { return(mIndexList[i]); } - - /** - \brief Reduce the handle's depth within the NvParameterized object - */ - PX_INLINE int32_t popIndex(int32_t levels = 1); - - /** - \brief Set the Handle so it references a parameter in the specified instance with the name child_long_name - */ - PX_INLINE ErrorType set(const ::NvParameterized::Interface *instance, const Definition *root, const char *child_long_name); - - /** - \brief Set the Handle so it references a parameter in the specified instance with the name child_long_name - */ - PX_INLINE ErrorType set(const ::NvParameterized::Interface *instance, const char *child_long_name); - - /** - \brief Get the parameter specified by longName and set the Handle to point it - Given a long name like "mystruct.somearray[10].foo", it will return - a handle to that specific parameter. The handle can then be used to - set/get values, as long as it's a handle to a leaf node. - \note this method will not work if an included reference's child is included in the longName - */ - PX_INLINE ErrorType getParameter(const char *longName); - - /** - \brief Set the depth of the handle within the handle's parameter - - The set method is useful for accessing indices within an array of parameters or members - within a struct. - */ - PX_INLINE ErrorType set(int32_t child_index); - - /** - \brief Get a child handle of this handle - Sets handle to point to a child of this handle, with child_long_name being - relative to the current long name. - */ - PX_INLINE ErrorType getChildHandle(const ::NvParameterized::Interface *instance, const char *child_long_name, Handle &outHandle); - - /** - \brief Get a child handle of this handle - Sets handle to point to a direct child of this handle. Works with structs and arrays. - */ - PX_INLINE ErrorType getChildHandle(int32_t index, Handle &outHandle); - - /** - \brief Returns the long name of the parameter, with indexes into str. - \returns false if the long name didn't fit in str. - */ - PX_INLINE bool getLongName(char *str, uint32_t max_str_len) const; - - /** - \brief Reset all of the state data for the handle - */ - PX_INLINE void reset(); - - /** - \brief Does handle correspond to an existing Interface? - */ - PX_INLINE bool isConst(void) const { return(mIsConst); } - - /** - \brief Does handle correspond to a valid parameter? - */ - PX_INLINE bool isValid(void) const { return(mIsValid); } - - /** - \brief Same as isValid - */ - PX_INLINE operator bool() const { return(isValid()); } - - /** - \brief Return user data stored in handle - */ - PX_INLINE const void *userData(void) const { return(mUserData); } - - /** - \brief Return user data stored in handle - */ - PX_INLINE void *userData(void) { return(mUserData); } - - /** - \brief Store user data in handle - */ - PX_INLINE void setUserData(void *user_data) { mUserData = user_data; } - - /** - \brief Get associated NvParameterized object - \note Will return NULL in case of const handle (use getConstInterface instead) - */ - PX_INLINE ::NvParameterized::Interface * getInterface(void) const { return mIsConst ? 0 : mInterface; } - - /** - \brief Get associated NvParameterized object - */ - PX_INLINE const ::NvParameterized::Interface * getConstInterface(void) const { return mInterface; } - - /** - \brief Set associated NvParameterized object - */ - PX_INLINE void setInterface(::NvParameterized::Interface *iface) { mIsConst = false; mInterface = iface; } - - /** - \brief Set associated NvParameterized object - */ - PX_INLINE void setInterface(const ::NvParameterized::Interface *iface) { mIsConst = true; mInterface = (::NvParameterized::Interface *)iface; } - - /** - \brief Initialize a Reference parameter - - \param [in] chosenRefStr This string must be one of the strings returned from - Definition::refVariantVal() - - \param [in] doDestroyOld Sets whether the previous object should be destroyed or not - - \see Interface::initParamRef(), Definition::numRefVariants(), Definition::refVariantVal() - */ - PX_INLINE ErrorType initParamRef(const char *chosenRefStr = 0, bool doDestroyOld = false); - - /** - \brief Store this Handle's parameter to a string - \param [in] buf this buffer is used to store any strings that need to be constructed - \param [in] bufSize size of buf - \param [out] ret this contains a pointer to the value as a string, it may or may not - be equal to buf, depending if the value had to be constructed dynamically or if it already exists as a static string - */ - PX_INLINE ErrorType valueToStr(char *buf, uint32_t bufSize, const char *&ret); - - /** - \brief Store the string to this Handle's parameter - \returns ERROR_TYPE_NOT_SUPPORTED if the Handle's parameter type is an array, struct, or reference - \returns ERROR_NONE if the Handle's parameter type is a simple type (u32, i32, vec3, etc) - */ - PX_INLINE ErrorType strToValue(const char *str, const char **endptr); - - /** - \brief Resize the array that the Handle points to - */ - ErrorType resizeArray(int32_t new_size); - - /** - \brief Get the array size for the given array dimension - */ - PX_INLINE ErrorType getArraySize(int32_t &size, int32_t dimension = 0) const; - - /** - \brief Swap two elements of an array - */ - PX_INLINE ErrorType swapArrayElements(uint32_t firstElement, uint32_t secondElement); - - // These functions wrap the raw(Get|Set)XXXXX() methods. They deal with - // error handling and casting. - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamBool(bool &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamBool(bool val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamBoolArray(bool *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamBoolArray(const bool *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamString(const char *&val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamString(const char *val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamStringArray(char **array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamStringArray(const char **array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamEnum(const char *&val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamEnum(const char *val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamEnumArray(char **array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamEnumArray(const char **array, int32_t n, int32_t offset = 0) ; - - /** - \see Interface::getParamRef() - */ - PX_INLINE ErrorType getParamRef(::NvParameterized::Interface *&val) const ; - - /** - \see Interface::getParamRefArray() - */ - PX_INLINE ErrorType getParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset = 0) const ; - - /** - \see Interface::setParamRef() - */ - PX_INLINE ErrorType setParamRef(::NvParameterized::Interface * val, bool doDestroyOld = false) ; - - /** - \see Interface::setParamRefArray() - */ - PX_INLINE ErrorType setParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset = 0, bool doDestroyOld = false) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamI8(int8_t &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamI8(int8_t val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamI8Array(int8_t *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamI8Array(const int8_t *val, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamI16(int16_t &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamI16(int16_t val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamI16Array(int16_t *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamI16Array(const int16_t *val, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamI32(int32_t &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamI32(int32_t val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamI32Array(int32_t *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamI32Array(const int32_t *val, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamI64(int64_t &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamI64(int64_t val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamI64Array(int64_t *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamI64Array(const int64_t *val, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamU8(uint8_t &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamU8(uint8_t val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamU8Array(uint8_t *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamU8Array(const uint8_t *val, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamU16(uint16_t &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamU16(uint16_t val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamU16Array(uint16_t *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamU16Array(const uint16_t *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamU32(uint32_t &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamU32(uint32_t val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamU32Array(uint32_t *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamU32Array(const uint32_t *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamU64(uint64_t &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamU64(uint64_t val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamU64Array(uint64_t *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamU64Array(const uint64_t *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamF32(float &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamF32(float val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamF32Array(float *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamF32Array(const float *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamF64(double &val) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamF64(double val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamF64Array(double *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamF64Array(const double *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamVec2(const physx::PxVec2 &val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamVec2(physx::PxVec2 &val) const ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamVec2Array(physx::PxVec2 *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamVec2Array(const physx::PxVec2 *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType setParamVec3(const physx::PxVec3 &val) ; - - /** - \brief Set param - */ - PX_INLINE ErrorType getParamVec3(physx::PxVec3 &val) const ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamVec3Array(physx::PxVec3 *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamVec3Array(const physx::PxVec3 *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType setParamVec4(const physx::PxVec4 &val) ; - - /** - \brief Set param - */ - PX_INLINE ErrorType getParamVec4(physx::PxVec4 &val) const ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamVec4Array(physx::PxVec4 *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamVec4Array(const physx::PxVec4 *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType setParamQuat(const physx::PxQuat &val) ; - - /** - \brief Set param - */ - PX_INLINE ErrorType getParamQuat(physx::PxQuat &val) const ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamQuatArray(physx::PxQuat *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamQuatArray(const physx::PxQuat *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType setParamMat33(const physx::PxMat33 &val) ; - - /** - \brief Set param - */ - PX_INLINE ErrorType getParamMat33(physx::PxMat33 &val) const ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamMat33Array(physx::PxMat33 *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamMat33Array(const physx::PxMat33 *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamMat44(const physx::PxMat44 &val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamMat44(physx::PxMat44 &val) const ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamMat44Array(physx::PxMat44 *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamMat44Array(const physx::PxMat44 *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamMat34Legacy(const float (&val)[12]) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamMat34Legacy(float (&val)[12]) const ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamMat34LegacyArray(float* array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamMat34LegacyArray(const float *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamBounds3(const physx::PxBounds3 &val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamBounds3(physx::PxBounds3 &val) const ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamBounds3Array(physx::PxBounds3 *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamBounds3Array(const physx::PxBounds3 *array, int32_t n, int32_t offset = 0) ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamTransform(const physx::PxTransform &val) ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamTransform(physx::PxTransform &val) const ; - - /** - \brief Get param - */ - PX_INLINE ErrorType getParamTransformArray(physx::PxTransform *array, int32_t n, int32_t offset = 0) const ; - - /** - \brief Set param - */ - PX_INLINE ErrorType setParamTransformArray(const physx::PxTransform *array, int32_t n, int32_t offset = 0) ; - - - /// Template version of setParamXxx - template <typename T> PX_INLINE ErrorType setParam(const T &val); - - /// Template version of getParamXxx - template <typename T> PX_INLINE ErrorType getParam(T &val) const; - - /// Template version of getParamXxxArray - template <typename T> PX_INLINE ErrorType getParamArray(T *array, int32_t n, int32_t offset = 0) const; - - /// Template version of setParamXxxArray - template <typename T> PX_INLINE ErrorType setParamArray(const T *array, int32_t n, int32_t offset = 0); - -private: - - PX_INLINE void pushIndex(int32_t index); - - bool mIsValid, mIsConst; - int32_t mNumIndexes; - int32_t mIndexList[MAX_DEPTH]; - const Definition *mParameterDefinition; - void *mUserData; - ::NvParameterized::Interface *mInterface; -}; - -/// A callback class for notification just prior to serialization -class SerializationCallback -{ -public: - virtual ~SerializationCallback() {} - /// Callback method - virtual void preSerialize(void* userData = NULL) = 0; -}; - - -/** -\brief Represents the interface to the NvParameterized object -*/ -class Interface -{ - friend class Handle; -public: - - /** - \brief Destructor - */ - virtual ~Interface() {} - - /** - \brief Destroys the NvParameterized object and all nested dynamic objects contained within - */ - virtual void destroy() = 0; - - /** - \brief Initializes all parameters to their default value - */ - virtual void initDefaults(void) = 0; - - /** - \brief Initializes all parameters with random values - */ - virtual void initRandom(void) = 0; - - /** - \brief Get the class name - */ - virtual const char * className(void) const = 0; - - /** - \brief Sets the class name - - This method is used for named references. The input name should be one of the possible variants. - \see Definition::numRefVariants(), Definition::refVariantVal() - */ - virtual void setClassName(const char *name) = 0; - - /** - \brief Get the name of the NvParameterized object - This method is used for named references. The name will typically specify an asset to be loaded. - */ - virtual const char * name(void) const = 0; - - /** - \brief Set the name of the NvParameterized object - This method is used for named references. The name will typically specify an asset to be loaded. - */ - virtual void setName(const char *name) = 0; - - /** - \brief Get the class version - */ - virtual uint32_t version(void) const = 0; - - /** - \brief Get the major part of class version - */ - virtual uint16_t getMajorVersion(void) const = 0; - - /** - \brief Get the minor part of class version - */ - virtual uint16_t getMinorVersion(void) const = 0; - - /** - \brief Get the class checksum. - \param bits contains the number of bits contained in the checksum - \returns A pointer to a constant array of uint32_t values representing the checksum - */ - virtual const uint32_t * checksum(uint32_t &bits) const = 0; - - /** - \brief Get the number of parameters contained in the NvParameterized object - */ - virtual int32_t numParameters(void) = 0; - - /** - \brief Get the definition of i-th parameter - */ - virtual const Definition *parameterDefinition(int32_t index) = 0; - - /** - \brief Get definition of root structure - */ - virtual const Definition *rootParameterDefinition(void) = 0; - - /** - \brief Get definition of root structure - */ - virtual const Definition *rootParameterDefinition(void) const = 0; - - /** - \brief Set the Handle to point to the parameter specified by longName - Given a long name like "mystruct.somearray[10].foo", it will return - a handle to that specific parameter. The handle can then be used to - set/get values, as long as it's a handle to a leaf node. - \note this method will not work if an included reference's child is included in the longName - */ - virtual ErrorType getParameterHandle(const char *longName, Handle &handle) const = 0; - - /** - \brief Set the Handle to point to the parameter specified by longName - Given a long name like "mystruct.somearray[10].foo", it will return - a handle to that specific parameter. The handle can then be used to - set/get values, as long as it's a handle to a leaf node. - \note this method will not work if an included reference's child is included in the longName - */ - virtual ErrorType getParameterHandle(const char *longName, Handle &handle) = 0; - - /// An application may set a callback function that is called immediately before serialization - virtual void setSerializationCallback(SerializationCallback *cb, void *userData = NULL) = 0; - - /// Called prior by Serializer to serialization - virtual ErrorType callPreSerializeCallback() const = 0; - - - /** - \brief Compares two NvParameterized objects - \param [in] obj The other ::NvParameterized::Interface object (this == obj) - \param [out] handlesOfInequality If the return value is False, these handles will contain the path to where definition or data is not identical - \param [in] numHandlesOfInequality The number of handles that can be written to. - \param [in] doCompareNotSerialized If false differences of parameters with DONOTSERIALIZE-hint are ignored. - \returns true if parameter definition tree is equal as well as parameter values - */ - virtual bool equals(const ::NvParameterized::Interface &obj, Handle* handlesOfInequality = NULL, uint32_t numHandlesOfInequality = 0, bool doCompareNotSerialized = true) const = 0; - - /** - \brief Checks if object satisfies schema constraints - \param [out] invalidHandles If the return value is False, these handles will contain the path to invalid data - \param [in] numInvalidHandles The number of handles that can be written to. - \returns true if all values satisfy constraints - */ - virtual bool areParamsOK(Handle *invalidHandles = NULL, uint32_t numInvalidHandles = 0) = 0; - - /** - \brief Copies an NvParameterized object - \param [in] src the src NvParameterized object will be copied to this object. It must be of the same type (class name). - */ - virtual ErrorType copy(const ::NvParameterized::Interface &src) = 0; - - /** - \brief Clones an NvParameterized object - \param [out] nullDestObject cloned object; note this is a *reference* to a pointer; the destination cloned object will be created and stored in this pointer; should be NULL on entry! - */ - virtual ErrorType clone(Interface *&nullDestObject) const = 0; - - /** - \brief Check that alignments of internal elements match the schema - \warning Only for internal use - */ - virtual bool checkAlignments() const = 0; - -protected: - /** - \brief Initialize a Reference parameter - - \note By default previous value of parameter isn't destroyed (bool doDestroyOld = false) - */ - virtual ErrorType initParamRef(const Handle &handle, const char *chosenRefStr = 0, bool doDestroyOld = false) = 0; - - // These functions wrap the raw(Get|Set)XXXXX() methods. They deal with - // error handling and casting. - - /** - \brief Get param - */ - virtual ErrorType getParamBool(const Handle &handle, bool &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamBool(const Handle &handle, bool val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamBoolArray(const Handle &handle, bool *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamBoolArray(const Handle &handle, const bool *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamString(const Handle &handle, const char *&val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamString(const Handle &handle, const char *val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamStringArray(const Handle &handle, char **array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamStringArray(const Handle &handle, const char **array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamEnum(const Handle &handle, const char *&val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamEnum(const Handle &handle, const char *val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamEnumArray(const Handle &handle, char **array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamEnumArray(const Handle &handle, const char **array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamRef(const Handle &handle, ::NvParameterized::Interface *&val) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamRefArray(const Handle &handle, ::NvParameterized::Interface **array, int32_t n, int32_t offset = 0) const = 0; - - /** - \note By default previous value of parameter is not destroyed (bool doDestroyOld = false) - */ - virtual ErrorType setParamRef(const Handle &handle, ::NvParameterized::Interface * val, bool doDestroyOld = false) = 0; - - /** - \note By default previous values of parameter are not destroyed (bool doDestroyOld = false) - */ - virtual ErrorType setParamRefArray(const Handle &handle, /*const*/ ::NvParameterized::Interface **array, int32_t n, int32_t offset = 0, bool doDestroyOld = false) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamI8(const Handle &handle, int8_t &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamI8(const Handle &handle, int8_t val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamI8Array(const Handle &handle, int8_t *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamI8Array(const Handle &handle, const int8_t *val, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamI16(const Handle &handle, int16_t &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamI16(const Handle &handle, int16_t val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamI16Array(const Handle &handle, int16_t *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamI16Array(const Handle &handle, const int16_t *val, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamI32(const Handle &handle, int32_t &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamI32(const Handle &handle, int32_t val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamI32Array(const Handle &handle, int32_t *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamI32Array(const Handle &handle, const int32_t *val, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamI64(const Handle &handle, int64_t &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamI64(const Handle &handle, int64_t val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamI64Array(const Handle &handle, int64_t *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamI64Array(const Handle &handle, const int64_t *val, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamU8(const Handle &handle, uint8_t &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamU8(const Handle &handle, uint8_t val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamU8Array(const Handle &handle, uint8_t *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamU8Array(const Handle &handle, const uint8_t *val, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamU16(const Handle &handle, uint16_t &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamU16(const Handle &handle, uint16_t val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamU16Array(const Handle &handle, uint16_t *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamU16Array(const Handle &handle, const uint16_t *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamU32(const Handle &handle, uint32_t &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamU32(const Handle &handle, uint32_t val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamU32Array(const Handle &handle, uint32_t *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamU32Array(const Handle &handle, const uint32_t *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamU64(const Handle &handle, uint64_t &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamU64(const Handle &handle, uint64_t val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamU64Array(const Handle &handle, uint64_t *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamU64Array(const Handle &handle, const uint64_t *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamF32(const Handle &handle, float &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamF32(const Handle &handle, float val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamF32Array(const Handle &handle, float *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamF32Array(const Handle &handle, const float *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamF64(const Handle &handle, double &val) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamF64(const Handle &handle, double val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamF64Array(const Handle &handle, double *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamF64Array(const Handle &handle, const double *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamVec2(const Handle &handle, const physx::PxVec2 &val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamVec2(const Handle &handle, physx::PxVec2 &val) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamVec2Array(const Handle &handle, physx::PxVec2 *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamVec2Array(const Handle &handle, const physx::PxVec2 *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamVec3(const Handle &handle, const physx::PxVec3 &val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamVec3(const Handle &handle, physx::PxVec3 &val) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamVec3Array(const Handle &handle, physx::PxVec3 *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamVec3Array(const Handle &handle, const physx::PxVec3 *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamVec4(const Handle &handle, const physx::PxVec4 &val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamVec4(const Handle &handle, physx::PxVec4 &val) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamVec4Array(const Handle &handle, physx::PxVec4 *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamVec4Array(const Handle &handle, const physx::PxVec4 *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamQuat(const Handle &handle, const physx::PxQuat &val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamQuat(const Handle &handle, physx::PxQuat &val) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamQuatArray(const Handle &handle, physx::PxQuat *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamQuatArray(const Handle &handle, const physx::PxQuat *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamMat33(const Handle &handle, const physx::PxMat33 &val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamMat33(const Handle &handle, physx::PxMat33 &val) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamMat33Array(const Handle &handle, physx::PxMat33 *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamMat33Array(const Handle &handle, const physx::PxMat33 *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamMat44(const Handle &handle, const physx::PxMat44 &val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamMat44(const Handle &handle, physx::PxMat44 &val) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamMat44Array(const Handle &handle, physx::PxMat44 *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamMat44Array(const Handle &handle, const physx::PxMat44 *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamMat34Legacy(const Handle &handle, const float (&val)[12]) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamMat34Legacy(const Handle &handle, float (&val)[12]) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamMat34LegacyArray(const Handle &handle, float *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamMat34LegacyArray(const Handle &handle, const float *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamBounds3(const Handle &handle, const physx::PxBounds3 &val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamBounds3(const Handle &handle, physx::PxBounds3 &val) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamBounds3Array(const Handle &handle, physx::PxBounds3 *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamTransform(const Handle &handle, const physx::PxTransform &val) = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamTransform(const Handle &handle, physx::PxTransform &val) const = 0; - - /** - \brief Get param - */ - virtual ErrorType getParamTransformArray(const Handle &handle, physx::PxTransform *array, int32_t n, int32_t offset = 0) const = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamTransformArray(const Handle &handle, const physx::PxTransform *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Set param - */ - virtual ErrorType setParamBounds3Array(const Handle &handle, const physx::PxBounds3 *array, int32_t n, int32_t offset = 0) = 0; - - /** - \brief Store value of parameter into a string - \see Handle::valueToStr - */ - virtual ErrorType valueToStr(const Handle &handle, char *buf, uint32_t bufSize, const char *&ret) = 0; - - /** - \brief Read value of parameter from string - \see Handle::strToValue - */ - virtual ErrorType strToValue(Handle &handle,const char *str, const char **endptr) = 0; // assigns this string to the value - - /** - \brief Resize array parameter - \see Handle::resizeArray - */ - virtual ErrorType resizeArray(const Handle &array_handle, int32_t new_size) = 0; - - /** - \brief Get size of array parameter - \see Handle::getArraySize - */ - virtual ErrorType getArraySize(const Handle &array_handle, int32_t &size, int32_t dimension = 0) const = 0; - - /** - \brief Swap two elements of an array - \see Handle::swapArrayElements - */ - virtual ErrorType swapArrayElements(const Handle &array_handle, uint32_t firstElement, uint32_t secondElement) = 0; -}; - -} // end of namespace - -#include "NvParameterized.inl" // inline the NvParamterHandle methods. - -PX_POP_PACK - -#endif // NV_PARAMETERIZED_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef NV_PARAMETERIZED_H
+#define NV_PARAMETERIZED_H
+
+/**
+ * APEX uses a framework called NvParameterized for storing asset and actor data.
+ * NvParameterized classes provide reflection on every parameter they include making it
+ * effective for serialization and auto-generation of user interfaces for tools.<br>
+ *
+ * NvParameterized stores data in C++ classes which are auto-generated from their
+ * descriptions written in a special domain specific language (DSL). Description files
+ * contain information on internal layout and various high-level metadata of corresponding
+ * classes and their members. All generated classes implement special interface for
+ * run time reflection and modification of data.
+ * */
+
+/*!
+\file
+\brief NvParameterized classes
+*/
+
+#include "foundation/PxVec2.h"
+#include "foundation/PxVec3.h"
+#include "foundation/PxVec4.h"
+#include "foundation/PxQuat.h"
+#include "foundation/PxBounds3.h"
+#include "foundation/PxMat44.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <new> // for placement new
+
+PX_PUSH_PACK_DEFAULT
+
+//! \brief NvParameterized namespace
+namespace NvParameterized
+{
+
+class Interface;
+class Traits;
+
+/**
+\brief Various errors that may be returned from NvParameterized calls
+*/
+enum ErrorType
+{
+ ERROR_NONE = 0,
+ ERROR_TYPE_NOT_SUPPORTED,
+ ERROR_INDEX_OUT_OF_RANGE,
+ ERROR_INVALID_PARAMETER_NAME,
+ ERROR_INVALID_PARAMETER_HANDLE,
+ ERROR_CAST_FAILED,
+ ERROR_INVALID_ENUM_VAL,
+ ERROR_SYNTAX_ERROR_IN_NAME,
+ ERROR_IS_LEAF_NODE,
+ ERROR_RESULT_BUFFER_OVERFLOW,
+ ERROR_NAME_DOES_NOT_MATCH_DEFINITION,
+ ERROR_NOT_AN_ARRAY,
+ ERROR_ARRAY_SIZE_IS_FIXED,
+ ERROR_ARRAY_RESIZING_IS_NOT_SUPPORTED,
+ ERROR_ARRAY_IS_TOO_SMALL,
+ ERROR_INVALID_ARRAY_DIMENSION,
+ ERROR_INVALID_ARRAY_SIZE,
+ ERROR_PARAMETER_HANDLE_DOES_NOT_MATCH_CLASS,
+ ERROR_MEMORY_ALLOCATION_FAILURE,
+ ERROR_INVALID_REFERENCE_INCLUDE_HINT,
+ ERROR_INVALID_REFERENCE_VALUE,
+ ERROR_PARAMETER_HANDLE_NOT_INITIALIZED,
+ ERROR_PARAMETER_DEFINITIONS_DO_NOT_MATCH,
+ ERROR_HANDLE_MISSING_INTERFACE_POINTER,
+ ERROR_HANDLE_INVALID_INTERFACE_POINTER,
+ ERROR_INVALID_CALL_ON_NAMED_REFERENCE,
+ ERROR_NOT_IMPLEMENTED,
+ ERROR_OBJECT_CONSTRUCTION_FAILED,
+ ERROR_MODIFY_CONST_HANDLE
+};
+
+/**
+\brief These types are supported in NvParameterized schemas
+\warning Do not change values of enums!
+*/
+enum DataType
+{
+ TYPE_UNDEFINED = 0,
+
+ /**
+ \brief Array type, size may be static or dynamic
+ \see Definition::arraySizeIsFixed(), Handle::resizeArray(), Handle::getArraySize()
+ */
+ TYPE_ARRAY = 1,
+
+ TYPE_STRUCT = 2,
+
+ TYPE_BOOL = 3,
+ /**
+ \brief String type, represented by a const char pointer
+ \see Handle::getParamString(), Handle::setParamString()
+ */
+ TYPE_STRING = 4,
+
+ /**
+ \brief Enum type, represented by a const char pointer
+ \see Definition::numEnumVals(), Definition::enumVal(), Handle::getParamEnum(), Handle::setParamEnum()
+ */
+ TYPE_ENUM = 5,
+
+ /**
+ \brief Reference type, may be a named or included reference
+
+ References are intended to be used in instances where a class needs either a
+ named reference (an emitter asset references an IOFX and IOS asset), or an
+ included reference (a destructible asset that serializes an APEX render mesh).
+ References may also used to create a unions within a class. Each reference will
+ contain one or more variants to allow for unions.
+
+ \see Handle::initParamRef(), Definition::numRefVariants(), Definition::refVariantVal(), Handle::initParamRef(), Handle::getParamRef(), Handle::setParamRef()
+ */
+ TYPE_REF = 6,
+
+ TYPE_I8 = 7,
+ TYPE_I16 = 8,
+ TYPE_I32 = 9,
+ TYPE_I64 = 10,
+
+ TYPE_U8 = 11,
+ TYPE_U16 = 12,
+ TYPE_U32 = 13,
+ TYPE_U64 = 14,
+
+ TYPE_F32 = 15,
+ TYPE_F64 = 16,
+
+ TYPE_VEC2 = 17,
+ TYPE_VEC3 = 18,
+ TYPE_VEC4 = 19,
+ TYPE_QUAT = 20,
+ TYPE_MAT33 = 21,
+ TYPE_BOUNDS3 = 23,
+ TYPE_MAT44 = 24,
+
+ TYPE_POINTER = 25,
+
+ TYPE_TRANSFORM = 26,
+
+ TYPE_MAT34 = 27,
+
+ TYPE_LAST
+};
+
+/**
+\brief Provides hints about the parameter definition
+
+\see Definition
+*/
+class Hint
+{
+ public:
+
+ /**
+ \brief Destructor
+ */
+ virtual ~Hint() {}
+ /**
+ \brief Returns the name of the hint
+ */
+ virtual const char * name(void) const = 0;
+
+ /**
+ \brief Returns the type of the hint
+ */
+ virtual DataType type(void) const = 0;
+
+ /**
+ \brief Returns the unsigned 64-bit value of the hint
+ \note Undefined results if the type != TYPE_U64
+ */
+ virtual uint64_t asUInt(void) const = 0;
+
+ /**
+ \brief Returns the 64-bit floating point value of the hint
+ \note Undefined results if the type != TYPE_FU64
+ */
+ virtual double asFloat(void) const = 0;
+
+ /**
+ \brief Returns the const character pointer for hint
+ \note Undefined results if the type != TYPE_STRING
+ */
+ virtual const char * asString(void) const = 0;
+
+ /**
+ \brief Set the value if the hint is a 64bit unsigned type
+ */
+ virtual bool setAsUInt(uint64_t v) = 0;
+
+ private:
+};
+
+/**
+\brief Provides information about a parameter
+*/
+class Definition
+{
+public:
+
+ /**
+ \brief Destructor
+ */
+ virtual ~Definition() {}
+
+ /**
+ \brief Destroys the Definition object and all nested dynamic objects contained within
+ */
+ virtual void destroy() = 0;
+
+ /**
+ \brief Returns the number of hints in the parameter Definition
+ */
+ virtual int32_t numHints(void) const = 0;
+
+ /**
+ \brief Returns the Hint located at the index
+ \returns NULL if index >= Hint::numHints()
+ */
+ virtual const Hint * hint(int32_t index) const = 0;
+
+ /**
+ \brief Returns the Hint that matches the input name
+ \returns NULL if name does not match any of the Definition's hints
+ */
+ virtual const Hint * hint(const char *name) const = 0;
+
+ /**
+ \brief Store parameter hints
+ \warning Only for internal use
+ */
+ virtual void setHints(const Hint **hints, int32_t n) = 0;
+
+ /**
+ \brief Add parameter hint
+ \warning Only for internal use
+ */
+ virtual void addHint(Hint *hint) = 0;
+
+ /**
+ \brief Returns this Definition's parent Definition
+ \returns NULL if at the top level
+ */
+ virtual const Definition * parent(void) const = 0;
+
+ /**
+ \brief Returns this Definition's top most ancestor
+ */
+ virtual const Definition * root(void) const = 0;
+
+ /**
+ \brief Returns the name of the parameter
+ */
+ virtual const char * name(void) const = 0;
+
+ /**
+ \brief Returns the long name of the parameter
+ If the parameter is a member of a struct or an array the long name will contain these
+ parent names
+ */
+ virtual const char * longName(void) const = 0;
+
+ /**
+ \brief Returns the name of parameter's struct type
+ \returns NULL if not struct
+ */
+ virtual const char * structName(void) const = 0;
+
+ /**
+ \brief Returns the parameter type
+ */
+ virtual DataType type(void) const = 0;
+
+ /**
+ \brief Return the parameter type in string form
+ */
+ virtual const char* typeString() const = 0;
+
+ /**
+ \brief Returns the number of variants this parameter could be
+ A reference is sometimes a union of different types, each different type is referred to as
+ a "variant". Variants can be used in either included or named references.
+ */
+ virtual int32_t numRefVariants(void) const = 0;
+
+ /**
+ \brief Given the ref variant name, get its val index
+ \returns -1 if input ref_val is not found
+ */
+ virtual int32_t refVariantValIndex( const char * ref_val ) const = 0;
+
+ /**
+ \brief Get the string value of the reference variant
+ */
+ virtual const char * refVariantVal(int32_t index) const = 0;
+
+ /**
+ \brief Returns the number of enums for the parameter
+ */
+ virtual int32_t numEnumVals(void) const = 0;
+
+ /**
+ \brief Given the enum string, get the enum val index
+ \returns -1 if input enum_val is not found
+ */
+ virtual int32_t enumValIndex( const char * enum_val ) const = 0;
+
+ /**
+ \brief Returns the Enum string located at the index
+ \returns NULL if index >= Hint::numEnumVals()
+ */
+ virtual const char * enumVal(int32_t index) const = 0;
+
+ /**
+ \brief Store possible enum values for TYPE_ENUM parameter
+ \warning Only for internal use
+ */
+ virtual void setEnumVals(const char **enum_vals, int32_t n) = 0;
+
+ /**
+ \brief Add new enum value to a list of possible enum values for TYPE_ENUM parameter
+ \warning Only for internal use
+ */
+ virtual void addEnumVal(const char *enum_val) = 0;
+
+ /**
+ \brief Returns custom alignment if parameter uses it; otherwise returns 0
+ */
+ virtual uint32_t alignment(void) const = 0;
+
+ /**
+ \brief Returns custom padding if parameter uses it; otherwise returns 0
+ */
+ virtual uint32_t padding(void) const = 0;
+
+ /**
+ \brief Returns the number of dimensions of a static array
+ */
+ virtual int32_t arrayDimension(void) const = 0;
+
+ /**
+ \brief Returns the array size of a static array
+ \returns 0 for dynamic arrays
+ */
+ virtual int32_t arraySize(int32_t dimension = 0) const = 0;
+
+ /**
+ \brief Used to determine if an array is static or dynamic
+ */
+ virtual bool arraySizeIsFixed(void) const = 0;
+
+ /**
+ \brief Set size of static array
+ \warning Only for internal use
+ */
+ virtual bool setArraySize(int32_t size) = 0; // -1 if the size is not fixed
+
+ /**
+ \brief Used to determine if parameter is aggregate (TYPE_STRUCT or TYPE_ARRAY) or not.
+ */
+ virtual bool isLeaf(void) const = 0;
+
+ /**
+ \brief Used to determine if reference is included or not.
+ */
+ virtual bool isIncludedRef(void) const = 0;
+
+ /**
+ \brief Returns the number of children (for a struct or static array)
+ */
+ virtual int32_t numChildren(void) const = 0;
+
+ /**
+ \brief Access definition of i-th child parameter.
+ */
+ virtual const Definition *child(int32_t index) const = 0;
+
+ /**
+ \brief Access definition of child parameter with given name
+ \warning Only used with TYPE_STRUCT
+ */
+ virtual const Definition *child(const char *name, int32_t &index) const = 0;
+
+ /**
+ \brief Store definitions of child parameters
+ \warning Only for internal use
+ */
+ virtual void setChildren(Definition **children, int32_t n) = 0;
+
+ /**
+ \brief Add definition of one morechild parameter
+ \warning Only for internal use
+ */
+ virtual void addChild(Definition *child) = 0;
+
+ /**
+ \brief Set indices of child handles which must be released when downsizing array
+ */
+ virtual void setDynamicHandleIndicesMap(const uint8_t *indices, uint32_t numIndices) = 0;
+
+ /**
+ \brief Get indices of child handles which must be released when downsizing array
+ */
+ virtual const uint8_t * getDynamicHandleIndicesMap(uint32_t &outNumIndices) const = 0;
+
+ /**
+ \brief Used to determine whether type is not an aggregate (array, ref or struct)
+ \param [in] simpleStructs structure of simple types is also considered simple
+ \param [in] simpleStrings strings are considered simple
+ */
+ virtual bool isSimpleType(bool simpleStructs = true, bool simpleStrings = true) const = 0;
+};
+
+/**
+\brief Provides access to individual parameters within the NvParameterized object
+*/
+class Handle
+{
+public:
+
+ enum { MAX_DEPTH = 16 };
+
+ /**
+ \brief The constructor takes a pointer (if the user requires an instance before the ::NvParameterized::Interface exists)
+ */
+ PX_INLINE Handle(::NvParameterized::Interface *iface);
+
+ /**
+ \brief The constructor takes a reference
+ */
+ PX_INLINE Handle(::NvParameterized::Interface &iface);
+
+ /**
+ \brief The constructor takes a const interface
+ \note Handles which are constructed from const objects are not allowed to modify them.
+ */
+ PX_INLINE Handle(const ::NvParameterized::Interface &iface);
+
+ /**
+ \brief Copy constructor
+ */
+ PX_INLINE Handle(const Handle ¶m_handle);
+
+ /**
+ \brief This constructor allows the user to create a handle that initially points at a particular parameter in the instance
+ */
+ PX_INLINE Handle(::NvParameterized::Interface &instance, const char *longName);
+
+ /**
+ \brief This constructor allows the user to create a handle that initially points at a particular parameter in the instance
+ \note Handles which are constructed from const objects are not allowed to modify them.
+ */
+ PX_INLINE Handle(const ::NvParameterized::Interface &instance, const char *longName);
+
+ /**
+ \brief Get the parameter Definition for the handle's parameter
+ */
+ PX_INLINE const Definition *parameterDefinition(void) const { return(mParameterDefinition); }
+
+ /**
+ \brief Get the depth of the handle within the NvParameterized object
+ */
+ PX_INLINE int32_t numIndexes(void) const { return(mNumIndexes); }
+
+ /**
+ \brief Get the index at the specified depth within the NvParameterized object
+ */
+ PX_INLINE int32_t index(int32_t i) const { return(mIndexList[i]); }
+
+ /**
+ \brief Reduce the handle's depth within the NvParameterized object
+ */
+ PX_INLINE int32_t popIndex(int32_t levels = 1);
+
+ /**
+ \brief Set the Handle so it references a parameter in the specified instance with the name child_long_name
+ */
+ PX_INLINE ErrorType set(const ::NvParameterized::Interface *instance, const Definition *root, const char *child_long_name);
+
+ /**
+ \brief Set the Handle so it references a parameter in the specified instance with the name child_long_name
+ */
+ PX_INLINE ErrorType set(const ::NvParameterized::Interface *instance, const char *child_long_name);
+
+ /**
+ \brief Get the parameter specified by longName and set the Handle to point it
+ Given a long name like "mystruct.somearray[10].foo", it will return
+ a handle to that specific parameter. The handle can then be used to
+ set/get values, as long as it's a handle to a leaf node.
+ \note this method will not work if an included reference's child is included in the longName
+ */
+ PX_INLINE ErrorType getParameter(const char *longName);
+
+ /**
+ \brief Set the depth of the handle within the handle's parameter
+
+ The set method is useful for accessing indices within an array of parameters or members
+ within a struct.
+ */
+ PX_INLINE ErrorType set(int32_t child_index);
+
+ /**
+ \brief Get a child handle of this handle
+ Sets handle to point to a child of this handle, with child_long_name being
+ relative to the current long name.
+ */
+ PX_INLINE ErrorType getChildHandle(const ::NvParameterized::Interface *instance, const char *child_long_name, Handle &outHandle);
+
+ /**
+ \brief Get a child handle of this handle
+ Sets handle to point to a direct child of this handle. Works with structs and arrays.
+ */
+ PX_INLINE ErrorType getChildHandle(int32_t index, Handle &outHandle);
+
+ /**
+ \brief Returns the long name of the parameter, with indexes into str.
+ \returns false if the long name didn't fit in str.
+ */
+ PX_INLINE bool getLongName(char *str, uint32_t max_str_len) const;
+
+ /**
+ \brief Reset all of the state data for the handle
+ */
+ PX_INLINE void reset();
+
+ /**
+ \brief Does handle correspond to an existing Interface?
+ */
+ PX_INLINE bool isConst(void) const { return(mIsConst); }
+
+ /**
+ \brief Does handle correspond to a valid parameter?
+ */
+ PX_INLINE bool isValid(void) const { return(mIsValid); }
+
+ /**
+ \brief Same as isValid
+ */
+ PX_INLINE operator bool() const { return(isValid()); }
+
+ /**
+ \brief Return user data stored in handle
+ */
+ PX_INLINE const void *userData(void) const { return(mUserData); }
+
+ /**
+ \brief Return user data stored in handle
+ */
+ PX_INLINE void *userData(void) { return(mUserData); }
+
+ /**
+ \brief Store user data in handle
+ */
+ PX_INLINE void setUserData(void *user_data) { mUserData = user_data; }
+
+ /**
+ \brief Get associated NvParameterized object
+ \note Will return NULL in case of const handle (use getConstInterface instead)
+ */
+ PX_INLINE ::NvParameterized::Interface * getInterface(void) const { return mIsConst ? 0 : mInterface; }
+
+ /**
+ \brief Get associated NvParameterized object
+ */
+ PX_INLINE const ::NvParameterized::Interface * getConstInterface(void) const { return mInterface; }
+
+ /**
+ \brief Set associated NvParameterized object
+ */
+ PX_INLINE void setInterface(::NvParameterized::Interface *iface) { mIsConst = false; mInterface = iface; }
+
+ /**
+ \brief Set associated NvParameterized object
+ */
+ PX_INLINE void setInterface(const ::NvParameterized::Interface *iface) { mIsConst = true; mInterface = (::NvParameterized::Interface *)iface; }
+
+ /**
+ \brief Initialize a Reference parameter
+
+ \param [in] chosenRefStr This string must be one of the strings returned from
+ Definition::refVariantVal()
+
+ \param [in] doDestroyOld Sets whether the previous object should be destroyed or not
+
+ \see Interface::initParamRef(), Definition::numRefVariants(), Definition::refVariantVal()
+ */
+ PX_INLINE ErrorType initParamRef(const char *chosenRefStr = 0, bool doDestroyOld = false);
+
+ /**
+ \brief Store this Handle's parameter to a string
+ \param [in] buf this buffer is used to store any strings that need to be constructed
+ \param [in] bufSize size of buf
+ \param [out] ret this contains a pointer to the value as a string, it may or may not
+ be equal to buf, depending if the value had to be constructed dynamically or if it already exists as a static string
+ */
+ PX_INLINE ErrorType valueToStr(char *buf, uint32_t bufSize, const char *&ret);
+
+ /**
+ \brief Store the string to this Handle's parameter
+ \returns ERROR_TYPE_NOT_SUPPORTED if the Handle's parameter type is an array, struct, or reference
+ \returns ERROR_NONE if the Handle's parameter type is a simple type (u32, i32, vec3, etc)
+ */
+ PX_INLINE ErrorType strToValue(const char *str, const char **endptr);
+
+ /**
+ \brief Resize the array that the Handle points to
+ */
+ ErrorType resizeArray(int32_t new_size);
+
+ /**
+ \brief Get the array size for the given array dimension
+ */
+ PX_INLINE ErrorType getArraySize(int32_t &size, int32_t dimension = 0) const;
+
+ /**
+ \brief Swap two elements of an array
+ */
+ PX_INLINE ErrorType swapArrayElements(uint32_t firstElement, uint32_t secondElement);
+
+ // These functions wrap the raw(Get|Set)XXXXX() methods. They deal with
+ // error handling and casting.
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamBool(bool &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamBool(bool val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamBoolArray(bool *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamBoolArray(const bool *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamString(const char *&val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamString(const char *val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamStringArray(char **array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamStringArray(const char **array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamEnum(const char *&val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamEnum(const char *val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamEnumArray(char **array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamEnumArray(const char **array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \see Interface::getParamRef()
+ */
+ PX_INLINE ErrorType getParamRef(::NvParameterized::Interface *&val) const ;
+
+ /**
+ \see Interface::getParamRefArray()
+ */
+ PX_INLINE ErrorType getParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \see Interface::setParamRef()
+ */
+ PX_INLINE ErrorType setParamRef(::NvParameterized::Interface * val, bool doDestroyOld = false) ;
+
+ /**
+ \see Interface::setParamRefArray()
+ */
+ PX_INLINE ErrorType setParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset = 0, bool doDestroyOld = false) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamI8(int8_t &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamI8(int8_t val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamI8Array(int8_t *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamI8Array(const int8_t *val, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamI16(int16_t &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamI16(int16_t val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamI16Array(int16_t *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamI16Array(const int16_t *val, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamI32(int32_t &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamI32(int32_t val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamI32Array(int32_t *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamI32Array(const int32_t *val, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamI64(int64_t &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamI64(int64_t val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamI64Array(int64_t *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamI64Array(const int64_t *val, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamU8(uint8_t &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamU8(uint8_t val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamU8Array(uint8_t *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamU8Array(const uint8_t *val, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamU16(uint16_t &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamU16(uint16_t val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamU16Array(uint16_t *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamU16Array(const uint16_t *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamU32(uint32_t &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamU32(uint32_t val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamU32Array(uint32_t *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamU32Array(const uint32_t *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamU64(uint64_t &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamU64(uint64_t val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamU64Array(uint64_t *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamU64Array(const uint64_t *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamF32(float &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamF32(float val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamF32Array(float *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamF32Array(const float *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamF64(double &val) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamF64(double val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamF64Array(double *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamF64Array(const double *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamVec2(const physx::PxVec2 &val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamVec2(physx::PxVec2 &val) const ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamVec2Array(physx::PxVec2 *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamVec2Array(const physx::PxVec2 *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType setParamVec3(const physx::PxVec3 &val) ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType getParamVec3(physx::PxVec3 &val) const ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamVec3Array(physx::PxVec3 *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamVec3Array(const physx::PxVec3 *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType setParamVec4(const physx::PxVec4 &val) ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType getParamVec4(physx::PxVec4 &val) const ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamVec4Array(physx::PxVec4 *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamVec4Array(const physx::PxVec4 *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType setParamQuat(const physx::PxQuat &val) ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType getParamQuat(physx::PxQuat &val) const ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamQuatArray(physx::PxQuat *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamQuatArray(const physx::PxQuat *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType setParamMat33(const physx::PxMat33 &val) ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType getParamMat33(physx::PxMat33 &val) const ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamMat33Array(physx::PxMat33 *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamMat33Array(const physx::PxMat33 *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamMat44(const physx::PxMat44 &val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamMat44(physx::PxMat44 &val) const ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamMat44Array(physx::PxMat44 *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamMat44Array(const physx::PxMat44 *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamMat34Legacy(const float (&val)[12]) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamMat34Legacy(float (&val)[12]) const ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamMat34LegacyArray(float* array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamMat34LegacyArray(const float *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamBounds3(const physx::PxBounds3 &val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamBounds3(physx::PxBounds3 &val) const ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamBounds3Array(physx::PxBounds3 *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamBounds3Array(const physx::PxBounds3 *array, int32_t n, int32_t offset = 0) ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamTransform(const physx::PxTransform &val) ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamTransform(physx::PxTransform &val) const ;
+
+ /**
+ \brief Get param
+ */
+ PX_INLINE ErrorType getParamTransformArray(physx::PxTransform *array, int32_t n, int32_t offset = 0) const ;
+
+ /**
+ \brief Set param
+ */
+ PX_INLINE ErrorType setParamTransformArray(const physx::PxTransform *array, int32_t n, int32_t offset = 0) ;
+
+
+ /// Template version of setParamXxx
+ template <typename T> PX_INLINE ErrorType setParam(const T &val);
+
+ /// Template version of getParamXxx
+ template <typename T> PX_INLINE ErrorType getParam(T &val) const;
+
+ /// Template version of getParamXxxArray
+ template <typename T> PX_INLINE ErrorType getParamArray(T *array, int32_t n, int32_t offset = 0) const;
+
+ /// Template version of setParamXxxArray
+ template <typename T> PX_INLINE ErrorType setParamArray(const T *array, int32_t n, int32_t offset = 0);
+
+private:
+
+ PX_INLINE void pushIndex(int32_t index);
+
+ bool mIsValid, mIsConst;
+ int32_t mNumIndexes;
+ int32_t mIndexList[MAX_DEPTH];
+ const Definition *mParameterDefinition;
+ void *mUserData;
+ ::NvParameterized::Interface *mInterface;
+};
+
+/// A callback class for notification just prior to serialization
+class SerializationCallback
+{
+public:
+ virtual ~SerializationCallback() {}
+ /// Callback method
+ virtual void preSerialize(void* userData = NULL) = 0;
+};
+
+
+/**
+\brief Represents the interface to the NvParameterized object
+*/
+class Interface
+{
+ friend class Handle;
+public:
+
+ /**
+ \brief Destructor
+ */
+ virtual ~Interface() {}
+
+ /**
+ \brief Destroys the NvParameterized object and all nested dynamic objects contained within
+ */
+ virtual void destroy() = 0;
+
+ /**
+ \brief Initializes all parameters to their default value
+ */
+ virtual void initDefaults(void) = 0;
+
+ /**
+ \brief Initializes all parameters with random values
+ */
+ virtual void initRandom(void) = 0;
+
+ /**
+ \brief Get the class name
+ */
+ virtual const char * className(void) const = 0;
+
+ /**
+ \brief Sets the class name
+
+ This method is used for named references. The input name should be one of the possible variants.
+ \see Definition::numRefVariants(), Definition::refVariantVal()
+ */
+ virtual void setClassName(const char *name) = 0;
+
+ /**
+ \brief Get the name of the NvParameterized object
+ This method is used for named references. The name will typically specify an asset to be loaded.
+ */
+ virtual const char * name(void) const = 0;
+
+ /**
+ \brief Set the name of the NvParameterized object
+ This method is used for named references. The name will typically specify an asset to be loaded.
+ */
+ virtual void setName(const char *name) = 0;
+
+ /**
+ \brief Get the class version
+ */
+ virtual uint32_t version(void) const = 0;
+
+ /**
+ \brief Get the major part of class version
+ */
+ virtual uint16_t getMajorVersion(void) const = 0;
+
+ /**
+ \brief Get the minor part of class version
+ */
+ virtual uint16_t getMinorVersion(void) const = 0;
+
+ /**
+ \brief Get the class checksum.
+ \param bits contains the number of bits contained in the checksum
+ \returns A pointer to a constant array of uint32_t values representing the checksum
+ */
+ virtual const uint32_t * checksum(uint32_t &bits) const = 0;
+
+ /**
+ \brief Get the number of parameters contained in the NvParameterized object
+ */
+ virtual int32_t numParameters(void) = 0;
+
+ /**
+ \brief Get the definition of i-th parameter
+ */
+ virtual const Definition *parameterDefinition(int32_t index) = 0;
+
+ /**
+ \brief Get definition of root structure
+ */
+ virtual const Definition *rootParameterDefinition(void) = 0;
+
+ /**
+ \brief Get definition of root structure
+ */
+ virtual const Definition *rootParameterDefinition(void) const = 0;
+
+ /**
+ \brief Set the Handle to point to the parameter specified by longName
+ Given a long name like "mystruct.somearray[10].foo", it will return
+ a handle to that specific parameter. The handle can then be used to
+ set/get values, as long as it's a handle to a leaf node.
+ \note this method will not work if an included reference's child is included in the longName
+ */
+ virtual ErrorType getParameterHandle(const char *longName, Handle &handle) const = 0;
+
+ /**
+ \brief Set the Handle to point to the parameter specified by longName
+ Given a long name like "mystruct.somearray[10].foo", it will return
+ a handle to that specific parameter. The handle can then be used to
+ set/get values, as long as it's a handle to a leaf node.
+ \note this method will not work if an included reference's child is included in the longName
+ */
+ virtual ErrorType getParameterHandle(const char *longName, Handle &handle) = 0;
+
+ /// An application may set a callback function that is called immediately before serialization
+ virtual void setSerializationCallback(SerializationCallback *cb, void *userData = NULL) = 0;
+
+ /// Called prior by Serializer to serialization
+ virtual ErrorType callPreSerializeCallback() const = 0;
+
+
+ /**
+ \brief Compares two NvParameterized objects
+ \param [in] obj The other ::NvParameterized::Interface object (this == obj)
+ \param [out] handlesOfInequality If the return value is False, these handles will contain the path to where definition or data is not identical
+ \param [in] numHandlesOfInequality The number of handles that can be written to.
+ \param [in] doCompareNotSerialized If false differences of parameters with DONOTSERIALIZE-hint are ignored.
+ \returns true if parameter definition tree is equal as well as parameter values
+ */
+ virtual bool equals(const ::NvParameterized::Interface &obj, Handle* handlesOfInequality = NULL, uint32_t numHandlesOfInequality = 0, bool doCompareNotSerialized = true) const = 0;
+
+ /**
+ \brief Checks if object satisfies schema constraints
+ \param [out] invalidHandles If the return value is False, these handles will contain the path to invalid data
+ \param [in] numInvalidHandles The number of handles that can be written to.
+ \returns true if all values satisfy constraints
+ */
+ virtual bool areParamsOK(Handle *invalidHandles = NULL, uint32_t numInvalidHandles = 0) = 0;
+
+ /**
+ \brief Copies an NvParameterized object
+ \param [in] src the src NvParameterized object will be copied to this object. It must be of the same type (class name).
+ */
+ virtual ErrorType copy(const ::NvParameterized::Interface &src) = 0;
+
+ /**
+ \brief Clones an NvParameterized object
+ \param [out] nullDestObject cloned object; note this is a *reference* to a pointer; the destination cloned object will be created and stored in this pointer; should be NULL on entry!
+ */
+ virtual ErrorType clone(Interface *&nullDestObject) const = 0;
+
+ /**
+ \brief Check that alignments of internal elements match the schema
+ \warning Only for internal use
+ */
+ virtual bool checkAlignments() const = 0;
+
+protected:
+ /**
+ \brief Initialize a Reference parameter
+
+ \note By default previous value of parameter isn't destroyed (bool doDestroyOld = false)
+ */
+ virtual ErrorType initParamRef(const Handle &handle, const char *chosenRefStr = 0, bool doDestroyOld = false) = 0;
+
+ // These functions wrap the raw(Get|Set)XXXXX() methods. They deal with
+ // error handling and casting.
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamBool(const Handle &handle, bool &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamBool(const Handle &handle, bool val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamBoolArray(const Handle &handle, bool *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamBoolArray(const Handle &handle, const bool *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamString(const Handle &handle, const char *&val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamString(const Handle &handle, const char *val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamStringArray(const Handle &handle, char **array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamStringArray(const Handle &handle, const char **array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamEnum(const Handle &handle, const char *&val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamEnum(const Handle &handle, const char *val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamEnumArray(const Handle &handle, char **array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamEnumArray(const Handle &handle, const char **array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamRef(const Handle &handle, ::NvParameterized::Interface *&val) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamRefArray(const Handle &handle, ::NvParameterized::Interface **array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \note By default previous value of parameter is not destroyed (bool doDestroyOld = false)
+ */
+ virtual ErrorType setParamRef(const Handle &handle, ::NvParameterized::Interface * val, bool doDestroyOld = false) = 0;
+
+ /**
+ \note By default previous values of parameter are not destroyed (bool doDestroyOld = false)
+ */
+ virtual ErrorType setParamRefArray(const Handle &handle, /*const*/ ::NvParameterized::Interface **array, int32_t n, int32_t offset = 0, bool doDestroyOld = false) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamI8(const Handle &handle, int8_t &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamI8(const Handle &handle, int8_t val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamI8Array(const Handle &handle, int8_t *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamI8Array(const Handle &handle, const int8_t *val, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamI16(const Handle &handle, int16_t &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamI16(const Handle &handle, int16_t val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamI16Array(const Handle &handle, int16_t *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamI16Array(const Handle &handle, const int16_t *val, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamI32(const Handle &handle, int32_t &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamI32(const Handle &handle, int32_t val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamI32Array(const Handle &handle, int32_t *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamI32Array(const Handle &handle, const int32_t *val, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamI64(const Handle &handle, int64_t &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamI64(const Handle &handle, int64_t val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamI64Array(const Handle &handle, int64_t *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamI64Array(const Handle &handle, const int64_t *val, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamU8(const Handle &handle, uint8_t &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamU8(const Handle &handle, uint8_t val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamU8Array(const Handle &handle, uint8_t *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamU8Array(const Handle &handle, const uint8_t *val, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamU16(const Handle &handle, uint16_t &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamU16(const Handle &handle, uint16_t val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamU16Array(const Handle &handle, uint16_t *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamU16Array(const Handle &handle, const uint16_t *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamU32(const Handle &handle, uint32_t &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamU32(const Handle &handle, uint32_t val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamU32Array(const Handle &handle, uint32_t *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamU32Array(const Handle &handle, const uint32_t *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamU64(const Handle &handle, uint64_t &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamU64(const Handle &handle, uint64_t val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamU64Array(const Handle &handle, uint64_t *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamU64Array(const Handle &handle, const uint64_t *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamF32(const Handle &handle, float &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamF32(const Handle &handle, float val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamF32Array(const Handle &handle, float *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamF32Array(const Handle &handle, const float *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamF64(const Handle &handle, double &val) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamF64(const Handle &handle, double val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamF64Array(const Handle &handle, double *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamF64Array(const Handle &handle, const double *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamVec2(const Handle &handle, const physx::PxVec2 &val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamVec2(const Handle &handle, physx::PxVec2 &val) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamVec2Array(const Handle &handle, physx::PxVec2 *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamVec2Array(const Handle &handle, const physx::PxVec2 *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamVec3(const Handle &handle, const physx::PxVec3 &val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamVec3(const Handle &handle, physx::PxVec3 &val) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamVec3Array(const Handle &handle, physx::PxVec3 *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamVec3Array(const Handle &handle, const physx::PxVec3 *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamVec4(const Handle &handle, const physx::PxVec4 &val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamVec4(const Handle &handle, physx::PxVec4 &val) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamVec4Array(const Handle &handle, physx::PxVec4 *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamVec4Array(const Handle &handle, const physx::PxVec4 *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamQuat(const Handle &handle, const physx::PxQuat &val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamQuat(const Handle &handle, physx::PxQuat &val) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamQuatArray(const Handle &handle, physx::PxQuat *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamQuatArray(const Handle &handle, const physx::PxQuat *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamMat33(const Handle &handle, const physx::PxMat33 &val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamMat33(const Handle &handle, physx::PxMat33 &val) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamMat33Array(const Handle &handle, physx::PxMat33 *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamMat33Array(const Handle &handle, const physx::PxMat33 *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamMat44(const Handle &handle, const physx::PxMat44 &val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamMat44(const Handle &handle, physx::PxMat44 &val) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamMat44Array(const Handle &handle, physx::PxMat44 *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamMat44Array(const Handle &handle, const physx::PxMat44 *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamMat34Legacy(const Handle &handle, const float (&val)[12]) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamMat34Legacy(const Handle &handle, float (&val)[12]) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamMat34LegacyArray(const Handle &handle, float *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamMat34LegacyArray(const Handle &handle, const float *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamBounds3(const Handle &handle, const physx::PxBounds3 &val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamBounds3(const Handle &handle, physx::PxBounds3 &val) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamBounds3Array(const Handle &handle, physx::PxBounds3 *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamTransform(const Handle &handle, const physx::PxTransform &val) = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamTransform(const Handle &handle, physx::PxTransform &val) const = 0;
+
+ /**
+ \brief Get param
+ */
+ virtual ErrorType getParamTransformArray(const Handle &handle, physx::PxTransform *array, int32_t n, int32_t offset = 0) const = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamTransformArray(const Handle &handle, const physx::PxTransform *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Set param
+ */
+ virtual ErrorType setParamBounds3Array(const Handle &handle, const physx::PxBounds3 *array, int32_t n, int32_t offset = 0) = 0;
+
+ /**
+ \brief Store value of parameter into a string
+ \see Handle::valueToStr
+ */
+ virtual ErrorType valueToStr(const Handle &handle, char *buf, uint32_t bufSize, const char *&ret) = 0;
+
+ /**
+ \brief Read value of parameter from string
+ \see Handle::strToValue
+ */
+ virtual ErrorType strToValue(Handle &handle,const char *str, const char **endptr) = 0; // assigns this string to the value
+
+ /**
+ \brief Resize array parameter
+ \see Handle::resizeArray
+ */
+ virtual ErrorType resizeArray(const Handle &array_handle, int32_t new_size) = 0;
+
+ /**
+ \brief Get size of array parameter
+ \see Handle::getArraySize
+ */
+ virtual ErrorType getArraySize(const Handle &array_handle, int32_t &size, int32_t dimension = 0) const = 0;
+
+ /**
+ \brief Swap two elements of an array
+ \see Handle::swapArrayElements
+ */
+ virtual ErrorType swapArrayElements(const Handle &array_handle, uint32_t firstElement, uint32_t secondElement) = 0;
+};
+
+} // end of namespace
+
+#include "NvParameterized.inl" // inline the NvParamterHandle methods.
+
+PX_POP_PACK
+
+#endif // NV_PARAMETERIZED_H
diff --git a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.inl b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.inl index b7c2d2c..43e1703 100644..100755 --- a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.inl +++ b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized.inl @@ -1,1229 +1,1229 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. - - -/*! -\brief NvParameterized inline implementation -*/ - -namespace NvParameterized -{ - -#include "nvparameterized/NvParameterizedMacroses.h" - -#if PX_VC && !PX_PS4 - #pragma warning(push) - #pragma warning(disable: 4996) -#endif //!PX_PS4 - -#define IS_ALPHA(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) -#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') -#define IS_ALPHANUM(c) (IS_ALPHA(c) || IS_DIGIT(c)) -#define IS_IDENTCHAR(c) (IS_ALPHANUM(c) || (c) == ' ' || (c) == '_') - -/** -\brief Enum of tokenizer result types -*/ -enum TokenizerResultType -{ - TOKENIZER_RESULT_NONE, - TOKENIZER_RESULT_BUFFER_OVERFLOW, - TOKENIZER_RESULT_SYNTAX_ERROR, - TOKENIZER_RESULT_STRUCT_MEMBER, - TOKENIZER_RESULT_ARRAY_INDEX -}; - -/** -\brief Get struct member token -*/ -PX_INLINE TokenizerResultType getStructMemberToken(const char *long_name, - char *token, - uint32_t max_token_len, - uint32_t &offset) -{ - PX_ASSERT(long_name != NULL); - PX_ASSERT(token != NULL); - PX_ASSERT(max_token_len > 1); - PX_ASSERT(IS_IDENTCHAR(long_name[0]) || long_name[0] == '.'); - - offset = 0; - - if(long_name[0] == '.') - offset++; - - uint32_t tokenLen = 0; - while(IS_IDENTCHAR(long_name[offset])) - { - if(offset == max_token_len - 1) - return(TOKENIZER_RESULT_BUFFER_OVERFLOW); - - token[tokenLen++] = long_name[offset++]; - } - - token[tokenLen++] = 0; - - if(long_name[offset] != 0 && long_name[offset] != '.' && long_name[offset] != '[') - return(TOKENIZER_RESULT_SYNTAX_ERROR); - - return(TOKENIZER_RESULT_STRUCT_MEMBER); -} - -/** -\brief Get array member token -*/ -PX_INLINE TokenizerResultType getArrayMemberToken(const char *long_name, - char *token, - uint32_t max_token_len, - uint32_t &offset) -{ - PX_ASSERT(long_name != NULL); - PX_ASSERT(token != NULL); - PX_ASSERT(max_token_len > 1); - PX_ASSERT(long_name[0] == '['); - - offset = 1; - - uint32_t tokenLen = 0; - while(long_name[offset] && IS_DIGIT(long_name[offset])) - { - if(tokenLen == max_token_len - 1) - return(TOKENIZER_RESULT_BUFFER_OVERFLOW); - - token[tokenLen++] = long_name[offset++]; - } - - token[tokenLen++] = 0; - - if(long_name[offset] != ']') - return(TOKENIZER_RESULT_SYNTAX_ERROR); - - offset++; - - return(TOKENIZER_RESULT_ARRAY_INDEX); -} - -/** -\brief Get next token -*/ -PX_INLINE TokenizerResultType getNextToken(const char *long_name, - char *token, - uint32_t max_token_len, - uint32_t &offset) -{ - PX_ASSERT(long_name != NULL); - PX_ASSERT(token != NULL); - PX_ASSERT(max_token_len > 1); - - if(long_name[0] == 0) - return(TOKENIZER_RESULT_NONE); - - if(long_name[0] == '.' || IS_IDENTCHAR(long_name[0])) - return(getStructMemberToken(long_name, token, max_token_len, offset)); - - if(long_name[0] == '[') - return(getArrayMemberToken(long_name, token, max_token_len, offset)); - - return(TOKENIZER_RESULT_SYNTAX_ERROR); -} - -#undef IS_ALPHA -#undef IS_DIGIT -#undef IS_ALPHANUM -#undef IS_IDENTCHAR - -/* - The local_strcat_s function appends strSource to strDestination and terminates the resulting string with a null character. - The initial character of strSource overwrites the terminating null character of strDestination. The behavior of strcat_s is - undefined if the source and destination strings overlap. Note that the second parameter is the total size of the buffer, not - the remaining size -*/ - -/** -\brief The local_strcat_s function appends strSource to strDestination and terminates the resulting string with a null character. -*/ -PX_INLINE int local_strcat_s(char* dest, size_t size, const char* src) -{ - size_t d, destStringLen, srcStringLen; - - if ( dest == NULL || - src == NULL || - size == 0 ) - { - return -1; - } - - destStringLen = strlen(dest); - srcStringLen = strlen(src); - d = srcStringLen + destStringLen; - - if ( size <= d ) - { - return -1; - } - - ::memcpy( &dest[destStringLen], src, srcStringLen ); - dest[d] = '\0'; - - return 0; -} - -/** -\brief The local_sprintf_s function wraps the va_list functionality required for PxVxprintf -*/ -int32_t local_sprintf_s( char * _DstBuf, size_t _DstSize, const char * _Format, ...); - -PX_INLINE Handle::Handle(::NvParameterized::Interface *iface) -{ - reset(); - mInterface = iface; - mIsConst = false; - if (mInterface != NULL) - mParameterDefinition = mInterface->rootParameterDefinition(); -} - -PX_INLINE Handle::Handle(::NvParameterized::Interface &iface) -{ - reset(); - mInterface = &iface; - mIsConst = false; - mParameterDefinition = mInterface->rootParameterDefinition(); -} - -PX_INLINE Handle::Handle(const ::NvParameterized::Interface &iface) -{ - reset(); - mInterface = const_cast< ::NvParameterized::Interface * >(&iface); - mIsConst = true; - mParameterDefinition = mInterface->rootParameterDefinition(); -} - -PX_INLINE Handle::Handle(const Handle ¶m_handle) -{ - reset(); - - if(param_handle.isValid()) - { - mNumIndexes = param_handle.mNumIndexes; - memcpy(mIndexList, param_handle.mIndexList, sizeof(int32_t) * mNumIndexes); - mParameterDefinition = param_handle.mParameterDefinition; - mIsValid = param_handle.mIsValid; - mIsConst = param_handle.mIsConst; - mInterface = param_handle.mInterface; - } - else - mIsConst = mIsValid = false; -} - - -PX_INLINE Handle::Handle(::NvParameterized::Interface &instance,const char *longName) -{ - mInterface = &instance; - mIsConst = false; - mInterface->getParameterHandle(longName, *this); -} - -PX_INLINE Handle::Handle(const ::NvParameterized::Interface &instance,const char *longName) -{ - mInterface = const_cast< ::NvParameterized::Interface *>(&instance); - mIsConst = true; - mInterface->getParameterHandle(longName, *this); -} - -PX_INLINE ErrorType Handle::getChildHandle(const ::NvParameterized::Interface *instance,const char *child_long_name, Handle &handle) -{ - handle = *this; - handle.mUserData = NULL; - return(handle.set(instance,child_long_name)); -} - -PX_INLINE ErrorType Handle::getParameter(const char *longName) -{ - if( !mInterface ) - { - return ERROR_HANDLE_MISSING_INTERFACE_POINTER; - } - - return mInterface->getParameterHandle(longName, *this); -} - -PX_INLINE ErrorType Handle::set(const ::NvParameterized::Interface *instance,const Definition *root,const char *child_long_name) -{ - PX_ASSERT(root->parent() == NULL); - - reset(); - mParameterDefinition = root; - mIsValid = true; - - return(set(instance,child_long_name)); -} - -PX_INLINE ErrorType Handle::set(const ::NvParameterized::Interface *instance,const char *child_long_name) -{ - PX_ASSERT(mParameterDefinition != NULL); - PX_ASSERT(child_long_name != NULL); - - if(!isValid()) - return(ERROR_INVALID_PARAMETER_HANDLE); - - mUserData = NULL; - - if(child_long_name[0] == 0) - { - return(ERROR_NONE); - } - - int32_t indexLevel = 0; - - mIsValid = false; - // while(1) causes C4127 warning - for( ; ; ) - { - char token[1024]; - uint32_t offset; - - TokenizerResultType Result = getNextToken(child_long_name, token, sizeof(token), offset); - - switch(Result) - { - case TOKENIZER_RESULT_NONE: - if(indexLevel == 0) - return(ERROR_INVALID_PARAMETER_NAME); - else - goto no_error; - - case TOKENIZER_RESULT_BUFFER_OVERFLOW: - return(ERROR_RESULT_BUFFER_OVERFLOW); - - case TOKENIZER_RESULT_SYNTAX_ERROR: - return(ERROR_SYNTAX_ERROR_IN_NAME); - - case TOKENIZER_RESULT_STRUCT_MEMBER: - { - if(mParameterDefinition->type() != TYPE_STRUCT) - return(ERROR_NAME_DOES_NOT_MATCH_DEFINITION); - - int32_t index; - mParameterDefinition = mParameterDefinition->child(token, index); - if(mParameterDefinition == NULL) - return(ERROR_INVALID_PARAMETER_NAME); - - pushIndex(index); - } - break; - - case TOKENIZER_RESULT_ARRAY_INDEX: - { - if(mParameterDefinition->type() != TYPE_ARRAY) - return(ERROR_NAME_DOES_NOT_MATCH_DEFINITION); - - int32_t index = atoi(token); - PX_ASSERT(index >= 0); - - int32_t arraySize=0; - if ( instance ) - { - Handle handle(*instance); - ErrorType err = instance->getParameterHandle( mParameterDefinition->longName(), handle ); - if(err != ERROR_NONE) - return(err); - handle.getArraySize(arraySize); - } - else - { - arraySize = mParameterDefinition->arraySize(); - } - - if(index >= arraySize ) - return(ERROR_INDEX_OUT_OF_RANGE); - - PX_ASSERT(mParameterDefinition->numChildren() == 1); - mParameterDefinition = mParameterDefinition->child(0); - - pushIndex(index); - } - break; - } - - child_long_name += offset; - indexLevel++; - } - -no_error: - - mIsValid = true; - return(ERROR_NONE); -} - -PX_INLINE ErrorType Handle::set(int32_t child_index) -{ - PX_ASSERT(mParameterDefinition != NULL); - PX_ASSERT(child_index >= 0); - - switch(parameterDefinition()->type()) - { - case TYPE_STRUCT: - if(child_index < 0 || child_index >= parameterDefinition()->numChildren()) - return(ERROR_INDEX_OUT_OF_RANGE); - mParameterDefinition = mParameterDefinition->child(child_index); - pushIndex(child_index); - - break; - - - case TYPE_ARRAY: - if(child_index < 0) - return(ERROR_INDEX_OUT_OF_RANGE); - - // parameterDefinition()->arraySize() does not work on dynamic arrays... - if( parameterDefinition()->arraySizeIsFixed() && - child_index >= parameterDefinition()->arraySize()) - return(ERROR_INDEX_OUT_OF_RANGE); - - mParameterDefinition = mParameterDefinition->child(0); - pushIndex(child_index); - break; - - NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS - default: - { - return(ERROR_IS_LEAF_NODE); - } - } - - mIsValid = true; - return(ERROR_NONE); -} - -PX_INLINE ErrorType Handle::getChildHandle(int32_t index, Handle &handle) -{ - if(parameterDefinition()->type() != TYPE_ARRAY && parameterDefinition()->type() != TYPE_STRUCT) - return(ERROR_IS_LEAF_NODE); - - if(!isValid()) - return(ERROR_INVALID_PARAMETER_HANDLE); - - handle = *this; - handle.pushIndex(index); - if(parameterDefinition()->type() == TYPE_STRUCT) - { - PX_ASSERT(parameterDefinition()->child(index) != NULL); - handle.mParameterDefinition = parameterDefinition()->child(index); - } - else - { - PX_ASSERT(parameterDefinition()->child(0) != NULL); - handle.mParameterDefinition = parameterDefinition()->child(0); - } - - return(ERROR_NONE); -} - -PX_INLINE bool Handle::getLongName(char *str, uint32_t max_str_len) const -{ - PX_ASSERT(parameterDefinition() != NULL); - - if(!isValid()) - return(false); - - if(numIndexes() < 1) - return(false); - - const Definition *root = parameterDefinition()->root(); - - *str = 0; - const Definition *node = root->child(index(0)); - char tmpStr[32]; - for(int32_t i=1; i <= numIndexes(); ++i) - { - PX_ASSERT(node != NULL); - PX_ASSERT(node->parent() != NULL); - - switch(node->parent()->type()) - { - case TYPE_STRUCT: - { - if(node->parent()->parent() != NULL) - { - local_strcat_s(str, max_str_len, "."); - } - local_strcat_s(str, max_str_len, node->name()); - break; - } - - case TYPE_ARRAY: - { - local_strcat_s(str, max_str_len, "["); - - local_sprintf_s(tmpStr, sizeof(tmpStr), "%d", index(i-1)); - - local_strcat_s(str, max_str_len, tmpStr); - local_strcat_s(str, max_str_len, "]"); - break; - } - - NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS - default: - { - local_strcat_s(str, max_str_len, node->name()); - } - } - - switch(node->type()) - { - case TYPE_STRUCT: - node = node->child(index(i)); - break; - - case TYPE_ARRAY: - node = node->child(0); - break; - - NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS - default: - node = NULL; - } - } - - return(true); -} - -PX_INLINE void Handle::reset(void) -{ - mNumIndexes = 0; - mParameterDefinition = NULL; - mUserData = NULL; - mIsValid = false; -} - -PX_INLINE void Handle::pushIndex(int32_t index) -{ - PX_ASSERT(mNumIndexes < MAX_DEPTH); - PX_ASSERT(index >= 0); - - if(mNumIndexes < MAX_DEPTH) - mIndexList[mNumIndexes++] = index; -} - -PX_INLINE int32_t Handle::popIndex(int32_t levels) -{ - PX_ASSERT(levels > 0); - PX_ASSERT(mNumIndexes >= levels); - PX_ASSERT(mParameterDefinition != NULL); - - if(mNumIndexes >= levels ) - { - mNumIndexes -= levels; - - for(; levels > 0; --levels) - mParameterDefinition = mParameterDefinition->parent(); - - return(mIndexList[mNumIndexes]); - } - - return(-1); -} - -PX_INLINE ErrorType Handle::initParamRef(const char *chosenRefStr, bool doDestroyOld) -{ - PX_ASSERT(mInterface); - return mInterface->initParamRef(*this, chosenRefStr, doDestroyOld); -} - -// These functions wrap the raw(Get|Set)XXXXX() methods. They deal with -// error handling and casting. - -#define CHECK_CONST_HANDLE if( mIsConst ) return ERROR_MODIFY_CONST_HANDLE; - -PX_INLINE ErrorType Handle::getParamBool(bool &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamBool(*this,val); -} - -PX_INLINE ErrorType Handle::setParamBool(bool val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamBool(*this,val); -} - -PX_INLINE ErrorType Handle::getParamBoolArray(bool *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamBoolArray(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamBoolArray(const bool *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamBoolArray(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::getParamString(const char *&val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamString(*this,val); -} - -PX_INLINE ErrorType Handle::setParamString(const char *val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamString(*this,val); -} - -PX_INLINE ErrorType Handle::getParamStringArray(char **array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamStringArray(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamStringArray(const char **array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamStringArray(*this,array,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamEnum(const char *&val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamEnum(*this,val); -} - -PX_INLINE ErrorType Handle::setParamEnum(const char *val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamEnum(*this,val); -} - -PX_INLINE ErrorType Handle::getParamEnumArray(char **array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamEnumArray(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamEnumArray(const char **array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamEnumArray(*this,array,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamRef(::NvParameterized::Interface *&val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamRef(*this,val); -} - -PX_INLINE ErrorType Handle::setParamRef(::NvParameterized::Interface *val, bool doDestroyOld) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamRef(*this, val, doDestroyOld); -} - -PX_INLINE ErrorType Handle::getParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamRefArray(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset, bool doDestroyOld) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamRefArray(*this,array,n,offset,doDestroyOld); -} - -PX_INLINE ErrorType Handle::getParamI8(int8_t &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamI8(*this,val); -} - -PX_INLINE ErrorType Handle::setParamI8(int8_t val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamI8(*this,val); -} - -PX_INLINE ErrorType Handle::getParamI8Array(int8_t *_array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamI8Array(*this,_array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamI8Array(const int8_t *val, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamI8Array(*this,val,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamI16(int16_t &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamI16(*this,val); -} - -PX_INLINE ErrorType Handle::setParamI16(int16_t val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamI16(*this,val); -} - -PX_INLINE ErrorType Handle::getParamI16Array(int16_t *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamI16Array(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamI16Array(const int16_t *val, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamI16Array(*this,val,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamI32(int32_t &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamI32(*this,val); -} - -PX_INLINE ErrorType Handle::setParamI32(int32_t val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamI32(*this,val); -} - -PX_INLINE ErrorType Handle::getParamI32Array(int32_t *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamI32Array(*this,array,n,offset ) ; -} - -PX_INLINE ErrorType Handle::setParamI32Array(const int32_t *val, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamI32Array(*this,val,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamI64(int64_t &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamI64(*this,val) ; -} - -PX_INLINE ErrorType Handle::setParamI64(int64_t val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamI64(*this,val); -} - -PX_INLINE ErrorType Handle::getParamI64Array(int64_t *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamI64Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamI64Array(const int64_t *val, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamI64Array(*this,val,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamU8(uint8_t &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamU8(*this,val); -} - -PX_INLINE ErrorType Handle::setParamU8(uint8_t val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamU8(*this,val); -} - -PX_INLINE ErrorType Handle::getParamU8Array(uint8_t *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamU8Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamU8Array(const uint8_t *val, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamU8Array(*this,val,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamU16(uint16_t &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamU16(*this,val); -} - -PX_INLINE ErrorType Handle::setParamU16(uint16_t val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamU16(*this,val); -} - -PX_INLINE ErrorType Handle::getParamU16Array(uint16_t *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamU16Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamU16Array(const uint16_t *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamU16Array(*this,array,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamU32(uint32_t &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamU32(*this,val); -} - -PX_INLINE ErrorType Handle::setParamU32(uint32_t val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamU32(*this,val); -} - -PX_INLINE ErrorType Handle::getParamU32Array(uint32_t *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamU32Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamU32Array(const uint32_t *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamU32Array(*this,array,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamU64(uint64_t &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamU64(*this,val); -} - -PX_INLINE ErrorType Handle::setParamU64(uint64_t val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamU64(*this,val); -} - -PX_INLINE ErrorType Handle::getParamU64Array(uint64_t *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamU64Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamU64Array(const uint64_t *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamU64Array(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::getParamF32(float &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamF32(*this,val); -} - -PX_INLINE ErrorType Handle::setParamF32(float val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamF32(*this,val); -} - -PX_INLINE ErrorType Handle::getParamF32Array(float *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamF32Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamF32Array(const float *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamF32Array(*this,array,n,offset); -} - - -PX_INLINE ErrorType Handle::getParamF64(double &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamF64(*this,val); -} - -PX_INLINE ErrorType Handle::setParamF64(double val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamF64(*this,val); -} - -PX_INLINE ErrorType Handle::getParamF64Array(double *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamF64Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamF64Array(const double *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamF64Array(*this,array,n,offset); -} - - -PX_INLINE ErrorType Handle::setParamVec2(const physx::PxVec2 &val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamVec2(*this,val); -} - -PX_INLINE ErrorType Handle::getParamVec2(physx::PxVec2 &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamVec2(*this,val); -} - -PX_INLINE ErrorType Handle::getParamVec2Array(physx::PxVec2 *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamVec2Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamVec2Array(const physx::PxVec2 *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamVec2Array(*this,array,n,offset); -} - - -PX_INLINE ErrorType Handle::setParamVec3(const physx::PxVec3 &val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamVec3(*this,val); -} - -PX_INLINE ErrorType Handle::getParamVec3(physx::PxVec3 &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamVec3(*this,val); -} - -PX_INLINE ErrorType Handle::getParamVec3Array(physx::PxVec3 *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamVec3Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamVec3Array(const physx::PxVec3 *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamVec3Array(*this,array,n,offset); -} - - -PX_INLINE ErrorType Handle::setParamVec4(const physx::PxVec4 &val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamVec4(*this,val); -} - -PX_INLINE ErrorType Handle::getParamVec4(physx::PxVec4 &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamVec4(*this,val); -} - -PX_INLINE ErrorType Handle::getParamVec4Array(physx::PxVec4 *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamVec4Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamVec4Array(const physx::PxVec4 *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamVec4Array(*this,array,n,offset); -} - - -PX_INLINE ErrorType Handle::setParamQuat(const physx::PxQuat &val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamQuat(*this,val); -} - -PX_INLINE ErrorType Handle::getParamQuat(physx::PxQuat &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamQuat(*this,val); -} - -PX_INLINE ErrorType Handle::getParamQuatArray(physx::PxQuat *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamQuatArray(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamQuatArray(const physx::PxQuat *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamQuatArray(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamMat33(const physx::PxMat33 &val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamMat33(*this,val); -} - -PX_INLINE ErrorType Handle::getParamMat33(physx::PxMat33 &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamMat33(*this,val); -} - -PX_INLINE ErrorType Handle::getParamMat33Array(physx::PxMat33 *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamMat33Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamMat33Array(const physx::PxMat33 *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamMat33Array(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamMat44(const physx::PxMat44 &val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamMat44(*this,val); -} - -PX_INLINE ErrorType Handle::getParamMat44(physx::PxMat44 &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamMat44(*this,val); -} - -PX_INLINE ErrorType Handle::getParamMat44Array(physx::PxMat44 *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamMat44Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamMat44Array(const physx::PxMat44 *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamMat44Array(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamMat34Legacy(const float (&val)[12]) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamMat34Legacy(*this,val); -} - -PX_INLINE ErrorType Handle::getParamMat34Legacy(float (&val)[12]) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamMat34Legacy(*this,val); -} - -PX_INLINE ErrorType Handle::getParamMat34LegacyArray(float *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamMat34LegacyArray(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamMat34LegacyArray(const float *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamMat34LegacyArray(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamBounds3(const physx::PxBounds3 &val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamBounds3(*this,val); -} - -PX_INLINE ErrorType Handle::getParamBounds3(physx::PxBounds3 &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamBounds3(*this,val); -} - -PX_INLINE ErrorType Handle::getParamBounds3Array(physx::PxBounds3 *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamBounds3Array(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamBounds3Array(const physx::PxBounds3 *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamBounds3Array(*this,array,n,offset); -} - -PX_INLINE ErrorType Handle::setParamTransform(const physx::PxTransform &val) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamTransform(*this,val); -} - -PX_INLINE ErrorType Handle::getParamTransform(physx::PxTransform &val) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamTransform(*this,val); -} - -PX_INLINE ErrorType Handle::getParamTransformArray(physx::PxTransform *array, int32_t n, int32_t offset ) const -{ - PX_ASSERT(mInterface); - return mInterface->getParamTransformArray(*this,array,n,offset ); -} - -PX_INLINE ErrorType Handle::setParamTransformArray(const physx::PxTransform *array, int32_t n, int32_t offset) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->setParamTransformArray(*this,array,n,offset); -} - - - -#define NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES -#define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES -#define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES -#define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \ - template <> PX_INLINE ::NvParameterized::ErrorType Handle::setParam<c_type>(const c_type &val) { return setParam##type_name(val); } \ - template <> PX_INLINE ::NvParameterized::ErrorType Handle::getParam<c_type>(c_type &val) const {return getParam##type_name(val); } \ - template <> PX_INLINE ::NvParameterized::ErrorType Handle::getParamArray<c_type>(c_type *array, int32_t n, int32_t offset) const { return getParam##type_name##Array(array, n, offset); } \ - template <> PX_INLINE ::NvParameterized::ErrorType Handle::setParamArray<c_type>(const c_type *array, int32_t n, int32_t offset) { return setParam##type_name##Array(array, n, offset); } -#include "NvParameterized_types.h" - -PX_INLINE ErrorType Handle::valueToStr(char *buf, uint32_t bufSize, const char *&ret) -{ - PX_ASSERT(mInterface); - return mInterface->valueToStr(*this, buf, bufSize, ret); -} - -PX_INLINE ErrorType Handle::strToValue(const char *str, const char **endptr) // assigns this string to the valu -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->strToValue(*this,str, endptr); // assigns this string to the value -} - - -PX_INLINE ErrorType Handle::resizeArray(int32_t new_size) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->resizeArray(*this,new_size); -} - -PX_INLINE ErrorType Handle::getArraySize(int32_t &size, int32_t dimension ) const -{ - PX_ASSERT(mInterface); - return mInterface->getArraySize(*this,size,dimension ); -} - -PX_INLINE ErrorType Handle::swapArrayElements(uint32_t firstElement, uint32_t secondElement) -{ - PX_ASSERT(mInterface); - CHECK_CONST_HANDLE - return mInterface->swapArrayElements(*this, firstElement, secondElement); -} - -#undef IS_ALPHA -#undef IS_DIGIT -#undef IS_ALPHANUM -#undef IS_IDENTCHAR -#undef CHECK_CONST_HANDLE - -#if PX_VC && !PX_PS4 - #pragma warning(pop) -#endif //!PX_PS4 - -} // end of namespace +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+
+/*!
+\brief NvParameterized inline implementation
+*/
+
+namespace NvParameterized
+{
+
+#include "nvparameterized/NvParameterizedMacroses.h"
+
+#if PX_VC && !PX_PS4
+ #pragma warning(push)
+ #pragma warning(disable: 4996)
+#endif //!PX_PS4
+
+#define IS_ALPHA(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z'))
+#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
+#define IS_ALPHANUM(c) (IS_ALPHA(c) || IS_DIGIT(c))
+#define IS_IDENTCHAR(c) (IS_ALPHANUM(c) || (c) == ' ' || (c) == '_')
+
+/**
+\brief Enum of tokenizer result types
+*/
+enum TokenizerResultType
+{
+ TOKENIZER_RESULT_NONE,
+ TOKENIZER_RESULT_BUFFER_OVERFLOW,
+ TOKENIZER_RESULT_SYNTAX_ERROR,
+ TOKENIZER_RESULT_STRUCT_MEMBER,
+ TOKENIZER_RESULT_ARRAY_INDEX
+};
+
+/**
+\brief Get struct member token
+*/
+PX_INLINE TokenizerResultType getStructMemberToken(const char *long_name,
+ char *token,
+ uint32_t max_token_len,
+ uint32_t &offset)
+{
+ PX_ASSERT(long_name != NULL);
+ PX_ASSERT(token != NULL);
+ PX_ASSERT(max_token_len > 1);
+ PX_ASSERT(IS_IDENTCHAR(long_name[0]) || long_name[0] == '.');
+
+ offset = 0;
+
+ if(long_name[0] == '.')
+ offset++;
+
+ uint32_t tokenLen = 0;
+ while(IS_IDENTCHAR(long_name[offset]))
+ {
+ if(offset == max_token_len - 1)
+ return(TOKENIZER_RESULT_BUFFER_OVERFLOW);
+
+ token[tokenLen++] = long_name[offset++];
+ }
+
+ token[tokenLen++] = 0;
+
+ if(long_name[offset] != 0 && long_name[offset] != '.' && long_name[offset] != '[')
+ return(TOKENIZER_RESULT_SYNTAX_ERROR);
+
+ return(TOKENIZER_RESULT_STRUCT_MEMBER);
+}
+
+/**
+\brief Get array member token
+*/
+PX_INLINE TokenizerResultType getArrayMemberToken(const char *long_name,
+ char *token,
+ uint32_t max_token_len,
+ uint32_t &offset)
+{
+ PX_ASSERT(long_name != NULL);
+ PX_ASSERT(token != NULL);
+ PX_ASSERT(max_token_len > 1);
+ PX_ASSERT(long_name[0] == '[');
+
+ offset = 1;
+
+ uint32_t tokenLen = 0;
+ while(long_name[offset] && IS_DIGIT(long_name[offset]))
+ {
+ if(tokenLen == max_token_len - 1)
+ return(TOKENIZER_RESULT_BUFFER_OVERFLOW);
+
+ token[tokenLen++] = long_name[offset++];
+ }
+
+ token[tokenLen++] = 0;
+
+ if(long_name[offset] != ']')
+ return(TOKENIZER_RESULT_SYNTAX_ERROR);
+
+ offset++;
+
+ return(TOKENIZER_RESULT_ARRAY_INDEX);
+}
+
+/**
+\brief Get next token
+*/
+PX_INLINE TokenizerResultType getNextToken(const char *long_name,
+ char *token,
+ uint32_t max_token_len,
+ uint32_t &offset)
+{
+ PX_ASSERT(long_name != NULL);
+ PX_ASSERT(token != NULL);
+ PX_ASSERT(max_token_len > 1);
+
+ if(long_name[0] == 0)
+ return(TOKENIZER_RESULT_NONE);
+
+ if(long_name[0] == '.' || IS_IDENTCHAR(long_name[0]))
+ return(getStructMemberToken(long_name, token, max_token_len, offset));
+
+ if(long_name[0] == '[')
+ return(getArrayMemberToken(long_name, token, max_token_len, offset));
+
+ return(TOKENIZER_RESULT_SYNTAX_ERROR);
+}
+
+#undef IS_ALPHA
+#undef IS_DIGIT
+#undef IS_ALPHANUM
+#undef IS_IDENTCHAR
+
+/*
+ The local_strcat_s function appends strSource to strDestination and terminates the resulting string with a null character.
+ The initial character of strSource overwrites the terminating null character of strDestination. The behavior of strcat_s is
+ undefined if the source and destination strings overlap. Note that the second parameter is the total size of the buffer, not
+ the remaining size
+*/
+
+/**
+\brief The local_strcat_s function appends strSource to strDestination and terminates the resulting string with a null character.
+*/
+PX_INLINE int local_strcat_s(char* dest, size_t size, const char* src)
+{
+ size_t d, destStringLen, srcStringLen;
+
+ if ( dest == NULL ||
+ src == NULL ||
+ size == 0 )
+ {
+ return -1;
+ }
+
+ destStringLen = strlen(dest);
+ srcStringLen = strlen(src);
+ d = srcStringLen + destStringLen;
+
+ if ( size <= d )
+ {
+ return -1;
+ }
+
+ ::memcpy( &dest[destStringLen], src, srcStringLen );
+ dest[d] = '\0';
+
+ return 0;
+}
+
+/**
+\brief The local_sprintf_s function wraps the va_list functionality required for PxVxprintf
+*/
+int32_t local_sprintf_s( char * _DstBuf, size_t _DstSize, const char * _Format, ...);
+
+PX_INLINE Handle::Handle(::NvParameterized::Interface *iface)
+{
+ reset();
+ mInterface = iface;
+ mIsConst = false;
+ if (mInterface != NULL)
+ mParameterDefinition = mInterface->rootParameterDefinition();
+}
+
+PX_INLINE Handle::Handle(::NvParameterized::Interface &iface)
+{
+ reset();
+ mInterface = &iface;
+ mIsConst = false;
+ mParameterDefinition = mInterface->rootParameterDefinition();
+}
+
+PX_INLINE Handle::Handle(const ::NvParameterized::Interface &iface)
+{
+ reset();
+ mInterface = const_cast< ::NvParameterized::Interface * >(&iface);
+ mIsConst = true;
+ mParameterDefinition = mInterface->rootParameterDefinition();
+}
+
+PX_INLINE Handle::Handle(const Handle ¶m_handle)
+{
+ reset();
+
+ if(param_handle.isValid())
+ {
+ mNumIndexes = param_handle.mNumIndexes;
+ memcpy(mIndexList, param_handle.mIndexList, sizeof(int32_t) * mNumIndexes);
+ mParameterDefinition = param_handle.mParameterDefinition;
+ mIsValid = param_handle.mIsValid;
+ mIsConst = param_handle.mIsConst;
+ mInterface = param_handle.mInterface;
+ }
+ else
+ mIsConst = mIsValid = false;
+}
+
+
+PX_INLINE Handle::Handle(::NvParameterized::Interface &instance,const char *longName)
+{
+ mInterface = &instance;
+ mIsConst = false;
+ mInterface->getParameterHandle(longName, *this);
+}
+
+PX_INLINE Handle::Handle(const ::NvParameterized::Interface &instance,const char *longName)
+{
+ mInterface = const_cast< ::NvParameterized::Interface *>(&instance);
+ mIsConst = true;
+ mInterface->getParameterHandle(longName, *this);
+}
+
+PX_INLINE ErrorType Handle::getChildHandle(const ::NvParameterized::Interface *instance,const char *child_long_name, Handle &handle)
+{
+ handle = *this;
+ handle.mUserData = NULL;
+ return(handle.set(instance,child_long_name));
+}
+
+PX_INLINE ErrorType Handle::getParameter(const char *longName)
+{
+ if( !mInterface )
+ {
+ return ERROR_HANDLE_MISSING_INTERFACE_POINTER;
+ }
+
+ return mInterface->getParameterHandle(longName, *this);
+}
+
+PX_INLINE ErrorType Handle::set(const ::NvParameterized::Interface *instance,const Definition *root,const char *child_long_name)
+{
+ PX_ASSERT(root->parent() == NULL);
+
+ reset();
+ mParameterDefinition = root;
+ mIsValid = true;
+
+ return(set(instance,child_long_name));
+}
+
+PX_INLINE ErrorType Handle::set(const ::NvParameterized::Interface *instance,const char *child_long_name)
+{
+ PX_ASSERT(mParameterDefinition != NULL);
+ PX_ASSERT(child_long_name != NULL);
+
+ if(!isValid())
+ return(ERROR_INVALID_PARAMETER_HANDLE);
+
+ mUserData = NULL;
+
+ if(child_long_name[0] == 0)
+ {
+ return(ERROR_NONE);
+ }
+
+ int32_t indexLevel = 0;
+
+ mIsValid = false;
+ // while(1) causes C4127 warning
+ for( ; ; )
+ {
+ char token[1024];
+ uint32_t offset;
+
+ TokenizerResultType Result = getNextToken(child_long_name, token, sizeof(token), offset);
+
+ switch(Result)
+ {
+ case TOKENIZER_RESULT_NONE:
+ if(indexLevel == 0)
+ return(ERROR_INVALID_PARAMETER_NAME);
+ else
+ goto no_error;
+
+ case TOKENIZER_RESULT_BUFFER_OVERFLOW:
+ return(ERROR_RESULT_BUFFER_OVERFLOW);
+
+ case TOKENIZER_RESULT_SYNTAX_ERROR:
+ return(ERROR_SYNTAX_ERROR_IN_NAME);
+
+ case TOKENIZER_RESULT_STRUCT_MEMBER:
+ {
+ if(mParameterDefinition->type() != TYPE_STRUCT)
+ return(ERROR_NAME_DOES_NOT_MATCH_DEFINITION);
+
+ int32_t index;
+ mParameterDefinition = mParameterDefinition->child(token, index);
+ if(mParameterDefinition == NULL)
+ return(ERROR_INVALID_PARAMETER_NAME);
+
+ pushIndex(index);
+ }
+ break;
+
+ case TOKENIZER_RESULT_ARRAY_INDEX:
+ {
+ if(mParameterDefinition->type() != TYPE_ARRAY)
+ return(ERROR_NAME_DOES_NOT_MATCH_DEFINITION);
+
+ int32_t index = atoi(token);
+ PX_ASSERT(index >= 0);
+
+ int32_t arraySize=0;
+ if ( instance )
+ {
+ Handle handle(*instance);
+ ErrorType err = instance->getParameterHandle( mParameterDefinition->longName(), handle );
+ if(err != ERROR_NONE)
+ return(err);
+ handle.getArraySize(arraySize);
+ }
+ else
+ {
+ arraySize = mParameterDefinition->arraySize();
+ }
+
+ if(index >= arraySize )
+ return(ERROR_INDEX_OUT_OF_RANGE);
+
+ PX_ASSERT(mParameterDefinition->numChildren() == 1);
+ mParameterDefinition = mParameterDefinition->child(0);
+
+ pushIndex(index);
+ }
+ break;
+ }
+
+ child_long_name += offset;
+ indexLevel++;
+ }
+
+no_error:
+
+ mIsValid = true;
+ return(ERROR_NONE);
+}
+
+PX_INLINE ErrorType Handle::set(int32_t child_index)
+{
+ PX_ASSERT(mParameterDefinition != NULL);
+ PX_ASSERT(child_index >= 0);
+
+ switch(parameterDefinition()->type())
+ {
+ case TYPE_STRUCT:
+ if(child_index < 0 || child_index >= parameterDefinition()->numChildren())
+ return(ERROR_INDEX_OUT_OF_RANGE);
+ mParameterDefinition = mParameterDefinition->child(child_index);
+ pushIndex(child_index);
+
+ break;
+
+
+ case TYPE_ARRAY:
+ if(child_index < 0)
+ return(ERROR_INDEX_OUT_OF_RANGE);
+
+ // parameterDefinition()->arraySize() does not work on dynamic arrays...
+ if( parameterDefinition()->arraySizeIsFixed() &&
+ child_index >= parameterDefinition()->arraySize())
+ return(ERROR_INDEX_OUT_OF_RANGE);
+
+ mParameterDefinition = mParameterDefinition->child(0);
+ pushIndex(child_index);
+ break;
+
+ NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS
+ default:
+ {
+ return(ERROR_IS_LEAF_NODE);
+ }
+ }
+
+ mIsValid = true;
+ return(ERROR_NONE);
+}
+
+PX_INLINE ErrorType Handle::getChildHandle(int32_t index, Handle &handle)
+{
+ if(parameterDefinition()->type() != TYPE_ARRAY && parameterDefinition()->type() != TYPE_STRUCT)
+ return(ERROR_IS_LEAF_NODE);
+
+ if(!isValid())
+ return(ERROR_INVALID_PARAMETER_HANDLE);
+
+ handle = *this;
+ handle.pushIndex(index);
+ if(parameterDefinition()->type() == TYPE_STRUCT)
+ {
+ PX_ASSERT(parameterDefinition()->child(index) != NULL);
+ handle.mParameterDefinition = parameterDefinition()->child(index);
+ }
+ else
+ {
+ PX_ASSERT(parameterDefinition()->child(0) != NULL);
+ handle.mParameterDefinition = parameterDefinition()->child(0);
+ }
+
+ return(ERROR_NONE);
+}
+
+PX_INLINE bool Handle::getLongName(char *str, uint32_t max_str_len) const
+{
+ PX_ASSERT(parameterDefinition() != NULL);
+
+ if(!isValid())
+ return(false);
+
+ if(numIndexes() < 1)
+ return(false);
+
+ const Definition *root = parameterDefinition()->root();
+
+ *str = 0;
+ const Definition *node = root->child(index(0));
+ char tmpStr[32];
+ for(int32_t i=1; i <= numIndexes(); ++i)
+ {
+ PX_ASSERT(node != NULL);
+ PX_ASSERT(node->parent() != NULL);
+
+ switch(node->parent()->type())
+ {
+ case TYPE_STRUCT:
+ {
+ if(node->parent()->parent() != NULL)
+ {
+ local_strcat_s(str, max_str_len, ".");
+ }
+ local_strcat_s(str, max_str_len, node->name());
+ break;
+ }
+
+ case TYPE_ARRAY:
+ {
+ local_strcat_s(str, max_str_len, "[");
+
+ local_sprintf_s(tmpStr, sizeof(tmpStr), "%d", index(i-1));
+
+ local_strcat_s(str, max_str_len, tmpStr);
+ local_strcat_s(str, max_str_len, "]");
+ break;
+ }
+
+ NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS
+ default:
+ {
+ local_strcat_s(str, max_str_len, node->name());
+ }
+ }
+
+ switch(node->type())
+ {
+ case TYPE_STRUCT:
+ node = node->child(index(i));
+ break;
+
+ case TYPE_ARRAY:
+ node = node->child(0);
+ break;
+
+ NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS
+ default:
+ node = NULL;
+ }
+ }
+
+ return(true);
+}
+
+PX_INLINE void Handle::reset(void)
+{
+ mNumIndexes = 0;
+ mParameterDefinition = NULL;
+ mUserData = NULL;
+ mIsValid = false;
+}
+
+PX_INLINE void Handle::pushIndex(int32_t index)
+{
+ PX_ASSERT(mNumIndexes < MAX_DEPTH);
+ PX_ASSERT(index >= 0);
+
+ if(mNumIndexes < MAX_DEPTH)
+ mIndexList[mNumIndexes++] = index;
+}
+
+PX_INLINE int32_t Handle::popIndex(int32_t levels)
+{
+ PX_ASSERT(levels > 0);
+ PX_ASSERT(mNumIndexes >= levels);
+ PX_ASSERT(mParameterDefinition != NULL);
+
+ if(mNumIndexes >= levels )
+ {
+ mNumIndexes -= levels;
+
+ for(; levels > 0; --levels)
+ mParameterDefinition = mParameterDefinition->parent();
+
+ return(mIndexList[mNumIndexes]);
+ }
+
+ return(-1);
+}
+
+PX_INLINE ErrorType Handle::initParamRef(const char *chosenRefStr, bool doDestroyOld)
+{
+ PX_ASSERT(mInterface);
+ return mInterface->initParamRef(*this, chosenRefStr, doDestroyOld);
+}
+
+// These functions wrap the raw(Get|Set)XXXXX() methods. They deal with
+// error handling and casting.
+
+#define CHECK_CONST_HANDLE if( mIsConst ) return ERROR_MODIFY_CONST_HANDLE;
+
+PX_INLINE ErrorType Handle::getParamBool(bool &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamBool(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamBool(bool val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamBool(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamBoolArray(bool *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamBoolArray(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamBoolArray(const bool *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamBoolArray(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::getParamString(const char *&val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamString(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamString(const char *val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamString(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamStringArray(char **array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamStringArray(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamStringArray(const char **array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamStringArray(*this,array,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamEnum(const char *&val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamEnum(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamEnum(const char *val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamEnum(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamEnumArray(char **array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamEnumArray(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamEnumArray(const char **array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamEnumArray(*this,array,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamRef(::NvParameterized::Interface *&val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamRef(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamRef(::NvParameterized::Interface *val, bool doDestroyOld)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamRef(*this, val, doDestroyOld);
+}
+
+PX_INLINE ErrorType Handle::getParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamRefArray(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamRefArray(::NvParameterized::Interface **array, int32_t n, int32_t offset, bool doDestroyOld)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamRefArray(*this,array,n,offset,doDestroyOld);
+}
+
+PX_INLINE ErrorType Handle::getParamI8(int8_t &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamI8(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamI8(int8_t val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamI8(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamI8Array(int8_t *_array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamI8Array(*this,_array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamI8Array(const int8_t *val, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamI8Array(*this,val,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamI16(int16_t &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamI16(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamI16(int16_t val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamI16(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamI16Array(int16_t *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamI16Array(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamI16Array(const int16_t *val, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamI16Array(*this,val,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamI32(int32_t &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamI32(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamI32(int32_t val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamI32(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamI32Array(int32_t *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamI32Array(*this,array,n,offset ) ;
+}
+
+PX_INLINE ErrorType Handle::setParamI32Array(const int32_t *val, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamI32Array(*this,val,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamI64(int64_t &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamI64(*this,val) ;
+}
+
+PX_INLINE ErrorType Handle::setParamI64(int64_t val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamI64(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamI64Array(int64_t *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamI64Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamI64Array(const int64_t *val, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamI64Array(*this,val,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamU8(uint8_t &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamU8(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamU8(uint8_t val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamU8(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamU8Array(uint8_t *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamU8Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamU8Array(const uint8_t *val, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamU8Array(*this,val,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamU16(uint16_t &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamU16(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamU16(uint16_t val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamU16(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamU16Array(uint16_t *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamU16Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamU16Array(const uint16_t *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamU16Array(*this,array,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamU32(uint32_t &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamU32(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamU32(uint32_t val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamU32(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamU32Array(uint32_t *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamU32Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamU32Array(const uint32_t *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamU32Array(*this,array,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamU64(uint64_t &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamU64(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamU64(uint64_t val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamU64(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamU64Array(uint64_t *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamU64Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamU64Array(const uint64_t *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamU64Array(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::getParamF32(float &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamF32(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamF32(float val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamF32(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamF32Array(float *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamF32Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamF32Array(const float *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamF32Array(*this,array,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::getParamF64(double &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamF64(*this,val);
+}
+
+PX_INLINE ErrorType Handle::setParamF64(double val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamF64(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamF64Array(double *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamF64Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamF64Array(const double *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamF64Array(*this,array,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::setParamVec2(const physx::PxVec2 &val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamVec2(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamVec2(physx::PxVec2 &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamVec2(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamVec2Array(physx::PxVec2 *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamVec2Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamVec2Array(const physx::PxVec2 *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamVec2Array(*this,array,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::setParamVec3(const physx::PxVec3 &val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamVec3(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamVec3(physx::PxVec3 &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamVec3(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamVec3Array(physx::PxVec3 *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamVec3Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamVec3Array(const physx::PxVec3 *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamVec3Array(*this,array,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::setParamVec4(const physx::PxVec4 &val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamVec4(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamVec4(physx::PxVec4 &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamVec4(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamVec4Array(physx::PxVec4 *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamVec4Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamVec4Array(const physx::PxVec4 *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamVec4Array(*this,array,n,offset);
+}
+
+
+PX_INLINE ErrorType Handle::setParamQuat(const physx::PxQuat &val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamQuat(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamQuat(physx::PxQuat &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamQuat(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamQuatArray(physx::PxQuat *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamQuatArray(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamQuatArray(const physx::PxQuat *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamQuatArray(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamMat33(const physx::PxMat33 &val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamMat33(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamMat33(physx::PxMat33 &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamMat33(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamMat33Array(physx::PxMat33 *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamMat33Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamMat33Array(const physx::PxMat33 *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamMat33Array(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamMat44(const physx::PxMat44 &val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamMat44(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamMat44(physx::PxMat44 &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamMat44(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamMat44Array(physx::PxMat44 *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamMat44Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamMat44Array(const physx::PxMat44 *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamMat44Array(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamMat34Legacy(const float (&val)[12])
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamMat34Legacy(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamMat34Legacy(float (&val)[12]) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamMat34Legacy(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamMat34LegacyArray(float *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamMat34LegacyArray(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamMat34LegacyArray(const float *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamMat34LegacyArray(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamBounds3(const physx::PxBounds3 &val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamBounds3(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamBounds3(physx::PxBounds3 &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamBounds3(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamBounds3Array(physx::PxBounds3 *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamBounds3Array(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamBounds3Array(const physx::PxBounds3 *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamBounds3Array(*this,array,n,offset);
+}
+
+PX_INLINE ErrorType Handle::setParamTransform(const physx::PxTransform &val)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamTransform(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamTransform(physx::PxTransform &val) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamTransform(*this,val);
+}
+
+PX_INLINE ErrorType Handle::getParamTransformArray(physx::PxTransform *array, int32_t n, int32_t offset ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getParamTransformArray(*this,array,n,offset );
+}
+
+PX_INLINE ErrorType Handle::setParamTransformArray(const physx::PxTransform *array, int32_t n, int32_t offset)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->setParamTransformArray(*this,array,n,offset);
+}
+
+
+
+#define NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES
+#define NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+#define NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+#define NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) \
+ template <> PX_INLINE ::NvParameterized::ErrorType Handle::setParam<c_type>(const c_type &val) { return setParam##type_name(val); } \
+ template <> PX_INLINE ::NvParameterized::ErrorType Handle::getParam<c_type>(c_type &val) const {return getParam##type_name(val); } \
+ template <> PX_INLINE ::NvParameterized::ErrorType Handle::getParamArray<c_type>(c_type *array, int32_t n, int32_t offset) const { return getParam##type_name##Array(array, n, offset); } \
+ template <> PX_INLINE ::NvParameterized::ErrorType Handle::setParamArray<c_type>(const c_type *array, int32_t n, int32_t offset) { return setParam##type_name##Array(array, n, offset); }
+#include "NvParameterized_types.h"
+
+PX_INLINE ErrorType Handle::valueToStr(char *buf, uint32_t bufSize, const char *&ret)
+{
+ PX_ASSERT(mInterface);
+ return mInterface->valueToStr(*this, buf, bufSize, ret);
+}
+
+PX_INLINE ErrorType Handle::strToValue(const char *str, const char **endptr) // assigns this string to the valu
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->strToValue(*this,str, endptr); // assigns this string to the value
+}
+
+
+PX_INLINE ErrorType Handle::resizeArray(int32_t new_size)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->resizeArray(*this,new_size);
+}
+
+PX_INLINE ErrorType Handle::getArraySize(int32_t &size, int32_t dimension ) const
+{
+ PX_ASSERT(mInterface);
+ return mInterface->getArraySize(*this,size,dimension );
+}
+
+PX_INLINE ErrorType Handle::swapArrayElements(uint32_t firstElement, uint32_t secondElement)
+{
+ PX_ASSERT(mInterface);
+ CHECK_CONST_HANDLE
+ return mInterface->swapArrayElements(*this, firstElement, secondElement);
+}
+
+#undef IS_ALPHA
+#undef IS_DIGIT
+#undef IS_ALPHANUM
+#undef IS_IDENTCHAR
+#undef CHECK_CONST_HANDLE
+
+#if PX_VC && !PX_PS4
+ #pragma warning(pop)
+#endif //!PX_PS4
+
+} // end of namespace
diff --git a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedMacroses.h b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedMacroses.h index 71ca9c6..d39a062 100644..100755 --- a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedMacroses.h +++ b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedMacroses.h @@ -1,136 +1,136 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved. - -#ifndef NV_PARAMETERIZED_MACROSES_H -#define NV_PARAMETERIZED_MACROSES_H - -/** Case labels for different NvParameterized::DataType's -*/ -#define NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS \ -case NvParameterized::TYPE_ARRAY:\ -case NvParameterized::TYPE_STRUCT:\ - -#define NV_PARAMETRIZED_LINAL_DATATYPE_LABELS \ -case NvParameterized::TYPE_VEC2:\ -case NvParameterized::TYPE_VEC3:\ -case NvParameterized::TYPE_VEC4:\ -case NvParameterized::TYPE_QUAT:\ -case NvParameterized::TYPE_MAT33:\ -case NvParameterized::TYPE_BOUNDS3:\ -case NvParameterized::TYPE_MAT44:\ -case NvParameterized::TYPE_TRANSFORM:\ -case NvParameterized::TYPE_MAT34: - -#define NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS \ -case NvParameterized::TYPE_I8:\ -case NvParameterized::TYPE_I16:\ -case NvParameterized::TYPE_I32:\ -case NvParameterized::TYPE_I64:\ -case NvParameterized::TYPE_U8:\ -case NvParameterized::TYPE_U16:\ -case NvParameterized::TYPE_U32:\ -case NvParameterized::TYPE_U64:\ -case NvParameterized::TYPE_F32:\ -case NvParameterized::TYPE_F64:\ -case NvParameterized::TYPE_BOOL: - -#define NV_PARAMETRIZED_STRING_DATATYPE_LABELS \ -case NvParameterized::TYPE_STRING: - -#define NV_PARAMETRIZED_REF_DATATYPE_LABELS \ -case NvParameterized::TYPE_REF: - -#define NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \ -case NvParameterized::TYPE_ENUM: - -#define NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \ -case NvParameterized::TYPE_POINTER: - -#define NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS \ -case NvParameterized::TYPE_UNDEFINED:\ -case NvParameterized::TYPE_LAST: - -/** Case labels for composite conditions of switch conditions*/ -/***********************************************************************/ -#define NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS \ -/* NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS*/ \ -NV_PARAMETRIZED_LINAL_DATATYPE_LABELS \ -NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS \ -NV_PARAMETRIZED_STRING_DATATYPE_LABELS \ -NV_PARAMETRIZED_REF_DATATYPE_LABELS \ -NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \ -NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \ -NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS - -#define NV_PARAMETRIZED_NO_AGGREGATE_AND_ARITHMETIC_DATATYPE_LABELS \ -/* NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS*/ \ -NV_PARAMETRIZED_LINAL_DATATYPE_LABELS \ -/*NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS*/ \ -NV_PARAMETRIZED_STRING_DATATYPE_LABELS \ -NV_PARAMETRIZED_REF_DATATYPE_LABELS \ -NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \ -NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \ -NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS - -#define NV_PARAMETRIZED_NO_AGGREGATE_AND_REF_DATATYPE_LABELS \ -/* NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS*/ \ -NV_PARAMETRIZED_LINAL_DATATYPE_LABELS \ -NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS \ -NV_PARAMETRIZED_STRING_DATATYPE_LABELS \ -/*NV_PARAMETRIZED_REF_DATATYPE_LABELS*/ \ -NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \ -NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \ -NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS - -#define NV_PARAMETRIZED_NO_ARITHMETIC_AND_LINAL_DATATYPE_LABELS \ -NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS \ -/*NV_PARAMETRIZED_LINAL_DATATYPE_LABELS*/ \ -/*NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS*/ \ -NV_PARAMETRIZED_STRING_DATATYPE_LABELS \ -NV_PARAMETRIZED_REF_DATATYPE_LABELS \ -NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \ -NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \ -NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS - -#define NV_PARAMETRIZED_SERVICE_AND_LAST_DATATYPE_LABELS \ -NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \ -case NvParameterized::TYPE_LAST: - -#define NV_PARAMETRIZED_LEGACY_DATATYPE_LABELS \ -case NvParameterized::TYPE_MAT34: - -#define NV_PARAMETRIZED_NO_MATH_DATATYPE_LABELS \ -NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS \ -NV_PARAMETRIZED_STRING_DATATYPE_LABELS \ -NV_PARAMETRIZED_REF_DATATYPE_LABELS \ -NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \ -NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \ -NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS - -/***********************************************************************/ - -#endif // NV_PARAMETERIZED_MACROSES_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
+
+#ifndef NV_PARAMETERIZED_MACROSES_H
+#define NV_PARAMETERIZED_MACROSES_H
+
+/** Case labels for different NvParameterized::DataType's
+*/
+#define NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS \
+case NvParameterized::TYPE_ARRAY:\
+case NvParameterized::TYPE_STRUCT:\
+
+#define NV_PARAMETRIZED_LINAL_DATATYPE_LABELS \
+case NvParameterized::TYPE_VEC2:\
+case NvParameterized::TYPE_VEC3:\
+case NvParameterized::TYPE_VEC4:\
+case NvParameterized::TYPE_QUAT:\
+case NvParameterized::TYPE_MAT33:\
+case NvParameterized::TYPE_BOUNDS3:\
+case NvParameterized::TYPE_MAT44:\
+case NvParameterized::TYPE_TRANSFORM:\
+case NvParameterized::TYPE_MAT34:
+
+#define NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS \
+case NvParameterized::TYPE_I8:\
+case NvParameterized::TYPE_I16:\
+case NvParameterized::TYPE_I32:\
+case NvParameterized::TYPE_I64:\
+case NvParameterized::TYPE_U8:\
+case NvParameterized::TYPE_U16:\
+case NvParameterized::TYPE_U32:\
+case NvParameterized::TYPE_U64:\
+case NvParameterized::TYPE_F32:\
+case NvParameterized::TYPE_F64:\
+case NvParameterized::TYPE_BOOL:
+
+#define NV_PARAMETRIZED_STRING_DATATYPE_LABELS \
+case NvParameterized::TYPE_STRING:
+
+#define NV_PARAMETRIZED_REF_DATATYPE_LABELS \
+case NvParameterized::TYPE_REF:
+
+#define NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \
+case NvParameterized::TYPE_ENUM:
+
+#define NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \
+case NvParameterized::TYPE_POINTER:
+
+#define NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS \
+case NvParameterized::TYPE_UNDEFINED:\
+case NvParameterized::TYPE_LAST:
+
+/** Case labels for composite conditions of switch conditions*/
+/***********************************************************************/
+#define NV_PARAMETRIZED_NO_AGGREGATE_DATATYPE_LABELS \
+/* NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS*/ \
+NV_PARAMETRIZED_LINAL_DATATYPE_LABELS \
+NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS \
+NV_PARAMETRIZED_STRING_DATATYPE_LABELS \
+NV_PARAMETRIZED_REF_DATATYPE_LABELS \
+NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+
+#define NV_PARAMETRIZED_NO_AGGREGATE_AND_ARITHMETIC_DATATYPE_LABELS \
+/* NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS*/ \
+NV_PARAMETRIZED_LINAL_DATATYPE_LABELS \
+/*NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS*/ \
+NV_PARAMETRIZED_STRING_DATATYPE_LABELS \
+NV_PARAMETRIZED_REF_DATATYPE_LABELS \
+NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+
+#define NV_PARAMETRIZED_NO_AGGREGATE_AND_REF_DATATYPE_LABELS \
+/* NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS*/ \
+NV_PARAMETRIZED_LINAL_DATATYPE_LABELS \
+NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS \
+NV_PARAMETRIZED_STRING_DATATYPE_LABELS \
+/*NV_PARAMETRIZED_REF_DATATYPE_LABELS*/ \
+NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+
+#define NV_PARAMETRIZED_NO_ARITHMETIC_AND_LINAL_DATATYPE_LABELS \
+NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS \
+/*NV_PARAMETRIZED_LINAL_DATATYPE_LABELS*/ \
+/*NV_PARAMETRIZED_ARITHMETIC_DATATYPE_LABELS*/ \
+NV_PARAMETRIZED_STRING_DATATYPE_LABELS \
+NV_PARAMETRIZED_REF_DATATYPE_LABELS \
+NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+
+#define NV_PARAMETRIZED_SERVICE_AND_LAST_DATATYPE_LABELS \
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \
+case NvParameterized::TYPE_LAST:
+
+#define NV_PARAMETRIZED_LEGACY_DATATYPE_LABELS \
+case NvParameterized::TYPE_MAT34:
+
+#define NV_PARAMETRIZED_NO_MATH_DATATYPE_LABELS \
+NV_PARAMETRIZED_AGGREGATE_DATATYPE_LABELS \
+NV_PARAMETRIZED_STRING_DATATYPE_LABELS \
+NV_PARAMETRIZED_REF_DATATYPE_LABELS \
+NV_PARAMETRIZED_ENUM_DATATYPE_LABELS \
+NV_PARAMETRIZED_SERVICE_DATATYPE_LABELS \
+NV_PARAMETRIZED_UNDEFINED_AND_LAST_DATATYPE_LABELS
+
+/***********************************************************************/
+
+#endif // NV_PARAMETERIZED_MACROSES_H
diff --git a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedTraits.h b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedTraits.h index ba97ebc..a05d0d0 100644..100755 --- a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedTraits.h +++ b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterizedTraits.h @@ -1,373 +1,373 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. - -#ifndef NV_PARAMETERIZED_TRAITS_H -#define NV_PARAMETERIZED_TRAITS_H - -/*! -\file -\brief NvParameterized traits class -*/ - -#include <string.h> -#include "foundation/PxAssert.h" - -namespace NvParameterized -{ - -PX_PUSH_PACK_DEFAULT - -class Traits; -class Interface; - -/** -\brief Interface class for NvParameterized factories -*/ -class Factory -{ -public: - - /** - \brief Creates NvParameterized object of class - */ - virtual ::NvParameterized::Interface *create( Traits *paramTraits ) = 0; - - /** - \brief Finishes initialization of inplace-deserialized objects (vptr and stuff) - */ - virtual ::NvParameterized::Interface *finish( Traits *paramTraits, void *obj, void *buf, int32_t *refCount ) = 0; - - /** - \brief Returns name of class whose objects are created by factory - */ - virtual const char * getClassName() = 0; - - /** - \brief Returns version of class whose objects are created by factory - */ - virtual uint32_t getVersion() = 0; - - /** - \brief Returns memory alignment required for objects of class - */ - virtual uint32_t getAlignment() = 0; - - /** - \brief Returns checksum of class whose objects are created by factory - */ - virtual const uint32_t * getChecksum( uint32_t &bits ) = 0; - - /** - \brief Destructor - */ - virtual ~Factory() {} - - /** - \brief Clean reflection definition table. Call it if you don't have any instances of classes. - */ - virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) = 0; -}; - -/** -\brief Interface class for legacy object conversions -*/ -class Conversion -{ -public: - virtual ~Conversion() {} - - /** - \brief Initialize object using data from legacy object - \param [in] legacyObj legacy object to be converter - \param [in] obj destination object - \return true if conversion succeeded, false otherwise - \warning You may assume that all nested references were already converted. - */ - virtual bool operator()(::NvParameterized::Interface &legacyObj, ::NvParameterized::Interface &obj) = 0; - - /** - \brief Release converter and any memory allocations associated with it - */ - virtual void release() = 0; -}; - -/** -\brief Interface class for user traits - -This class is a collection of loosely-related functions provided by application or framework -and used by NvParameterized library to do memory allocation, object creation, user notification, etc. -*/ -class Traits -{ -public: - virtual ~Traits() {} - - /** - \brief Register NvParameterized class factory - */ - virtual void registerFactory( ::NvParameterized::Factory & factory ) = 0; - - /** - \brief Remove NvParameterized class factory for current version of class - \return Removed factory or NULL if it is not found - */ - virtual ::NvParameterized::Factory *removeFactory( const char * className ) = 0; - - /** - \brief Remove NvParameterized class factory for given version of class - \return Removed factory or NULL if it is not found - */ - virtual ::NvParameterized::Factory *removeFactory( const char * className, uint32_t version ) = 0; - - /** - \brief Checks whether any class factory is registered - */ - virtual bool doesFactoryExist(const char* className) = 0; - - /** - \brief Checks whether class factory for given version is registered - */ - virtual bool doesFactoryExist(const char* className, uint32_t version) = 0; - - /** - \brief Create object of NvParameterized class using its staticClassName() - - \param [in] name static class name of the instance to create - - Most probably this just calls Factory::create on appropriate factory. - */ - virtual ::NvParameterized::Interface * createNvParameterized( const char * name ) = 0; - - /** - \brief Create object of NvParameterized class using its staticClassName() - - \param [in] name static class name of the instance to create - \param [in] ver version of the class - - Most probably this just calls Factory::create on appropriate factory. - */ - virtual ::NvParameterized::Interface * createNvParameterized( const char * name, uint32_t ver ) = 0; - - /** - \brief Finish construction of inplace object of NvParameterized class - - Most probably this just calls Factory::finish using appropriate factory. - */ - virtual ::NvParameterized::Interface * finishNvParameterized( const char * name, void *obj, void *buf, int32_t *refCount ) = 0; - - /** - \brief Finish construction of inplace object of NvParameterized class - - Most probably this just calls Factory::finish using appropriate factory. - */ - virtual ::NvParameterized::Interface * finishNvParameterized( const char * name, uint32_t ver, void *obj, void *buf, int32_t *refCount ) = 0; - - /** - \brief Get version of class which is currently used - */ - virtual uint32_t getCurrentVersion(const char *className) const = 0; - - /** - \brief Get memory alignment required for objects of class - */ - virtual uint32_t getAlignment(const char *className, uint32_t classVersion) const = 0; - - /** - \brief Register converter for legacy version of class - */ - virtual void registerConversion(const char * /*className*/, uint32_t /*from*/, uint32_t /*to*/, Conversion & /*conv*/) {} - - /** - \brief Remove converter for legacy version of class - */ - virtual ::NvParameterized::Conversion *removeConversion(const char * /*className*/, uint32_t /*from*/, uint32_t /*to*/) { return 0; } - - /** - \brief Update legacy object (most probably using appropriate registered converter) - \param [in] legacyObj legacy object to be converted - \param [in] obj destination object - \return True if conversion was successful, false otherwise - \warning Note that update is intrusive - legacyObj may be modified as a result of update - */ - virtual bool updateLegacyNvParameterized(::NvParameterized::Interface &legacyObj, ::NvParameterized::Interface &obj) - { - PX_UNUSED(&legacyObj); - PX_UNUSED(&obj); - - return false; - } - - /** - \brief Get a list of the NvParameterized class type names - - \param [in] names buffer for names - \param [out] outCount minimal required length of buffer - \param [in] inCount length of buffer - \return False if 'inCount' is not large enough to contain all of the names, true otherwise - - \warning The memory for the strings returned is owned by the traits class - and should only be read, not written or freed. - */ - virtual bool getNvParameterizedNames( const char ** names, uint32_t &outCount, uint32_t inCount) const = 0; - - /** - \brief Get a list of versions of particular NvParameterized class - - \param [in] className Name of the class - \param [in] versions buffer for versions - \param [out] outCount minimal required length of buffer - \param [in] inCount length of buffer - \return False if 'inCount' is not large enough to contain all of version names, true otherwise - - \warning The memory for the strings returned is owned by the traits class - and should only be read, not written or freed. - */ - virtual bool getNvParameterizedVersions(const char* className, uint32_t* versions, uint32_t &outCount, uint32_t inCount) const = 0; - - /** - \brief Increment reference counter - */ - virtual int32_t incRefCount(int32_t *refCount) = 0; - - /** - \brief Decrement reference counter - */ - virtual int32_t decRefCount(int32_t *refCount) = 0; - - /** - \brief Called when inplace object is destroyed - */ - virtual void onInplaceObjectDestroyed(void * /*buf*/, ::NvParameterized::Interface * /*obj*/) {} - - /** - \brief Called when all inplace objects are destroyed - */ - virtual void onAllInplaceObjectsDestroyed(void *buf) { free(buf); } - - /** - \brief Allocate memory with default alignment of 8 - */ - virtual void *alloc(uint32_t nbytes) = 0; - - /** - \brief Allocate aligned memory - */ - virtual void *alloc(uint32_t nbytes, uint32_t align) = 0; - - /** - \brief Deallocate memory - */ - virtual void free(void *buf) = 0; - - /** - \brief Copy string - */ - virtual char *strdup(const char *str) - { - if( !str ) - return NULL; - - uint32_t strLen = (uint32_t)strlen(str) + 1; - char *retStr = (char *)this->alloc(strLen, 1); - - PX_ASSERT( retStr ); - - if( NULL != retStr ) -#if PX_WINDOWS_FAMILY || PX_XBOXONE - strcpy_s( retStr, strLen, str ); -#else - strncpy(retStr, str, strLen); -#endif - return retStr; - } - - /** - \brief Release copied string - */ - virtual void strfree(char *str) - { - if( NULL != str ) - this->free( str ); - } - - /** - \brief Warns user - */ - virtual void traitsWarn(const char * /*msg*/) const {} - - /** - \brief Release Traits - */ - virtual void release(void) = 0; - - /** - \brief Adapter for allocator classes in PxAlloctor.h - */ - class Allocator - { - ::NvParameterized::Traits *mTraits; - - public: - - /** - \brief Constructor - */ - Allocator(Traits *traits): mTraits(traits) {} - - /** - \brief Allocate memory - */ - void *allocate(size_t size) - { - return allocate(size, __FILE__, __LINE__); - } - - /** - \brief Allocate memory - */ - void *allocate(size_t size, const char * /*filename*/, int /*line*/) - { - PX_ASSERT( static_cast<uint32_t>(size) == size ); - return mTraits->alloc(static_cast<uint32_t>(size)); - } - - /** - \brief Release memory - */ - void deallocate(void *ptr) - { - return mTraits->free(ptr); - } - }; -}; - - -PX_POP_PACK - -} // namespace NvParameterized - -#endif // NV_PARAMETERIZED_TRAITS_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef NV_PARAMETERIZED_TRAITS_H
+#define NV_PARAMETERIZED_TRAITS_H
+
+/*!
+\file
+\brief NvParameterized traits class
+*/
+
+#include <string.h>
+#include "foundation/PxAssert.h"
+
+namespace NvParameterized
+{
+
+PX_PUSH_PACK_DEFAULT
+
+class Traits;
+class Interface;
+
+/**
+\brief Interface class for NvParameterized factories
+*/
+class Factory
+{
+public:
+
+ /**
+ \brief Creates NvParameterized object of class
+ */
+ virtual ::NvParameterized::Interface *create( Traits *paramTraits ) = 0;
+
+ /**
+ \brief Finishes initialization of inplace-deserialized objects (vptr and stuff)
+ */
+ virtual ::NvParameterized::Interface *finish( Traits *paramTraits, void *obj, void *buf, int32_t *refCount ) = 0;
+
+ /**
+ \brief Returns name of class whose objects are created by factory
+ */
+ virtual const char * getClassName() = 0;
+
+ /**
+ \brief Returns version of class whose objects are created by factory
+ */
+ virtual uint32_t getVersion() = 0;
+
+ /**
+ \brief Returns memory alignment required for objects of class
+ */
+ virtual uint32_t getAlignment() = 0;
+
+ /**
+ \brief Returns checksum of class whose objects are created by factory
+ */
+ virtual const uint32_t * getChecksum( uint32_t &bits ) = 0;
+
+ /**
+ \brief Destructor
+ */
+ virtual ~Factory() {}
+
+ /**
+ \brief Clean reflection definition table. Call it if you don't have any instances of classes.
+ */
+ virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) = 0;
+};
+
+/**
+\brief Interface class for legacy object conversions
+*/
+class Conversion
+{
+public:
+ virtual ~Conversion() {}
+
+ /**
+ \brief Initialize object using data from legacy object
+ \param [in] legacyObj legacy object to be converter
+ \param [in] obj destination object
+ \return true if conversion succeeded, false otherwise
+ \warning You may assume that all nested references were already converted.
+ */
+ virtual bool operator()(::NvParameterized::Interface &legacyObj, ::NvParameterized::Interface &obj) = 0;
+
+ /**
+ \brief Release converter and any memory allocations associated with it
+ */
+ virtual void release() = 0;
+};
+
+/**
+\brief Interface class for user traits
+
+This class is a collection of loosely-related functions provided by application or framework
+and used by NvParameterized library to do memory allocation, object creation, user notification, etc.
+*/
+class Traits
+{
+public:
+ virtual ~Traits() {}
+
+ /**
+ \brief Register NvParameterized class factory
+ */
+ virtual void registerFactory( ::NvParameterized::Factory & factory ) = 0;
+
+ /**
+ \brief Remove NvParameterized class factory for current version of class
+ \return Removed factory or NULL if it is not found
+ */
+ virtual ::NvParameterized::Factory *removeFactory( const char * className ) = 0;
+
+ /**
+ \brief Remove NvParameterized class factory for given version of class
+ \return Removed factory or NULL if it is not found
+ */
+ virtual ::NvParameterized::Factory *removeFactory( const char * className, uint32_t version ) = 0;
+
+ /**
+ \brief Checks whether any class factory is registered
+ */
+ virtual bool doesFactoryExist(const char* className) = 0;
+
+ /**
+ \brief Checks whether class factory for given version is registered
+ */
+ virtual bool doesFactoryExist(const char* className, uint32_t version) = 0;
+
+ /**
+ \brief Create object of NvParameterized class using its staticClassName()
+
+ \param [in] name static class name of the instance to create
+
+ Most probably this just calls Factory::create on appropriate factory.
+ */
+ virtual ::NvParameterized::Interface * createNvParameterized( const char * name ) = 0;
+
+ /**
+ \brief Create object of NvParameterized class using its staticClassName()
+
+ \param [in] name static class name of the instance to create
+ \param [in] ver version of the class
+
+ Most probably this just calls Factory::create on appropriate factory.
+ */
+ virtual ::NvParameterized::Interface * createNvParameterized( const char * name, uint32_t ver ) = 0;
+
+ /**
+ \brief Finish construction of inplace object of NvParameterized class
+
+ Most probably this just calls Factory::finish using appropriate factory.
+ */
+ virtual ::NvParameterized::Interface * finishNvParameterized( const char * name, void *obj, void *buf, int32_t *refCount ) = 0;
+
+ /**
+ \brief Finish construction of inplace object of NvParameterized class
+
+ Most probably this just calls Factory::finish using appropriate factory.
+ */
+ virtual ::NvParameterized::Interface * finishNvParameterized( const char * name, uint32_t ver, void *obj, void *buf, int32_t *refCount ) = 0;
+
+ /**
+ \brief Get version of class which is currently used
+ */
+ virtual uint32_t getCurrentVersion(const char *className) const = 0;
+
+ /**
+ \brief Get memory alignment required for objects of class
+ */
+ virtual uint32_t getAlignment(const char *className, uint32_t classVersion) const = 0;
+
+ /**
+ \brief Register converter for legacy version of class
+ */
+ virtual void registerConversion(const char * /*className*/, uint32_t /*from*/, uint32_t /*to*/, Conversion & /*conv*/) {}
+
+ /**
+ \brief Remove converter for legacy version of class
+ */
+ virtual ::NvParameterized::Conversion *removeConversion(const char * /*className*/, uint32_t /*from*/, uint32_t /*to*/) { return 0; }
+
+ /**
+ \brief Update legacy object (most probably using appropriate registered converter)
+ \param [in] legacyObj legacy object to be converted
+ \param [in] obj destination object
+ \return True if conversion was successful, false otherwise
+ \warning Note that update is intrusive - legacyObj may be modified as a result of update
+ */
+ virtual bool updateLegacyNvParameterized(::NvParameterized::Interface &legacyObj, ::NvParameterized::Interface &obj)
+ {
+ PX_UNUSED(&legacyObj);
+ PX_UNUSED(&obj);
+
+ return false;
+ }
+
+ /**
+ \brief Get a list of the NvParameterized class type names
+
+ \param [in] names buffer for names
+ \param [out] outCount minimal required length of buffer
+ \param [in] inCount length of buffer
+ \return False if 'inCount' is not large enough to contain all of the names, true otherwise
+
+ \warning The memory for the strings returned is owned by the traits class
+ and should only be read, not written or freed.
+ */
+ virtual bool getNvParameterizedNames( const char ** names, uint32_t &outCount, uint32_t inCount) const = 0;
+
+ /**
+ \brief Get a list of versions of particular NvParameterized class
+
+ \param [in] className Name of the class
+ \param [in] versions buffer for versions
+ \param [out] outCount minimal required length of buffer
+ \param [in] inCount length of buffer
+ \return False if 'inCount' is not large enough to contain all of version names, true otherwise
+
+ \warning The memory for the strings returned is owned by the traits class
+ and should only be read, not written or freed.
+ */
+ virtual bool getNvParameterizedVersions(const char* className, uint32_t* versions, uint32_t &outCount, uint32_t inCount) const = 0;
+
+ /**
+ \brief Increment reference counter
+ */
+ virtual int32_t incRefCount(int32_t *refCount) = 0;
+
+ /**
+ \brief Decrement reference counter
+ */
+ virtual int32_t decRefCount(int32_t *refCount) = 0;
+
+ /**
+ \brief Called when inplace object is destroyed
+ */
+ virtual void onInplaceObjectDestroyed(void * /*buf*/, ::NvParameterized::Interface * /*obj*/) {}
+
+ /**
+ \brief Called when all inplace objects are destroyed
+ */
+ virtual void onAllInplaceObjectsDestroyed(void *buf) { free(buf); }
+
+ /**
+ \brief Allocate memory with default alignment of 8
+ */
+ virtual void *alloc(uint32_t nbytes) = 0;
+
+ /**
+ \brief Allocate aligned memory
+ */
+ virtual void *alloc(uint32_t nbytes, uint32_t align) = 0;
+
+ /**
+ \brief Deallocate memory
+ */
+ virtual void free(void *buf) = 0;
+
+ /**
+ \brief Copy string
+ */
+ virtual char *strdup(const char *str)
+ {
+ if( !str )
+ return NULL;
+
+ uint32_t strLen = (uint32_t)strlen(str) + 1;
+ char *retStr = (char *)this->alloc(strLen, 1);
+
+ PX_ASSERT( retStr );
+
+ if( NULL != retStr )
+#if PX_WINDOWS_FAMILY || PX_XBOXONE
+ strcpy_s( retStr, strLen, str );
+#else
+ strncpy(retStr, str, strLen);
+#endif
+ return retStr;
+ }
+
+ /**
+ \brief Release copied string
+ */
+ virtual void strfree(char *str)
+ {
+ if( NULL != str )
+ this->free( str );
+ }
+
+ /**
+ \brief Warns user
+ */
+ virtual void traitsWarn(const char * /*msg*/) const {}
+
+ /**
+ \brief Release Traits
+ */
+ virtual void release(void) = 0;
+
+ /**
+ \brief Adapter for allocator classes in PxAlloctor.h
+ */
+ class Allocator
+ {
+ ::NvParameterized::Traits *mTraits;
+
+ public:
+
+ /**
+ \brief Constructor
+ */
+ Allocator(Traits *traits): mTraits(traits) {}
+
+ /**
+ \brief Allocate memory
+ */
+ void *allocate(size_t size)
+ {
+ return allocate(size, __FILE__, __LINE__);
+ }
+
+ /**
+ \brief Allocate memory
+ */
+ void *allocate(size_t size, const char * /*filename*/, int /*line*/)
+ {
+ PX_ASSERT( static_cast<uint32_t>(size) == size );
+ return mTraits->alloc(static_cast<uint32_t>(size));
+ }
+
+ /**
+ \brief Release memory
+ */
+ void deallocate(void *ptr)
+ {
+ return mTraits->free(ptr);
+ }
+ };
+};
+
+
+PX_POP_PACK
+
+} // namespace NvParameterized
+
+#endif // NV_PARAMETERIZED_TRAITS_H
diff --git a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized_types.h b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized_types.h index 289595a..d0e7281 100644..100755 --- a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized_types.h +++ b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvParameterized_types.h @@ -1,107 +1,107 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. - -/*! -\brief NvParameterized type X-macro template -\note See http://en.wikipedia.org/wiki/C_preprocessor#X-Macros for more details -*/ - - -// NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type) - -#if PX_VC && !PX_PS4 - #pragma warning(push) - #pragma warning(disable:4555) -#endif //!PX_PS4 - -PX_PUSH_PACK_DEFAULT - -#ifndef NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES -#ifndef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES -NV_PARAMETERIZED_TYPE(Array, ARRAY, void *) -NV_PARAMETERIZED_TYPE(Struct, STRUCT, void *) -NV_PARAMETERIZED_TYPE(Ref, REF, NvParameterized::Interface *) -#endif -#endif - -#ifndef NV_PARAMETERIZED_TYPES_NO_STRING_TYPES -#ifndef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES -NV_PARAMETERIZED_TYPE(String, STRING, const char *) -NV_PARAMETERIZED_TYPE(Enum, ENUM, const char *) -#endif -#endif - -NV_PARAMETERIZED_TYPE(Bool, BOOL, bool) - -NV_PARAMETERIZED_TYPE(I8, I8, int8_t) -NV_PARAMETERIZED_TYPE(I16, I16, int16_t) -NV_PARAMETERIZED_TYPE(I32, I32, int32_t) -NV_PARAMETERIZED_TYPE(I64, I64, int64_t) - -NV_PARAMETERIZED_TYPE(U8, U8, uint8_t) -NV_PARAMETERIZED_TYPE(U16, U16, uint16_t) -NV_PARAMETERIZED_TYPE(U32, U32, uint32_t) -NV_PARAMETERIZED_TYPE(U64, U64, uint64_t) - -NV_PARAMETERIZED_TYPE(F32, F32, float) -NV_PARAMETERIZED_TYPE(F64, F64, double) - -#ifndef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES -NV_PARAMETERIZED_TYPE(Vec2, VEC2, physx::PxVec2) -NV_PARAMETERIZED_TYPE(Vec3, VEC3, physx::PxVec3) -NV_PARAMETERIZED_TYPE(Vec4, VEC4, physx::PxVec4) -NV_PARAMETERIZED_TYPE(Quat, QUAT, physx::PxQuat) -NV_PARAMETERIZED_TYPE(Bounds3, BOUNDS3, physx::PxBounds3) -NV_PARAMETERIZED_TYPE(Mat33, MAT33, physx::PxMat33) -NV_PARAMETERIZED_TYPE(Mat44, MAT44, physx::PxMat44) -NV_PARAMETERIZED_TYPE(Transform, TRANSFORM, physx::PxTransform) -#endif - - -#ifdef NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES -# undef NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES -#endif - -#ifdef NV_PARAMETERIZED_TYPES_NO_STRING_TYPES -# undef NV_PARAMETERIZED_TYPES_NO_STRING_TYPES -#endif - -#ifdef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES -# undef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES -#endif - -#ifdef NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES -# undef NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES -#endif - -#if PX_VC && !PX_PS4 - #pragma warning(pop) -#endif //!PX_PS4 - -PX_POP_PACK - -#undef NV_PARAMETERIZED_TYPE +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+/*!
+\brief NvParameterized type X-macro template
+\note See http://en.wikipedia.org/wiki/C_preprocessor#X-Macros for more details
+*/
+
+
+// NV_PARAMETERIZED_TYPE(type_name, enum_name, c_type)
+
+#if PX_VC && !PX_PS4
+ #pragma warning(push)
+ #pragma warning(disable:4555)
+#endif //!PX_PS4
+
+PX_PUSH_PACK_DEFAULT
+
+#ifndef NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+#ifndef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES
+NV_PARAMETERIZED_TYPE(Array, ARRAY, void *)
+NV_PARAMETERIZED_TYPE(Struct, STRUCT, void *)
+NV_PARAMETERIZED_TYPE(Ref, REF, NvParameterized::Interface *)
+#endif
+#endif
+
+#ifndef NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+#ifndef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES
+NV_PARAMETERIZED_TYPE(String, STRING, const char *)
+NV_PARAMETERIZED_TYPE(Enum, ENUM, const char *)
+#endif
+#endif
+
+NV_PARAMETERIZED_TYPE(Bool, BOOL, bool)
+
+NV_PARAMETERIZED_TYPE(I8, I8, int8_t)
+NV_PARAMETERIZED_TYPE(I16, I16, int16_t)
+NV_PARAMETERIZED_TYPE(I32, I32, int32_t)
+NV_PARAMETERIZED_TYPE(I64, I64, int64_t)
+
+NV_PARAMETERIZED_TYPE(U8, U8, uint8_t)
+NV_PARAMETERIZED_TYPE(U16, U16, uint16_t)
+NV_PARAMETERIZED_TYPE(U32, U32, uint32_t)
+NV_PARAMETERIZED_TYPE(U64, U64, uint64_t)
+
+NV_PARAMETERIZED_TYPE(F32, F32, float)
+NV_PARAMETERIZED_TYPE(F64, F64, double)
+
+#ifndef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES
+NV_PARAMETERIZED_TYPE(Vec2, VEC2, physx::PxVec2)
+NV_PARAMETERIZED_TYPE(Vec3, VEC3, physx::PxVec3)
+NV_PARAMETERIZED_TYPE(Vec4, VEC4, physx::PxVec4)
+NV_PARAMETERIZED_TYPE(Quat, QUAT, physx::PxQuat)
+NV_PARAMETERIZED_TYPE(Bounds3, BOUNDS3, physx::PxBounds3)
+NV_PARAMETERIZED_TYPE(Mat33, MAT33, physx::PxMat33)
+NV_PARAMETERIZED_TYPE(Mat44, MAT44, physx::PxMat44)
+NV_PARAMETERIZED_TYPE(Transform, TRANSFORM, physx::PxTransform)
+#endif
+
+
+#ifdef NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+# undef NV_PARAMETERIZED_TYPES_ONLY_SIMPLE_TYPES
+#endif
+
+#ifdef NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+# undef NV_PARAMETERIZED_TYPES_NO_STRING_TYPES
+#endif
+
+#ifdef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES
+# undef NV_PARAMETERIZED_TYPES_ONLY_SCALAR_TYPES
+#endif
+
+#ifdef NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES
+# undef NV_PARAMETERIZED_TYPES_NO_LEGACY_TYPES
+#endif
+
+#if PX_VC && !PX_PS4
+ #pragma warning(pop)
+#endif //!PX_PS4
+
+PX_POP_PACK
+
+#undef NV_PARAMETERIZED_TYPE
diff --git a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.h b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.h index 810e064..83b085a 100644..100755 --- a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.h +++ b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.h @@ -1,463 +1,463 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. - -#ifndef NV_SERIALIZER_H -#define NV_SERIALIZER_H - -/*! -\file -\brief NvParameterized serializer class -*/ - - -#include <filebuf/PxFileBuf.h> - - -namespace NvParameterized -{ - -PX_PUSH_PACK_DEFAULT - -/** -\brief Platform descriptor - -This class describes target serialization platform which consists of processor architecture, compiler and OS. -*/ -struct SerializePlatform -{ - /** - \brief Processor architectures enumeration - \warning Do not change values of enums! - */ - typedef enum - { - ARCH_GEN = 0, - ARCH_X86 = 1, - ARCH_X86_64 = 2, - ARCH_PPC = 3, - ARCH_CELL = 4, - ARCH_ARM = 5, - ARCH_ARM_64 = 6, - ARCH_LAST - } ArchType; - - /** - \brief Platform processor architecture - */ - ArchType archType; - - /** - \brief Compilers enumeration - \warning Do not change values of enums! - */ - typedef enum - { - COMP_GEN = 0, - COMP_GCC = 1, - COMP_VC = 2, - COMP_MW = 3, - COMP_LAST - } CompilerType; - - /** - \brief Platform compiler - */ - CompilerType compilerType; - - /** - \brief Platform compiler version - */ - uint32_t compilerVer; - - /** - \brief OSes enumeration - \warning Do not change values of enums! - */ - typedef enum - { - OS_WINDOWS = 0, - OS_LINUX = 1, - OS_LV2 = 2, // PS3 - OS_MACOSX = 3, - OS_XBOX = 4, - OS_GEN = 5, - OS_ANDROID = 6, - OS_XBOXONE = 7, - OS_PS4 = 8, - OS_HOS = 9, - OS_LAST - } OsType; - - /** - \brief Platform OS - */ - OsType osType; - - /** - \brief Platform OS version - */ - uint32_t osVer; - - /** - \brief This value identfies that version is unknown - */ - static const uint32_t ANY_VERSION = (uint32_t)-1; - - PX_INLINE SerializePlatform(); - - /** - \brief Constructor of SerializePlatform - */ - PX_INLINE SerializePlatform(ArchType archType, CompilerType compType, uint32_t compVer, OsType osType, uint32_t osVer); - - /** - \brief Checks if platforms are binary-compatible - */ - PX_INLINE bool operator ==(const SerializePlatform &p) const; - - /** - \brief Checks if platforms are binary-incompatible - */ - PX_INLINE bool operator !=(const SerializePlatform &p) const; -}; - -class Interface; -class Definition; -class Traits; -struct SerializePlatform; - -/** -\brief Interface class for serializer-deserializer of NvParameterized objects - -Serializer serializes and deserializes one or more NvParameterized objects to file using various output formats -(see SerializeType). -*/ -class Serializer -{ -public: - - /** - \brief Status enums that the Serializer methods may return - */ - enum ErrorType - { - ERROR_NONE = 0, - - ERROR_UNKNOWN, - ERROR_NOT_IMPLEMENTED, - - // File format related errors - ERROR_INVALID_PLATFORM, - ERROR_INVALID_PLATFORM_NAME, - ERROR_INVALID_FILE_VERSION, - ERROR_INVALID_FILE_FORMAT, - ERROR_INVALID_MAGIC, - ERROR_INVALID_CHAR, - - // External errors - ERROR_STREAM_ERROR, - ERROR_MEMORY_ALLOCATION_FAILURE, - ERROR_UNALIGNED_MEMORY, - ERROR_PRESERIALIZE_FAILED, - ERROR_INTERNAL_BUFFER_OVERFLOW, - ERROR_OBJECT_CREATION_FAILED, - ERROR_CONVERSION_FAILED, - - // Xml-specific errors - ERROR_VAL2STRING_FAILED, - ERROR_STRING2VAL_FAILED, - ERROR_INVALID_TYPE_ATTRIBUTE, - ERROR_UNKNOWN_XML_TAG, - ERROR_MISSING_DOCTYPE, - ERROR_MISSING_ROOT_ELEMENT, - ERROR_INVALID_NESTING, - ERROR_INVALID_ATTR, - - // Other stuff - ERROR_INVALID_ARRAY, - ERROR_ARRAY_INDEX_OUT_OF_RANGE, - ERROR_INVALID_VALUE, - ERROR_INVALID_INTERNAL_PTR, - ERROR_INVALID_PARAM_HANDLE, - ERROR_INVALID_RELOC_TYPE, - ERROR_INVALID_DATA_TYPE, - ERROR_INVALID_REFERENCE - }; - - /** - \brief The supported serialization formats - */ - enum SerializeType - { - /// serialize in XML format. - NST_XML = 0, - - /// serialize in a binary format - NST_BINARY, - - NST_LAST - }; - - /** - \brief Get type of stream (binary or xml) - \param [in] stream stream to be analyzed - */ - static SerializeType peekSerializeType(physx::general_PxIOStream2::PxFileBuf &stream); - - /** - \brief Get stream native platform - \param [in] stream stream to be analyzed - \param [out] platform stream native platform - */ - static ErrorType peekPlatform(physx::general_PxIOStream2::PxFileBuf &stream, SerializePlatform &platform); - - virtual ~Serializer() {} - - /** - \brief Set platform to use in platform-dependent serialization - \param [in] platform target platform - - \warning Currently this is used only in binary serializer - - Application running on target platforms may potentially make use of extremely fast - inplace deserialization (using method deserializeInplace) on files which were serialized - for this platform. - */ - virtual ErrorType setTargetPlatform(const SerializePlatform &platform) = 0; - - /** - \brief Sets whether serializer will automatically update - objects after deserialization - \param [in] doUpdate should automatic update be done? - - \warning Normally you will not need this - \warning This is true by default - */ - virtual void setAutoUpdate(bool doUpdate) = 0; - - /** - \brief Serialize array of NvParameterized-objects to a stream - \param [in] stream the stream to which the object will be serialized - \param [in] objs NvParameterized-objects which will be serialized - \param [in] nobjs number of objects - \param [in] doSerializeMetadata set this to store object metadata in file - - \warning Serialized file may depend on selected target platform - */ - virtual ErrorType serialize( - physx::general_PxIOStream2::PxFileBuf &stream, - const ::NvParameterized::Interface **objs, - uint32_t nobjs, - bool doSerializeMetadata = false) = 0; - - /** - \brief Peek number of NvParameterized-objects in stream with serialized data - \param [in] stream the stream from which the object will be deserialized - \param [out] numObjects number of objects - - \warning Not all streams support peeking - */ - virtual ErrorType peekNumObjects(physx::general_PxIOStream2::PxFileBuf &stream, uint32_t &numObjects) = 0; - - /** - \brief Peek number of NvParameterized-objects in stream with serialized data - \param [in] stream the stream from which objects will be deserialized - \param [in] classNames pointer to buffer for resulting names - \param [in,out] numClassNames limit on number of returned classNames; number of returned names - - \warning User is responsible for releasing every element of classNames via Traits::strfree() - */ - virtual ErrorType peekClassNames(physx::general_PxIOStream2::PxFileBuf &stream, char **classNames, uint32_t &numClassNames) = 0; - - /** - \brief Peek number of NvParameterized-objects in memory buffer with serialized data - \param [in] data pointer to memory buffer - \param [in] dataLen length of memory buffer - \param [out] numObjects number of objects - */ - virtual ErrorType peekNumObjectsInplace(const void *data, uint32_t dataLen, uint32_t &numObjects) = 0; - - /// TODO - template < typename T, int bufSize = 8 > class DeserializedResults - { - T buf[bufSize]; //For small number of objects - - T *objs; - - uint32_t nobjs; - - Traits *traits; - - void clear(); - - public: - - PX_INLINE DeserializedResults(); - - PX_INLINE ~DeserializedResults(); - - /** - \brief Copy constructor - */ - PX_INLINE DeserializedResults(const DeserializedResults &data); - - /** - \brief Assignment operator - */ - PX_INLINE DeserializedResults &operator =(const DeserializedResults &rhs); - - /** - \brief Allocate memory for values - */ - PX_INLINE void init(Traits *traits_, uint32_t nobjs_); - - /** - \brief Allocate memory and set values - */ - PX_INLINE void init(Traits *traits_, T *objs_, uint32_t nobjs_); - - /** - \brief Number of objects in a container - */ - PX_INLINE uint32_t size() const; - - /** - \brief Access individual object in container - */ - PX_INLINE T &operator[](uint32_t i); - - /** - \brief Const-access individual object in container - */ - PX_INLINE const T &operator[](uint32_t i) const; - - /** - \brief Read all NvParameterized objects in container to buffer outObjs - \warning outObjs must be large enough to hold all contained objects - */ - PX_INLINE void getObjects(T *outObjs); - - /** - \brief Release all objects - */ - PX_INLINE void releaseAll(); - }; - - /** - \brief Container for results of deserialization - - DeserializedData holds array of NvParameterized objects obtained during deserialization. - */ - typedef DeserializedResults< ::NvParameterized::Interface *> DeserializedData; - - /// This class keeps metadata of a single NvParameterized class - struct MetadataEntry - { - /// Class name - const char *className; - - /// Class version - uint32_t version; - - /// Class metadata - Definition *def; - }; - - /** - \brief Container for results of metadata deserialization - - DeserializedMetadata holds array of MetadataEntry obtained during metadata deserialization. - */ - typedef DeserializedResults<MetadataEntry> DeserializedMetadata; - - /** - \brief Deserialize metadata from a stream into one or more definitions - \param [in] stream the stream from which metadata will be deserialized - \param [out] desData storage for deserialized metadata - \warning This is a draft implementation! - */ - virtual ErrorType deserializeMetadata(physx::general_PxIOStream2::PxFileBuf &stream, DeserializedMetadata &desData); - - /** - \brief Deserialize a stream into one or more NvParameterized objects - \param [in] stream the stream from which objects will be deserialized - \param [out] desData storage for deserialized data - */ - virtual ErrorType deserialize(physx::general_PxIOStream2::PxFileBuf &stream, DeserializedData &desData); - - /** - \brief Deserialize a stream into one or more NvParameterized objects - \param [in] stream the stream from which objects will be deserialized - \param [out] desData storage for deserialized data - \param [out] isUpdated true if any legacy object was updated, false otherwise - */ - virtual ErrorType deserialize(physx::general_PxIOStream2::PxFileBuf &stream, DeserializedData &desData, bool &isUpdated) = 0; - - /** - \brief Deserialize memory buffer into one or more NvParameterized objects - \param [in] data pointer to serialized data. It should be allocated via Traits. - \param [in] dataLen length of serialized data - \param [out] desData storage for deserialized data - - \warning Currently only binary serializer supports inplace deserialization - \warning Memory must be aligned to 8 byte boundary - */ - virtual ErrorType deserializeInplace(void *data, uint32_t dataLen, DeserializedData &desData); - - /** - \brief Deserialize memory buffer into one or more NvParameterized objects - \param [in] data pointer to serialized data - \param [in] dataLen length of serialized data - \param [out] desData storage for deserialized data - \param [out] isUpdated true if any legacy object was updated, false otherwise - - \warning Currently only binary serializer supports inplace deserialization - \warning Memory must be aligned to the boundary required by the data (see getInplaceAlignment) - */ - virtual ErrorType deserializeInplace(void *data, uint32_t dataLen, DeserializedData &desData, bool &isUpdated) = 0; - - /** - \brief Get minimum alignment required for inplace deserialization of data in stream - \param [in] stream stream which will be inplace deserialized - \param [out] align alignment required for inplace deserialization of stream - \note For most of the objects this will return default alignment of 8 bytes - */ - virtual ErrorType peekInplaceAlignment(physx::general_PxIOStream2::PxFileBuf& stream, uint32_t& align) = 0; - - /** - \brief Release deserializer and any memory allocations associated with it - */ - virtual void release() = 0; -}; - -PX_POP_PACK - -} // namespace NvParameterized - -#include "NvSerializer.inl" - -#endif // NV_SERIALIZER_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#ifndef NV_SERIALIZER_H
+#define NV_SERIALIZER_H
+
+/*!
+\file
+\brief NvParameterized serializer class
+*/
+
+
+#include <filebuf/PxFileBuf.h>
+
+
+namespace NvParameterized
+{
+
+PX_PUSH_PACK_DEFAULT
+
+/**
+\brief Platform descriptor
+
+This class describes target serialization platform which consists of processor architecture, compiler and OS.
+*/
+struct SerializePlatform
+{
+ /**
+ \brief Processor architectures enumeration
+ \warning Do not change values of enums!
+ */
+ typedef enum
+ {
+ ARCH_GEN = 0,
+ ARCH_X86 = 1,
+ ARCH_X86_64 = 2,
+ ARCH_PPC = 3,
+ ARCH_CELL = 4,
+ ARCH_ARM = 5,
+ ARCH_ARM_64 = 6,
+ ARCH_LAST
+ } ArchType;
+
+ /**
+ \brief Platform processor architecture
+ */
+ ArchType archType;
+
+ /**
+ \brief Compilers enumeration
+ \warning Do not change values of enums!
+ */
+ typedef enum
+ {
+ COMP_GEN = 0,
+ COMP_GCC = 1,
+ COMP_VC = 2,
+ COMP_MW = 3,
+ COMP_LAST
+ } CompilerType;
+
+ /**
+ \brief Platform compiler
+ */
+ CompilerType compilerType;
+
+ /**
+ \brief Platform compiler version
+ */
+ uint32_t compilerVer;
+
+ /**
+ \brief OSes enumeration
+ \warning Do not change values of enums!
+ */
+ typedef enum
+ {
+ OS_WINDOWS = 0,
+ OS_LINUX = 1,
+ OS_LV2 = 2, // PS3
+ OS_MACOSX = 3,
+ OS_XBOX = 4,
+ OS_GEN = 5,
+ OS_ANDROID = 6,
+ OS_XBOXONE = 7,
+ OS_PS4 = 8,
+ OS_HOS = 9,
+ OS_LAST
+ } OsType;
+
+ /**
+ \brief Platform OS
+ */
+ OsType osType;
+
+ /**
+ \brief Platform OS version
+ */
+ uint32_t osVer;
+
+ /**
+ \brief This value identfies that version is unknown
+ */
+ static const uint32_t ANY_VERSION = (uint32_t)-1;
+
+ PX_INLINE SerializePlatform();
+
+ /**
+ \brief Constructor of SerializePlatform
+ */
+ PX_INLINE SerializePlatform(ArchType archType, CompilerType compType, uint32_t compVer, OsType osType, uint32_t osVer);
+
+ /**
+ \brief Checks if platforms are binary-compatible
+ */
+ PX_INLINE bool operator ==(const SerializePlatform &p) const;
+
+ /**
+ \brief Checks if platforms are binary-incompatible
+ */
+ PX_INLINE bool operator !=(const SerializePlatform &p) const;
+};
+
+class Interface;
+class Definition;
+class Traits;
+struct SerializePlatform;
+
+/**
+\brief Interface class for serializer-deserializer of NvParameterized objects
+
+Serializer serializes and deserializes one or more NvParameterized objects to file using various output formats
+(see SerializeType).
+*/
+class Serializer
+{
+public:
+
+ /**
+ \brief Status enums that the Serializer methods may return
+ */
+ enum ErrorType
+ {
+ ERROR_NONE = 0,
+
+ ERROR_UNKNOWN,
+ ERROR_NOT_IMPLEMENTED,
+
+ // File format related errors
+ ERROR_INVALID_PLATFORM,
+ ERROR_INVALID_PLATFORM_NAME,
+ ERROR_INVALID_FILE_VERSION,
+ ERROR_INVALID_FILE_FORMAT,
+ ERROR_INVALID_MAGIC,
+ ERROR_INVALID_CHAR,
+
+ // External errors
+ ERROR_STREAM_ERROR,
+ ERROR_MEMORY_ALLOCATION_FAILURE,
+ ERROR_UNALIGNED_MEMORY,
+ ERROR_PRESERIALIZE_FAILED,
+ ERROR_INTERNAL_BUFFER_OVERFLOW,
+ ERROR_OBJECT_CREATION_FAILED,
+ ERROR_CONVERSION_FAILED,
+
+ // Xml-specific errors
+ ERROR_VAL2STRING_FAILED,
+ ERROR_STRING2VAL_FAILED,
+ ERROR_INVALID_TYPE_ATTRIBUTE,
+ ERROR_UNKNOWN_XML_TAG,
+ ERROR_MISSING_DOCTYPE,
+ ERROR_MISSING_ROOT_ELEMENT,
+ ERROR_INVALID_NESTING,
+ ERROR_INVALID_ATTR,
+
+ // Other stuff
+ ERROR_INVALID_ARRAY,
+ ERROR_ARRAY_INDEX_OUT_OF_RANGE,
+ ERROR_INVALID_VALUE,
+ ERROR_INVALID_INTERNAL_PTR,
+ ERROR_INVALID_PARAM_HANDLE,
+ ERROR_INVALID_RELOC_TYPE,
+ ERROR_INVALID_DATA_TYPE,
+ ERROR_INVALID_REFERENCE
+ };
+
+ /**
+ \brief The supported serialization formats
+ */
+ enum SerializeType
+ {
+ /// serialize in XML format.
+ NST_XML = 0,
+
+ /// serialize in a binary format
+ NST_BINARY,
+
+ NST_LAST
+ };
+
+ /**
+ \brief Get type of stream (binary or xml)
+ \param [in] stream stream to be analyzed
+ */
+ static SerializeType peekSerializeType(physx::general_PxIOStream2::PxFileBuf &stream);
+
+ /**
+ \brief Get stream native platform
+ \param [in] stream stream to be analyzed
+ \param [out] platform stream native platform
+ */
+ static ErrorType peekPlatform(physx::general_PxIOStream2::PxFileBuf &stream, SerializePlatform &platform);
+
+ virtual ~Serializer() {}
+
+ /**
+ \brief Set platform to use in platform-dependent serialization
+ \param [in] platform target platform
+
+ \warning Currently this is used only in binary serializer
+
+ Application running on target platforms may potentially make use of extremely fast
+ inplace deserialization (using method deserializeInplace) on files which were serialized
+ for this platform.
+ */
+ virtual ErrorType setTargetPlatform(const SerializePlatform &platform) = 0;
+
+ /**
+ \brief Sets whether serializer will automatically update
+ objects after deserialization
+ \param [in] doUpdate should automatic update be done?
+
+ \warning Normally you will not need this
+ \warning This is true by default
+ */
+ virtual void setAutoUpdate(bool doUpdate) = 0;
+
+ /**
+ \brief Serialize array of NvParameterized-objects to a stream
+ \param [in] stream the stream to which the object will be serialized
+ \param [in] objs NvParameterized-objects which will be serialized
+ \param [in] nobjs number of objects
+ \param [in] doSerializeMetadata set this to store object metadata in file
+
+ \warning Serialized file may depend on selected target platform
+ */
+ virtual ErrorType serialize(
+ physx::general_PxIOStream2::PxFileBuf &stream,
+ const ::NvParameterized::Interface **objs,
+ uint32_t nobjs,
+ bool doSerializeMetadata = false) = 0;
+
+ /**
+ \brief Peek number of NvParameterized-objects in stream with serialized data
+ \param [in] stream the stream from which the object will be deserialized
+ \param [out] numObjects number of objects
+
+ \warning Not all streams support peeking
+ */
+ virtual ErrorType peekNumObjects(physx::general_PxIOStream2::PxFileBuf &stream, uint32_t &numObjects) = 0;
+
+ /**
+ \brief Peek number of NvParameterized-objects in stream with serialized data
+ \param [in] stream the stream from which objects will be deserialized
+ \param [in] classNames pointer to buffer for resulting names
+ \param [in,out] numClassNames limit on number of returned classNames; number of returned names
+
+ \warning User is responsible for releasing every element of classNames via Traits::strfree()
+ */
+ virtual ErrorType peekClassNames(physx::general_PxIOStream2::PxFileBuf &stream, char **classNames, uint32_t &numClassNames) = 0;
+
+ /**
+ \brief Peek number of NvParameterized-objects in memory buffer with serialized data
+ \param [in] data pointer to memory buffer
+ \param [in] dataLen length of memory buffer
+ \param [out] numObjects number of objects
+ */
+ virtual ErrorType peekNumObjectsInplace(const void *data, uint32_t dataLen, uint32_t &numObjects) = 0;
+
+ /// TODO
+ template < typename T, int bufSize = 8 > class DeserializedResults
+ {
+ T buf[bufSize]; //For small number of objects
+
+ T *objs;
+
+ uint32_t nobjs;
+
+ Traits *traits;
+
+ void clear();
+
+ public:
+
+ PX_INLINE DeserializedResults();
+
+ PX_INLINE ~DeserializedResults();
+
+ /**
+ \brief Copy constructor
+ */
+ PX_INLINE DeserializedResults(const DeserializedResults &data);
+
+ /**
+ \brief Assignment operator
+ */
+ PX_INLINE DeserializedResults &operator =(const DeserializedResults &rhs);
+
+ /**
+ \brief Allocate memory for values
+ */
+ PX_INLINE void init(Traits *traits_, uint32_t nobjs_);
+
+ /**
+ \brief Allocate memory and set values
+ */
+ PX_INLINE void init(Traits *traits_, T *objs_, uint32_t nobjs_);
+
+ /**
+ \brief Number of objects in a container
+ */
+ PX_INLINE uint32_t size() const;
+
+ /**
+ \brief Access individual object in container
+ */
+ PX_INLINE T &operator[](uint32_t i);
+
+ /**
+ \brief Const-access individual object in container
+ */
+ PX_INLINE const T &operator[](uint32_t i) const;
+
+ /**
+ \brief Read all NvParameterized objects in container to buffer outObjs
+ \warning outObjs must be large enough to hold all contained objects
+ */
+ PX_INLINE void getObjects(T *outObjs);
+
+ /**
+ \brief Release all objects
+ */
+ PX_INLINE void releaseAll();
+ };
+
+ /**
+ \brief Container for results of deserialization
+
+ DeserializedData holds array of NvParameterized objects obtained during deserialization.
+ */
+ typedef DeserializedResults< ::NvParameterized::Interface *> DeserializedData;
+
+ /// This class keeps metadata of a single NvParameterized class
+ struct MetadataEntry
+ {
+ /// Class name
+ const char *className;
+
+ /// Class version
+ uint32_t version;
+
+ /// Class metadata
+ Definition *def;
+ };
+
+ /**
+ \brief Container for results of metadata deserialization
+
+ DeserializedMetadata holds array of MetadataEntry obtained during metadata deserialization.
+ */
+ typedef DeserializedResults<MetadataEntry> DeserializedMetadata;
+
+ /**
+ \brief Deserialize metadata from a stream into one or more definitions
+ \param [in] stream the stream from which metadata will be deserialized
+ \param [out] desData storage for deserialized metadata
+ \warning This is a draft implementation!
+ */
+ virtual ErrorType deserializeMetadata(physx::general_PxIOStream2::PxFileBuf &stream, DeserializedMetadata &desData);
+
+ /**
+ \brief Deserialize a stream into one or more NvParameterized objects
+ \param [in] stream the stream from which objects will be deserialized
+ \param [out] desData storage for deserialized data
+ */
+ virtual ErrorType deserialize(physx::general_PxIOStream2::PxFileBuf &stream, DeserializedData &desData);
+
+ /**
+ \brief Deserialize a stream into one or more NvParameterized objects
+ \param [in] stream the stream from which objects will be deserialized
+ \param [out] desData storage for deserialized data
+ \param [out] isUpdated true if any legacy object was updated, false otherwise
+ */
+ virtual ErrorType deserialize(physx::general_PxIOStream2::PxFileBuf &stream, DeserializedData &desData, bool &isUpdated) = 0;
+
+ /**
+ \brief Deserialize memory buffer into one or more NvParameterized objects
+ \param [in] data pointer to serialized data. It should be allocated via Traits.
+ \param [in] dataLen length of serialized data
+ \param [out] desData storage for deserialized data
+
+ \warning Currently only binary serializer supports inplace deserialization
+ \warning Memory must be aligned to 8 byte boundary
+ */
+ virtual ErrorType deserializeInplace(void *data, uint32_t dataLen, DeserializedData &desData);
+
+ /**
+ \brief Deserialize memory buffer into one or more NvParameterized objects
+ \param [in] data pointer to serialized data
+ \param [in] dataLen length of serialized data
+ \param [out] desData storage for deserialized data
+ \param [out] isUpdated true if any legacy object was updated, false otherwise
+
+ \warning Currently only binary serializer supports inplace deserialization
+ \warning Memory must be aligned to the boundary required by the data (see getInplaceAlignment)
+ */
+ virtual ErrorType deserializeInplace(void *data, uint32_t dataLen, DeserializedData &desData, bool &isUpdated) = 0;
+
+ /**
+ \brief Get minimum alignment required for inplace deserialization of data in stream
+ \param [in] stream stream which will be inplace deserialized
+ \param [out] align alignment required for inplace deserialization of stream
+ \note For most of the objects this will return default alignment of 8 bytes
+ */
+ virtual ErrorType peekInplaceAlignment(physx::general_PxIOStream2::PxFileBuf& stream, uint32_t& align) = 0;
+
+ /**
+ \brief Release deserializer and any memory allocations associated with it
+ */
+ virtual void release() = 0;
+};
+
+PX_POP_PACK
+
+} // namespace NvParameterized
+
+#include "NvSerializer.inl"
+
+#endif // NV_SERIALIZER_H
diff --git a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.inl b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.inl index e9298bb..d3989e9 100644..100755 --- a/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.inl +++ b/sdk/extensions/import/apexmodules/nvparutils/nvparameterized/NvSerializer.inl @@ -1,177 +1,177 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved. - -#include "NvParameterized.h" -#include "NvParameterizedTraits.h" - -namespace NvParameterized -{ - -/*! -\brief Serializer::SerializePlatform and Serializer::DeserializedData inline implementation -*/ - -/** -\brief Check binary compatibility of compiler versions -*/ -PX_INLINE bool DoCompilerVersMatch(SerializePlatform::CompilerType t, uint32_t v1, uint32_t v2) -{ - PX_UNUSED(t); - if( SerializePlatform::ANY_VERSION == v1 || SerializePlatform::ANY_VERSION == v2 ) - return true; - - //In future we should distinguish compiler versions which have different ABI - //but now we are optimistic - - return true; -} - -/** -\brief Check binary compatibility of OS versions -*/ -PX_INLINE bool DoOsVersMatch(SerializePlatform::OsType t, uint32_t v1, uint32_t v2) -{ - PX_UNUSED(t); - if( SerializePlatform::ANY_VERSION == v1 || SerializePlatform::ANY_VERSION == v2 ) - return true; - - return true; //See comment for doCompilerVersMatch -} - -PX_INLINE SerializePlatform::SerializePlatform() - : archType(ARCH_LAST), - compilerType(COMP_LAST), - compilerVer(ANY_VERSION), - osType(OS_LAST), - osVer(ANY_VERSION) -{} - -PX_INLINE SerializePlatform::SerializePlatform(ArchType archType_, CompilerType compType_, uint32_t compVer_, OsType osType_, uint32_t osVer_) - : archType(archType_), - compilerType(compType_), - compilerVer(compVer_), - osType(osType_), - osVer(osVer_) -{} - -PX_INLINE bool SerializePlatform::operator ==(const SerializePlatform &p) const -{ - return archType == p.archType - && compilerType == p.compilerType - && osType == p.osType - && DoCompilerVersMatch(compilerType, compilerVer, p.compilerVer) - && DoOsVersMatch(osType, osVer, p.osVer); -} - -PX_INLINE bool SerializePlatform::operator !=(const SerializePlatform &p) const -{ - return !(*this == p); -} - -template<typename T, int bufSize> PX_INLINE Serializer::DeserializedResults<T, bufSize>::DeserializedResults(): objs(0), nobjs(0), traits(0) {} - -template<typename T, int bufSize> PX_INLINE Serializer::DeserializedResults<T, bufSize>::DeserializedResults(const Serializer::DeserializedResults<T, bufSize> &data) -{ - *this = data; -} - -template<typename T, int bufSize> PX_INLINE Serializer::DeserializedResults<T, bufSize> &Serializer::DeserializedResults<T, bufSize>::operator =(const Serializer::DeserializedResults<T, bufSize> &rhs) -{ - if( this == &rhs ) - return *this; - - init(rhs.traits, rhs.objs, rhs.nobjs); - return *this; -} - -template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::clear() -{ - if ( objs && objs != buf ) //Memory was allocated? - { - PX_ASSERT(traits); - traits->free(objs); - } -} - -template<typename T, int bufSize> PX_INLINE Serializer::DeserializedResults<T, bufSize>::~DeserializedResults() -{ - clear(); -} - -template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::init(Traits *traits_, T *objs_, uint32_t nobjs_) -{ - init(traits_, nobjs_); - ::memcpy(objs, objs_, nobjs * sizeof(T)); -} - -template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::init(Traits *traits_, uint32_t nobjs_) -{ - clear(); - - traits = traits_; - nobjs = nobjs_; - - //Allocate memory if buf is too small - objs = nobjs <= bufSize - ? buf - : (T *)traits->alloc(nobjs * sizeof(T)); -} - -template<typename T, int bufSize> PX_INLINE uint32_t Serializer::DeserializedResults<T, bufSize>::size() const -{ - return nobjs; -} - -template<typename T, int bufSize> PX_INLINE T &Serializer::DeserializedResults<T, bufSize>::operator[](uint32_t i) -{ - PX_ASSERT( i < nobjs ); - return objs[i]; -} - -template<typename T, int bufSize> PX_INLINE const T &Serializer::DeserializedResults<T, bufSize>::operator[](uint32_t i) const -{ - PX_ASSERT( i < nobjs ); - return objs[i]; -} - -template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::getObjects(T *outObjs) -{ - ::memcpy(outObjs, objs, nobjs * sizeof(T)); -} - -template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::releaseAll() -{ - for(uint32_t i = 0; i < nobjs; ++i) - { - if (objs[i]) - { - objs[i]->destroy(); // FIXME What should we do with buf. And should we delete T* obj? - } - } -} - -} // namespace NvParameterized +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
+
+#include "NvParameterized.h"
+#include "NvParameterizedTraits.h"
+
+namespace NvParameterized
+{
+
+/*!
+\brief Serializer::SerializePlatform and Serializer::DeserializedData inline implementation
+*/
+
+/**
+\brief Check binary compatibility of compiler versions
+*/
+PX_INLINE bool DoCompilerVersMatch(SerializePlatform::CompilerType t, uint32_t v1, uint32_t v2)
+{
+ PX_UNUSED(t);
+ if( SerializePlatform::ANY_VERSION == v1 || SerializePlatform::ANY_VERSION == v2 )
+ return true;
+
+ //In future we should distinguish compiler versions which have different ABI
+ //but now we are optimistic
+
+ return true;
+}
+
+/**
+\brief Check binary compatibility of OS versions
+*/
+PX_INLINE bool DoOsVersMatch(SerializePlatform::OsType t, uint32_t v1, uint32_t v2)
+{
+ PX_UNUSED(t);
+ if( SerializePlatform::ANY_VERSION == v1 || SerializePlatform::ANY_VERSION == v2 )
+ return true;
+
+ return true; //See comment for doCompilerVersMatch
+}
+
+PX_INLINE SerializePlatform::SerializePlatform()
+ : archType(ARCH_LAST),
+ compilerType(COMP_LAST),
+ compilerVer(ANY_VERSION),
+ osType(OS_LAST),
+ osVer(ANY_VERSION)
+{}
+
+PX_INLINE SerializePlatform::SerializePlatform(ArchType archType_, CompilerType compType_, uint32_t compVer_, OsType osType_, uint32_t osVer_)
+ : archType(archType_),
+ compilerType(compType_),
+ compilerVer(compVer_),
+ osType(osType_),
+ osVer(osVer_)
+{}
+
+PX_INLINE bool SerializePlatform::operator ==(const SerializePlatform &p) const
+{
+ return archType == p.archType
+ && compilerType == p.compilerType
+ && osType == p.osType
+ && DoCompilerVersMatch(compilerType, compilerVer, p.compilerVer)
+ && DoOsVersMatch(osType, osVer, p.osVer);
+}
+
+PX_INLINE bool SerializePlatform::operator !=(const SerializePlatform &p) const
+{
+ return !(*this == p);
+}
+
+template<typename T, int bufSize> PX_INLINE Serializer::DeserializedResults<T, bufSize>::DeserializedResults(): objs(0), nobjs(0), traits(0) {}
+
+template<typename T, int bufSize> PX_INLINE Serializer::DeserializedResults<T, bufSize>::DeserializedResults(const Serializer::DeserializedResults<T, bufSize> &data)
+{
+ *this = data;
+}
+
+template<typename T, int bufSize> PX_INLINE Serializer::DeserializedResults<T, bufSize> &Serializer::DeserializedResults<T, bufSize>::operator =(const Serializer::DeserializedResults<T, bufSize> &rhs)
+{
+ if( this == &rhs )
+ return *this;
+
+ init(rhs.traits, rhs.objs, rhs.nobjs);
+ return *this;
+}
+
+template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::clear()
+{
+ if ( objs && objs != buf ) //Memory was allocated?
+ {
+ PX_ASSERT(traits);
+ traits->free(objs);
+ }
+}
+
+template<typename T, int bufSize> PX_INLINE Serializer::DeserializedResults<T, bufSize>::~DeserializedResults()
+{
+ clear();
+}
+
+template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::init(Traits *traits_, T *objs_, uint32_t nobjs_)
+{
+ init(traits_, nobjs_);
+ ::memcpy(objs, objs_, nobjs * sizeof(T));
+}
+
+template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::init(Traits *traits_, uint32_t nobjs_)
+{
+ clear();
+
+ traits = traits_;
+ nobjs = nobjs_;
+
+ //Allocate memory if buf is too small
+ objs = nobjs <= bufSize
+ ? buf
+ : (T *)traits->alloc(nobjs * sizeof(T));
+}
+
+template<typename T, int bufSize> PX_INLINE uint32_t Serializer::DeserializedResults<T, bufSize>::size() const
+{
+ return nobjs;
+}
+
+template<typename T, int bufSize> PX_INLINE T &Serializer::DeserializedResults<T, bufSize>::operator[](uint32_t i)
+{
+ PX_ASSERT( i < nobjs );
+ return objs[i];
+}
+
+template<typename T, int bufSize> PX_INLINE const T &Serializer::DeserializedResults<T, bufSize>::operator[](uint32_t i) const
+{
+ PX_ASSERT( i < nobjs );
+ return objs[i];
+}
+
+template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::getObjects(T *outObjs)
+{
+ ::memcpy(outObjs, objs, nobjs * sizeof(T));
+}
+
+template<typename T, int bufSize> PX_INLINE void Serializer::DeserializedResults<T, bufSize>::releaseAll()
+{
+ for(uint32_t i = 0; i < nobjs; ++i)
+ {
+ if (objs[i])
+ {
+ objs[i]->destroy(); // FIXME What should we do with buf. And should we delete T* obj?
+ }
+ }
+}
+
+} // namespace NvParameterized
|