Skip to content

Commit

Permalink
Root to element (#842)
Browse files Browse the repository at this point in the history
* Adding ToElement conversion to Root DOM

Signed-off-by: Nate Koenig <[email protected]>

* Added non-const mutable accessors for root child objects

Signed-off-by: Nate Koenig <[email protected]>

* Remove comment

Signed-off-by: Nate Koenig <[email protected]>

* Adding Root::ToElemnt

Signed-off-by: Nate Koenig <[email protected]>

* Handle include plugins

Signed-off-by: Nate Koenig <[email protected]>

* style

Signed-off-by: Nate Koenig <[email protected]>

* Added parameter passing documentation

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
  • Loading branch information
nkoenig and Nate Koenig authored Mar 5, 2022
1 parent 9641718 commit c496c5b
Show file tree
Hide file tree
Showing 45 changed files with 488 additions and 9 deletions.
2 changes: 2 additions & 0 deletions include/sdf/Actor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// actor.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated actor values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/AirPressure.hh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// air pressure sensor.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated sensor values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Altimeter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// altimeter sensor.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated sensor values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Atmosphere.hh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// atmosphere.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated atmosphere values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Box.hh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// box.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated box values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Camera.hh
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// camera.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated camera values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Capsule.hh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// capsule.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated capsule values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Collision.hh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// collision.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated collision values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Cylinder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// cylinder.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated cylinder values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Ellipsoid.hh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// ellipsoid.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated ellipsoid values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/ForceTorque.hh
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// force torque sensor.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated sensor values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Geometry.hh
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// geometry.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated geometry values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Gui.hh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// gui.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated gui values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Heightmap.hh
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// heightmap.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated heightmap values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Imu.hh
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// imu sensor.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated sensor values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Joint.hh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// joint.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated joint values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/JointAxis.hh
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// joint axis.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \param[in] _index Index of this joint axis
/// \return SDF element pointer with updated joint values.
public: sdf::ElementPtr ToElement(unsigned int _index = 0u) const;
Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Lidar.hh
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// lidar.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated sensor values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Light.hh
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// light object.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated light values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Link.hh
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// link.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated link values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Magnetometer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// magnetometer.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated sensor values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Material.hh
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// material.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated material values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Mesh.hh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// mesh.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated mesh values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Model.hh
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// model.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \param[in] _useIncludeTag When true, the model's URI is used to create
/// an SDF `<include>` rather than a `<model>`. The model's URI must be
/// first set using the `Model::SetUri` function. If the model's URI is
Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Noise.hh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// noise.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated noise values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/ParticleEmitter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// particle emitter.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated particle emitter values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Physics.hh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// physics.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated physics values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Plane.hh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// plane.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated plane values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Plugin.hh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// plugin.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated plugin values.
public: sdf::ElementPtr ToElement() const;

Expand Down
24 changes: 24 additions & 0 deletions include/sdf/Root.hh
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,31 @@ namespace sdf
/// \return A pointer to the model, nullptr if it doesn't exist
public: const sdf::Model *Model() const;

/// \brief Set the model object. This will override any existing model,
/// actor, and light object.
/// \param[in] _model The model to use.
public: void SetModel(const sdf::Model &_model);

/// \brief Get a pointer to the light object if it exists.
///
/// \return A pointer to the light, nullptr if it doesn't exist
public: const sdf::Light *Light() const;

/// \brief Set the light object. This will override any existing model,
/// actor, and light object.
/// \param[in] _light The light to use.
public: void SetLight(const sdf::Light &_light);

/// \brief Get a pointer to the actor object if it exists.
///
/// \return A pointer to the actor, nullptr if it doesn't exist
public: const sdf::Actor *Actor() const;

/// \brief Set the actor object. This will override any existing model,
/// actor, and light object.
/// \param[in] _actor The actor to use.
public: void SetActor(const sdf::Actor &_actor);

/// \brief Get a pointer to the SDF element that was generated during
/// load.
/// \return SDF element pointer. The value will be nullptr if Load has
Expand Down Expand Up @@ -183,6 +198,15 @@ namespace sdf
/// an error code and message. An empty vector indicates no error.
public: Errors UpdateGraphs();

/// \brief Create and return an SDF element filled with data from this
/// root.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \param[in] _useIncludeTag This will pass the _useIncludeTag to
/// sdf::Model::ToElement.
/// \return SDF element pointer with updated root values.
public: sdf::ElementPtr ToElement(bool _useIncludeTag = true) const;

/// \brief Private data pointer
IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
};
Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Scene.hh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// scene.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated scene values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Sensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// sensor.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated sensor values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Sky.hh
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// sky.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated sky values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Sphere.hh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// sphere.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated sphere values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Surface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// surface.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated surface values.
public: sdf::ElementPtr ToElement() const;

Expand Down
2 changes: 2 additions & 0 deletions include/sdf/Visual.hh
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// visual.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \return SDF element pointer with updated visual values.
public: sdf::ElementPtr ToElement() const;

Expand Down
6 changes: 5 additions & 1 deletion include/sdf/World.hh
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,12 @@ namespace sdf

/// \brief Create and return an SDF element filled with data from this
/// world.
/// Note that parameter passing functionality is not captured with this
/// function.
/// \param[in] _useIncludeTag This parameter is passed through to the
/// Model::ToElement function.
/// \return SDF element pointer with updated world values.
public: sdf::ElementPtr ToElement() const;
public: sdf::ElementPtr ToElement(bool _useIncludeTag = true) const;

/// \brief Get the plugins attached to this object.
/// \return A vector of Plugin, which will be empty if there are no
Expand Down
Loading

0 comments on commit c496c5b

Please sign in to comment.