Panda3D

pStatCollectorDef.cxx

00001 // Filename: pStatCollectorDef.cxx
00002 // Created by:  drose (09Jul00)
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 #include "pStatCollectorDef.h"
00016 
00017 #include "datagram.h"
00018 #include "datagramIterator.h"
00019 
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: PStatCollectorDef::Default Constructor
00023 //       Access: Public
00024 //  Description:
00025 ////////////////////////////////////////////////////////////////////
00026 PStatCollectorDef::
00027 PStatCollectorDef() {
00028   _index = 0;
00029   _parent_index = 0;
00030   _suggested_color.r = 0.0;
00031   _suggested_color.g = 0.0;
00032   _suggested_color.b = 0.0;
00033   _sort = -1;
00034   _suggested_scale = 0.0;
00035   _factor = 1.0;
00036   _is_active = true;
00037   _active_explicitly_set = false;
00038 }
00039 
00040 ////////////////////////////////////////////////////////////////////
00041 //     Function: PStatCollectorDef::Constructor
00042 //       Access: Public
00043 //  Description:
00044 ////////////////////////////////////////////////////////////////////
00045 PStatCollectorDef::
00046 PStatCollectorDef(int index, const string &name) :
00047   _index(index),
00048   _name(name)
00049 {
00050   _parent_index = 0;
00051   _suggested_color.r = 0.0;
00052   _suggested_color.g = 0.0;
00053   _suggested_color.b = 0.0;
00054   _sort = -1;
00055   _suggested_scale = 0.0;
00056   _factor = 1.0;
00057   _is_active = true;
00058   _active_explicitly_set = false;
00059 }
00060 
00061 ////////////////////////////////////////////////////////////////////
00062 //     Function: PStatCollectorDef::set_parent
00063 //       Access: Public
00064 //  Description: This is normally called only by the PStatClient when
00065 //               the new PStatCollectorDef is created; it sets the
00066 //               parent of the CollectorDef and inherits whatever
00067 //               properties are appropriate.
00068 ////////////////////////////////////////////////////////////////////
00069 void PStatCollectorDef::
00070 set_parent(const PStatCollectorDef &parent) {
00071   _parent_index = parent._index;
00072   _level_units = parent._level_units;
00073   _suggested_scale = parent._suggested_scale;
00074   _factor = parent._factor;
00075   _is_active = parent._is_active;
00076   _active_explicitly_set = parent._active_explicitly_set;
00077 }
00078 
00079 ////////////////////////////////////////////////////////////////////
00080 //     Function: PStatCollectorDef::write_datagram
00081 //       Access: Public
00082 //  Description: Writes the definition of the collectorDef to the
00083 //               datagram.
00084 ////////////////////////////////////////////////////////////////////
00085 void PStatCollectorDef::
00086 write_datagram(Datagram &destination) const {
00087   destination.add_int16(_index);
00088   destination.add_string(_name);
00089   destination.add_int16(_parent_index);
00090   destination.add_float32(_suggested_color.r);
00091   destination.add_float32(_suggested_color.g);
00092   destination.add_float32(_suggested_color.b);
00093   destination.add_int16(_sort);
00094   destination.add_string(_level_units);
00095   destination.add_float32(_suggested_scale);
00096   destination.add_float32(_factor);
00097 }
00098 
00099 ////////////////////////////////////////////////////////////////////
00100 //     Function: PStatCollectorDef::read_datagram
00101 //       Access: Public
00102 //  Description: Extracts the collectorDef definition from the datagram.
00103 ////////////////////////////////////////////////////////////////////
00104 void PStatCollectorDef::
00105 read_datagram(DatagramIterator &source, PStatClientVersion *) {
00106   _index = source.get_int16();
00107   _name = source.get_string();
00108   _parent_index = source.get_int16();
00109   _suggested_color.r = source.get_float32();
00110   _suggested_color.g = source.get_float32();
00111   _suggested_color.b = source.get_float32();
00112   _sort = source.get_int16();
00113   _level_units = source.get_string();
00114   _suggested_scale = source.get_float32();
00115   _factor = source.get_float32();
00116 }
 All Classes Functions Variables Enumerations