Public Member Functions | Public Attributes | List of all members
sdf::v12::Plugin Class Reference

#include <Plugin.hh>

Public Member Functions

 Plugin ()
 Default constructor. More...
 
 Plugin (const Plugin &_plugin)
 Copy constructor. More...
 
 Plugin (const std::string &_filename, const std::string &_name, const std::string &_xmlContent="")
 A constructor that initializes the plugin's filename, name, and optionally the content. More...
 
 Plugin (Plugin &&_plugin) noexcept
 Move constructor. More...
 
 ~Plugin ()
 Default destructor. More...
 
void ClearContents ()
 Remove the contents of the plugin, this is everything that is a child element of the <plugin>. More...
 
const std::vector< sdf::ElementPtr > & Contents () const
 Get the plugin contents. More...
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load. More...
 
std::string Filename () const
 Get the filename of the shared library. More...
 
void InsertContent (const sdf::ElementPtr _elem)
 Insert an element into the plugin content. More...
 
bool InsertContent (const std::string _content)
 Insert XML content into this plugin. More...
 
Errors Load (ElementPtr _sdf)
 Load the plugin based on a element pointer. More...
 
std::string Name () const
 Get the name of the plugin. More...
 
bool operator!= (const Plugin &_plugin) const
 Plugin inequality operator. More...
 
Pluginoperator= (const Plugin &_plugin)
 Copy assignment operator. More...
 
Pluginoperator= (Plugin &&_plugin) noexcept
 Move assignment operator. More...
 
bool operator== (const Plugin &_plugin) const
 Plugin equality operator. More...
 
void SetFilename (const std::string &_filename)
 Set the filename of the shared library. More...
 
void SetName (const std::string &_name)
 Set the name of the plugin. More...
 
sdf::ElementPtr ToElement () const
 Create and return an SDF element filled with data from this plugin. More...
 

Public Attributes

std::unique_ptr< sdf::PluginPrivate > dataPtr
 Private data pointer. More...
 

Constructor & Destructor Documentation

◆ Plugin() [1/4]

sdf::v12::Plugin::Plugin ( )

Default constructor.

◆ ~Plugin()

sdf::v12::Plugin::~Plugin ( )

Default destructor.

◆ Plugin() [2/4]

sdf::v12::Plugin::Plugin ( const Plugin _plugin)

Copy constructor.

Parameters
[in]_pluginPlugin to copy.

◆ Plugin() [3/4]

sdf::v12::Plugin::Plugin ( Plugin &&  _plugin)
noexcept

Move constructor.

Parameters
[in]_pluginPlugin to copy.

◆ Plugin() [4/4]

sdf::v12::Plugin::Plugin ( const std::string &  _filename,
const std::string &  _name,
const std::string &  _xmlContent = "" 
)

A constructor that initializes the plugin's filename, name, and optionally the content.

Parameters
[in]_filenameFilename of the shared library associated with this plugin.
[in]_nameThe name of the plugin.
[in]_xmlContentOptional XML content that will be stored in this plugin.

Member Function Documentation

◆ ClearContents()

void sdf::v12::Plugin::ClearContents ( )

Remove the contents of the plugin, this is everything that is a child element of the <plugin>.

◆ Contents()

const std::vector<sdf::ElementPtr>& sdf::v12::Plugin::Contents ( ) const

Get the plugin contents.

This is all the SDF elements that are children of the <plugin>.

Returns
The child elements of this plugin.

◆ Element()

sdf::ElementPtr sdf::v12::Plugin::Element ( ) const

Get a pointer to the SDF element that was used during load.

Returns
SDF element pointer. The value will be nullptr if Load has not been called.

◆ Filename()

std::string sdf::v12::Plugin::Filename ( ) const

Get the filename of the shared library.

Returns
Filename of the shared library associated with the plugin.

◆ InsertContent() [1/2]

void sdf::v12::Plugin::InsertContent ( const sdf::ElementPtr  _elem)

Insert an element into the plugin content.

This does not modify the values in the sdf::ElementPtr returned by the Element() function.

Parameters
[in]_elemElement to insert.

◆ InsertContent() [2/2]

bool sdf::v12::Plugin::InsertContent ( const std::string  _content)

Insert XML content into this plugin.

This function does not modify the values in the sdf::ElementPtr returned by the Element() function. The provided content must be valid XML.

Parameters
[in]_contentA string that contains valid XML. The XML is inserted into this plugin if it is valid.
Returns
False if the provided content was invalid, in which case the content of this plugin is not modified. True otherwise

◆ Load()

Errors sdf::v12::Plugin::Load ( ElementPtr  _sdf)

Load the plugin based on a element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ Name()

std::string sdf::v12::Plugin::Name ( ) const

Get the name of the plugin.

The name of the plugin should be unique within the scope of its parent.

Returns
Name of the plugin.

◆ operator!=()

bool sdf::v12::Plugin::operator!= ( const Plugin _plugin) const

Plugin inequality operator.

Parameters
[in]_pluginPlugin to compare against.
Returns
True if this plugin does not match the provided plugin. The name, filename, or contents must be different to return false.

◆ operator=() [1/2]

Plugin& sdf::v12::Plugin::operator= ( const Plugin _plugin)

Copy assignment operator.

Parameters
[in]_pluginPlugin to copy
Returns
A reference to this plugin

◆ operator=() [2/2]

Plugin& sdf::v12::Plugin::operator= ( Plugin &&  _plugin)
noexcept

Move assignment operator.

Parameters
[in]_pluginPlugin to move
Returns
A reference to this plugin

◆ operator==()

bool sdf::v12::Plugin::operator== ( const Plugin _plugin) const

Plugin equality operator.

Parameters
[in]_pluginPlugin to compare against.
Returns
True if this plugin matches the provided plugin. The name, filename, and contents must all match to return true.

◆ SetFilename()

void sdf::v12::Plugin::SetFilename ( const std::string &  _filename)

Set the filename of the shared library.

Parameters
[in]_filenameFilename of the shared library associated with this plugin.

◆ SetName()

void sdf::v12::Plugin::SetName ( const std::string &  _name)

Set the name of the plugin.

The name of the plugin should be unique within the scope of its parent.

Parameters
[in]_nameName of the plugin.

◆ ToElement()

sdf::ElementPtr sdf::v12::Plugin::ToElement ( ) const

Create and return an SDF element filled with data from this plugin.

Note that parameter passing functionality is not captured with this function.

Returns
SDF element pointer with updated plugin values.

Member Data Documentation

◆ dataPtr

std::unique_ptr<sdf::PluginPrivate> sdf::v12::Plugin::dataPtr

Private data pointer.


The documentation for this class was generated from the following file: