Panda3D
 All Classes Functions Variables Enumerations
xFileArrayDef.I
1 // Filename: xFileArrayDef.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: XFileArrayDef::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE XFileArrayDef::
22 XFileArrayDef(int fixed_size) :
23  _fixed_size(fixed_size),
24  _dynamic_size(NULL)
25 {
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: XFileArrayDef::Constructor
30 // Access: Public
31 // Description:
32 ////////////////////////////////////////////////////////////////////
33 INLINE XFileArrayDef::
34 XFileArrayDef(XFileDataDef *dynamic_size) :
35  _fixed_size(0),
36  _dynamic_size(dynamic_size)
37 {
38 }
39 
40 ////////////////////////////////////////////////////////////////////
41 // Function: XFileArrayDef::is_fixed_size
42 // Access: Public
43 // Description: Returns true if this array definition specifies a
44 // const-size array, false if it is a dynamic-size
45 // array.
46 ////////////////////////////////////////////////////////////////////
47 INLINE bool XFileArrayDef::
48 is_fixed_size() const {
49  return (_dynamic_size == (XFileDataDef *)NULL);
50 }
51 
52 ////////////////////////////////////////////////////////////////////
53 // Function: XFileArrayDef::get_fixed_size
54 // Access: Public
55 // Description: Returns the const size of the array, if
56 // is_fixed_size() returned true.
57 ////////////////////////////////////////////////////////////////////
58 INLINE int XFileArrayDef::
59 get_fixed_size() const {
60  nassertr(is_fixed_size(), 0);
61  return _fixed_size;
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: XFileArrayDef::get_dynamic_size
66 // Access: Public
67 // Description: Returns the data element that names the dynamic size
68 // of the array, if is_fixed_size() returned false.
69 ////////////////////////////////////////////////////////////////////
72  nassertr(!is_fixed_size(), NULL);
73  return _dynamic_size;
74 }
75 
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
A definition of a single data element appearing within a template record.
Definition: xFileDataDef.h:35
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
int get_fixed_size() const
Returns the const size of the array, if is_fixed_size() returned true.
Definition: xFileArrayDef.I:59