Classes | Public Types | Public Member Functions | Static Public Member Functions
NvParameterized::Serializer Class Reference

Interface class for serializer-deserializer of NvParameterized objects. More...

#include <NvSerializer.h>

List of all members.

Classes

class  DeserializedResults
 TODO. More...
struct  MetadataEntry
 This class keeps metadata of a single NvParameterized class. More...

Public Types

enum  ErrorType {
  ERROR_NONE = 0,
  ERROR_UNKNOWN,
  ERROR_NOT_IMPLEMENTED,
  ERROR_INVALID_PLATFORM,
  ERROR_INVALID_PLATFORM_NAME,
  ERROR_INVALID_FILE_VERSION,
  ERROR_INVALID_FILE_FORMAT,
  ERROR_INVALID_MAGIC,
  ERROR_INVALID_CHAR,
  ERROR_STREAM_ERROR,
  ERROR_MEMORY_ALLOCATION_FAILURE,
  ERROR_UNALIGNED_MEMORY,
  ERROR_PRESERIALIZE_FAILED,
  ERROR_INTERNAL_BUFFER_OVERFLOW,
  ERROR_OBJECT_CREATION_FAILED,
  ERROR_CONVERSION_FAILED,
  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,
  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
}
 Status enums that the Serializer methods may return.
enum  SerializeType {
  NST_XML = 0,
  NST_BINARY,
  NST_LAST
}
 The supported serialization formats. More...
typedef DeserializedResults
< ::NvParameterized::Interface * > 
DeserializedData
 Container for results of deserialization.
typedef DeserializedResults
< MetadataEntry
DeserializedMetadata
 Container for results of metadata deserialization.

Public Member Functions

virtual ErrorType setTargetPlatform (const SerializePlatform &platform)=0
 Set platform to use in platform-dependent serialization.
virtual void setAutoUpdate (bool doUpdate)=0
 Sets whether serializer will automatically update objects after deserialization.
virtual ErrorType serialize (physx::general_PxIOStream2::PxFileBuf &stream, const ::NvParameterized::Interface **objs, uint32_t nobjs, bool doSerializeMetadata=false)=0
 Serialize array of NvParameterized-objects to a stream.
virtual ErrorType peekNumObjects (physx::general_PxIOStream2::PxFileBuf &stream, uint32_t &numObjects)=0
 Peek number of NvParameterized-objects in stream with serialized data.
virtual ErrorType peekClassNames (physx::general_PxIOStream2::PxFileBuf &stream, char **classNames, uint32_t &numClassNames)=0
 Peek number of NvParameterized-objects in stream with serialized data.
virtual ErrorType peekNumObjectsInplace (const void *data, uint32_t dataLen, uint32_t &numObjects)=0
 Peek number of NvParameterized-objects in memory buffer with serialized data.
virtual ErrorType deserializeMetadata (physx::general_PxIOStream2::PxFileBuf &stream, DeserializedMetadata &desData)
 Deserialize metadata from a stream into one or more definitions.
virtual ErrorType deserialize (physx::general_PxIOStream2::PxFileBuf &stream, DeserializedData &desData)
 Deserialize a stream into one or more NvParameterized objects.
virtual ErrorType deserialize (physx::general_PxIOStream2::PxFileBuf &stream, DeserializedData &desData, bool &isUpdated)=0
 Deserialize a stream into one or more NvParameterized objects.
virtual ErrorType deserializeInplace (void *data, uint32_t dataLen, DeserializedData &desData)
 Deserialize memory buffer into one or more NvParameterized objects.
virtual ErrorType deserializeInplace (void *data, uint32_t dataLen, DeserializedData &desData, bool &isUpdated)=0
 Deserialize memory buffer into one or more NvParameterized objects.
virtual ErrorType peekInplaceAlignment (physx::general_PxIOStream2::PxFileBuf &stream, uint32_t &align)=0
 Get minimum alignment required for inplace deserialization of data in stream.
virtual void release ()=0
 Release deserializer and any memory allocations associated with it.

Static Public Member Functions

static SerializeType peekSerializeType (physx::general_PxIOStream2::PxFileBuf &stream)
 Get type of stream (binary or xml)
static ErrorType peekPlatform (physx::general_PxIOStream2::PxFileBuf &stream, SerializePlatform &platform)
 Get stream native platform.

Detailed Description

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).


Member Typedef Documentation

Container for results of deserialization.

DeserializedData holds array of NvParameterized objects obtained during deserialization.

Container for results of metadata deserialization.

DeserializedMetadata holds array of MetadataEntry obtained during metadata deserialization.


Member Enumeration Documentation

The supported serialization formats.

Enumerator:
NST_XML 

serialize in XML format.

NST_BINARY 

serialize in a binary format


Member Function Documentation

virtual ErrorType NvParameterized::Serializer::deserialize ( physx::general_PxIOStream2::PxFileBuf &  stream,
DeserializedData desData 
) [virtual]

Deserialize a stream into one or more NvParameterized objects.

Parameters:
[in]streamthe stream from which objects will be deserialized
[out]desDatastorage for deserialized data
virtual ErrorType NvParameterized::Serializer::deserialize ( physx::general_PxIOStream2::PxFileBuf &  stream,
DeserializedData desData,
bool &  isUpdated 
) [pure virtual]

Deserialize a stream into one or more NvParameterized objects.

Parameters:
[in]streamthe stream from which objects will be deserialized
[out]desDatastorage for deserialized data
[out]isUpdatedtrue if any legacy object was updated, false otherwise
virtual ErrorType NvParameterized::Serializer::deserializeInplace ( void *  data,
uint32_t  dataLen,
DeserializedData desData 
) [virtual]

Deserialize memory buffer into one or more NvParameterized objects.

Parameters:
[in]datapointer to serialized data. It should be allocated via Traits.
[in]dataLenlength of serialized data
[out]desDatastorage for deserialized data
Warning:
Currently only binary serializer supports inplace deserialization
Memory must be aligned to 8 byte boundary
virtual ErrorType NvParameterized::Serializer::deserializeInplace ( void *  data,
uint32_t  dataLen,
DeserializedData desData,
bool &  isUpdated 
) [pure virtual]

Deserialize memory buffer into one or more NvParameterized objects.

Parameters:
[in]datapointer to serialized data
[in]dataLenlength of serialized data
[out]desDatastorage for deserialized data
[out]isUpdatedtrue if any legacy object was updated, false otherwise
Warning:
Currently only binary serializer supports inplace deserialization
Memory must be aligned to the boundary required by the data (see getInplaceAlignment)
virtual ErrorType NvParameterized::Serializer::deserializeMetadata ( physx::general_PxIOStream2::PxFileBuf &  stream,
DeserializedMetadata desData 
) [virtual]

Deserialize metadata from a stream into one or more definitions.

Parameters:
[in]streamthe stream from which metadata will be deserialized
[out]desDatastorage for deserialized metadata
Warning:
This is a draft implementation!
virtual ErrorType NvParameterized::Serializer::peekClassNames ( physx::general_PxIOStream2::PxFileBuf &  stream,
char **  classNames,
uint32_t &  numClassNames 
) [pure virtual]

Peek number of NvParameterized-objects in stream with serialized data.

Parameters:
[in]streamthe stream from which objects will be deserialized
[in]classNamespointer to buffer for resulting names
[in,out]numClassNameslimit on number of returned classNames; number of returned names
Warning:
User is responsible for releasing every element of classNames via Traits::strfree()
virtual ErrorType NvParameterized::Serializer::peekInplaceAlignment ( physx::general_PxIOStream2::PxFileBuf &  stream,
uint32_t &  align 
) [pure virtual]

Get minimum alignment required for inplace deserialization of data in stream.

Parameters:
[in]streamstream which will be inplace deserialized
[out]alignalignment required for inplace deserialization of stream
Note:
For most of the objects this will return default alignment of 8 bytes
virtual ErrorType NvParameterized::Serializer::peekNumObjects ( physx::general_PxIOStream2::PxFileBuf &  stream,
uint32_t &  numObjects 
) [pure virtual]

Peek number of NvParameterized-objects in stream with serialized data.

Parameters:
[in]streamthe stream from which the object will be deserialized
[out]numObjectsnumber of objects
Warning:
Not all streams support peeking
virtual ErrorType NvParameterized::Serializer::peekNumObjectsInplace ( const void *  data,
uint32_t  dataLen,
uint32_t &  numObjects 
) [pure virtual]

Peek number of NvParameterized-objects in memory buffer with serialized data.

Parameters:
[in]datapointer to memory buffer
[in]dataLenlength of memory buffer
[out]numObjectsnumber of objects
static ErrorType NvParameterized::Serializer::peekPlatform ( physx::general_PxIOStream2::PxFileBuf &  stream,
SerializePlatform platform 
) [static]

Get stream native platform.

Parameters:
[in]streamstream to be analyzed
[out]platformstream native platform
static SerializeType NvParameterized::Serializer::peekSerializeType ( physx::general_PxIOStream2::PxFileBuf &  stream) [static]

Get type of stream (binary or xml)

Parameters:
[in]streamstream to be analyzed
virtual ErrorType NvParameterized::Serializer::serialize ( physx::general_PxIOStream2::PxFileBuf &  stream,
const ::NvParameterized::Interface **  objs,
uint32_t  nobjs,
bool  doSerializeMetadata = false 
) [pure virtual]

Serialize array of NvParameterized-objects to a stream.

Parameters:
[in]streamthe stream to which the object will be serialized
[in]objsNvParameterized-objects which will be serialized
[in]nobjsnumber of objects
[in]doSerializeMetadataset this to store object metadata in file
Warning:
Serialized file may depend on selected target platform
virtual void NvParameterized::Serializer::setAutoUpdate ( bool  doUpdate) [pure virtual]

Sets whether serializer will automatically update objects after deserialization.

Parameters:
[in]doUpdateshould automatic update be done?
Warning:
Normally you will not need this
This is true by default
virtual ErrorType NvParameterized::Serializer::setTargetPlatform ( const SerializePlatform platform) [pure virtual]

Set platform to use in platform-dependent serialization.

Parameters:
[in]platformtarget 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.


The documentation for this class was generated from the following file:

Generated on Sat Dec 1 2018 15:52:11

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