LCOV - code coverage report
Current view: top level - src/PointCloud - Object.cpp (source / functions) Hit Total Coverage
Test: HLR Lines: 22 22 100.0 %
Date: 2018-01-15 11:19:19 Functions: 6 6 100.0 %

          Line data    Source code
       1             : #include "Object.hpp"
       2             : #include <CGAL/IO/io.h>
       3             : 
       4             : namespace HLR
       5             : {
       6             : namespace PointCloud
       7             : {
       8             : namespace
       9             : {
      10             : bool is_same_polyhedron(
      11             :     const CGAL::Surface_mesh<CGAL::Simple_cartesian<double>::Point_3>& lhs,
      12             :     const CGAL::Surface_mesh<CGAL::Simple_cartesian<double>::Point_3>& rhs);
      13             : }
      14             : 
      15           1 : Object::operator HLR::Object() const
      16             : {
      17           1 :     HLR::Object object;
      18           1 :     object.id = id;
      19           1 :     if (speed)
      20             :     {
      21           1 :         object.speed = *speed;
      22           1 :         object.flags |= HLR::Object::HAS_SPEED;
      23             :     }
      24           1 :     object.flags |= static_cast<std::uint8_t>(is_cup ? HLR::Object::IS_CUP : 0);
      25           2 :     object.flags |=
      26           1 :         static_cast<std::uint8_t>(is_deleted ? HLR::Object::IS_DELETED : 0);
      27             : 
      28           2 :     std::ostringstream serialization_stream;
      29           1 :     serialization_stream << polyhedron;
      30           1 :     object.polyhedron = serialization_stream.str();
      31             : 
      32           2 :     return object;
      33             : }
      34             : 
      35           4 : bool Object::operator==(const Object& rhs) const
      36             : {
      37           8 :     return id == rhs.id && is_same_polyhedron(polyhedron, rhs.polyhedron)
      38           4 :            && speed == rhs.speed && is_cup == rhs.is_cup
      39           6 :            && is_deleted == rhs.is_deleted;
      40             : }
      41             : 
      42           3 : bool Object::operator!=(const Object& rhs) const
      43             : {
      44           3 :     return !(*this == rhs);
      45             : }
      46             : 
      47             : namespace
      48             : {
      49           4 : bool is_same_polyhedron(const CGAL::Surface_mesh<
      50             :                             CGAL::Simple_cartesian<double>::Point_3>& /* lhs */,
      51             :                         const CGAL::Surface_mesh<
      52             :                             CGAL::Simple_cartesian<double>::Point_3>& /* rhs */)
      53             : {
      54             :     // TODO: Actually implement this
      55           4 :     return true;
      56             : }
      57             : } // namespace
      58             : 
      59             : } // namespace PointCloud
      60           3 : } // namespace HLR

Generated by: LCOV version 1.12