8 #define DRIPLINE_API_EXPORTS
16 LOGGER(
rclog,
"return_codes" );
23 f_description( a_description )
27 f_value( a_code.rc_value() ),
28 f_name( a_code.rc_name() ),
29 f_description( a_code.rc_description() )
90 void add_return_code(
unsigned a_value, const std::
string& a_name, const std::
string& a_description )
92 static std::vector< std::unique_ptr<custom_return_code_registrar> > f_rc_registrars;
104 catch(
const scarab::error& )
112 std::vector< unsigned > return_codes;
113 scarab::indexed_factory< unsigned, return_code >* the_factory = scarab::indexed_factory< unsigned, return_code >::get_instance();
115 for(
auto code_entry = the_factory->begin(); code_entry != the_factory->end(); ++code_entry )
117 return_codes.push_back( code_entry->first );
124 std::map< unsigned, std::unique_ptr<return_code> > the_return_codes;
125 scarab::indexed_factory< unsigned, return_code >* the_factory = scarab::indexed_factory< unsigned, return_code >::get_instance();
126 for(
auto code_entry = the_factory->begin(); code_entry != the_factory->end(); ++code_entry )
128 the_return_codes.emplace( std::make_pair(
130 std::unique_ptr<return_code>( code_entry->second->create() )
133 return the_return_codes;
140 f_description( a_description)
147 scarab::indexed_factory< unsigned, return_code >::get_instance()->remove_class(
f_value );
152 scarab::indexed_factory< unsigned, return_code >::get_instance()->register_class(
f_value,
this );
virtual ~custom_return_code_registrar()
void register_class() const
custom_return_code_registrar(const unsigned &a_value, const std::string &a_name, const std::string &a_description)
return_code * create() const
std::string f_description
bool check_and_add_return_code(unsigned a_value, const std::string &a_name, const std::string &a_description)
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 ...
std::ostream & operator<<(std::ostream &a_os, op_t an_op)
Pass the integer-equivalent of a message-operation enum to an ostream.
std::vector< unsigned > get_return_code_values()
std::map< unsigned, std::unique_ptr< return_code > > get_return_codes_map()
bool operator==(const message &a_lhs, const message &a_rhs)
static ::scarab::logger_type< ::scarab::spd_initializer_async_stdout_color_mt > rclog("return_codes", __FILE_NAME__, __LINE__)
#define IMPLEMENT_DL_RET_CODE(name, the_value, description)
Stores a copy of the return-code value, name, and description, either as a custom return-code or copy...
copy_code(unsigned a_value, const std::string &a_name, const std::string &a_description)
Base class for return codes.
virtual std::string rc_name() const =0
virtual std::string rc_description() const =0
virtual unsigned rc_value() const =0