00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "pStatCollectorDef.h"
00016
00017 #include "datagram.h"
00018 #include "datagramIterator.h"
00019
00020
00021
00022
00023
00024
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
00042
00043
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
00063
00064
00065
00066
00067
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
00081
00082
00083
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
00101
00102
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 }