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

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

#include <NxSerializer.h>

List of all members.

Classes

class  DeserializedResults
 TODO. More...
struct  MetadataEntry
 This class keeps metadata of a single NxParameterized 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
< ::NxParameterized::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 ::NxParameterized::Interface **objs, physx::PxU32 nobjs, bool doSerializeMetadata=false)=0
 Serialize array of NxParameterized-objects to a stream.
virtual ErrorType peekNumObjects (physx::general_PxIOStream2::PxFileBuf &stream, physx::PxU32 &numObjects)=0
 Peek number of NxParameterized-objects in stream with serialized data.
virtual ErrorType peekClassNames (physx::general_PxIOStream2::PxFileBuf &stream, char **classNames, physx::PxU32 &numClassNames)=0
 Peek number of NxParameterized-objects in stream with serialized data.
virtual ErrorType peekNumObjectsInplace (const void *data, physx::PxU32 dataLen, physx::PxU32 &numObjects)=0
 Peek number of NxParameterized-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 NxParameterized objects.
virtual ErrorType deserialize (physx::general_PxIOStream2::PxFileBuf &stream, DeserializedData &desData, bool &isUpdated)=0
 Deserialize a stream into one or more NxParameterized objects.
virtual ErrorType deserializeInplace (void *data, physx::PxU32 dataLen, DeserializedData &desData)
 Deserialize memory buffer into one or more NxParameterized objects.
virtual ErrorType deserializeInplace (void *data, physx::PxU32 dataLen, DeserializedData &desData, bool &isUpdated)=0
 Deserialize memory buffer into one or more NxParameterized objects.
virtual ErrorType peekInplaceAlignment (physx::general_PxIOStream2::PxFileBuf &stream, physx::PxU32 &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 NxParameterized objects.

Serializer serializes and deserializes one or more NxParameterized objects to file using various output formats (see SerializeType).


Member Typedef Documentation

Container for results of deserialization.

DeserializedData holds array of NxParameterized 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 NxParameterized::Serializer::deserialize ( physx::general_PxIOStream2::PxFileBuf &  stream,
DeserializedData desData 
) [virtual]

Deserialize a stream into one or more NxParameterized objects.

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

Deserialize a stream into one or more NxParameterized 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 NxParameterized::Serializer::deserializeInplace ( void *  data,
physx::PxU32  dataLen,
DeserializedData desData 
) [virtual]

Deserialize memory buffer into one or more NxParameterized objects.

Parameters:
[in]datapointer to serialized data
[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 NxParameterized::Serializer::deserializeInplace ( void *  data,
physx::PxU32  dataLen,
DeserializedData desData,
bool &  isUpdated 
) [pure virtual]

Deserialize memory buffer into one or more NxParameterized 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 NxParameterized::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 NxParameterized::Serializer::peekClassNames ( physx::general_PxIOStream2::PxFileBuf &  stream,
char **  classNames,
physx::PxU32 &  numClassNames 
) [pure virtual]

Peek number of NxParameterized-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 NxParameterized::Serializer::peekInplaceAlignment ( physx::general_PxIOStream2::PxFileBuf &  stream,
physx::PxU32 &  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 NxParameterized::Serializer::peekNumObjects ( physx::general_PxIOStream2::PxFileBuf &  stream,
physx::PxU32 &  numObjects 
) [pure virtual]

Peek number of NxParameterized-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 NxParameterized::Serializer::peekNumObjectsInplace ( const void *  data,
physx::PxU32  dataLen,
physx::PxU32 &  numObjects 
) [pure virtual]

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

Parameters:
[in]datapointer to memory buffer
[in]dataLenlength of memory buffer
[out]numObjectsnumber of objects
static ErrorType NxParameterized::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 NxParameterized::Serializer::peekSerializeType ( physx::general_PxIOStream2::PxFileBuf &  stream) [static]

Get type of stream (binary or xml)

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

Serialize array of NxParameterized-objects to a stream.

Parameters:
[in]streamthe stream to which the object will be serialized
[in]objsNxParameterized-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 NxParameterized::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 NxParameterized::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 Mon Apr 28 2014 08:01:36

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