fpmas 1.6
serializer_set_up.h
Go to the documentation of this file.
1#ifndef FPMAS_MODEL_SERIALIZER_SET_UP_H
2#define FPMAS_MODEL_SERIALIZER_SET_UP_H
3
8#include <stdexcept>
9#include <typeindex>
11#include "fpmas/utils/log.h"
12
16#define FPMAS_TYPE_STR(T) typeid(T).name()
17
18#ifndef FPMAS_TYPE_INDEX
38 #define FPMAS_TYPE_INDEX std::uint_fast8_t
39#endif
40
41namespace fpmas {
55 template<typename Agent>
57
58
59 namespace exceptions {
67 class BadIdException : public std::exception {
68 private:
69 std::string message;
70
71 public:
77 BadIdException(std::size_t bad_id)
78 : message("Unknown type id : " + std::to_string(bad_id)) {}
79
85 const char* what() const noexcept override {
86 return message.c_str();
87 }
88 };
89
97 class BadTypeException : public std::exception {
98 private:
99 std::string message;
100
101 public:
107 BadTypeException(const std::type_index& bad_type)
108 : message("Unknown type index : " + std::string(bad_type.name())) {}
109
115 const char* what() const noexcept override {
116 return message.c_str();
117 }
118 };
119 }
120}
121
122#endif
Definition: ptr_wrapper.h:21
Definition: serializer_set_up.h:67
const char * what() const noexcept override
Definition: serializer_set_up.h:85
BadIdException(std::size_t bad_id)
Definition: serializer_set_up.h:77
Definition: serializer_set_up.h:97
const char * what() const noexcept override
Definition: serializer_set_up.h:115
BadTypeException(const std::type_index &bad_type)
Definition: serializer_set_up.h:107
Definition: fpmas.cpp:3
std::string to_string(const api::graph::DistributedId &id)
Definition: distributed_id.cpp:4