exceptions.cpp
Go to the documentation of this file.
1 #include "exceptions.h"
2 
3 #include <sstream>
4 
5 #include "VoxelGridStructure.h"
6 
8 {
9 
10  InvalidVoxelDataSize::InvalidVoxelDataSize(std::size_t actual, std::size_t expected) :
11  VoxelGridError(makeMsg(actual, expected))
12  {
13  }
14 
15  std::string
16  InvalidVoxelDataSize::makeMsg(std::size_t actual, std::size_t expected)
17  {
18  std::stringstream ss;
19  ss << "Provided voxel data (" << actual << " voxels) "
20  << "does not match structure (" << expected << " voxels).";
21  return ss.str();
22  }
23 
25  const VoxelGridStructure& actual,
26  const std::string& message) :
27  VoxelGridError(makeMsg(expected, actual, message))
28  {
29  }
30 
31  std::string
32  InvalidStructure::makeMsg(const VoxelGridStructure& expected,
33  const VoxelGridStructure& actual,
34  const std::string& message)
35  {
36  std::stringstream ss;
37  ss << message << "\n"
38  << " Expected: \n"
39  << expected << "\n"
40  << " but was : \n"
41  << actual;
42  return ss.str();
43  }
44 
45 } // namespace visionx::voxelgrid::error
exceptions.h
visionx::voxelgrid::error::InvalidStructure::InvalidStructure
InvalidStructure(const VoxelGridStructure &expected, const VoxelGridStructure &actual, const std::string &message="Voxel grid structure does not match.")
Definition: exceptions.cpp:24
VoxelGridStructure.h
visionx::voxelgrid::error
Definition: exceptions.cpp:7
message
message(STATUS "Boost-Library-Dir: " "${Boost_LIBRARY_DIRS}") message(STATUS "Boost-LIBRARIES
Definition: CMakeLists.txt:8
visionx::voxelgrid::error::InvalidVoxelDataSize::InvalidVoxelDataSize
InvalidVoxelDataSize(std::size_t actual, std::size_t expected)
Definition: exceptions.cpp:10
visionx::voxelgrid::VoxelGridStructure
Geometric structure of a 3D voxel grid.
Definition: VoxelGridStructure.h:94
visionx::voxelgrid::error::VoxelGridError
Base class for exceptions in this library.
Definition: exceptions.h:16