Panda3D
 All Classes Functions Variables Enumerations
eggMorph.I
00001 // Filename: eggMorph.I
00002 // Created by:  drose (29Jan99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: EggMorph::Constructor
00018 //       Access: Public
00019 //  Description:
00020 ////////////////////////////////////////////////////////////////////
00021 template<class Parameter>
00022 INLINE EggMorph<Parameter>::
00023 EggMorph(const string &name, const Parameter &offset)
00024   : Namable(name), _offset(offset) {
00025 }
00026 
00027 
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //     Function: EggMorph::set_offset
00031 //       Access: Public
00032 //  Description:
00033 ////////////////////////////////////////////////////////////////////
00034 template<class Parameter>
00035 INLINE void EggMorph<Parameter>::
00036 set_offset(const Parameter &offset) {
00037   _offset = offset;
00038 }
00039 
00040 
00041 ////////////////////////////////////////////////////////////////////
00042 //     Function: EggMorph::get_offset
00043 //       Access: Public
00044 //  Description:
00045 ////////////////////////////////////////////////////////////////////
00046 template<class Parameter>
00047 INLINE const Parameter &EggMorph<Parameter>::
00048 get_offset() const {
00049   return _offset;
00050 }
00051 
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: EggMorph::Ordering operator
00055 //       Access: Public
00056 //  Description:
00057 ////////////////////////////////////////////////////////////////////
00058 template<class Parameter>
00059 INLINE bool EggMorph<Parameter>::
00060 operator < (const EggMorph<Parameter> &other) const {
00061   return get_name() < other.get_name();
00062 }
00063 
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: EggMorph::Equality operator
00067 //       Access: Public
00068 //  Description:
00069 ////////////////////////////////////////////////////////////////////
00070 template<class Parameter>
00071 INLINE bool EggMorph<Parameter>::
00072 operator == (const EggMorph<Parameter> &other) const {
00073   return get_name() == other.get_name();
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: EggMorph::Inequality operator
00078 //       Access: Public
00079 //  Description:
00080 ////////////////////////////////////////////////////////////////////
00081 template<class Parameter>
00082 INLINE bool EggMorph<Parameter>::
00083 operator != (const EggMorph<Parameter> &other) const {
00084   return !operator == (other);
00085 }
00086 
00087 ////////////////////////////////////////////////////////////////////
00088 //     Function: EggMorph::compare_to
00089 //       Access: Public
00090 //  Description: compare_to() compares a different space than the
00091 //               operator methods, which only check the name.
00092 //               compare_to() compares the name and the value as well.
00093 ////////////////////////////////////////////////////////////////////
00094 template<class Parameter>
00095 INLINE int EggMorph<Parameter>::
00096 compare_to(const EggMorph<Parameter> &other, double threshold) const {
00097   int compare = strcmp(get_name().c_str(), other.get_name().c_str());
00098   if (compare != 0) {
00099     return compare;
00100   }
00101   return _offset.compare_to(other._offset, threshold);
00102 }
00103 
00104 ////////////////////////////////////////////////////////////////////
00105 //     Function: EggMorph::output
00106 //       Access: Public
00107 //  Description: 
00108 ////////////////////////////////////////////////////////////////////
00109 template<class Parameter>
00110 INLINE void EggMorph<Parameter>::
00111 output(ostream &out, const string &tag, int num_dimensions) const {
00112   out << tag << " " << get_name() << " {";
00113   for (int i = 0; i < num_dimensions; ++i) {
00114     out << " " << MAYBE_ZERO(_offset[i]);
00115   }
00116   out << " }";
00117 }
 All Classes Functions Variables Enumerations