Track.cpp
Go to the documentation of this file.
1 
18 #include "Tracks.hpp"
19 #include <math.h>
20 
21 namespace ISM {
23  double sum = 0;
24  int count = 0;
25  for (ObjectPtr& obj : this->objects) {
26  if (obj) {
27  sum += obj->weight;
28  count++;
29  }
30  }
31 
32  this->weight = floor((sum / (double)count) + 0.5);
33  }
34 
35  std::ostream& operator<<(std::ostream &strm, const ISM::Track &o)
36  {
37  strm << "Type: " << o.type << std::endl
38  << "ObservedId: " << o.observedId << std::endl
39  << "Weight: " << o.weight << std::endl;
40  strm << "Objects :" << std::endl;
41  for(const ObjectPtr& ob : o.objects)
42  {
43  strm << ob << std::endl;
44  }
45 
46  return strm;
47  }
48 
49  std::ostream& operator<<(std::ostream &strm, const ISM::TrackPtr &o)
50  {
51  return strm << (*o);
52  }
53 }
double weight
Definition: Track.hpp:34
std::string type
Definition: Track.hpp:31
std::ostream & operator<<(std::ostream &strm, const ISM::ObjectRelation &r)
std::string observedId
Definition: Track.hpp:32
void calculateWeight()
Definition: Track.cpp:22
boost::shared_ptr< Track > TrackPtr
Definition: Track.hpp:55
this namespace contains all generally usable classes.
std::vector< ObjectPtr > objects
Definition: Track.hpp:33
boost::shared_ptr< Object > ObjectPtr
Definition: Object.hpp:82


asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:41