Public Member Functions | Private Attributes | List of all members
swarmio::simulator::InMemoryParameter Class Referencefinal

A strongly typed in-memory parameter target that can be made read-only. More...

#include <InMemoryParameter.h>

Inheritance diagram for swarmio::simulator::InMemoryParameter:
Inheritance graph
[legend]

Public Member Functions

virtual bool CanRead (const std::string &path) const noexceptoverride
 Determines whether the value can be read. More...
 
virtual bool CanWrite (const std::string &path) const noexceptoverride
 Determines whether the value can be written. More...
 
virtual data::Variant Get (const std::string &path) override
 Get the current value of the target. More...
 
virtual data::discovery::Field GetFieldDescriptor (const std::string &path) const override
 Get the data type of the target. More...
 
const std::string & GetPath () const
 Get the resource path of the parameter. More...
 
 InMemoryParameter (const std::string &path, bool value, bool readOnly=false)
 Create a new boolean in-memory parameter. More...
 
 InMemoryParameter (const std::string &path, const std::string &value, bool readOnly=false)
 Create a new string in-memory parameter. More...
 
 InMemoryParameter (const std::string &path, const char *value, bool readOnly=false)
 Create a new string in-memory parameter. More...
 
 InMemoryParameter (const std::string &path, int value, bool readOnly=false)
 Create a new integer in-memory parameter. More...
 
 InMemoryParameter (const std::string &path, double value, bool readOnly=false)
 Create a new integer in-memory parameter. More...
 
virtual void Set (const std::string &path, const data::Variant &value) override
 Set the current value of the target. More...
 

Private Attributes

std::string _path
 Resource path. More...
 
bool _readOnly
 Is read-only? More...
 
data::discovery::Type _type
 Type. More...
 
data::Variant _value
 Value. More...
 

Detailed Description

A strongly typed in-memory parameter target that can be made read-only.

Definition at line 14 of file InMemoryParameter.h.

Constructor & Destructor Documentation

swarmio::simulator::InMemoryParameter::InMemoryParameter ( const std::string &  path,
bool  value,
bool  readOnly = false 
)
inline

Create a new boolean in-memory parameter.

Parameters
valueValue
readOnlyIs read-only?

Definition at line 50 of file InMemoryParameter.h.

swarmio::simulator::InMemoryParameter::InMemoryParameter ( const std::string &  path,
const std::string &  value,
bool  readOnly = false 
)
inline

Create a new string in-memory parameter.

Parameters
valueValue
readOnlyIs read-only?

Definition at line 63 of file InMemoryParameter.h.

swarmio::simulator::InMemoryParameter::InMemoryParameter ( const std::string &  path,
const char *  value,
bool  readOnly = false 
)
inline

Create a new string in-memory parameter.

Parameters
valueValue
readOnlyIs read-only?

Definition at line 76 of file InMemoryParameter.h.

swarmio::simulator::InMemoryParameter::InMemoryParameter ( const std::string &  path,
int  value,
bool  readOnly = false 
)
inline

Create a new integer in-memory parameter.

Parameters
valueValue
readOnlyIs read-only?

Definition at line 89 of file InMemoryParameter.h.

swarmio::simulator::InMemoryParameter::InMemoryParameter ( const std::string &  path,
double  value,
bool  readOnly = false 
)
inline

Create a new integer in-memory parameter.

Parameters
valueValue
readOnlyIs read-only?

Definition at line 102 of file InMemoryParameter.h.

Member Function Documentation

virtual bool swarmio::simulator::InMemoryParameter::CanRead ( const std::string &  path) const
inlineoverridevirtualnoexcept

Determines whether the value can be read.

Returns
True if Get operations are allowed

Reimplemented from swarmio::services::keyvalue::Target.

Definition at line 240 of file InMemoryParameter.h.

virtual bool swarmio::simulator::InMemoryParameter::CanWrite ( const std::string &  path) const
inlineoverridevirtualnoexcept

Determines whether the value can be written.

Returns
True if Set operations are allowed

Reimplemented from swarmio::services::keyvalue::Target.

Definition at line 223 of file InMemoryParameter.h.

virtual data::Variant swarmio::simulator::InMemoryParameter::Get ( const std::string &  path)
inlineoverridevirtual

Get the current value of the target.

Returns
data::Variant

Implements swarmio::services::keyvalue::Target.

Definition at line 114 of file InMemoryParameter.h.

virtual data::discovery::Field swarmio::simulator::InMemoryParameter::GetFieldDescriptor ( const std::string &  path) const
inlineoverridevirtual

Get the data type of the target.

Returns
data::discovery::Type

Implements swarmio::services::keyvalue::Target.

Definition at line 204 of file InMemoryParameter.h.

const std::string& swarmio::simulator::InMemoryParameter::GetPath ( ) const
inline

Get the resource path of the parameter.

Returns
const std::string&

Definition at line 257 of file InMemoryParameter.h.

virtual void swarmio::simulator::InMemoryParameter::Set ( const std::string &  path,
const data::Variant &  value 
)
inlineoverridevirtual

Set the current value of the target.

Parameters
valueNew value

Implements swarmio::services::keyvalue::Target.

Definition at line 131 of file InMemoryParameter.h.

Member Data Documentation

std::string swarmio::simulator::InMemoryParameter::_path
private

Resource path.

Definition at line 40 of file InMemoryParameter.h.

bool swarmio::simulator::InMemoryParameter::_readOnly
private

Is read-only?

Definition at line 34 of file InMemoryParameter.h.

data::discovery::Type swarmio::simulator::InMemoryParameter::_type
private

Type.

Definition at line 28 of file InMemoryParameter.h.

data::Variant swarmio::simulator::InMemoryParameter::_value
private

Value.

Definition at line 22 of file InMemoryParameter.h.


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


swarmros
Author(s):
autogenerated on Fri Apr 3 2020 03:42:48