Classes | |
class | sdf::v12::AssertionInternalError |
Class for generating Exceptions which come from sdf assertions. They include information about the assertion expression violated, function where problem appeared and assertion debug message. More... | |
class | sdf::v12::Console |
Message, error, warning, and logging functionality. More... | |
class | sdf::v12::ConsolePrivate |
class | sdf::v12::Console::ConsoleStream |
An ostream-like class that we'll use for logging. More... | |
class | sdf::v12::Element |
SDF Element class. More... | |
class | sdf::v12::ElementPrivate |
class | sdf::v12::Exception |
Class for generating exceptions. More... | |
class | sdf::v12::InternalError |
Class for generating Internal Gazebo Errors: those errors which should never happend and represent programming bugs. More... | |
class | sdf::v12::SDF |
Base SDF class. More... | |
Macros | |
#define | sdfdbg (sdf::Console::Instance()->Log("Dbg", __FILE__, __LINE__)) |
Output a debug message. More... | |
#define | sdferr |
Output an error message. More... | |
#define | sdfmsg |
Output a message. More... | |
#define | sdfthrow(msg) |
This macro logs an error to the throw stream and throws an exception that contains the file name and line number. More... | |
#define | sdfwarn |
Output a warning message. More... | |
Typedefs | |
typedef std::shared_ptr< Console > | sdf::v12::ConsolePtr |
Functions | |
sdf::v12::ConsolePrivate::ConsolePrivate () | |
Constructor. More... | |
sdf::v12::Console::ConsoleStream::ConsoleStream (std::ostream *_stream) | |
Constructor. More... | |
virtual | sdf::v12::Console::~Console () |
Destructor. More... | |
void | sdf::v12::addURIPath (const std::string &_uri, const std::string &_path) |
Associate paths to a URI. More... | |
static void | sdf::v12::Console::Clear () |
Clear out the current console to make room for a new one. More... | |
ConsoleStream & | sdf::v12::Console::ColorMsg (const std::string &lbl, const std::string &file, unsigned int line, int color) |
Use this to output a colored message to the terminal. More... | |
std::string | sdf::v12::findFile (const std::string &_filename, bool _searchLocalPath, bool _useCallback, const ParserConfig &_config) |
Find the absolute path of a file. More... | |
std::string | sdf::v12::findFile (const std::string &_filename, bool _searchLocalPath=true, bool _useCallback=false) |
Find the absolute path of a file. More... | |
template<typename T > | |
std::pair< T, bool > | sdf::v12::Element::Get (const std::string &_key, const T &_defaultValue) const |
Get the value of a key. More... | |
template<typename T > | |
bool | sdf::v12::Element::Get (const std::string &_key, T &_param, const T &_defaultValue) const |
Get the value of a key. More... | |
template<typename T > | |
T | sdf::v12::Element::Get (const std::string &_key="") const |
Get the value of a key. More... | |
ConsoleStream & | sdf::v12::Console::GetLogStream () |
Get the current log stream object. More... | |
ConsoleStream & | sdf::v12::Console::GetMsgStream () |
Get the current message stream object. More... | |
std::ostream * | sdf::v12::Console::ConsoleStream::GetStream () |
Get the current stream object. More... | |
static ConsolePtr | sdf::v12::Console::Instance () |
Return an instance to this class. More... | |
ConsoleStream & | sdf::v12::Console::Log (const std::string &lbl, const std::string &file, unsigned int line) |
Use this to output a message to a log file at $HOME/.sdformat/sdformat.log . More... | |
template<class T > | |
ConsoleStream & | sdf::v12::Console::ConsoleStream::operator<< (const T &_rhs) |
Redirect whatever is passed in to both our ostream (if non-NULL) and the log file (if open). More... | |
void | sdf::v12::Console::ConsoleStream::Prefix (const std::string &_lbl, const std::string &_file, unsigned int _line, int _color) |
Print a prefix to both terminal and log file. More... | |
template<typename T > | |
bool | sdf::v12::Element::Set (const T &_value) |
Set the value of this element. More... | |
void | sdf::v12::setFindCallback (std::function< std::string(const std::string &)> _cb) |
Set the callback to use when SDF can't find a file. More... | |
void | sdf::v12::Console::SetQuiet (bool _q) |
Set quiet output. More... | |
void | sdf::v12::Console::ConsoleStream::SetStream (std::ostream *_stream) |
Set the stream object. More... | |
Variables | |
std::ofstream | sdf::v12::ConsolePrivate::logFileStream |
logfile stream More... | |
Console::ConsoleStream | sdf::v12::ConsolePrivate::logStream |
log stream More... | |
Console::ConsoleStream | sdf::v12::ConsolePrivate::msgStream |
message stream More... | |
#define sdfdbg (sdf::Console::Instance()->Log("Dbg", __FILE__, __LINE__)) |
Output a debug message.
#define sdferr |
Output an error message.
#define sdfmsg |
Output a message.
#define sdfthrow | ( | msg | ) |
This macro logs an error to the throw stream and throws an exception that contains the file name and line number.
#define sdfwarn |
Output a warning message.
typedef std::shared_ptr<Console> sdf::v12::ConsolePtr |
|
inline |
Constructor.
|
inlineexplicit |
Constructor.
[in] | _stream | Pointer to an output stream operator. Can be NULL/nullptr. |
|
virtual |
Destructor.
void sdf::v12::addURIPath | ( | const std::string & | _uri, |
const std::string & | _path | ||
) |
Associate paths to a URI.
Example paramters: "model://", "/usr/share/models:~/.gazebo/models"
[in] | _uri | URI that will be mapped to _path |
[in] | _path | Colon separated set of paths. |
|
static |
Clear out the current console to make room for a new one.
ConsoleStream& sdf::v12::Console::ColorMsg | ( | const std::string & | lbl, |
const std::string & | file, | ||
unsigned int | line, | ||
int | color | ||
) |
Use this to output a colored message to the terminal.
[in] | _lbl | Text label |
[in] | _file | File containing the error |
[in] | _line | Line containing the error |
[in] | _color | Color to make the label |
std::string sdf::v12::findFile | ( | const std::string & | _filename, |
bool | _searchLocalPath, | ||
bool | _useCallback, | ||
const ParserConfig & | _config | ||
) |
Find the absolute path of a file.
This overload uses the URI path map and and the callback function configured in the input ParserConfig object instead of their global counterparts.
[in] | _filename | Name of the file to find. |
[in] | _searchLocalPath | True to search for the file in the current working directory. |
[in] | _useCallback | True to find a file based on a registered callback if the file is not found via the normal mechanism. |
[in] | _config | Custom parser configuration |
std::string sdf::v12::findFile | ( | const std::string & | _filename, |
bool | _searchLocalPath = true , |
||
bool | _useCallback = false |
||
) |
Find the absolute path of a file.
The search order in the function is as follows:
SDF_SHARE_PATH
.SDF_SHARE_PATH/sdformat<major version>/<version>/
SDF_PATH
.[in] | _filename | Name of the file to find. |
[in] | _searchLocalPath | True to search for the file in the current working directory. |
[in] | _useCallback | True to find a file based on a registered callback if the file is not found via the normal mechanism. |
std::pair< T, bool > sdf::v12::Element::Get | ( | const std::string & | _key, |
const T & | _defaultValue | ||
) | const |
Get the value of a key.
[in] | _key | the name of a child attribute or element. |
[in] | _defaultValue | a default value to use if _key is not found. |
bool sdf::v12::Element::Get | ( | const std::string & | _key, |
T & | _param, | ||
const T & | _defaultValue | ||
) | const |
Get the value of a key.
[in] | _key | the name of a child attribute or element. |
[out] | _param | the parameter output |
[in] | _defaultValue | a default value to use if _key is not found. |
T sdf::v12::Element::Get | ( | const std::string & | _key = "" | ) | const |
Get the value of a key.
This function assumes the _key exists.
[in] | _key | the name of a child attribute or element. |
ConsoleStream& sdf::v12::Console::GetLogStream | ( | ) |
Get the current log stream object.
This can be useful for redirecting the output, for example, to a std::stringstream for testing.
ConsoleStream& sdf::v12::Console::GetMsgStream | ( | ) |
Get the current message stream object.
This can be useful for redirecting the output, for example, to a std::stringstream for testing.
std::ostream* sdf::v12::Console::ConsoleStream::GetStream | ( | ) |
Get the current stream object.
|
static |
Return an instance to this class.
ConsoleStream& sdf::v12::Console::Log | ( | const std::string & | lbl, |
const std::string & | file, | ||
unsigned int | line | ||
) |
Use this to output a message to a log file at $HOME/.sdformat/sdformat.log
.
To disable this log file, define the following symbol when compiling: SDFORMAT_DISABLE_CONSOLE_LOGFILE
ConsoleStream& sdf::v12::Console::ConsoleStream::operator<< | ( | const T & | _rhs | ) |
Redirect whatever is passed in to both our ostream (if non-NULL) and the log file (if open).
[in] | _rhs | Content to be logged. |
void sdf::v12::Console::ConsoleStream::Prefix | ( | const std::string & | _lbl, |
const std::string & | _file, | ||
unsigned int | _line, | ||
int | _color | ||
) |
Print a prefix to both terminal and log file.
[in] | _lbl | Text label |
[in] | _file | File containing the error |
[in] | _line | Line containing the error |
[in] | _color | Color to make the label. Used only on terminal. |
bool sdf::v12::Element::Set | ( | const T & | _value | ) |
Set the value of this element.
[in] | _value | the value to set. |
void sdf::v12::setFindCallback | ( | std::function< std::string(const std::string &)> | _cb | ) |
Set the callback to use when SDF can't find a file.
The callback should return a complete path to the requested file, or and empty string if the file was not found in the callback.
[in] | _cb | The callback function. |
void sdf::v12::Console::SetQuiet | ( | bool | _q | ) |
Set quiet output.
[in] | q | True to prevent warning |
void sdf::v12::Console::ConsoleStream::SetStream | ( | std::ostream * | _stream | ) |
Set the stream object.
[in] | _stream | Pointer to an output stream. This can be useful for redirecting the output, for example, to a std::stringstream for testing. |
std::ofstream sdf::v12::ConsolePrivate::logFileStream |
logfile stream
Console::ConsoleStream sdf::v12::ConsolePrivate::logStream |
log stream
Console::ConsoleStream sdf::v12::ConsolePrivate::msgStream |
message stream