Root class that acts as an entry point to the SDF document model. More...
#include <Root.hh>
Public Member Functions | |
Root () | |
Default constructor. More... | |
const sdf::Actor * | Actor () const |
Get a pointer to the actor object if it exists. More... | |
sdf::ElementPtr | Element () const |
Get a pointer to the SDF element that was generated during load. More... | |
const sdf::Light * | Light () const |
Get a pointer to the light object if it exists. More... | |
Errors | Load (const SDFPtr _sdf) |
Parse the given SDF pointer, and generate objects based on types specified in the SDF file. More... | |
Errors | Load (const SDFPtr _sdf, const ParserConfig &_config) |
Parse the given SDF pointer, and generate objects based on types specified in the SDF file. More... | |
Errors | Load (const std::string &_filename) |
Parse the given SDF file, and generate objects based on types specified in the SDF file. More... | |
Errors | Load (const std::string &_filename, const ParserConfig &_config) |
Parse the given SDF file, and generate objects based on types specified in the SDF file. More... | |
Errors | LoadSdfString (const std::string &_sdf) |
Parse the given SDF string, and generate objects based on types specified in the SDF file. More... | |
Errors | LoadSdfString (const std::string &_sdf, const ParserConfig &_config) |
Parse the given SDF string, and generate objects based on types specified in the SDF file. More... | |
const sdf::Model * | Model () const |
Get a pointer to the model object if it exists. More... | |
void | SetVersion (const std::string &_version) |
Set the SDF version string. More... | |
std::string | Version () const |
Get the SDF version specified in the parsed file or SDF pointer. More... | |
const World * | WorldByIndex (const uint64_t _index) const |
Get a world based on an index. More... | |
uint64_t | WorldCount () const |
Get the number of worlds. More... | |
bool | WorldNameExists (const std::string &_name) const |
Get whether a world name exists. More... | |
Root class that acts as an entry point to the SDF document model.
Multiple worlds can exist in a single SDF file. A user of multiple worlds could run parallel instances of simulation, or offer selection of a world at runtime.
In this example, a root object is loaded from a file specified in the first command line argument to a program.
sdf::v12::Root::Root | ( | ) |
Default constructor.
const sdf::Actor* sdf::v12::Root::Actor | ( | ) | const |
Get a pointer to the actor object if it exists.
sdf::ElementPtr sdf::v12::Root::Element | ( | ) | const |
const sdf::Light* sdf::v12::Root::Light | ( | ) | const |
Get a pointer to the light object if it exists.
Errors sdf::v12::Root::Load | ( | const SDFPtr | _sdf, |
const ParserConfig & | _config | ||
) |
Errors sdf::v12::Root::Load | ( | const std::string & | _filename | ) |
Errors sdf::v12::Root::Load | ( | const std::string & | _filename, |
const ParserConfig & | _config | ||
) |
Errors sdf::v12::Root::LoadSdfString | ( | const std::string & | _sdf | ) |
Errors sdf::v12::Root::LoadSdfString | ( | const std::string & | _sdf, |
const ParserConfig & | _config | ||
) |
const sdf::Model* sdf::v12::Root::Model | ( | ) | const |
Get a pointer to the model object if it exists.
void sdf::v12::Root::SetVersion | ( | const std::string & | _version | ) |
std::string sdf::v12::Root::Version | ( | ) | const |
Get the SDF version specified in the parsed file or SDF pointer.
const World* sdf::v12::Root::WorldByIndex | ( | const uint64_t | _index | ) | const |
Get a world based on an index.
[in] | _index | Index of the world. The index should be in the range [0..WorldCount()). |
uint64_t sdf::v12::Root::WorldCount | ( | ) | const |
Get the number of worlds.
bool sdf::v12::Root::WorldNameExists | ( | const std::string & | _name | ) | const |
Get whether a world name exists.
[in] | _name | Name of the world to check. |