Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::ConfigEntryBase Class Reference

Base class for individual configuration entries. More...

#include <ConfigEntry.hxx>

Inheritance diagram for openlcb::ConfigEntryBase:
openlcb::ConfigReference openlcb::BytesConfigEntry< SIZE > openlcb::EmptyGroup< N > openlcb::NumericConfigEntry< TR > openlcb::RepeatedGroup< Group, N > openlcb::StringConfigEntry< SIZE > openlcb::ToplevelEntryBase openlcb::EventConfigEntry openlcb::Acdi openlcb::Identification

Static Public Member Functions

template<typename... Args>
static constexpr GroupConfigOptions group_opts (Args... args)
 
static void handle_events (const EventOffsetCallback &fn)
 

Protected Member Functions

template<class T >
raw_read (int fd) const
 Reads a given typed variable from the configuration file.
 
template<class T >
void raw_write (int fd, const T &value) const
 Writes a given typed variable to the configuration file.
 
void repeated_read (int fd, void *buf, size_t size) const
 Performs a reliable read from the given FD.
 
void repeated_write (int fd, const void *buf, size_t size) const
 Performs a reliable write to the given FD.
 

Additional Inherited Members

- Public Member Functions inherited from openlcb::ConfigReference
constexpr ConfigReference (unsigned offset)
 Initializes the config reference from a configuration space offset.
 
constexpr ConfigReference (const ConfigReference &ref)
 Initializes the config reference from an existing config reference.
 
constexpr unsigned offset () const
 
- Protected Attributes inherited from openlcb::ConfigReference
unsigned offset_
 zero-based offset from the beginning of the configuration file.
 

Detailed Description

Base class for individual configuration entries.

Defines helper methods for reading and writing.

Definition at line 91 of file ConfigEntry.hxx.

Member Function Documentation

◆ group_opts()

template<typename... Args>
static constexpr GroupConfigOptions openlcb::ConfigEntryBase::group_opts ( Args...  args)
inlinestaticconstexpr

Definition at line 97 of file ConfigEntry.hxx.

◆ handle_events()

static void openlcb::ConfigEntryBase::handle_events ( const EventOffsetCallback fn)
inlinestatic

Definition at line 102 of file ConfigEntry.hxx.

◆ raw_read()

template<class T >
T openlcb::ConfigEntryBase::raw_read ( int  fd) const
inlineprotected

Reads a given typed variable from the configuration file.

DOes not do any binary conversion (only reads raw data).

Parameters
fdfile to read data from.
Returns
the raw value read from the configuration file.

Definition at line 112 of file ConfigEntry.hxx.

◆ raw_write()

template<class T >
void openlcb::ConfigEntryBase::raw_write ( int  fd,
const T &  value 
) const
inlineprotected

Writes a given typed variable to the configuration file.

Does not do any binary conversion.

Parameters
fdfile to write data to.
valuethe raw value to write to the configuration file.

Definition at line 126 of file ConfigEntry.hxx.

◆ repeated_read()

void openlcb::ConfigEntryBase::repeated_read ( int  fd,
void *  buf,
size_t  size 
) const
protected

Performs a reliable read from the given FD.

Crashes if the read fails.

Parameters
fdthe file to read data from
bufthe location to write data to
sizehow many bytes to read

Definition at line 45 of file ConfigEntry.cxx.

◆ repeated_write()

void openlcb::ConfigEntryBase::repeated_write ( int  fd,
const void *  buf,
size_t  size 
) const
protected

Performs a reliable write to the given FD.

Crashes if the write fails.

Parameters
fdthe file to write data to
bufthe location of the data to write
sizehow many bytes to write

Definition at line 52 of file ConfigEntry.cxx.


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