SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
Functions
sutil::printables Namespace Reference

Functions

const SPrintableBaseget (const std::string &arg_name)
 
template<typename ObjectType >
bool add (const std::string &arg_name, const ObjectType &arg_obj)
 
bool reset ()
 

Detailed Description

To print any arbitrary type's contents, you have to do two things:

  1. Define a function that parses the object's data into an ostream
  2. Add the printable subclass of SPrintable to the print object map

To make your life easy, we have a template that does most of the work for you.

  1. 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_; } }

  2. Add these lines of code in your callbacks:

    printables::add<TYPE>("object_name", object);

Function Documentation

template<typename ObjectType >
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.