Loading...
Searching...
No Matches
SDF

Classes

class  sdf::AssertionInternalError
 Class for generating Exceptions which come from sdf assertions. More...
class  sdf::Console
 Message, error, warning, and logging functionality. More...
class  sdf::ConsolePrivate
class  sdf::Element
 SDF Element class. More...
class  sdf::ElementPrivate
class  sdf::Exception
 Class for generating exceptions. More...
class  sdf::InternalError
 Class for generating Internal Gazebo Errors: those errors which should never happend and represent programming bugs. More...
class  sdf::SDF
 Base SDF class. More...

Macros

#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.

Typedefs

typedef std::shared_ptr< Consolesdf::ConsolePtr

Functions

SDFORMAT_VISIBLE void sdf::addURIPath (const std::string &_uri, const std::string &_path)
 Associate paths to a URI.
SDFORMAT_VISIBLE std::string sdf::findFile (const std::string &_filename, bool _searchLocalPath=true, bool _useCallback=false)
 Find the absolute path of a file.
template<typename T>
std::pair< T, bool > sdf::Element::Get (const std::string &_key, const T &_defaultValue) const
 Get the value of a key.
template<typename T>
bool sdf::Element::Get (const std::string &_key, T &_param, const T &_defaultValue) const
 Get the value of a key.
template<typename T>
sdf::Element::Get (const std::string &_key="") const
 Get the value of a key.
template<class T>
Console::ConsoleStreamsdf::Console::ConsoleStream::operator<< (const T &_rhs)
template<typename T>
bool sdf::Element::Set (const T &_value)
 Set the value of this element.
SDFORMAT_VISIBLE void sdf::setFindCallback (std::function< std::string(const std::string &)> _cb)
 Set the callback to use when SDF can't find a file.

Detailed Description

Macro Definition Documentation

◆ sdfdbg

#define sdfdbg   (sdf::Console::Instance()->Log("Dbg", __FILE__, __LINE__))

Output a debug message.

◆ sdferr

#define sdferr
Value:
(sdf::Console::Instance()->ColorMsg("Error", \
__FILE__, __LINE__, 31))
static ConsolePtr Instance()
Return an instance to this class.

Output an error message.

Referenced by sdf::Param::Get(), sdf::Param::GetDefault(), and sdf::Param::Set().

◆ sdfmsg

#define sdfmsg
Value:
(sdf::Console::Instance()->ColorMsg("Msg", \
__FILE__, __LINE__, 32))

Output a message.

◆ sdfthrow

#define sdfthrow ( msg)
Value:
{std::ostringstream throwStream;\
throwStream << msg << std::endl << std::flush;\
throw sdf::Exception(__FILE__, __LINE__, throwStream.str()); }
Class for generating exceptions.
Definition Exception.hh:52

This macro logs an error to the throw stream and throws an exception that contains the file name and line number.

◆ sdfwarn

#define sdfwarn
Value:
(sdf::Console::Instance()->ColorMsg("Warning", \
__FILE__, __LINE__, 33))

Output a warning message.

Typedef Documentation

◆ ConsolePtr

typedef std::shared_ptr<Console> sdf::ConsolePtr

Function Documentation

◆ addURIPath()

SDFORMAT_VISIBLE void sdf::addURIPath ( const std::string & _uri,
const std::string & _path )

Associate paths to a URI.

Example paramters: "model://", "/usr/share/models:~/.gazebo/models"

Parameters
[in]_uriURI that will be mapped to _path
[in]_pathColon separated set of paths.

References SDFORMAT_VISIBLE.

◆ findFile()

SDFORMAT_VISIBLE std::string sdf::findFile ( const std::string & _filename,
bool _searchLocalPath = true,
bool _useCallback = false )

Find the absolute path of a file.

Parameters
[in]_filenameName of the file to find.
[in]_searchLocalPathTrue to search for the file in the current working directory.
[in]_useCallbackTrue to find a file based on a registered callback if the file is not found via the normal mechanism.
Returns
File's full path.

References SDFORMAT_VISIBLE.

◆ Get() [1/3]

template<typename T>
std::pair< T, bool > sdf::Element::Get ( const std::string & _key,
const T & _defaultValue ) const

Get the value of a key.

Parameters
[in]_keythe name of a child attribute or element.
[in]_defaultValuea default value to use if _key is not found.
Returns
A pair where the first element is the value of _key, and the second element is true when the _key was found and false otherwise.

References GetAttribute(), GetElementDescription(), GetElementImpl(), HasElement(), and HasElementDescription().

◆ Get() [2/3]

template<typename T>
bool sdf::Element::Get ( const std::string & _key,
T & _param,
const T & _defaultValue ) const

Get the value of a key.

Parameters
[in]_keythe name of a child attribute or element.
[out]_paramthe parameter output
[in]_defaultValuea default value to use if _key is not found.
Returns
True when the _key was found and false otherwise.

References Get().

◆ Get() [3/3]

template<typename T>
T sdf::Element::Get ( const std::string & _key = "") const

Get the value of a key.

This function assumes the _key exists.

Parameters
[in]_keythe name of a child attribute or element.
Returns
The value of the _key.
See also
std::pair<T, bool> Get(const std::string &_key, const T &_defaultValue)

References Get().

Referenced by Get(), Get(), and GetAny().

◆ operator<<()

template<class T>
Console::ConsoleStream & sdf::Console::ConsoleStream::operator<< ( const T & _rhs)

◆ Set()

template<typename T>
bool sdf::Element::Set ( const T & _value)

Set the value of this element.

Parameters
[in]_valuethe value to set.
Returns
True if the value was successfully set, false otherwise.

Referenced by GetAny().

◆ setFindCallback()

SDFORMAT_VISIBLE void sdf::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.

Parameters
[in]_cbThe callback function.