Panda3D
eggAnimData.I
1 // Filename: eggAnimData.I
2 // Created by: drose (19Feb99)
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 #include "pnotify.h"
16 
17 ////////////////////////////////////////////////////////////////////
18 // Function: EggAnimData::Constructor
19 // Access: Public
20 // Description:
21 ////////////////////////////////////////////////////////////////////
22 INLINE EggAnimData::
23 EggAnimData(const string &name) : EggNode(name) {
24  _has_fps = false;
25 }
26 
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: EggAnimData::Copy constructor
30 // Access: Public
31 // Description:
32 ////////////////////////////////////////////////////////////////////
33 INLINE EggAnimData::
34 EggAnimData(const EggAnimData &copy) :
35  EggNode(copy), _data(copy._data),
36  _fps(copy._fps), _has_fps(copy._has_fps) {
37 }
38 
39 
40 ////////////////////////////////////////////////////////////////////
41 // Function: EggAnimData::Copy assignment operator
42 // Access: Public
43 // Description:
44 ////////////////////////////////////////////////////////////////////
45 INLINE EggAnimData &EggAnimData::
46 operator = (const EggAnimData &copy) {
47  EggNode::operator = (copy);
48  _data = copy._data;
49  _fps = copy._fps;
50  _has_fps = copy._has_fps;
51 
52  return *this;
53 }
54 
55 
56 ////////////////////////////////////////////////////////////////////
57 // Function: EggAnimData::set_fps
58 // Access: Public
59 // Description:
60 ////////////////////////////////////////////////////////////////////
61 INLINE void EggAnimData::
62 set_fps(double fps) {
63  _fps = fps;
64  _has_fps = true;
65 }
66 
67 
68 ////////////////////////////////////////////////////////////////////
69 // Function: EggAnimData::clear_fps
70 // Access: Public
71 // Description:
72 ////////////////////////////////////////////////////////////////////
73 INLINE void EggAnimData::
74 clear_fps() {
75  _has_fps = false;
76 }
77 
78 ////////////////////////////////////////////////////////////////////
79 // Function: EggAnimData::has_fps
80 // Access: Public
81 // Description:
82 ////////////////////////////////////////////////////////////////////
83 INLINE bool EggAnimData::
84 has_fps() const {
85  return _has_fps;
86 }
87 
88 ////////////////////////////////////////////////////////////////////
89 // Function: EggAnimData::get_fps
90 // Access: Public
91 // Description: This is only valid if has_fps() returns true.
92 ////////////////////////////////////////////////////////////////////
93 INLINE double EggAnimData::
94 get_fps() const {
95  nassertr(has_fps(), 0.0);
96  return _fps;
97 }
98 
99 
100 ////////////////////////////////////////////////////////////////////
101 // Function: EggAnimData::clear_data
102 // Access: Public
103 // Description: Removes all data and empties the table.
104 ////////////////////////////////////////////////////////////////////
105 INLINE void EggAnimData::
107  _data.clear();
108 }
109 
110 ////////////////////////////////////////////////////////////////////
111 // Function: EggAnimData::add_data
112 // Access: Public
113 // Description: Adds a single element to the table.
114 ////////////////////////////////////////////////////////////////////
115 INLINE void EggAnimData::
116 add_data(double value) {
117  _data.push_back(value);
118 }
119 
120 
121 
122 ////////////////////////////////////////////////////////////////////
123 // Function: EggAnimData::get_size
124 // Access: Public
125 // Description: Returns the number of elements in the table.
126 ////////////////////////////////////////////////////////////////////
127 INLINE int EggAnimData::
128 get_size() const {
129  return _data.size();
130 }
131 
132 
133 ////////////////////////////////////////////////////////////////////
134 // Function: EggAnimData::get_data
135 // Access: Public
136 // Description: Returns the entire table of data.
137 ////////////////////////////////////////////////////////////////////
138 INLINE PTA_double EggAnimData::
139 get_data() const {
140  return _data;
141 }
142 
143 
144 ////////////////////////////////////////////////////////////////////
145 // Function: EggAnimData::set_data
146 // Access: Public
147 // Description: Replaces the entire table of data.
148 ////////////////////////////////////////////////////////////////////
149 INLINE void EggAnimData::
150 set_data(const PTA_double &data) {
151  _data = data;
152 }
153 
void add_data(double value)
Adds a single element to the table.
Definition: eggAnimData.I:116
int get_size() const
Returns the number of elements in the table.
Definition: eggAnimData.I:128
PTA_double get_data() const
Returns the entire table of data.
Definition: eggAnimData.I:139
void clear_data()
Removes all data and empties the table.
Definition: eggAnimData.I:106
void set_data(const PTA_double &data)
Replaces the entire table of data.
Definition: eggAnimData.I:150
double get_fps() const
This is only valid if has_fps() returns true.
Definition: eggAnimData.I:94
A base class for EggSAnimData and EggXfmAnimData, which contain rows and columns of numbers...
Definition: eggAnimData.h:32
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:38