Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

XFileDataNodeTemplate Class Reference

This is a node which contains all of the data elements defined by a template. More...

#include "xFileDataNodeTemplate.h"

Inheritance diagram for XFileDataNodeTemplate:
XFileDataNode XFileNode XFileDataObject TypedObject Namable ReferenceCount ReferenceCount MemoryBase MemoryBase MemoryBase

List of all members.

Public Types

typedef pmap< const
XFileDataDef
*, XFileDataObject * > 
PrevData

Public Member Functions

 XFileDataNodeTemplate (XFile *x_file, const string &name, XFileTemplate *xtemplate)
void add_child (XFileNode *node)
 Adds the indicated node as a child of this node.
XFileDataObjectadd_Coords2d (XFile *x_file, const LVecBase2d &coords)
 Appends a new Coords2d instance.
XFileDataObjectadd_double (double double_value)
 Appends a new floating-point value to the data object, if it makes sense to do so.
virtual bool add_element (XFileDataObject *element)
 Adds the indicated element as a nested data element, if this data object type supports it.
XFileDataNodeadd_Frame (const string &name)
 Creates a new Frame instance, as a child of this node.
XFileDataNodeadd_FrameTransformMatrix (const LMatrix4d &mat)
 Creates a new FrameTransformMatrix instance, as a child of this node.
XFileDataObjectadd_IndexedColor (XFile *x_file, int index, const Colorf &color)
 Appends a new IndexedColor instance.
XFileDataObjectadd_int (int int_value)
 Appends a new integer value to the data object, if it makes sense to do so.
XFileDataNodeadd_Material (const string &name, const Colorf &face_color, double power, const RGBColorf &specular_color, const RGBColorf &emissive_color)
 Creates a new Material instance, as a child of this node.
XFileDataNodeadd_Mesh (const string &name)
 Creates a new Mesh instance, as a child of this node.
XFileDataObjectadd_MeshFace (XFile *x_file)
 Appends a new MeshFace instance.
XFileDataNodeadd_MeshMaterialList (const string &name)
 Creates a new MeshMaterialList instance, as a child of this node.
XFileDataNodeadd_MeshNormals (const string &name)
 Creates a new MeshNormals instance, as a child of this node.
XFileDataNodeadd_MeshTextureCoords (const string &name)
 Creates a new MeshTextureCoords instance, as a child of this node.
XFileDataNodeadd_MeshVertexColors (const string &name)
 Creates a new MeshVertexColors instance, as a child of this node.
void add_parse_double (PTA_double double_list)
 Adds the indicated list of doubles as a data element encountered in the parser.
void add_parse_int (PTA_int int_list)
 Adds the indicated list of ints as a data element encountered in the parser.
void add_parse_string (const string &str)
 Adds the indicated string as a data element encountered in the parser.
XFileDataObjectadd_string (const string &string_value)
 Appends a new string value to the data object, if it makes sense to do so.
XFileDataNodeadd_TextureFilename (const string &name, const Filename &filename)
 Creates a new TextureFilename instance, as a child of this node.
XFileDataObjectadd_Vector (XFile *x_file, const LVecBase3d &vector)
 Appends a new Vector instance.
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer.
virtual void clear ()
 Removes all children from the node, and otherwise resets it to its initial state.
void clear_name ()
 Resets the Namable's name to empty.
double d () const
 Unambiguously returns the object's representation as a double, or 0.0 if the object has no double representation.
virtual bool fill_zero_data (XFileDataObject *object) const
 This is similar to repack_data(), except it is used to fill the initial values for a newly-created template object to zero.
bool finalize_parse_data ()
 Processes all of the data elements added by add_parse_*(), checks them for syntactic and semantic correctness against the Template definition, and stores the appropriate child data elements.
XFileNodefind_child (const string &name) const
 Returns the child with the indicated name, if any, or NULL if none.
int find_child_index (const string &name) const
 Returns the index number of the child with the indicated name, if any, or -1 if none.
int find_child_index (const XFileNode *child) const
 Returns the index number of the indicated child, or -1 if none.
XFileNodefind_descendent (const string &name) const
 Returns the first child or descendent found with the indicated name after a depth-first search, if any, or NULL if none.
virtual TypeHandle force_init_type ()
int get_best_parent_from_Set (const std::set< int > &) const
XFileNodeget_child (int n) const
 Returns the nth child of this node.
const XFileDataNodeget_data_child (int n) const
 Since the children of an XFileDataNode are syntactically constrained to themselves be XFileDataNodes, this is a convenience function that returns the same thing as XFileNode::get_child(), but it is cast to a type XFileDataNode and dereferenced.
const XFileDataDefget_data_def () const
 Returns the data object that this object is represented by, if any, or NULL if there is none.
virtual const WindowsGuidget_guid () const
 If has_guid() returned true, returns the particular GUID associated with this node.
const string & get_name () const
int get_num_children () const
 Returns the list of children of this node.
int get_num_objects () const
 Returns the list of child objects of this node.
XFileDataNodeget_object (int n) const
 Returns the nth child object of this node.
int get_ref_count () const
 Returns the current reference count.
XFileTemplateget_template () const
 Returns the template used to define this data object.
const string & get_template_name () const
 A convenience function to return the name of the template used to define this data object.
virtual TypeHandle get_type () const
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
virtual string get_type_name () const
 Returns a string that represents the type of object this data object represents.
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object.
XFileget_x_file () const
virtual bool has_guid () const
 Returns true if this node has a GUID associated.
bool has_name () const
 Returns true if the Namable has a nonempty name set, false if the name is empty.
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
int i () const
 Unambiguously returns the object's representation as an integer, or 0 if the object has no integer representation.
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.
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.
virtual bool is_object () const
 Returns true if this node represents a data object that is the instance of some template, or false otherwise.
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.
virtual bool is_reference () const
 Returns true if this node represents an indirect reference to an object defined previously in the file.
virtual bool is_standard_object (const string &template_name) const
 Returns true if this node represents an instance of the standard template with the indicated name, or false otherwise.
virtual bool is_template_def () const
 Returns true if this node represents the definition of some template.
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
LMatrix4d mat4 () const
 Returns the object's representation as an LMatrix4d.
virtual bool matches (const XFileNode *other) const
 Returns true if the node, particularly a template node, is structurally equivalent to the other node (which must be of the same type).
void operator delete (void *ptr, void *)
void operator delete (void *ptr, void *)
void operator delete (void *ptr)
void operator delete (void *ptr)
void operator delete[] (void *ptr)
void operator delete[] (void *ptr)
void operator delete[] (void *, void *)
void operator delete[] (void *, void *)
void * operator new (size_t size, void *ptr)
void * operator new (size_t size)
void * operator new (size_t size)
void * operator new (size_t size, void *ptr)
void * operator new[] (size_t size, void *ptr)
void * operator new[] (size_t size)
void * operator new[] (size_t size, void *ptr)
void * operator new[] (size_t size)
const XFileDataObjectoperator[] (int n) const
 Returns the nth nested object within this object.
XFileDataObjectoperator[] (const string &name)
 Returns the named nested object within this object.
XFileDataObjectoperator[] (int n)
 Returns the nth nested object within this object.
const XFileDataObjectoperator[] (const string &name) const
 Returns the named nested object within this object.
void output (ostream &out) const
 Outputs the Namable.
virtual void output_data (ostream &out) const
 Writes a suitable representation of this node to an .x file in text mode.
void ref () const
 Explicitly increments the reference count.
virtual bool repack_data (XFileDataObject *object, const XFileParseDataList &parse_data_list, PrevData &prev_data, size_t &index, size_t &sub_index) const
 This is called on the template that defines an object, once the data for the object has been parsed.
string s () const
 Unambiguously returns the object's representation as a string, or empty string if the object has no string representation.
void set (const LMatrix4d &mat)
 Stores the indicated Matrix value into the object, if it makes sense to do so.
void set (const LVecBase3d &vec)
 Stores the indicated Vec3 value into the object, if it makes sense to do so.
void set (const string &string_value)
 Stores the indicated string value into the object, if it makes sense to do so.
void set (double double_value)
 Stores the indicated floating-point value into the object, if it makes sense to do so.
void set (const LVecBase2d &vec)
 Stores the indicated Vec2 value into the object, if it makes sense to do so.
void set (const LVecBase4d &vec)
 Stores the indicated Vec4 value into the object, if it makes sense to do so.
void set (int int_value)
 Stores the indicated integer value into the object, if it makes sense to do so.
void set_name (const string &name)
int size () const
 Returns the number of nested data objects within this object.
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool unref () const
 Explicitly decrements the reference count.
LVecBase2d vec2 () const
 Returns the object's representation as an LVecBase2d.
LVecBase3d vec3 () const
 Returns the object's representation as an LVecBase3d.
LVecBase4d vec4 () const
 Returns the object's representation as an LVecBase4d.
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object.
void weak_unref (WeakPointerToVoid *ptv)
 Removes the indicated PointerToVoid as a weak reference to this object.
virtual void write_data (ostream &out, int indent_level, const char *separator) const
 Writes a suitable representation of this node to an .x file in text mode.
virtual void write_text (ostream &out, int indent_level) const
 Writes a suitable representation of this node to an .x file in text mode.
void zero_fill ()
 Fills the data node with zero-valued elements appropriate to the template.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
static string make_nice_name (const string &str)
 Transforms the indicated egg name to a name that is acceptable for a node in the X File format.

Protected Types

typedef pvector< PT(XFileNode) > Children
typedef pmap< string, int > ChildrenByName
typedef pvector< XFileDataNode * > Objects

Protected Member Functions

bool do_test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.
bool do_test_ref_count_nonzero () const
 Returns true if the reference count is nonzero, false otherwise.
void get_double_array (int num_elements, double *values) const
 Fills the indicated array of doubles with the values from the nested elements within this object.
virtual double get_double_value () const
 Returns the object's representation as a double, if it has one.
virtual XFileDataObjectget_element (int n)
 Returns the nth nested data element within the object.
virtual XFileDataObjectget_element (const string &name)
 Returns the nested data element within the object that has the indicated name.
virtual int get_int_value () const
 Returns the object's representation as an integer, if it has one.
virtual int get_num_elements () const
 Returns the number of nested data elements within the object.
virtual string get_string_value () const
 Returns the object's representation as a string, if it has one.
 PT (XFileTemplate) _template
virtual void set_double_value (double double_value)
 Sets the object's value as a floating-point number, if this is legal.
virtual void set_int_value (int int_value)
 Sets the object's value as an integer, if this is legal.
virtual void set_string_value (const string &string_value)
 Sets the object's value as a string, if this is legal.
void store_double_array (int num_elements, const double *values)
 Stores the indicated array of doubles in the nested elements within this object.

Protected Attributes

Children _children
ChildrenByName _children_by_name
const XFileDataDef_data_def
Objects _objects
XFile_x_file

Detailed Description

This is a node which contains all of the data elements defined by a template.

See XFileTemplate for the definition of the template; this class only contains the data members for a particular instance of a template.

Definition at line 34 of file xFileDataNodeTemplate.h.


Member Function Documentation

void XFileNode::add_child ( XFileNode node) [inherited]
XFileDataObject & XFileDataObject::add_Coords2d ( XFile x_file,
const LVecBase2d coords 
) [inherited]

Appends a new Coords2d instance.

Definition at line 169 of file xFileDataObject.cxx.

References XFileDataObject::add_element(), XFile::find_standard_template(), XFileDataObject::set(), and zero_fill().

Referenced by XFileMesh::make_x_uvs().

XFileDataObject & XFileDataObject::add_double ( double  double_value) [inherited]

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 84 of file xFileDataObject.cxx.

References XFileDataObject::add_element(), and XFileDataObject::get_data_def().

bool XFileDataNodeTemplate::add_element ( XFileDataObject element) [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 from XFileDataObject.

Definition at line 145 of file xFileDataNodeTemplate.cxx.

XFileDataNode * XFileNode::add_Frame ( const string &  name) [inherited]

Creates a new Frame instance, as a child of this node.

Definition at line 499 of file xFileNode.cxx.

References XFileNode::add_child(), XFile::find_standard_template(), and zero_fill().

XFileDataNode * XFileNode::add_FrameTransformMatrix ( const LMatrix4d mat) [inherited]

Creates a new FrameTransformMatrix instance, as a child of this node.

Definition at line 517 of file xFileNode.cxx.

References XFileNode::add_child(), XFile::find_standard_template(), and zero_fill().

XFileDataObject & XFileDataObject::add_IndexedColor ( XFile x_file,
int  index,
const Colorf color 
) [inherited]

Appends a new IndexedColor instance.

Definition at line 149 of file xFileDataObject.cxx.

References XFileDataObject::add_element(), XFile::find_standard_template(), and zero_fill().

Referenced by XFileMesh::make_x_colors().

XFileDataObject & XFileDataObject::add_int ( int  int_value) [inherited]

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 68 of file xFileDataObject.cxx.

References XFileDataObject::add_element(), and XFileDataObject::get_data_def().

Referenced by XFileMesh::make_x_material_list(), XFileMesh::make_x_mesh(), and XFileMesh::make_x_normals().

XFileDataNode * XFileNode::add_Material ( const string &  name,
const Colorf face_color,
double  power,
const RGBColorf specular_color,
const RGBColorf emissive_color 
) [inherited]

Creates a new Material instance, as a child of this node.

Definition at line 447 of file xFileNode.cxx.

References XFileNode::add_child(), XFile::find_standard_template(), and zero_fill().

Referenced by XFileMaterial::make_x_material().

XFileDataNode * XFileNode::add_Mesh ( const string &  name) [inherited]

Creates a new Mesh instance, as a child of this node.

Definition at line 357 of file xFileNode.cxx.

References XFileNode::add_child(), XFile::find_standard_template(), and zero_fill().

Referenced by XFileMesh::make_x_mesh().

XFileDataObject & XFileDataObject::add_MeshFace ( XFile x_file) [inherited]

Appends a new MeshFace instance.

Definition at line 132 of file xFileDataObject.cxx.

References XFileDataObject::add_element(), XFile::find_standard_template(), and zero_fill().

Referenced by XFileMesh::make_x_mesh(), and XFileMesh::make_x_normals().

XFileDataNode * XFileNode::add_MeshMaterialList ( const string &  name) [inherited]

Creates a new MeshMaterialList instance, as a child of this node.

Definition at line 429 of file xFileNode.cxx.

References XFileNode::add_child(), XFile::find_standard_template(), and zero_fill().

Referenced by XFileMesh::make_x_material_list().

XFileDataNode * XFileNode::add_MeshNormals ( const string &  name) [inherited]

Creates a new MeshNormals instance, as a child of this node.

Definition at line 375 of file xFileNode.cxx.

References XFileNode::add_child(), XFile::find_standard_template(), and zero_fill().

Referenced by XFileMesh::make_x_normals().

XFileDataNode * XFileNode::add_MeshTextureCoords ( const string &  name) [inherited]

Creates a new MeshTextureCoords instance, as a child of this node.

Definition at line 411 of file xFileNode.cxx.

References XFileNode::add_child(), XFile::find_standard_template(), and zero_fill().

Referenced by XFileMesh::make_x_uvs().

XFileDataNode * XFileNode::add_MeshVertexColors ( const string &  name) [inherited]

Creates a new MeshVertexColors instance, as a child of this node.

Definition at line 393 of file xFileNode.cxx.

References XFileNode::add_child(), XFile::find_standard_template(), and zero_fill().

Referenced by XFileMesh::make_x_colors().

void XFileDataNodeTemplate::add_parse_double ( PTA_double  double_list)

Adds the indicated list of doubles as a data element encountered in the parser.

It will later be processed by finalize_parse_data().

Definition at line 66 of file xFileDataNodeTemplate.cxx.

void XFileDataNodeTemplate::add_parse_int ( PTA_int  int_list)

Adds the indicated list of ints as a data element encountered in the parser.

It will later be processed by finalize_parse_data().

Definition at line 82 of file xFileDataNodeTemplate.cxx.

void XFileDataNodeTemplate::add_parse_string ( const string &  str)

Adds the indicated string as a data element encountered in the parser.

It will later be processed by finalize_parse_data().

Definition at line 98 of file xFileDataNodeTemplate.cxx.

XFileDataObject & XFileDataObject::add_string ( const string &  string_value) [inherited]

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 100 of file xFileDataObject.cxx.

References XFileDataObject::add_element(), and XFileDataObject::get_data_def().

XFileDataNode * XFileNode::add_TextureFilename ( const string &  name,
const Filename filename 
) [inherited]

Creates a new TextureFilename instance, as a child of this node.

Definition at line 479 of file xFileNode.cxx.

References XFileNode::add_child(), XFile::find_standard_template(), and zero_fill().

Referenced by XFileMaterial::make_x_material().

XFileDataObject & XFileDataObject::add_Vector ( XFile x_file,
const LVecBase3d vector 
) [inherited]
const TypedObject * TypedObject::as_typed_object ( ) const [inline, inherited]

Returns the object, upcast (if necessary) to a TypedObject pointer.

Definition at line 110 of file typedObject.I.

TypedObject * TypedObject::as_typed_object ( ) [inline, inherited]

Returns the object, upcast (if necessary) to a TypedObject pointer.

Definition at line 99 of file typedObject.I.

void XFileNode::clear ( void  ) [virtual, inherited]

Removes all children from the node, and otherwise resets it to its initial state.

Reimplemented in XFile, XFileDataDef, and XFileTemplate.

Definition at line 250 of file xFileNode.cxx.

void Namable::clear_name ( ) [inline, inherited]

Resets the Namable's name to empty.

Reimplemented in AsyncTask.

Definition at line 64 of file namable.I.

double XFileDataObject::d ( ) const [inline, inherited]

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 240 of file xFileDataObject.I.

References XFileDataObject::get_double_value().

Referenced by XFileMesh::fill_skin_weights().

bool ReferenceCount::do_test_ref_count_integrity ( ) const [protected, inherited]

Does some easy checks to make sure that the reference count isn't completely bogus.

Returns true if ok, false otherwise.

Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.

Definition at line 29 of file referenceCount.cxx.

Referenced by ReferenceCount::do_test_ref_count_nonzero(), and ReferenceCount::test_ref_count_integrity().

bool ReferenceCount::do_test_ref_count_nonzero ( ) const [protected, inherited]

Returns true if the reference count is nonzero, false otherwise.

Definition at line 56 of file referenceCount.cxx.

References ReferenceCount::do_test_ref_count_integrity().

Referenced by ReferenceCount::test_ref_count_nonzero().

bool XFileNode::fill_zero_data ( XFileDataObject object) const [virtual, inherited]

This is similar to repack_data(), except it is used to fill the initial values for a newly-created template object to zero.

Reimplemented in XFileDataDef.

Definition at line 312 of file xFileNode.cxx.

bool XFileDataNodeTemplate::finalize_parse_data ( )

Processes all of the data elements added by add_parse_*(), checks them for syntactic and semantic correctness against the Template definition, and stores the appropriate child data elements.

Returns true on success, false if there is a mismatch.

Definition at line 116 of file xFileDataNodeTemplate.cxx.

XFileNode * XFileNode::find_child ( const string &  name) const [inherited]

Returns the child with the indicated name, if any, or NULL if none.

Definition at line 61 of file xFileNode.cxx.

References XFileNode::get_child().

Referenced by XFileNode::find_descendent(), and XFile::find_template().

int XFileNode::find_child_index ( const string &  name) const [inherited]

Returns the index number of the child with the indicated name, if any, or -1 if none.

Definition at line 78 of file xFileNode.cxx.

Referenced by XFileArrayDef::matches().

int XFileNode::find_child_index ( const XFileNode child) const [inherited]

Returns the index number of the indicated child, or -1 if none.

Definition at line 95 of file xFileNode.cxx.

XFileNode * XFileNode::find_descendent ( const string &  name) const [inherited]

Returns the first child or descendent found with the indicated name after a depth-first search, if any, or NULL if none.

Definition at line 113 of file xFileNode.cxx.

References XFileNode::find_child(), and XFileNode::find_descendent().

Referenced by XFile::find_data_object(), and XFileNode::find_descendent().

XFileNode * XFileNode::get_child ( int  n) const [inline, inherited]

Returns the nth child of this node.

This list includes templates as well as data objects.

Definition at line 44 of file xFileNode.I.

Referenced by XFileNode::find_child(), XFileDataNode::get_data_child(), and XFileNode::matches().

const XFileDataNode & XFileDataNode::get_data_child ( int  n) const [inline, inherited]

Since the children of an XFileDataNode are syntactically constrained to themselves be XFileDataNodes, this is a convenience function that returns the same thing as XFileNode::get_child(), but it is cast to a type XFileDataNode and dereferenced.

Definition at line 26 of file xFileDataNode.I.

References XFileNode::get_child().

const XFileDataDef * XFileDataObject::get_data_def ( ) const [inline, inherited]

Returns the data object that this object is represented by, if any, or NULL if there is none.

Definition at line 34 of file xFileDataObject.I.

Referenced by XFileDataObject::add_double(), XFileDataObject::add_int(), and XFileDataObject::add_string().

void XFileDataObject::get_double_array ( int  num_elements,
double *  values 
) const [protected, inherited]

Fills the indicated array of doubles with the values from the nested elements within this object.

There must be exactly the indicated number of nested values, and they must all return a double.

Definition at line 319 of file xFileDataObject.cxx.

References XFileDataObject::get_num_elements(), XFileDataObject::get_type_name(), and XFileDataObject::i().

Referenced by XFileDataObject::mat4(), XFileDataObject::vec2(), XFileDataObject::vec3(), and XFileDataObject::vec4().

double XFileDataObject::get_double_value ( ) const [protected, virtual, inherited]

Returns the object's representation as a double, if it has one.

Reimplemented in XFileDataObjectDouble, and XFileDataObjectInteger.

Definition at line 295 of file xFileDataObject.cxx.

Referenced by XFileDataObject::d().

XFileDataObject * XFileDataNodeTemplate::get_element ( int  n) [protected, virtual]

Returns the nth nested data element within the object.

Reimplemented from XFileDataObject.

Definition at line 244 of file xFileDataNodeTemplate.cxx.

Referenced by get_element().

XFileDataObject * XFileDataNodeTemplate::get_element ( const string &  name) [protected, virtual]

Returns the nested data element within the object that has the indicated name.

Reimplemented from XFileDataObject.

Definition at line 256 of file xFileDataNodeTemplate.cxx.

References get_element().

const WindowsGuid & XFileNode::get_guid ( ) const [virtual, inherited]

If has_guid() returned true, returns the particular GUID associated with this node.

Reimplemented in XFileTemplate.

Definition at line 147 of file xFileNode.cxx.

Referenced by XFileNode::add_child().

int XFileDataObject::get_int_value ( ) const [protected, virtual, inherited]

Returns the object's representation as an integer, if it has one.

Reimplemented in XFileDataObjectDouble, and XFileDataObjectInteger.

Definition at line 284 of file xFileDataObject.cxx.

Referenced by XFileDataObject::i().

int XFileNode::get_num_children ( ) const [inline, inherited]

Returns the list of children of this node.

This list includes templates as well as data objects.

Definition at line 33 of file xFileNode.I.

Referenced by XFileNode::matches().

int XFileDataNodeTemplate::get_num_elements ( ) const [protected, virtual]

Returns the number of nested data elements within the object.

This may be, e.g. the size of the array, if it is an array.

Reimplemented from XFileDataObject.

Definition at line 233 of file xFileDataNodeTemplate.cxx.

int XFileNode::get_num_objects ( ) const [inline, inherited]

Returns the list of child objects of this node.

This list does not include template definitions; it is strictly the list of children that are also data objects (instances of templates).

Definition at line 58 of file xFileNode.I.

Referenced by XFileMaterial::fill_material(), XFileMesh::fill_material_list(), and XFileMesh::fill_mesh().

XFileDataNode * XFileNode::get_object ( int  n) const [inline, inherited]

Returns the nth child object of this node.

This list does not include template definitions; it is strictly the list of children that are also data objects (instances of templates).

Definition at line 71 of file xFileNode.I.

Referenced by XFileMaterial::fill_material(), XFileMesh::fill_material_list(), and XFileMesh::fill_mesh().

int ReferenceCount::get_ref_count ( ) const [inline, inherited]
string XFileDataObject::get_string_value ( ) const [protected, virtual, inherited]

Returns the object's representation as a string, if it has one.

Reimplemented in XFileDataObjectDouble, XFileDataObjectInteger, and XFileDataObjectString.

Definition at line 306 of file xFileDataObject.cxx.

Referenced by XFileDataObject::s().

XFileTemplate * XFileDataNode::get_template ( ) const [inline, inherited]

Returns the template used to define this data object.

Since the only classes to inherit from XFileDataNode are XFileDataNodeTemplate and XFileDataNodeReference, both of which represent a class that is defined by a template, it makes sense to put this common method here in the base class.

Reimplemented in XFileDataNodeReference.

Definition at line 42 of file xFileDataNode.I.

const string & XFileDataNode::get_template_name ( ) const [inline, inherited]

A convenience function to return the name of the template used to define this data object.

Definition at line 53 of file xFileDataNode.I.

Referenced by XFileMaterial::fill_material(), XFileMesh::fill_material_list(), and XFileMesh::fill_mesh_child().

int TypedObject::get_type_index ( ) const [inline, inherited]

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

Definition at line 52 of file typedObject.I.

References TypeHandle::get_index().

string XFileDataNode::get_type_name ( ) const [virtual, inherited]

Returns a string that represents the type of object this data object represents.

Reimplemented from XFileDataObject.

Definition at line 76 of file xFileDataNode.cxx.

WeakReferenceList * ReferenceCount::get_weak_list ( ) const [inline, inherited]

Returns the WeakReferenceList associated with this ReferenceCount object.

If there has never been a WeakReferenceList associated with this object, creates one now.

Definition at line 307 of file referenceCount.I.

Referenced by ReferenceCount::weak_ref().

bool XFileNode::has_guid ( ) const [virtual, inherited]

Returns true if this node has a GUID associated.

Reimplemented in XFileTemplate.

Definition at line 136 of file xFileNode.cxx.

Referenced by XFileNode::add_child().

bool Namable::has_name ( ) const [inline, inherited]
bool ReferenceCount::has_weak_list ( ) const [inline, inherited]

Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.

In general, this will be true if there was ever a WeakPointerTo created for this object (even if there is not any for it now).

Definition at line 294 of file referenceCount.I.

Referenced by ReferenceCount::weak_unref().

int XFileDataObject::i ( ) const [inline, inherited]

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 227 of file xFileDataObject.I.

References XFileDataObject::get_int_value().

Referenced by XFileMesh::fill_colors(), XFileMesh::fill_material_list(), XFileMesh::fill_mesh(), XFileMesh::fill_normals(), XFileMesh::fill_skin_weights(), XFileDataObject::get_double_array(), XFileDataObject::store_double_array(), XFileDataObjectArray::write_data(), and write_data().

bool XFileDataNodeTemplate::is_complex_object ( ) const [virtual]

Returns true if this kind of data object is a complex object that can hold nested data elements, false otherwise.

Reimplemented from XFileDataObject.

Definition at line 54 of file xFileDataNodeTemplate.cxx.

bool TypedObject::is_exact_type ( TypeHandle  handle) const [inline, inherited]
bool XFileDataNode::is_object ( ) const [virtual, inherited]

Returns true if this node represents a data object that is the instance of some template, or false otherwise.

This also returns true for references to objects (which are generally treated just like the objects themselves).

If this returns true, the node must be of type XFileDataNode (it is either an XFileDataNodeTemplate or an XFileDataNodeReference).

Reimplemented from XFileNode.

Definition at line 47 of file xFileDataNode.cxx.

bool TypedObject::is_of_type ( TypeHandle  handle) const [inline, inherited]

Returns true if the current object is or derives from the indicated type.

Definition at line 63 of file typedObject.I.

References TypeHandle::is_derived_from().

Referenced by EggSliderData::add_back_pointer(), EggJointData::add_back_pointer(), CIntervalManager::add_c_interval(), XFileNode::add_child(), CollisionTraverser::add_collider(), CollisionHandlerPhysical::add_collider(), EggXfmSAnim::add_data(), CharacterJointBundle::add_node(), NonlinearImager::add_screen(), EggGroupNode::apply_first_attribute(), EggGroupNode::apply_last_attribute(), DeferredNodeProperty::apply_to_node(), RecorderController::begin_playback(), NodePath::clear_clip_plane(), EggGroupNode::clear_connected_shading(), NodePath::clear_light(), EggBase::convert_paths(), NodePath::decode_from_bam_stream(), VrpnClient::disconnect_device(), PhysicsManager::do_physics(), GraphicsStateGuardian::fetch_specified_part(), EggRenderState::fill_state(), AnimBundleNode::find_anim_bundle(), EggGroupNode::find_coordsys_entry(), XFile::find_data_object(), Character::find_joint(), EggGroupNode::find_materials(), Character::find_slider(), XFile::find_template(), EggGroupNode::find_textures(), EggMaterialCollection::find_used_materials(), EggTextureCollection::find_used_textures(), EggGroupNode::force_filenames(), EggJointData::force_initial_rest_frame(), WindowFramework::get_aspect_2d(), EggPoolUniquifier::get_category(), EggGroupUniquifier::get_category(), EggGroupNode::get_connected_shading(), PandaFramework::get_mouse(), FactoryParams::get_param_of_type(), EggGroupNode::has_absolute_pathnames(), NodePath::has_clip_plane(), NodePath::has_clip_plane_off(), NodePath::has_light(), PandaFramework::hide_collision_solids(), x11GraphicsWindow::open_window(), eglGraphicsWindow::open_window(), EggNode::parse_egg(), CharacterMaker::part_to_node(), EggGroupNode::post_apply_flat_attribute(), EggBinner::prepare_node(), PortalClipper::prepare_portal(), NodePath::project_texture(), EggMatrixTablePointer::quantize_channels(), ParametricCurveCollection::r_add_curves(), SceneGraphReducer::r_collect_vertex_data(), EggGroupNode::r_load_externals(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::remove_invalid_primitives(), EggGroupNode::remove_unused_vertices(), EggLoader::reparent_decals(), EggMaterialCollection::replace_materials(), EggTextureCollection::replace_textures(), EggGroupNode::resolve_filenames(), EggGroupNode::reverse_vertex_ordering(), NodePath::set_clip_plane(), NodePath::set_clip_plane_off(), NodePath::set_light(), ProjectionScreen::set_projector(), NonlinearImager::set_source_camera(), EggXfmSAnim::set_value(), NonlinearImager::set_viewer_camera(), PandaFramework::show_collision_solids(), BamCache::store(), XFileToEggConverter::strip_nodes(), EggGroupNode::strip_normals(), DataGraphTraverser::traverse(), DataGraphTraverser::traverse_below(), EggGroupNode::triangulate_polygons(), EggGroupNode::unify_attributes(), EggNameUniquifier::uniquify(), NodeCullCallbackData::upcall(), PhysicsCollisionHandler::validate_target(), EggXfmSAnim::write(), EggGroup::write(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_entities().

bool XFileNode::is_reference ( ) const [virtual, inherited]

Returns true if this node represents an indirect reference to an object defined previously in the file.

References are generally transparent, so in most cases you never need to call this, unless you actually need to differentiate between references and instances; you can simply use the reference node as if it were itself the object it references.

If this returns true, the node must be of type XFileDataNodeReference.

Reimplemented in XFileDataNodeReference.

Definition at line 185 of file xFileNode.cxx.

bool XFileDataNode::is_standard_object ( const string &  template_name) const [virtual, inherited]

Returns true if this node represents an instance of the standard template with the indicated name, or false otherwise.

If this returns true, the object must be of type XFileDataNode.

Reimplemented from XFileNode.

Definition at line 60 of file xFileDataNode.cxx.

Referenced by XFileMaterial::fill_material(), XFileMesh::fill_material_list(), and XFileMesh::fill_mesh_child().

bool XFileNode::is_template_def ( ) const [virtual, inherited]

Returns true if this node represents the definition of some template.

This is the template definition, not an actual data object that represents an instance of the template. If the file strictly uses standard templates, the presence of template definitions is optional.

If this returns true, the node must be of type XFileTemplate.

Reimplemented in XFileTemplate.

Definition at line 166 of file xFileNode.cxx.

void ReferenceCount::local_object ( ) [inline, inherited]

This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.

This allows the object to be passed to functions that will increment and decrement the object's reference count temporarily, and it will prevent the object from being deleted (inappropriately), when the reference count returns to zero. It actually achieves this by setting a large positive value in the reference count field.

Definition at line 276 of file referenceCount.I.

Referenced by PGTop::cull_callback(), BoundingSphere::extend_by_hexahedron(), AsyncTaskManager::find_task(), AsyncTaskManager::find_tasks(), and AsyncTaskManager::find_tasks_matching().

string XFileNode::make_nice_name ( const string &  str) [static, inherited]

Transforms the indicated egg name to a name that is acceptable for a node in the X File format.

Definition at line 557 of file xFileNode.cxx.

LMatrix4d XFileDataObject::mat4 ( ) const [inline, inherited]

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 307 of file xFileDataObject.I.

References XFileDataObject::get_double_array().

bool XFileNode::matches ( const XFileNode other) const [virtual, inherited]

Returns true if the node, particularly a template node, is structurally equivalent to the other node (which must be of the same type).

This checks data element types, but does not compare data element names.

Reimplemented in XFileDataDef, and XFileTemplate.

Definition at line 333 of file xFileNode.cxx.

References XFileNode::get_child(), XFileNode::get_num_children(), and XFileNode::matches().

Referenced by XFileTemplate::matches(), XFileNode::matches(), and XFileDataDef::matches().

XFileDataObject & XFileDataObject::operator[] ( const string &  name) [inline, inherited]

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 374 of file xFileDataObject.I.

References XFileDataObject::get_element().

XFileDataObject & XFileDataObject::operator[] ( int  n) [inline, inherited]

Returns the nth nested object within this object.

Call get_num_children() to determine the number of nested objects.

Definition at line 360 of file xFileDataObject.I.

References XFileDataObject::get_element().

const XFileDataObject & XFileDataObject::operator[] ( const string &  name) const [inline, inherited]

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 346 of file xFileDataObject.I.

References XFileDataObject::get_element().

const XFileDataObject & XFileDataObject::operator[] ( int  n) const [inline, inherited]

Returns the nth nested object within this object.

Call get_num_children() to determine the number of nested objects.

Definition at line 332 of file xFileDataObject.I.

References XFileDataObject::get_element().

void Namable::output ( ostream &  out) const [inline, inherited]
void XFileDataObject::output_data ( ostream &  out) const [virtual, inherited]

Writes a suitable representation of this node to an .x file in text mode.

Reimplemented in XFileDataObjectDouble, XFileDataObjectInteger, and XFileDataObjectString.

Definition at line 202 of file xFileDataObject.cxx.

void ReferenceCount::ref ( ) const [inline, inherited]

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

Definition at line 179 of file referenceCount.I.

References ReferenceCount::test_ref_count_integrity().

Referenced by CachedTypedWritableReferenceCount::cache_ref(), TypedWritable::decode_raw_from_bam_stream(), NodeCachedReferenceCount::node_ref(), NodeReferenceCount::node_ref(), BamCacheRecord::set_data(), CullableObject::set_draw_callback(), and ModelRoot::set_reference().

bool XFileNode::repack_data ( XFileDataObject object,
const XFileParseDataList parse_data_list,
XFileNode::PrevData &  prev_data,
size_t &  index,
size_t &  sub_index 
) const [virtual, inherited]

This is called on the template that defines an object, once the data for the object has been parsed.

It is responsible for identifying which component of the template owns each data element, and packing the data elements appropriately back into the object.

It returns true on success, or false on an error (e.g. not enough data elements, mismatched data type).

Reimplemented in XFileDataDef.

Definition at line 284 of file xFileNode.cxx.

string XFileDataObject::s ( ) const [inline, inherited]

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 253 of file xFileDataObject.I.

References XFileDataObject::get_string_value().

void XFileDataObject::set ( const string &  string_value) [inline, inherited]

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 162 of file xFileDataObject.I.

References XFileDataObject::set_string_value().

void XFileDataObject::set ( double  double_value) [inline, inherited]

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 149 of file xFileDataObject.I.

References XFileDataObject::set_double_value().

void XFileDataObject::set ( const LMatrix4d mat) [inline, inherited]

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 214 of file xFileDataObject.I.

References LMatrix4d::get_data(), and XFileDataObject::store_double_array().

void XFileDataObject::set ( const LVecBase4d vec) [inline, inherited]

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 201 of file xFileDataObject.I.

References LVecBase4d::get_data(), and XFileDataObject::store_double_array().

void XFileDataObject::set ( int  int_value) [inline, inherited]

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 136 of file xFileDataObject.I.

References XFileDataObject::set_int_value().

Referenced by XFileDataObject::add_Coords2d(), and XFileDataObject::add_Vector().

void XFileDataObject::set ( const LVecBase3d vec) [inline, inherited]

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 188 of file xFileDataObject.I.

References LVecBase3d::get_data(), and XFileDataObject::store_double_array().

void XFileDataObject::set ( const LVecBase2d vec) [inline, inherited]

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 175 of file xFileDataObject.I.

References LVecBase2d::get_data(), and XFileDataObject::store_double_array().

void XFileDataObject::set_double_value ( double  double_value) [protected, virtual, inherited]

Sets the object's value as a floating-point number, if this is legal.

Reimplemented in XFileDataObjectDouble.

Definition at line 237 of file xFileDataObject.cxx.

References XFileDataObject::get_type_name().

Referenced by XFileDataObject::set(), and XFileDataObject::store_double_array().

void XFileDataObject::set_int_value ( int  int_value) [protected, virtual, inherited]

Sets the object's value as an integer, if this is legal.

Reimplemented in XFileDataObjectDouble, and XFileDataObjectInteger.

Definition at line 225 of file xFileDataObject.cxx.

References XFileDataObject::get_type_name().

Referenced by XFileDataObject::set().

void XFileDataObject::set_string_value ( const string &  string_value) [protected, virtual, inherited]

Sets the object's value as a string, if this is legal.

Reimplemented in XFileDataObjectString.

Definition at line 249 of file xFileDataObject.cxx.

References XFileDataObject::get_type_name().

Referenced by XFileDataObject::set().

int XFileDataObject::size ( ) const [inline, inherited]
void XFileDataObject::store_double_array ( int  num_elements,
const double *  values 
) [protected, inherited]

Stores the indicated array of doubles in the nested elements within this object.

There must be exactly the indicated number of nested values, and they must all accept a double.

Definition at line 263 of file xFileDataObject.cxx.

References XFileDataObject::get_element(), XFileDataObject::get_num_elements(), XFileDataObject::get_type_name(), XFileDataObject::i(), and XFileDataObject::set_double_value().

Referenced by XFileDataObject::set().

bool ReferenceCount::test_ref_count_integrity ( ) const [inline, inherited]
bool ReferenceCount::test_ref_count_nonzero ( ) const [inline, inherited]

Does some easy checks to make sure that the reference count isn't zero, or completely bogus.

Returns true if ok, false otherwise.

Definition at line 252 of file referenceCount.I.

References ReferenceCount::do_test_ref_count_nonzero().

Referenced by CopyOnWritePointer::test_ref_count_nonzero().

bool ReferenceCount::unref ( ) const [inline, virtual, inherited]

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is true if the new reference count is nonzero, false if it is zero.

Reimplemented in GeomVertexArrayFormat, GeomVertexFormat, InternalName, RenderAttrib, RenderEffects, RenderState, and TransformState.

Definition at line 214 of file referenceCount.I.

References ReferenceCount::test_ref_count_integrity().

Referenced by CachedTypedWritableReferenceCount::cache_unref(), TypedWritable::decode_raw_from_bam_stream(), RenderEffect::finalize(), NodeCachedReferenceCount::node_unref(), NodeReferenceCount::node_unref(), TransformState::unref(), RenderState::unref(), RenderEffects::unref(), RenderAttrib::unref(), InternalName::unref(), GeomVertexFormat::unref(), and GeomVertexArrayFormat::unref().

LVecBase2d XFileDataObject::vec2 ( ) const [inline, inherited]

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 265 of file xFileDataObject.I.

References XFileDataObject::get_double_array().

Referenced by XFileMesh::fill_uvs().

LVecBase3d XFileDataObject::vec3 ( ) const [inline, inherited]

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 279 of file xFileDataObject.I.

References XFileDataObject::get_double_array().

Referenced by XFileMesh::fill_mesh(), and XFileMesh::fill_normals().

LVecBase4d XFileDataObject::vec4 ( ) const [inline, inherited]

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 293 of file xFileDataObject.I.

References XFileDataObject::get_double_array().

void ReferenceCount::weak_ref ( WeakPointerToVoid ptv) [inline, inherited]

Adds the indicated PointerToVoid as a weak reference to this object.

Definition at line 321 of file referenceCount.I.

References WeakReferenceList::add_reference(), and ReferenceCount::get_weak_list().

void ReferenceCount::weak_unref ( WeakPointerToVoid ptv) [inline, inherited]

Removes the indicated PointerToVoid as a weak reference to this object.

It must have previously been added via a call to weak_ref().

Definition at line 334 of file referenceCount.I.

References WeakReferenceList::clear_reference(), and ReferenceCount::has_weak_list().

void XFileDataNodeTemplate::write_data ( ostream &  out,
int  indent_level,
const char *  separator 
) const [virtual]

Writes a suitable representation of this node to an .x file in text mode.

Reimplemented from XFileDataObject.

Definition at line 182 of file xFileDataNodeTemplate.cxx.

References XFileDataObject::i(), and XFileDataObject::is_complex_object().

void XFileDataNodeTemplate::write_text ( ostream &  out,
int  indent_level 
) const [virtual]

Writes a suitable representation of this node to an .x file in text mode.

Reimplemented from XFileNode.

Definition at line 157 of file xFileDataNodeTemplate.cxx.

References Namable::has_name().

void XFileDataNodeTemplate::zero_fill ( )

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations