exceptions.cpp
Go to the documentation of this file.
1#include "exceptions.h"
2
3#include <sstream>
4
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
Geometric structure of a 3D voxel grid.
InvalidStructure(const VoxelGridStructure &expected, const VoxelGridStructure &actual, const std::string &message="Voxel grid structure does not match.")
InvalidVoxelDataSize(std::size_t actual, std::size_t expected)
Base class for exceptions in this library.
Definition exceptions.h:17