SCL
1.0
Standard Control Library : Control, dynamics, physics, and simulation
|
Functions | |
const SPrintableBase * | get (const std::string &arg_name) |
template<typename ObjectType > | |
bool | add (const std::string &arg_name, const ObjectType &arg_obj) |
bool | reset () |
To print any arbitrary type's contents, you have to do two things:
To make your life easy, we have a template that does most of the work for you.
Simply code this function somewhere in your callbacks:
namespace sutil //Remember to do this. { template <> void printToStream<TYPE>( std::ostream& ostr, const TYPE& arg_data) { ostr<<arg_data.whatever_you_want_; } }
Add these lines of code in your callbacks:
printables::add<TYPE>("object_name", object);
bool sutil::printables::add | ( | const std::string & | arg_name, |
const ObjectType & | arg_obj | ||
) |
Enables adding an object to the map of printable objects. An object in the map can be passed to an ostream, and will print its contents into the stream
const SPrintableBase* sutil::printables::get | ( | const std::string & | arg_name | ) |
Enables access to the map of printable objects. An object in the map can be passed to an ostream, and will print its contents into the stream
Eg. One such call could be: if(0!=printables::get(std::string("YourObject"))) std::cout<<*printablesget(std::string("YourObject"));
bool sutil::printables::reset | ( | ) |
Deletes the all registered printable object definitions. Resets the singleton map that stores them.