Panda3D
eggMorph.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 eggMorph.I
10  * @author drose
11  * @date 1999-01-29
12  */
13 
14 /**
15  *
16  */
17 template<class Parameter>
19 EggMorph(const std::string &name, const Parameter &offset)
20  : Namable(name), _offset(offset) {
21 }
22 
23 
24 
25 /**
26  *
27  */
28 template<class Parameter>
29 INLINE void EggMorph<Parameter>::
30 set_offset(const Parameter &offset) {
31  _offset = offset;
32 }
33 
34 
35 /**
36  *
37  */
38 template<class Parameter>
39 INLINE const Parameter &EggMorph<Parameter>::
40 get_offset() const {
41  return _offset;
42 }
43 
44 
45 /**
46  *
47  */
48 template<class Parameter>
49 INLINE bool EggMorph<Parameter>::
50 operator < (const EggMorph<Parameter> &other) const {
51  return get_name() < other.get_name();
52 }
53 
54 
55 /**
56  *
57  */
58 template<class Parameter>
59 INLINE bool EggMorph<Parameter>::
60 operator == (const EggMorph<Parameter> &other) const {
61  return get_name() == other.get_name();
62 }
63 
64 /**
65  *
66  */
67 template<class Parameter>
68 INLINE bool EggMorph<Parameter>::
69 operator != (const EggMorph<Parameter> &other) const {
70  return !operator == (other);
71 }
72 
73 /**
74  * compare_to() compares a different space than the operator methods, which
75  * only check the name. compare_to() compares the name and the value as well.
76  */
77 template<class Parameter>
78 INLINE int EggMorph<Parameter>::
79 compare_to(const EggMorph<Parameter> &other, double threshold) const {
80  int compare = strcmp(get_name().c_str(), other.get_name().c_str());
81  if (compare != 0) {
82  return compare;
83  }
84  return _offset.compare_to(other._offset, threshold);
85 }
86 
87 /**
88  *
89  */
90 template<class Parameter>
91 INLINE void EggMorph<Parameter>::
92 output(std::ostream &out, const std::string &tag, int num_dimensions) const {
93  out << tag << " " << get_name() << " {";
94  for (int i = 0; i < num_dimensions; ++i) {
95  out << " " << MAYBE_ZERO(_offset[i]);
96  }
97  out << " }";
98 }
int compare_to(const EggMorph< Parameter > &other, double threshold) const
compare_to() compares a different space than the operator methods, which only check the name.
Definition: eggMorph.I:79
A single <Dxyz> or <Duv> or some such entry.
Definition: eggMorph.h:30
A base class for all things which can have a name.
Definition: namable.h:26