Panda3D
xFileArrayDef.h
1 // Filename: xFileArrayDef.h
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 #ifndef XFILEARRAYDEF_H
16 #define XFILEARRAYDEF_H
17 
18 #include "pandatoolbase.h"
19 #include "pnotify.h"
20 #include "xFileNode.h"
21 
22 class XFileDataDef;
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : XFileArrayDef
26 // Description : Defines one level of array bounds for an associated
27 // XFileDataDef element.
28 ////////////////////////////////////////////////////////////////////
30 public:
31  INLINE XFileArrayDef(int fixed_size);
32  INLINE XFileArrayDef(XFileDataDef *dynamic_size);
33 
34  INLINE bool is_fixed_size() const;
35  INLINE int get_fixed_size() const;
36  INLINE XFileDataDef *get_dynamic_size() const;
37 
38  int get_size(const XFileNode::PrevData &prev_data) const;
39 
40  void output(ostream &out) const;
41 
42  bool matches(const XFileArrayDef &other, const XFileDataDef *parent,
43  const XFileDataDef *other_parent) const;
44 
45 private:
46  int _fixed_size;
47  XFileDataDef *_dynamic_size;
48 };
49 
50 #include "xFileArrayDef.I"
51 
52 #endif
53 
54 
55 
This is our own Panda specialization on the default STL map.
Definition: pmap.h:52
XFileDataDef * get_dynamic_size() const
Returns the data element that names the dynamic size of the array, if is_fixed_size() returned false...
Definition: xFileArrayDef.I:71
Defines one level of array bounds for an associated XFileDataDef element.
Definition: xFileArrayDef.h:29
A definition of a single data element appearing within a template record.
Definition: xFileDataDef.h:35
int get_size(const XFileNode::PrevData &prev_data) const
Returns the size of the array dimension.
bool is_fixed_size() const
Returns true if this array definition specifies a const-size array, false if it is a dynamic-size arr...
Definition: xFileArrayDef.I:48
int get_fixed_size() const
Returns the const size of the array, if is_fixed_size() returned true.
Definition: xFileArrayDef.I:59
bool matches(const XFileArrayDef &other, const XFileDataDef *parent, const XFileDataDef *other_parent) const
Returns true if the node, particularly a template node, is structurally equivalent to the other node ...