Open 3D Engine (O3DE), the successor to Lumberyard, is now available in Developer Preview. Download O3DE or visit the AWS Game Tech blog to learn more. |
Represents a node in the tree of serialized data. More...
Public Member Functions |
|
DataElementNode () | |
A constructor.
More...
|
|
template<typename T > | |
bool | GetData (T &value) |
Gets the value of a
DataElementNode
.
More...
|
|
template<typename T > | |
bool | GetChildData (u32 childNameCrc, T &value) |
Gets the value of the specified subelement of a
DataElementNode
.
More...
|
|
template<typename T > | |
bool | SetData ( SerializeContext &sc, const T &value, ErrorHandler *errorHandler=nullptr) |
Sets the value of a
DataElementNode
.
More...
|
|
bool | Convert ( SerializeContext &sc, const char *name, const Uuid &id) |
Converts the current
DataElementNode
to the specified type and changes the name to the specified name.
More...
|
|
bool | Convert ( SerializeContext &sc, const Uuid &id) |
Converts the current
DataElementNode
to the specified type.
More...
|
|
template<typename T > | |
bool | Convert ( SerializeContext &sc, const char *name) |
Converts the current
DataElementNode
to the type that is specified by the template argument and changes the name to the specified name.
More...
|
|
template<typename T > | |
bool | Convert ( SerializeContext &sc) |
Converts the current
DataElementNode
to the type that is specified by the template argument.
More...
|
|
DataElement & | GetRawDataElement () |
Gets the
DataElement
that corresponds to this
DataElementNode
.
More...
|
|
const DataElement & | GetRawDataElement () const |
Gets the
DataElement
that corresponds to this
DataElementNode
.
More...
|
|
u32 | GetName () const |
Gets the CRC32 of the name of the
DataElement
that corresponds to this
DataElementNode
.
More...
|
|
const char * | GetNameString () const |
Gets the name of the
DataElement
that corresponds to this
DataElementNode
.
More...
|
|
void | SetName (const char *newName) |
Sets the name of the
DataElement
that corresponds to this
DataElementNode
.
More...
|
|
unsigned int | GetVersion () const |
Gets the version of the
DataElement
that corresponds to this
DataElementNode
.
More...
|
|
const Uuid & | GetId () const |
Gets the unique ID of the
DataElement
type that corresponds to this
DataElementNode
.
More...
|
|
int | GetNumSubElements () const |
Gets the number of subelements that belong to this
DataElementNode
.
More...
|
|
DataElementNode & | GetSubElement (int index) |
Gets the specified subelement (subnode) of this
DataElementNode
.
More...
|
|
int | FindElement (u32 crc) |
Finds the index of the specified subelement of this
DataElementNode
.
More...
|
|
DataElementNode * | FindSubElement (u32 crc) |
Gets a pointer to the specified subelement of this
DataElementNode
.
More...
|
|
void | RemoveElement (int index) |
Removes a subelement with the specified index from this
DataElementNode
.
More...
|
|
bool | RemoveElementByName (u32 crc) |
Removes a subelement with the specified name from this
DataElementNode
.
More...
|
|
int | AddElement (const DataElementNode &elem) |
Adds a subelement to this
DataElementNode
.
More...
|
|
int | AddElement ( SerializeContext &sc, const char *name, const Uuid &id) |
Adds a subelement with the specified name and unique type ID to this
DataElementNode
.
More...
|
|
int | AddElement ( SerializeContext &sc, const char *name, const ClassData &classData) |
Adds a subelement with the specified name and class data to this
DataElementNode
.
More...
|
|
template<typename T > | |
int | AddElement ( SerializeContext &sc, const char *name) |
Adds a subelement with the specified name to this
DataElementNode
.
More...
|
|
template<typename T > | |
int | AddElementWithData ( SerializeContext &sc, const char *name, const T &dataToSet) |
Adds a subelement with the specified name and data to the
DataElement
of this
DataElementNode
.
More...
|
|
int | ReplaceElement ( SerializeContext &sc, int index, const char *name, const Uuid &id) |
Replaces the subelement of this
DataElementNode
with a subelement with the specified name and unique type ID.
More...
|
|
template<typename T > | |
int | ReplaceElement ( SerializeContext &sc, int index, const char *name) |
Replaces the subelement of this
DataElementNode
with a subelement with the specified name.
More...
|
|
Protected Types |
|
typedef AZStd::vector< DataElementNode > | NodeArray |
A list of data element nodes.
More...
|
|
Protected Member Functions |
|
bool | SetDataHierarchy ( SerializeContext &sc, const void *objectPtr, const Uuid &classId, ErrorHandler *errorHandler=nullptr) |
Resets the data hierarchy after new data is added to a
DataElementNode
.
More...
|
|
Protected Attributes |
|
DataElement | m_element |
The serialized data within this
DataElementNode
.
More...
|
|
const ClassData * | m_classData |
The reflected class data for the data in this
DataElementNode
.
More...
|
|
NodeArray | m_subElements |
A list of subelements of this
DataElementNode
.
More...
|
|
Friends |
|
class | ObjectStreamInternal::ObjectStreamImpl |
class | DataOverlayTarget |
Detailed Description
Represents a node in the tree of serialized data.
The node consists of a DataElement , a pointer to the ClassData that describes the data element, and a list of the element's subnodes (subelements). For example, a class is represented as a parent node with its member variables as subnodes.
You need to use this class if you are writing a VersionConverter function.
Member Typedef Documentation
◆ NodeArray
|
protected |
A list of data element nodes.
Each DataElementNode contains its subelements in a list of this type.
Constructor & Destructor Documentation
◆ DataElementNode()
|
inline |
A constructor.
Member Function Documentation
◆ AddElement() [1/4]
int AZ::SerializeContext::DataElementNode::AddElement | ( | const DataElementNode & | elem | ) |
Adds a subelement to this DataElementNode .
- Parameters
-
elem A reference to the subelement to add.
- Returns
- The index of the subelement that was added. Returns -1 if the subelement could not be added.
◆ AddElement() [2/4]
int AZ::SerializeContext::DataElementNode::AddElement | ( | SerializeContext & | sc , |
const char * | name , | ||
const Uuid & | id | ||
) |
Adds a subelement with the specified name and unique type ID to this DataElementNode .
- Parameters
-
sc A reference to the serialize context. name A name for the added subelement. id The unique type ID of the type of subelement to add.
- Returns
- The index of the subelement that was added. Returns -1 if the subelement could not be added.
◆ AddElement() [3/4]
int AZ::SerializeContext::DataElementNode::AddElement | ( | SerializeContext & | sc , |
const char * | name , | ||
const ClassData & | classData | ||
) |
Adds a subelement with the specified name and class data to this DataElementNode .
- Parameters
-
sc A reference to the serialize context. name A name for the added subelement. classData A reference to a ClassData object that contains the reflected information of the type to add.
- Returns
- The index of the subelement that was added. Returns -1 if the subelement could not be added.
◆ AddElement() [4/4]
int AZ::SerializeContext::DataElementNode::AddElement | ( | SerializeContext & | sc , |
const char * | name | ||
) |
Adds a subelement with the specified name to this DataElementNode .
Gets the type from the template argument.
- Template Parameters
-
T The type of subelement to add.
- Parameters
-
sc A reference to the serialize context. name A name for the added subelement.
- Returns
- The index of the subelement that was added. Returns -1 if the subelement could not be added.
◆ AddElementWithData()
int AZ::SerializeContext::DataElementNode::AddElementWithData | ( | SerializeContext & | sc , |
const char * | name , | ||
const T & | dataToSet | ||
) |
Adds a subelement with the specified name and data to the DataElement of this DataElementNode .
Gets the type from the template argument.
- Template Parameters
-
T The type of subelement to add.
- Parameters
-
sc A reference to the serialize context. name A name for the added subelement. dataToSet A reference to the data to assign to the DataElement of this DataElementNode .
- Returns
- The index of the subelement that was added. Returns -1 if the subelement could not be added.
◆ Convert() [1/4]
bool AZ::SerializeContext::DataElementNode::Convert | ( | SerializeContext & | sc , |
const char * | name , | ||
const Uuid & | id | ||
) |
Converts the current DataElementNode to the specified type and changes the name to the specified name.
If the new type has subelements (that is, it is not a leaf node), you must add those elements to the DataElementNode after the conversion.
- Parameters
-
sc A reference to the serialize context. name A name for the converted DataElementNode . The name must be unique within the current scope. id The unique ID of the type to convert the DataElementNode to.
- Returns
- Returns true if the conversion succeeded. Otherwise, false.
◆ Convert() [2/4]
bool AZ::SerializeContext::DataElementNode::Convert | ( | SerializeContext & | sc , |
const Uuid & | id | ||
) |
Converts the current DataElementNode to the specified type.
If the new type has subelements (that is, it is not a leaf node), you must add those elements to the DataElementNode after the conversion.
- Parameters
-
sc A reference to the serialize context. id The unique ID of the type to convert the DataElementNode to.
- Returns
- Returns true if the conversion succeeded. Otherwise, false.
◆ Convert() [3/4]
bool AZ::SerializeContext::DataElementNode::Convert | ( | SerializeContext & | sc , |
const char * | name | ||
) |
Converts the current DataElementNode to the type that is specified by the template argument and changes the name to the specified name.
If the new type has subelements (that is, it is not a leaf node), you must add those elements to the DataElementNode after the conversion.
- Template Parameters
-
T The type to convert the DataElementNode to.
- Parameters
-
sc A reference to the serialize context. name A name for the converted DataElementNode . The name must be unique within the current scope.
- Returns
- Returns true if the conversion succeeded. Otherwise, false.
◆ Convert() [4/4]
bool AZ::SerializeContext::DataElementNode::Convert | ( | SerializeContext & | sc | ) |
Converts the current DataElementNode to the type that is specified by the template argument.
- Template Parameters
-
T The type to convert the DataElementNode to.
- Parameters
-
sc A reference to the serialize context.
- Returns
- Returns true if the conversion succeeded. Otherwise, false.
◆ FindElement()
int AZ::SerializeContext::DataElementNode::FindElement | ( | u32 | crc | ) |
Finds the index of the specified subelement of this DataElementNode .
- Parameters
-
crc The CRC32 of the name of the subelement to find.
- Returns
- The index of the subelement. Returns -1 if the subelement was not found.
◆ FindSubElement()
DataElementNode * AZ::SerializeContext::DataElementNode::FindSubElement | ( | u32 | crc | ) |
Gets a pointer to the specified subelement of this DataElementNode .
- Parameters
-
crc The CRC32 of the name of the subelement to find.
- Returns
- A pointer to the subelement. Returns a null pointer if the subelement was not found.
◆ GetChildData()
bool AZ::SerializeContext::DataElementNode::GetChildData | ( | u32 | childNameCrc , |
T & | value | ||
) |
Gets the value of the specified subelement of a DataElementNode .
- Template Parameters
-
T The data type.
- Parameters
-
childNameCrc The CRC of the name of the subelement. [out] value The value of the subelement's data.
- Returns
- Returns true if the data is loaded. Otherwise, false.
◆ GetData()
bool AZ::SerializeContext::DataElementNode::GetData | ( | T & | value | ) |
Gets the value of a DataElementNode .
This function only applies to nodes that contain data (leaf nodes).
- Template Parameters
-
T The data type.
- Parameters
-
[out] value A reference to the data.
- Returns
- Returns true if the data is loaded. Otherwise, false.
◆ GetId()
|
inline |
Gets the unique ID of the DataElement type that corresponds to this DataElementNode .
- Returns
- The unique ID of the data element type.
◆ GetName()
|
inline |
Gets the CRC32 of the name of the DataElement that corresponds to this DataElementNode .
- Returns
- The CRC32 of the data element name.
◆ GetNameString()
|
inline |
Gets the name of the DataElement that corresponds to this DataElementNode .
- Returns
- A pointer to a string that contains the data element name.
◆ GetNumSubElements()
|
inline |
Gets the number of subelements that belong to this DataElementNode .
- Returns
- The number of subelements that belong to this DataElementNode .
◆ GetRawDataElement() [1/2]
|
inline |
Gets the DataElement that corresponds to this DataElementNode .
- Returns
- A reference to the retrieved data element.
◆ GetRawDataElement() [2/2]
|
inline |
Gets the DataElement that corresponds to this DataElementNode .
- Returns
- A reference to the retrieved data element.
◆ GetSubElement()
|
inline |
Gets the specified subelement (subnode) of this DataElementNode .
- Parameters
-
index The index of the subelement to get.
- Returns
- A reference to the specified subelement.
◆ GetVersion()
|
inline |
Gets the version of the DataElement that corresponds to this DataElementNode .
- Returns
- The version of the data element.
◆ RemoveElement()
void AZ::SerializeContext::DataElementNode::RemoveElement | ( | int | index | ) |
Removes a subelement with the specified index from this DataElementNode .
- Parameters
-
index The index of the subelement to remove.
◆ RemoveElementByName()
bool AZ::SerializeContext::DataElementNode::RemoveElementByName | ( | u32 | crc | ) |
Removes a subelement with the specified name from this DataElementNode .
- Parameters
-
crc The CRC32 of the name of the subelement to remove.
- Returns
- Returns true if the element was successfully removed. Otherwise, false.
◆ ReplaceElement() [1/2]
int AZ::SerializeContext::DataElementNode::ReplaceElement | ( | SerializeContext & | sc , |
int | index , | ||
const char * | name , | ||
const Uuid & | id | ||
) |
Replaces the subelement of this DataElementNode with a subelement with the specified name and unique type ID.
- Parameters
-
sc A reference to the serialize context. index The index of the subelement to replace with the specified subelement. name A name for the new subelement. id The unique ID of the new subelement type.
- Returns
- The index at which the subelement was replaced. Returns -1 if the subelement could not be replaced.
◆ ReplaceElement() [2/2]
int AZ::SerializeContext::DataElementNode::ReplaceElement | ( | SerializeContext & | sc , |
int | index , | ||
const char * | name | ||
) |
Replaces the subelement of this DataElementNode with a subelement with the specified name.
Gets the type from the template argument.
- Template Parameters
-
T The type of the new subelement.
- Parameters
-
sc A reference to the serialize context. index The index of the subelement to replace with the specified subelement. name A name for the new subelement.
- Returns
- The index at which the subelement was replaced. Returns -1 if the subelement could not be replaced.
◆ SetData()
bool AZ::SerializeContext::DataElementNode::SetData | ( | SerializeContext & | sc , |
const T & | value , | ||
ErrorHandler * |
errorHandler
=
nullptr
|
||
) |
Sets the value of a DataElementNode .
- Template Parameters
-
T The data type.
- Parameters
-
sc A reference to the serialize context. value A reference to a data value. errorHandler (Optional) A pointer to an ErrorHandler object that reports errors and warnings as Lumberyard serializes data.
- Returns
- Returns true if the data is saved. Otherwise, false.
◆ SetDataHierarchy()
|
protected |
Resets the data hierarchy after new data is added to a DataElementNode .
- Parameters
-
sc A reference to the serialize context. objectPtr A pointer to the value of the data to add. classId The unique type ID of the data that was added. errorHandler (Optional) A pointer to an ErrorHandler object that reports errors and warnings as Lumberyard serializes data.
- Returns
- Returns true if the data hierarchy was set successfully. Otherwise, false.
◆ SetName()
void AZ::SerializeContext::DataElementNode::SetName | ( | const char * | newName | ) |
Sets the name of the DataElement that corresponds to this DataElementNode .
- Parameters
-
newName A pointer to a string that contains the new name.
Friends And Related Function Documentation
◆ DataOverlayTarget
|
friend |
◆ ObjectStreamInternal::ObjectStreamImpl
|
friend |
Member Data Documentation
◆ m_classData
|
protected |
The reflected class data for the data in this DataElementNode .
◆ m_element
|
protected |
The serialized data within this DataElementNode .
The serialized data is a DataElement .
◆ m_subElements
|
protected |
A list of subelements of this DataElementNode .
The subelements are of type DataElementNode also.
The documentation for this class was generated from the following file:
- C:/lumberyard-root/dev/Code/Framework/AZCore/AZCore/Serialization/ SerializeContext.h