moddef-cpp
Idiomatic C++ runtime for ModDef
Loading...
Searching...
No Matches
moddef Namespace Reference

Namespaces

namespace  detail
 

Classes

class  Device
 A device bound to a transport: read and write its points by id. More...
 
class  Document
 A parsed ModDef document. More...
 
class  Transport
 Blocking register-level transport. More...
 
class  Value
 A decoded point value: a typed view over the C core's md_value_t. More...
 

Typedefs

template<class T >
using Result = std::expected< T, Error >
 The canonical result type across the API; Result<void> for actions.
 

Enumerations

enum class  Error : int {
  Ok = MD_OK , Transport = MD_ERR_TRANSPORT , Parse = MD_ERR_PARSE , NotFound = MD_ERR_NOT_FOUND ,
  ShortRead = MD_ERR_SHORT_READ , Buffer = MD_ERR_BUFFER , UnresolvedRef = MD_ERR_UNRESOLVED_REF , ZeroScaleDenominator = MD_ERR_ZERO_SCALE_DEN ,
  ComposedBase = MD_ERR_COMPOSED_BASE , NotWritable = MD_ERR_NOT_WRITABLE , WrongType = MD_ERR_WRONG_TYPE , Unsupported = MD_ERR_UNSUPPORTED ,
  ConstraintMin = MD_ERR_CONSTRAINT_MIN , ConstraintMax = MD_ERR_CONSTRAINT_MAX , ConstraintStep = MD_ERR_CONSTRAINT_STEP , ConstraintAllowed = MD_ERR_CONSTRAINT_ALLOWED ,
  Discovery = MD_ERR_DISCOVERY , Unavailable = MD_ERR_UNAVAILABLE
}
 Strongly typed mirror of md_err_t (same underlying values, so casts are free in both directions). More...
 
enum class  ValueKind : std::uint8_t {
  F64 = MD_VAL_F64 , U64 = MD_VAL_U64 , I64 = MD_VAL_I64 , Bool = MD_VAL_BOOL ,
  Flags = MD_VAL_FLAGS , Fields = MD_VAL_FIELDS , DateTime = MD_VAL_DATETIME , Unavailable = MD_VAL_UNAVAILABLE
}
 

Functions

Error from_c (md_err_t e) noexcept
 
md_err_t to_c (Error e) noexcept
 
std::string_view to_string (Error e) noexcept
 
template<class T >
Result< T > ok_or (md_err_t e, T value)
 
Result< void > check (md_err_t e)
 
md_str_t to_c (std::string_view s) noexcept
 
std::string_view from_c (md_str_t s) noexcept
 

Typedef Documentation

◆ Result

template<class T >
using moddef::Result = typedef std::expected<T, Error>

The canonical result type across the API; Result<void> for actions.

Enumeration Type Documentation

◆ Error

enum class moddef::Error : int
strong

Strongly typed mirror of md_err_t (same underlying values, so casts are free in both directions).

Enumerator
Ok 
Transport 
Parse 
NotFound 
ShortRead 
Buffer 
UnresolvedRef 
ZeroScaleDenominator 
ComposedBase 
NotWritable 
WrongType 
Unsupported 
ConstraintMin 
ConstraintMax 
ConstraintStep 
ConstraintAllowed 
Discovery 
Unavailable 

◆ ValueKind

enum class moddef::ValueKind : std::uint8_t
strong
Enumerator
F64 
U64 
I64 
Bool 
Flags 
Fields 
DateTime 
Unavailable 

Function Documentation

◆ from_c() [1/2]

Error moddef::from_c ( md_err_t  e)
inlinenoexcept

◆ to_c() [1/2]

md_err_t moddef::to_c ( Error  e)
inlinenoexcept

◆ to_string()

std::string_view moddef::to_string ( Error  e)
inlinenoexcept

◆ ok_or()

template<class T >
Result< T > moddef::ok_or ( md_err_t  e,
value 
)
inline

◆ check()

Result< void > moddef::check ( md_err_t  e)
inline

◆ to_c() [2/2]

md_str_t moddef::to_c ( std::string_view  s)
inlinenoexcept

◆ from_c() [2/2]

std::string_view moddef::from_c ( md_str_t  s)
inlinenoexcept