00001 // Filename: eggAnimData.I 00002 // Created by: drose (19Feb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include <notify.h> 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function: EggAnimData::Constructor 00023 // Access: Public 00024 // Description: 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE EggAnimData:: 00027 EggAnimData(const string &name) : EggNode(name) { 00028 _has_fps = false; 00029 } 00030 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: EggAnimData::Copy constructor 00034 // Access: Public 00035 // Description: 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE EggAnimData:: 00038 EggAnimData(const EggAnimData ©) : 00039 EggNode(copy), _data(copy._data), 00040 _fps(copy._fps), _has_fps(copy._has_fps) { 00041 } 00042 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: EggAnimData::Copy assignment operator 00046 // Access: Public 00047 // Description: 00048 //////////////////////////////////////////////////////////////////// 00049 INLINE EggAnimData &EggAnimData:: 00050 operator = (const EggAnimData ©) { 00051 EggNode::operator = (copy); 00052 _data = copy._data; 00053 _fps = copy._fps; 00054 _has_fps = copy._has_fps; 00055 00056 return *this; 00057 } 00058 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: EggAnimData::set_fps 00062 // Access: Public 00063 // Description: 00064 //////////////////////////////////////////////////////////////////// 00065 INLINE void EggAnimData:: 00066 set_fps(double fps) { 00067 _fps = fps; 00068 _has_fps = true; 00069 } 00070 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: EggAnimData::clear_fps 00074 // Access: Public 00075 // Description: 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE void EggAnimData:: 00078 clear_fps() { 00079 _has_fps = false; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: EggAnimData::has_fps 00084 // Access: Public 00085 // Description: 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE bool EggAnimData:: 00088 has_fps() const { 00089 return _has_fps; 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: EggAnimData::get_fps 00094 // Access: Public 00095 // Description: This is only valid if has_fps() returns true. 00096 //////////////////////////////////////////////////////////////////// 00097 INLINE double EggAnimData:: 00098 get_fps() const { 00099 nassertr(has_fps(), 0.0); 00100 return _fps; 00101 } 00102 00103 00104 //////////////////////////////////////////////////////////////////// 00105 // Function: EggAnimData::clear_data 00106 // Access: Public 00107 // Description: Removes all data and empties the table. 00108 //////////////////////////////////////////////////////////////////// 00109 INLINE void EggAnimData:: 00110 clear_data() { 00111 _data.clear(); 00112 } 00113 00114 //////////////////////////////////////////////////////////////////// 00115 // Function: EggAnimData::add_data 00116 // Access: Public 00117 // Description: Adds a single element to the table. 00118 //////////////////////////////////////////////////////////////////// 00119 INLINE void EggAnimData:: 00120 add_data(double value) { 00121 _data.push_back(value); 00122 } 00123 00124 00125 00126 //////////////////////////////////////////////////////////////////// 00127 // Function: EggAnimData::get_size 00128 // Access: Public 00129 // Description: Returns the number of elements in the table. 00130 //////////////////////////////////////////////////////////////////// 00131 INLINE int EggAnimData:: 00132 get_size() const { 00133 return _data.size(); 00134 } 00135 00136 00137 //////////////////////////////////////////////////////////////////// 00138 // Function: EggAnimData::get_data 00139 // Access: Public 00140 // Description: Returns the entire table of data. 00141 //////////////////////////////////////////////////////////////////// 00142 INLINE PTA_double EggAnimData:: 00143 get_data() const { 00144 return _data; 00145 } 00146 00147 00148 //////////////////////////////////////////////////////////////////// 00149 // Function: EggAnimData::set_data 00150 // Access: Public 00151 // Description: Replaces the entire table of data. 00152 //////////////////////////////////////////////////////////////////// 00153 INLINE void EggAnimData:: 00154 set_data(const PTA_double &data) { 00155 _data = data; 00156 } 00157