Root class that acts as an entry point to the SDF document model. More...
#include <Root.hh>
Public Member Functions | |
Root () | |
Default constructor. More... | |
~Root () | |
Destructor. More... | |
const Actor * | ActorByIndex (const uint64_t _index) const |
Get an actor based on an index. More... | |
uint64_t | ActorCount () const |
Get the number of actors. More... | |
bool | ActorNameExists (const std::string &_name) const |
Get whether an actor name exists. More... | |
sdf::ElementPtr | Element () const |
Get a pointer to the SDF element that was generated during load. More... | |
const Light * | LightByIndex (const uint64_t _index) const |
Get a light based on an index. More... | |
uint64_t | LightCount () const |
Get the number of lights. More... | |
bool | LightNameExists (const std::string &_name) const |
Get whether a light name exists. 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 SDFPtr _sdf) |
Parse the given SDF pointer, 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... | |
const Model * | ModelByIndex (const uint64_t _index) const |
Get a model based on an index. More... | |
uint64_t | ModelCount () const |
Get the number of models. More... | |
bool | ModelNameExists (const std::string &_name) const |
Get whether a model name 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::v9::Root::Root | ( | ) |
Default constructor.
sdf::v9::Root::~Root | ( | ) |
Destructor.
const Actor* sdf::v9::Root::ActorByIndex | ( | const uint64_t | _index | ) | const |
Get an actor based on an index.
[in] | _index | Index of the actor. The actor should be in the range [0..ActorCount()). |
uint64_t sdf::v9::Root::ActorCount | ( | ) | const |
Get the number of actors.
bool sdf::v9::Root::ActorNameExists | ( | const std::string & | _name | ) | const |
Get whether an actor name exists.
[in] | _name | Name of the actor to check. |
sdf::ElementPtr sdf::v9::Root::Element | ( | ) | const |
const Light* sdf::v9::Root::LightByIndex | ( | const uint64_t | _index | ) | const |
Get a light based on an index.
[in] | _index | Index of the light. The index should be in the range [0..LightCount()). |
uint64_t sdf::v9::Root::LightCount | ( | ) | const |
Get the number of lights.
bool sdf::v9::Root::LightNameExists | ( | const std::string & | _name | ) | const |
Get whether a light name exists.
[in] | _name | Name of the light to check. |
Errors sdf::v9::Root::Load | ( | const std::string & | _filename | ) |
Errors sdf::v9::Root::LoadSdfString | ( | const std::string & | _sdf | ) |
const Model* sdf::v9::Root::ModelByIndex | ( | const uint64_t | _index | ) | const |
Get a model based on an index.
[in] | _index | Index of the model. The index should be in the range [0..ModelCount()). |
uint64_t sdf::v9::Root::ModelCount | ( | ) | const |
Get the number of models.
bool sdf::v9::Root::ModelNameExists | ( | const std::string & | _name | ) | const |
Get whether a model name exists.
[in] | _name | Name of the model to check. |
void sdf::v9::Root::SetVersion | ( | const std::string & | _version | ) |
std::string sdf::v9::Root::Version | ( | ) | const |
Get the SDF version specified in the parsed file or SDF pointer.
const World* sdf::v9::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::v9::Root::WorldCount | ( | ) | const |
Get the number of worlds.
bool sdf::v9::Root::WorldNameExists | ( | const std::string & | _name | ) | const |
Get whether a world name exists.
[in] | _name | Name of the world to check. |