Panda3D
xFileDataObjectArray.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file xFileDataObjectArray.h
10  * @author drose
11  * @date 2004-10-07
12  */
13 
14 #ifndef XFILEDATAOBJECTARRAY_H
15 #define XFILEDATAOBJECTARRAY_H
16 
17 #include "pandatoolbase.h"
18 #include "xFileDataObject.h"
19 
20 /**
21  * An array of nested data elements.
22  */
24 public:
25  INLINE XFileDataObjectArray(const XFileDataDef *data_def);
26 
27  virtual bool is_complex_object() const;
28 
29  virtual bool add_element(XFileDataObject *element);
30 
31  virtual void write_data(std::ostream &out, int indent_level,
32  const char *separator) const;
33 
34 protected:
35  virtual int get_num_elements() const;
36  virtual XFileDataObject *get_element(int n);
37 
38 private:
39  typedef pvector< PT(XFileDataObject) > NestedElements;
40  NestedElements _nested_elements;
41 
42 public:
43  static TypeHandle get_class_type() {
44  return _type_handle;
45  }
46  static void init_type() {
47  XFileDataObject::init_type();
48  register_type(_type_handle, "XFileDataObjectArray",
49  XFileDataObject::get_class_type());
50  }
51  virtual TypeHandle get_type() const {
52  return get_class_type();
53  }
54  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
55 
56 private:
57  static TypeHandle _type_handle;
58 };
59 
60 #include "xFileDataObjectArray.I"
61 
62 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool add_element(XFileDataObject *element)
Adds the indicated element as a nested data element, if this data object type supports it.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
A definition of a single data element appearing within a template record.
Definition: xFileDataDef.h:31
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool is_complex_object() const
Returns true if this kind of data object is a complex object that can hold nested data elements,...
An array of nested data elements.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
The abstract base class for a number of different types of data elements that may be stored in the X ...