moddef-cpp
Idiomatic C++ runtime for ModDef
Loading...
Searching...
No Matches
moddef::Device Class Reference

A device bound to a transport: read and write its points by id. More...

#include <device.hpp>

Public Member Functions

Result< Valueread (std::string_view point_id)
 Read and decode a point (numeric / bool / flags / fields / datetime).
 
Result< std::string_view > read_string (std::string_view point_id, std::span< char > buf)
 Read a string point (§15) into buf; returns a view into buf.
 
Result< void > write_f64 (std::string_view point_id, double value)
 Encode and write; validates access mode and §11.4 constraints first.
 
Result< void > write_i64 (std::string_view point_id, std::int64_t value)
 
Result< void > write_bool (std::string_view point_id, bool on)
 
 Device (Device &&o) noexcept
 
Deviceoperator= (Device &&o) noexcept
 
 Device (const Device &)=delete
 
Deviceoperator= (const Device &)=delete
 

Static Public Member Functions

static Result< Deviceopen (const Document &doc, std::string_view device_id, Transport &transport)
 Bind transport to the named profile in doc (empty id = first).
 

Detailed Description

A device bound to a transport: read and write its points by id.

Movable; non-copyable.

Constructor & Destructor Documentation

◆ Device() [1/2]

moddef::Device::Device ( Device &&  o)
inlinenoexcept

◆ Device() [2/2]

moddef::Device::Device ( const Device )
delete

Member Function Documentation

◆ open()

static Result< Device > moddef::Device::open ( const Document doc,
std::string_view  device_id,
Transport transport 
)
inlinestatic

Bind transport to the named profile in doc (empty id = first).

Both doc and transport must outlive the Device.

◆ read()

Result< Value > moddef::Device::read ( std::string_view  point_id)
inline

Read and decode a point (numeric / bool / flags / fields / datetime).

◆ read_string()

Result< std::string_view > moddef::Device::read_string ( std::string_view  point_id,
std::span< char >  buf 
)
inline

Read a string point (§15) into buf; returns a view into buf.

◆ write_f64()

Result< void > moddef::Device::write_f64 ( std::string_view  point_id,
double  value 
)
inline

Encode and write; validates access mode and §11.4 constraints first.

◆ write_i64()

Result< void > moddef::Device::write_i64 ( std::string_view  point_id,
std::int64_t  value 
)
inline

◆ write_bool()

Result< void > moddef::Device::write_bool ( std::string_view  point_id,
bool  on 
)
inline

◆ operator=() [1/2]

Device & moddef::Device::operator= ( Device &&  o)
inlinenoexcept

◆ operator=() [2/2]

Device & moddef::Device::operator= ( const Device )
delete

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