DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
String memory storage facility. More...
#include <StringMemoryArea.hpp>
Public Types | |
typedef unsigned int | offset_t |
typedef std::vector< std::string > | str_vector |
typedef std::map< std::string, std::string > | str_map |
Public Member Functions | |
offset_t | add (const char *str) |
size_t | clear (offset_t offset) |
const char * | get_string (offset_t offset) const |
offset_t | insert (offset_t offset, const char *str) |
void | insert (offset_t *offset, const char *str) |
offset_t | insert (offset_t offset, const str_vector &vect) |
void | insert (offset_t *offset, const str_vector &vect) |
str_vector | get_vector (offset_t offset) const |
offset_t | insert (offset_t offset, const str_map &map) |
void | insert (offset_t *offset, const str_map &map) |
str_map | get_map (offset_t offset) const |
Protected Member Functions | |
virtual const char * | string_area_read () const =0 |
read pointer for the string area | |
virtual char * | string_area_write ()=0 |
write pointer for the string area | |
virtual offset_t | last_string () const =0 |
offset of the end of the last string | |
virtual void | last_string (offset_t offset)=0 |
sets the offset of the end of last string | |
virtual size_t | string_area_size () const =0 |
size of the string area | |
Static Protected Attributes | |
static const char | STRING_SEPARATOR = (char) 3 |
character used to separate strings (i.e., to tokenize strings in vectors) | |
static const char | MAP_ENTRY_SEPARATOR = (char) 4 |
character used to separate map entries | |
String memory storage facility.
This class offers facilities to store variable length strings into a memory area. The class can also store vector of strings and arrays. Strings are manipulated using offsets those represent offset in the memory area. As the addresses are relative, they are suitable for use in memory mapped files.
Definition at line 30 of file StringMemoryArea.hpp.
unsigned int OksSystem::StringMemoryArea::offset_t |
Definition at line 32 of file StringMemoryArea.hpp.
std::map<std::string, std::string> OksSystem::StringMemoryArea::str_map |
Definition at line 34 of file StringMemoryArea.hpp.
std::vector<std::string> OksSystem::StringMemoryArea::str_vector |
Definition at line 33 of file StringMemoryArea.hpp.
OksSystem::StringMemoryArea::offset_t OksSystem::StringMemoryArea::add | ( | const char * | str | ) |
Inserts a string at the end of the string region
str | the string to insert |
Definition at line 23 of file StringMemoryArea.cpp.
size_t OksSystem::StringMemoryArea::clear | ( | offset_t | offset | ) |
Clears a string in the string region
offset | the offset of the start of the string |
Definition at line 43 of file StringMemoryArea.cpp.
OksSystem::StringMemoryArea::str_map OksSystem::StringMemoryArea::get_map | ( | offset_t | offset | ) | const |
Reads a string map from memory
offset | offset of the map in memory |
Definition at line 176 of file StringMemoryArea.cpp.
const char * OksSystem::StringMemoryArea::get_string | ( | offset_t | offset | ) | const |
Finds a string in the string area
offset | the starting offset of the string |
Definition at line 59 of file StringMemoryArea.cpp.
OksSystem::StringMemoryArea::str_vector OksSystem::StringMemoryArea::get_vector | ( | offset_t | offset | ) | const |
Extracts a vector of string from memory
offset | offset of the vector |
Definition at line 109 of file StringMemoryArea.cpp.
void OksSystem::StringMemoryArea::insert | ( | offset_t * | offset, |
const char * | str ) |
Inserts a string into memory This version updates the memory reference
address | of the offset of the string |
str | the string to insert |
Definition at line 98 of file StringMemoryArea.cpp.
Inserts a vector into memory This version updates the memory reference
address | of the offset of the string |
str | the string to insert |
Definition at line 243 of file StringMemoryArea.cpp.
void OksSystem::StringMemoryArea::insert | ( | offset_t * | offset, |
const str_vector & | vect ) |
Inserts a vector into memory This version updates the memory reference
address | of the offset of the string |
str | the string to insert |
Definition at line 165 of file StringMemoryArea.cpp.
OksSystem::StringMemoryArea::offset_t OksSystem::StringMemoryArea::insert | ( | offset_t | offset, |
const char * | str ) |
Inserts a string in the string area.
offset | offset of the existing string to replace - 0 means no offset defined |
str | the string to insert |
Definition at line 78 of file StringMemoryArea.cpp.
OksSystem::StringMemoryArea::offset_t OksSystem::StringMemoryArea::insert | ( | offset_t | offset, |
const str_map & | map ) |
Inserts a map into memory
offset | current offset of the map |
map | the map to insert |
Definition at line 221 of file StringMemoryArea.cpp.
OksSystem::StringMemoryArea::offset_t OksSystem::StringMemoryArea::insert | ( | offset_t | offset, |
const str_vector & | vect ) |
Inserts a vector in the string area
offset | the offset of the string |
vect | the vector to insert |
Definition at line 145 of file StringMemoryArea.cpp.
|
protectedpure virtual |
offset of the end of the last string
|
protectedpure virtual |
sets the offset of the end of last string
|
protectedpure virtual |
read pointer for the string area
|
protectedpure virtual |
size of the string area
|
protectedpure virtual |
write pointer for the string area
|
staticprotected |
character used to separate map entries
Definition at line 37 of file StringMemoryArea.hpp.
|
staticprotected |
character used to separate strings (i.e., to tokenize strings in vectors)
Definition at line 36 of file StringMemoryArea.hpp.