Panda3D
 All Classes Functions Variables Enumerations
xFileDataDef.I
1 // Filename: xFileDataDef.I
2 // Created by: drose (03Oct04)
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 
16 ////////////////////////////////////////////////////////////////////
17 // Function: XFileDataDef::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE XFileDataDef::
22 XFileDataDef(XFile *x_file, const string &name,
23  XFileDataDef::Type type, XFileTemplate *xtemplate) :
24  XFileNode(x_file, name),
25  _type(type),
26  _template(xtemplate)
27 {
28 }
29 
30 ////////////////////////////////////////////////////////////////////
31 // Function: XFileDataDef::get_data_type
32 // Access: Public
33 // Description: Returns the primitive type of this element, or
34 // T_template if this represents a nested template
35 // object.
36 ////////////////////////////////////////////////////////////////////
37 INLINE XFileDataDef::Type XFileDataDef::
38 get_data_type() const {
39  return _type;
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: XFileDataDef::get_template
44 // Access: Public
45 // Description: If get_data_type() returned T_template, this returns
46 // the particular template pointer that this object
47 // represents.
48 ////////////////////////////////////////////////////////////////////
50 get_template() const {
51  return _template;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: XFileDataDef::get_num_array_defs
56 // Access: Public
57 // Description: Returns the number of dimensions of array elements on
58 // this data object, or 0 if the data object is not an
59 // array.
60 ////////////////////////////////////////////////////////////////////
61 INLINE int XFileDataDef::
63  return _array_def.size();
64 }
65 
66 ////////////////////////////////////////////////////////////////////
67 // Function: XFileDataDef::get_array_def
68 // Access: Public
69 // Description: Returns the description of the nth dimension of array
70 // elements on this data object.
71 ////////////////////////////////////////////////////////////////////
72 INLINE const XFileArrayDef &XFileDataDef::
73 get_array_def(int i) const {
74  nassertr(i >= 0 && i < (int)_array_def.size(), _array_def[0]);
75  return _array_def[i];
76 }
Defines one level of array bounds for an associated XFileDataDef element.
Definition: xFileArrayDef.h:29
A single node of an X file.
Definition: xFileNode.h:42
XFileTemplate * get_template() const
If get_data_type() returned T_template, this returns the particular template pointer that this object...
Definition: xFileDataDef.I:50
int get_num_array_defs() const
Returns the number of dimensions of array elements on this data object, or 0 if the data object is no...
Definition: xFileDataDef.I:62
const XFileArrayDef & get_array_def(int i) const
Returns the description of the nth dimension of array elements on this data object.
Definition: xFileDataDef.I:73
This represents the complete contents of an X file (file.x) in memory.
Definition: xFile.h:35
A template definition in the X file.
Definition: xFileTemplate.h:29
Type get_data_type() const
Returns the primitive type of this element, or T_template if this represents a nested template object...
Definition: xFileDataDef.I:38