Panda3D
xFileDataNodeReference.h
1 // Filename: xFileDataNodeReference.h
2 // Created by: drose (08Oct04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef XFILEDATANODEREFERENCE_H
16 #define XFILEDATANODEREFERENCE_H
17 
18 #include "pandatoolbase.h"
19 #include "xFileDataNodeTemplate.h"
20 #include "pointerTo.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : XFileDataNodeReference
24 // Description : This is a nested reference to an instance of a
25 // template object, declared via the syntax:
26 //
27 // { InstanceName }
28 //
29 // in the X File.
30 ////////////////////////////////////////////////////////////////////
32 public:
34 
35  INLINE XFileTemplate *get_template() const;
36  INLINE XFileDataNodeTemplate *get_object() const;
37 
38  virtual bool is_reference() const;
39  virtual bool is_complex_object() const;
40 
41  virtual void write_text(ostream &out, int indent_level) const;
42 
43 protected:
44  virtual int get_num_elements() const;
45  virtual XFileDataObject *get_element(int n);
46  virtual XFileDataObject *get_element(const string &name);
47 
48 private:
49  PT(XFileDataNodeTemplate) _object;
50 
51 public:
52  static TypeHandle get_class_type() {
53  return _type_handle;
54  }
55  static void init_type() {
56  XFileDataNode::init_type();
57  register_type(_type_handle, "XFileDataNodeReference",
58  XFileDataNode::get_class_type());
59  }
60  virtual TypeHandle get_type() const {
61  return get_class_type();
62  }
63  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
64 
65 private:
66  static TypeHandle _type_handle;
67 };
68 
69 #include "xFileDataNodeReference.I"
70 
71 #endif
72 
73 
74 
75 
This is a nested reference to an instance of a template object, declared via the syntax: ...
This is a node which contains all of the data elements defined by a template.
virtual bool is_reference() const
Returns true if this node represents an indirect reference to an object defined previously in the fil...
XFileDataNodeTemplate * get_object() const
Returns the actual data object being referenced.
This is an abstract base class for an XFileNode which is also an XFileDataObject. ...
Definition: xFileDataNode.h:36
A template definition in the X file.
Definition: xFileTemplate.h:29
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual bool is_complex_object() const
Returns true if this kind of data object is a complex object that can hold nested data elements...
virtual void write_text(ostream &out, int indent_level) const
Writes a suitable representation of this node to an .x file in text mode.
The abstract base class for a number of different types of data elements that may be stored in the X ...