Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
StoredBitSet Class Referenceabstract

Abstract class for representing a set of numbered bits that are stored persistently in some backing store. More...

#include <StoredBitSet.hxx>

Inheritance diagram for StoredBitSet:
ShadowedStoredBitSet EEPROMStoredBitSet< HW >

Public Member Functions

virtual StoredBitSetset_bit (unsigned offset, bool value)=0
 Sets an individual bit to a specific value.
 
virtual bool get_bit (unsigned offset)=0
 Retrieves an individual bit.
 
virtual StoredBitSetset_multi (unsigned offset, unsigned size, unsigned value)=0
 Sets a block of consecutive bits.
 
virtual unsigned get_multi (unsigned offset, unsigned size)=0
 Returns a block of consecutive bits as an integer value.
 
virtual unsigned size ()=0
 
virtual void flush ()=0
 Writes the current values to persistent storage.
 
virtual void lock_and_flush ()=0
 Grabs a lock and writes the current values to persistent storage.
 

Detailed Description

Abstract class for representing a set of numbered bits that are stored persistently in some backing store.

Definition at line 47 of file StoredBitSet.hxx.

Member Function Documentation

◆ flush()

virtual void StoredBitSet::flush ( )
pure virtual

Writes the current values to persistent storage.

The caller is responsible for locking.

Implemented in EEPROMStoredBitSet< HW >.

◆ get_bit()

virtual bool StoredBitSet::get_bit ( unsigned  offset)
pure virtual

Retrieves an individual bit.

Parameters
offsetis the bit number to retrieve.
Returns
the last set bit value.

Implemented in ShadowedStoredBitSet.

◆ get_multi()

virtual unsigned StoredBitSet::get_multi ( unsigned  offset,
unsigned  size 
)
pure virtual

Returns a block of consecutive bits as an integer value.

Parameters
offsetis the number of the first bit to retrieve.
sizeis the number of bits to retrieve.
Returns
the unsigned value that the last set bits represent, with LSB-first (bit 0 will be from offset; bit 1 will be from offset + 1, etc.)

Implemented in ShadowedStoredBitSet.

◆ lock_and_flush()

virtual void StoredBitSet::lock_and_flush ( )
pure virtual

Grabs a lock and writes the current values to persistent storage.

Implemented in ShadowedStoredBitSet.

◆ set_bit()

virtual StoredBitSet & StoredBitSet::set_bit ( unsigned  offset,
bool  value 
)
pure virtual

Sets an individual bit to a specific value.

This call is thread-safe.

Parameters
offsetis the bit number to set.
valueis the new value for that bit.
Returns
*this.

Implemented in ShadowedStoredBitSet.

◆ set_multi()

virtual StoredBitSet & StoredBitSet::set_multi ( unsigned  offset,
unsigned  size,
unsigned  value 
)
pure virtual

Sets a block of consecutive bits.

This call is thread-safe.

Parameters
offsetis the number of the first bit to set.
sizeis the number of bits to set.
valuecontains the data to write, LSB (bit 0) goes to "offset", bit 1 goes to offset + 1, etc.; bits at and above size are checked to be zero.
Returns
*this.

Implemented in ShadowedStoredBitSet.

◆ size()

virtual unsigned StoredBitSet::size ( )
pure virtual
Returns
the number of bits in the storage. Valid offsets are 0..size()-1.

Implemented in ShadowedStoredBitSet.


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