DHART
Loading...
Searching...
No Matches
HFExceptions.h
Go to the documentation of this file.
1
7
8#pragma once
9
10#include <exception>
11#include <cstring>
12#include <stdexcept>
13
31 enum HF_STATUS {
32 OK = 1,
33
34 // Special Codes
36
37 // Error Codes
39 NOT_FOUND = -1,
41 NO_GRAPH = -3,
46 DB_BUSY = -8,
49 NO_PATH = -11,
50 NO_COST = -12,
52 };
53
55 struct FileNotFound : public std::exception
56 {
57 const char* what() const throw ()
58 {
59 return "Couldn't find the given file!";
60 }
61 };
62
64 struct InvalidOBJ : public std::exception
65 {
66 const char* what() const throw ()
67 {
68 return "The obj given couldn't be read!";
69 }
70 };
71
73 struct MissingDependency : public std::exception
74 {
75 const char* what() const throw ()
76 {
77 return "C++ Exception";
78 }
79 };
80
81 /* \brief This functionality has not been implemented yet. */
82 class NotImplemented : public std::logic_error
83 {
84 public:
85 NotImplemented() : std::logic_error("Function not yet implemented") { };
86 };
87
89 struct NoCost : public std::exception
90 {
91 std::string cost_type;
92 NoCost(const std::string& cost_name) {
93 cost_type = "Cost type " + cost_name + " doesn't exist in the graph!";
94 }
95
96 const char* what() const throw ()
97 {
98 return cost_type.c_str();
99 }
100 };
101
102}
103
STL namespace.
Custom exceptions and error codes used interally by DHARTAPI.
Definition: HFExceptions.h:22
HF_STATUS
A set of error codes standard throughout every DHARTAPI codebase.
Definition: HFExceptions.h:31
@ INVALID_OBJ
The given path did not point to a valid obj file.
Definition: HFExceptions.h:40
@ OK
Operation was successful.
Definition: HFExceptions.h:32
@ MALFORMED_DB
The database exists, but is in some kind of error state.
Definition: HFExceptions.h:45
@ OUT_OF_MEMORY
Ran out of memory during the last operation.
Definition: HFExceptions.h:44
@ NOT_FOUND
The path given did not lead to any file.
Definition: HFExceptions.h:39
@ MISSING_DEPEND
A dependency for this object is missing.
Definition: HFExceptions.h:43
@ GENERIC_ERROR
Not sure what happened here (If this gets thrown, either fix it or give it a status code!...
Definition: HFExceptions.h:38
@ NOT_COMPRESSED
Graph wasn't compressed!
Definition: HFExceptions.h:51
@ INVALID_COST
The given cost name does not exist in the database.
Definition: HFExceptions.h:42
@ DB_BUSY
The database is busy (is there some external connection?).
Definition: HFExceptions.h:46
@ INVALID_PTR
One or more of the given pointers didn't lead to anything.
Definition: HFExceptions.h:47
@ NO_GRAPH
This requires a valid graph in the DB to execute successfully.
Definition: HFExceptions.h:41
@ NO_COST
There is no cost with the given name in the given graph.
Definition: HFExceptions.h:50
@ NOT_IMPLEMENTED
This function hasn't been implemented yet.
Definition: HFExceptions.h:35
@ OUT_OF_RANGE
Tried to reference something not in the given container.
Definition: HFExceptions.h:48
@ NO_PATH
There is no path between the start and end points.
Definition: HFExceptions.h:49
Thrown when desired file is not found.
Definition: HFExceptions.h:56
const char * what() const
Definition: HFExceptions.h:57
The OBJ file was not valid.
Definition: HFExceptions.h:65
const char * what() const
Definition: HFExceptions.h:66
Thrown when a dependency is missing such as Embree.
Definition: HFExceptions.h:74
Thrown when a dependency is missing such as Embree.
Definition: HFExceptions.h:90
NoCost(const std::string &cost_name)
Definition: HFExceptions.h:92
const char * what() const
Definition: HFExceptions.h:96