The abstract base class for a number of different types of data elements that may be stored in the X file. More...
#include "xFileDataObject.h"
Public Member Functions | |
XFileDataObject (const XFileDataDef *data_def=nullptr) | |
XFileDataObject & | add_Coords2d (XFile *x_file, const LVecBase2d &coords) |
Appends a new Coords2d instance. More... | |
XFileDataObject & | add_double (double double_value) |
Appends a new floating-point value to the data object, if it makes sense to do so. More... | |
virtual bool | add_element (XFileDataObject *element) |
Adds the indicated element as a nested data element, if this data object type supports it. More... | |
XFileDataObject & | add_IndexedColor (XFile *x_file, int index, const LColor &color) |
Appends a new IndexedColor instance. More... | |
XFileDataObject & | add_int (int int_value) |
Appends a new integer value to the data object, if it makes sense to do so. More... | |
XFileDataObject & | add_MeshFace (XFile *x_file) |
Appends a new MeshFace instance. More... | |
XFileDataObject & | add_string (const std::string &string_value) |
Appends a new string value to the data object, if it makes sense to do so. More... | |
XFileDataObject & | add_Vector (XFile *x_file, const LVecBase3d &vector) |
Appends a new Vector instance. More... | |
double | d () const |
Unambiguously returns the object's representation as a double, or 0.0 if the object has no double representation. More... | |
virtual TypeHandle | force_init_type () |
const XFileDataDef * | get_data_def () const |
Returns the data object that this object is represented by, if any, or NULL if there is none. More... | |
virtual TypeHandle | get_type () const |
virtual std::string | get_type_name () const |
Returns a string that represents the type of object this data object represents. More... | |
int | i () const |
Unambiguously returns the object's representation as an integer, or 0 if the object has no integer representation. More... | |
virtual bool | is_complex_object () const |
Returns true if this kind of data object is a complex object that can hold nested data elements, false otherwise. More... | |
LMatrix4d | mat4 () const |
Returns the object's representation as an LMatrix4d. More... | |
const XFileDataObject & | operator [] (int n) const |
Returns the nth nested object within this object. More... | |
const XFileDataObject & | operator [] (const std::string &name) const |
Returns the named nested object within this object. More... | |
XFileDataObject & | operator [] (int n) |
Returns the nth nested object within this object. More... | |
XFileDataObject & | operator [] (const std::string &name) |
Returns the named nested object within this object. More... | |
void | operator= (int int_value) |
Stores the indicated integer value into the object, if it makes sense to do so. More... | |
void | operator= (double double_value) |
Stores the indicated floating-point value into the object, if it makes sense to do so. More... | |
void | operator= (const std::string &string_value) |
Stores the indicated string value into the object, if it makes sense to do so. More... | |
void | operator= (const LVecBase2d &vec) |
Stores the indicated Vec2 value into the object, if it makes sense to do so. More... | |
void | operator= (const LVecBase3d &vec) |
Stores the indicated Vec3 value into the object, if it makes sense to do so. More... | |
void | operator= (const LVecBase4d &vec) |
Stores the indicated Vec4 value into the object, if it makes sense to do so. More... | |
void | operator= (const LMatrix4d &mat) |
Stores the indicated Matrix value into the object, if it makes sense to do so. More... | |
virtual void | output_data (std::ostream &out) const |
Writes a suitable representation of this node to an .x file in text mode. More... | |
std::string | s () const |
Unambiguously returns the object's representation as a string, or empty string if the object has no string representation. More... | |
void | set (int int_value) |
Stores the indicated integer value into the object, if it makes sense to do so. More... | |
void | set (double double_value) |
Stores the indicated floating-point value into the object, if it makes sense to do so. More... | |
void | set (const std::string &string_value) |
Stores the indicated string value into the object, if it makes sense to do so. More... | |
void | set (const LVecBase2d &vec) |
Stores the indicated Vec2 value into the object, if it makes sense to do so. More... | |
void | set (const LVecBase3d &vec) |
Stores the indicated Vec3 value into the object, if it makes sense to do so. More... | |
void | set (const LVecBase4d &vec) |
Stores the indicated Vec4 value into the object, if it makes sense to do so. More... | |
void | set (const LMatrix4d &mat) |
Stores the indicated Matrix value into the object, if it makes sense to do so. More... | |
int | size () const |
Returns the number of nested data objects within this object. More... | |
LVecBase2d | vec2 () const |
Returns the object's representation as an LVecBase2d. More... | |
LVecBase3d | vec3 () const |
Returns the object's representation as an LVecBase3d. More... | |
LVecBase4d | vec4 () const |
Returns the object's representation as an LVecBase4d. More... | |
virtual void | write_data (std::ostream &out, int indent_level, const char *separator) const |
Writes a suitable representation of this node to an .x file in text mode. More... | |
Public Member Functions inherited from ReferenceCount | |
int | get_ref_count () const |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
void | ref () const |
Explicitly increments the reference count. More... | |
bool | ref_if_nonzero () const |
Atomically increases the reference count of this object if it is not zero. More... | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
virtual bool | unref () const |
Explicitly decrements the reference count. More... | |
WeakReferenceList * | weak_ref () |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref () |
Removes the indicated PointerToVoid as a weak reference to this object. More... | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from ReferenceCount | |
static TypeHandle | get_class_type () |
static void | init_type () |
Additional Inherited Members | |
Public Attributes inherited from ReferenceCount | |
get_ref_count | |
Returns the current reference count. More... | |
The abstract base class for a number of different types of data elements that may be stored in the X file.
Definition at line 30 of file xFileDataObject.h.
XFileDataObject & XFileDataObject::add_Coords2d | ( | XFile * | x_file, |
const LVecBase2d & | coords | ||
) |
Appends a new Coords2d instance.
Definition at line 146 of file xFileDataObject.cxx.
References XFile::find_standard_template().
XFileDataObject & XFileDataObject::add_double | ( | double | double_value | ) |
Appends a new floating-point value to the data object, if it makes sense to do so.
Normally, this is valid only for a DataObjectArray, or in certain special cases for a DataNodeTemplate.
Definition at line 72 of file xFileDataObject.cxx.
References add_element(), and get_data_def().
|
virtual |
Adds the indicated element as a nested data element, if this data object type supports it.
Returns true if added successfully, false if the data object type does not support nested data elements.
Reimplemented in XFileDataNodeTemplate, and XFileDataObjectArray.
Definition at line 165 of file xFileDataObject.cxx.
Referenced by add_double(), add_int(), and add_string().
XFileDataObject & XFileDataObject::add_IndexedColor | ( | XFile * | x_file, |
int | index, | ||
const LColor & | color | ||
) |
Appends a new IndexedColor instance.
Definition at line 128 of file xFileDataObject.cxx.
References XFile::find_standard_template().
XFileDataObject & XFileDataObject::add_int | ( | int | int_value | ) |
Appends a new integer value to the data object, if it makes sense to do so.
Normally, this is valid only for a DataObjectArray, or in certain special cases for a DataNodeTemplate.
Definition at line 59 of file xFileDataObject.cxx.
References add_element(), and get_data_def().
Referenced by XFileMesh::make_x_material_list(), and XFileMesh::make_x_normals().
XFileDataObject & XFileDataObject::add_MeshFace | ( | XFile * | x_file | ) |
Appends a new MeshFace instance.
Definition at line 113 of file xFileDataObject.cxx.
References XFile::find_standard_template().
Referenced by XFileMesh::make_x_normals().
XFileDataObject & XFileDataObject::add_string | ( | const std::string & | string_value | ) |
Appends a new string value to the data object, if it makes sense to do so.
Normally, this is valid only for a DataObjectArray, or in certain special cases for a DataNodeTemplate.
Definition at line 85 of file xFileDataObject.cxx.
References add_element(), and get_data_def().
XFileDataObject & XFileDataObject::add_Vector | ( | XFile * | x_file, |
const LVecBase3d & | vector | ||
) |
Appends a new Vector instance.
Definition at line 96 of file xFileDataObject.cxx.
References XFile::find_standard_template().
Referenced by XFileMesh::make_x_normals().
|
inline |
Unambiguously returns the object's representation as a double, or 0.0 if the object has no double representation.
See also get_data_def() to determine what kind of representation this object has.
Definition at line 188 of file xFileDataObject.I.
|
inline |
Returns the data object that this object is represented by, if any, or NULL if there is none.
Definition at line 28 of file xFileDataObject.I.
Referenced by add_double(), add_int(), and add_string().
|
virtual |
Returns a string that represents the type of object this data object represents.
Reimplemented in XFileDataNode.
Definition at line 49 of file xFileDataObject.cxx.
References TypeHandle::get_name.
|
inline |
Unambiguously returns the object's representation as an integer, or 0 if the object has no integer representation.
See also get_data_def() to determine what kind of representation this object has.
Definition at line 178 of file xFileDataObject.I.
Referenced by XFileDataObjectArray::write_data(), and XFileDataNodeTemplate::write_data().
|
virtual |
Returns true if this kind of data object is a complex object that can hold nested data elements, false otherwise.
Reimplemented in XFileDataNodeReference, XFileDataNodeTemplate, and XFileDataObjectArray.
Definition at line 40 of file xFileDataObject.cxx.
Referenced by XFileDataObjectArray::write_data(), and XFileDataNodeTemplate::write_data().
|
inline |
Returns the object's representation as an LMatrix4d.
It is an error if the object does not have sixteen nested objects that store a double value.
Definition at line 240 of file xFileDataObject.I.
|
inline |
Returns the nth nested object within this object.
Call get_num_children() to determine the number of nested objects.
Definition at line 259 of file xFileDataObject.I.
|
inline |
Returns the named nested object within this object.
It is an error if the named object does not exist. Call find_child() instead if there is any doubt.
Definition at line 271 of file xFileDataObject.I.
|
inline |
Returns the nth nested object within this object.
Call get_num_children() to determine the number of nested objects.
Definition at line 282 of file xFileDataObject.I.
|
inline |
Returns the named nested object within this object.
It is an error if the named object does not exist. Call find_child() instead if there is any doubt.
Definition at line 294 of file xFileDataObject.I.
|
inline |
Stores the indicated integer value into the object, if it makes sense to do so.
It is an error to call this on an object that cannot accept an integer value.
Definition at line 38 of file xFileDataObject.I.
References set().
|
inline |
Stores the indicated floating-point value into the object, if it makes sense to do so.
It is an error to call this on an object that cannot accept a floating-point value.
Definition at line 48 of file xFileDataObject.I.
References set().
|
inline |
Stores the indicated string value into the object, if it makes sense to do so.
It is an error to call this on an object that cannot accept a string value.
Definition at line 58 of file xFileDataObject.I.
References set().
|
inline |
Stores the indicated Vec2 value into the object, if it makes sense to do so.
It is an error to call this on an object that does not store two floating-point values.
Definition at line 68 of file xFileDataObject.I.
References set().
|
inline |
Stores the indicated Vec3 value into the object, if it makes sense to do so.
It is an error to call this on an object that does not store three floating-point values.
Definition at line 78 of file xFileDataObject.I.
References set().
|
inline |
Stores the indicated Vec4 value into the object, if it makes sense to do so.
It is an error to call this on an object that does not store four floating-point values.
Definition at line 88 of file xFileDataObject.I.
References set().
|
inline |
Stores the indicated Matrix value into the object, if it makes sense to do so.
It is an error to call this on an object that does not store sixteen floating-point values.
Definition at line 98 of file xFileDataObject.I.
|
virtual |
Writes a suitable representation of this node to an .x file in text mode.
Reimplemented in XFileDataObjectDouble, XFileDataObjectInteger, and XFileDataObjectString.
Definition at line 173 of file xFileDataObject.cxx.
|
inline |
Unambiguously returns the object's representation as a string, or empty string if the object has no string representation.
See also get_data_def() to determine what kind of representation this object has.
Definition at line 198 of file xFileDataObject.I.
|
inline |
Stores the indicated integer value into the object, if it makes sense to do so.
It is an error to call this on an object that cannot accept an integer value.
Definition at line 108 of file xFileDataObject.I.
Referenced by operator=().
|
inline |
Stores the indicated floating-point value into the object, if it makes sense to do so.
It is an error to call this on an object that cannot accept a floating-point value.
Definition at line 118 of file xFileDataObject.I.
|
inline |
Stores the indicated string value into the object, if it makes sense to do so.
It is an error to call this on an object that cannot accept a string value.
Definition at line 128 of file xFileDataObject.I.
|
inline |
Stores the indicated Vec2 value into the object, if it makes sense to do so.
It is an error to call this on an object that does not store two floating-point values.
Definition at line 138 of file xFileDataObject.I.
|
inline |
Stores the indicated Vec3 value into the object, if it makes sense to do so.
It is an error to call this on an object that does not store three floating-point values.
Definition at line 148 of file xFileDataObject.I.
|
inline |
Stores the indicated Vec4 value into the object, if it makes sense to do so.
It is an error to call this on an object that does not store four floating-point values.
Definition at line 158 of file xFileDataObject.I.
|
inline |
Stores the indicated Matrix value into the object, if it makes sense to do so.
It is an error to call this on an object that does not store sixteen floating-point values.
Definition at line 168 of file xFileDataObject.I.
|
inline |
Returns the number of nested data objects within this object.
Definition at line 250 of file xFileDataObject.I.
Referenced by XFileMesh::fill_material_list(), XFileMesh::fill_uvs(), XFileMesh::make_x_material_list(), and XFileMesh::make_x_normals().
|
inline |
Returns the object's representation as an LVecBase2d.
It is an error if the object does not have two nested objects that store a double value.
Definition at line 207 of file xFileDataObject.I.
|
inline |
Returns the object's representation as an LVecBase3d.
It is an error if the object does not have three nested objects that store a double value.
Definition at line 218 of file xFileDataObject.I.
|
inline |
Returns the object's representation as an LVecBase4d.
It is an error if the object does not have four nested objects that store a double value.
Definition at line 229 of file xFileDataObject.I.
|
virtual |
Writes a suitable representation of this node to an .x file in text mode.
Reimplemented in XFileDataNodeTemplate, XFileDataObjectArray, XFileDataObjectDouble, XFileDataObjectInteger, and XFileDataObjectString.
Definition at line 181 of file xFileDataObject.cxx.
References indent().