Panda3D

xFileArrayDef.I
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 xFileArrayDef.I
10 * @author drose
11 * @date 2004-10-03
12 */
13
14 /**
15 *
16 */
17 INLINE XFileArrayDef::
18 XFileArrayDef(int fixed_size) :
19 _fixed_size(fixed_size),
20 _dynamic_size(nullptr)
21 {
22 }
23
24 /**
25 *
26 */
27 INLINE XFileArrayDef::
28 XFileArrayDef(XFileDataDef *dynamic_size) :
29 _fixed_size(0),
30 _dynamic_size(dynamic_size)
31 {
32 }
33
34 /**
35 * Returns true if this array definition specifies a const-size array, false
36 * if it is a dynamic-size array.
37 */
38 INLINE bool XFileArrayDef::
39 is_fixed_size() const {
40 return (_dynamic_size == nullptr);
41 }
42
43 /**
44 * Returns the const size of the array, if is_fixed_size() returned true.
45 */
46 INLINE int XFileArrayDef::
47 get_fixed_size() const {
48 nassertr(is_fixed_size(), 0);
49 return _fixed_size;
50 }
51
52 /**
53 * Returns the data element that names the dynamic size of the array, if
54 * is_fixed_size() returned false.
55 */
56 INLINE XFileDataDef *XFileArrayDef::
57 get_dynamic_size() const {
58 nassertr(!is_fixed_size(), nullptr);
59 return _dynamic_size;
60 }
XFileArrayDef::is_fixed_size
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:39
XFileArrayDef::get_fixed_size
int get_fixed_size() const
Returns the const size of the array, if is_fixed_size() returned true.
Definition: xFileArrayDef.I:47
XFileArrayDef::get_dynamic_size
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:57
XFileDataDef
A definition of a single data element appearing within a template record.
Definition: xFileDataDef.h:31