19 #ifndef DRIPLINE_RETURN_CODES_HH_ 20 #define DRIPLINE_RETURN_CODES_HH_ 24 #include "indexed_factory.hh" 42 virtual unsigned rc_value()
const = 0;
43 virtual std::string rc_name()
const = 0;
44 virtual std::string rc_description()
const = 0;
54 copy_code(
unsigned a_value,
const std::string& a_name,
const std::string& a_description );
57 virtual unsigned rc_value()
const {
return f_value; }
58 virtual std::string
rc_name()
const {
return f_name; }
72 #define DEFINE_DL_RET_CODE( name, api_macro ) \ 73 struct api_macro dl_##name : public ::dripline::return_code \ 75 static unsigned s_value; \ 76 static std::string s_name; \ 77 static std::string s_description; \ 78 virtual ~dl_##name() {} \ 79 virtual unsigned rc_value() const { return dl_##name::s_value; } \ 80 virtual std::string rc_name() const {return dl_##name::s_name; } \ 81 virtual std::string rc_description() const {return dl_##name::s_description; } \ 89 #define DEFINE_DL_RET_CODE_NOAPI( name ) \ 90 struct dl_##name : public ::dripline::return_code \ 92 static unsigned s_value; \ 93 static std::string s_name; \ 94 static std::string s_description; \ 95 virtual ~dl_##name() {} \ 96 virtual unsigned rc_value() const { return dl_##name::s_value; } \ 97 virtual std::string rc_name() const {return dl_##name::s_name; } \ 98 virtual std::string rc_description() const {return dl_##name::s_description; } \ 107 #define IMPLEMENT_DL_RET_CODE( name, the_value, description ) \ 108 unsigned dl_##name::s_value = the_value; \ 109 std::string dl_##name::s_name( TOSTRING(name) ); \ 110 std::string dl_##name::s_description( description );\ 111 static scarab::indexed_registrar< unsigned, ::dripline::return_code, dl_##name > t_dl_##name##_rc_reg( the_value ); 164 void add_return_code(
unsigned a_value,
const std::string& a_name,
const std::string& a_description );
178 void register_class()
const;
Base class for return codes.
std::map< unsigned, std::unique_ptr< return_code > > get_return_codes_map()
virtual unsigned rc_value() const
Stores a copy of the return-code value, name, and description, either as a custom return-code or copy...
std::ostream & operator<<(std::ostream &a_os, op_t an_op)
Pass the integer-equivalent of a message-operation enum to an ostream.
std::string f_description
bool check_and_add_return_code(unsigned a_value, const std::string &a_name, const std::string &a_description)
virtual std::string rc_description() const
#define DEFINE_DL_RET_CODE(name, api_macro)
void add_return_code(unsigned a_value, const std::string &a_name, const std::string &a_description)
Helper function to add a return code (primarily for python binding); scarab::error will be thrown if ...
virtual std::string rc_name() const
bool operator==(const message &a_lhs, const message &a_rhs)
std::vector< unsigned > get_return_code_values()
std::string f_description