DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
StringMemoryArea.hpp
Go to the documentation of this file.
1/*
2 * StringMemoryArea.h
3 * OksSystem
4 *
5 * Created by Matthias Wiesmann on 17.02.05.
6 * Copyright 2005 CERN. All rights reserved.
7 *
8 */
9
10#ifndef OKSSYSTEM_STRING_MEMORY_AREA
11#define OKSSYSTEM_STRING_MEMORY_AREA
12
13#include <map>
14#include <vector>
15
16namespace OksSystem {
17
31public:
32 typedef unsigned int offset_t ;
33 typedef std::vector<std::string> str_vector ;
34 typedef std::map<std::string, std::string> str_map ;
35protected:
36 static const char STRING_SEPARATOR ;
37 static const char MAP_ENTRY_SEPARATOR ;
38 virtual const char * string_area_read() const = 0 ;
39 virtual char* string_area_write() = 0 ;
40 virtual offset_t last_string() const = 0 ;
41 virtual void last_string(offset_t offset) = 0 ;
42 virtual size_t string_area_size() const = 0 ;
43public:
44 offset_t add(const char *str) ;
45 size_t clear(offset_t offset) ;
46 const char* get_string(offset_t offset) const ;
47 offset_t insert(offset_t offset, const char* str) ;
48 void insert(offset_t *offset, const char* str) ;
50 void insert(offset_t *offset, const str_vector &vect) ;
53 void insert(offset_t *offset, const str_map &map) ;
55 } ; // StringMemoryArea
56
57} // okssystem
58
59#endif
String memory storage facility.
virtual char * string_area_write()=0
write pointer for the string area
virtual size_t string_area_size() const =0
size of the string area
size_t clear(offset_t offset)
const char * get_string(offset_t offset) const
std::vector< std::string > str_vector
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
static const char STRING_SEPARATOR
character used to separate strings (i.e., to tokenize strings in vectors)
static const char MAP_ENTRY_SEPARATOR
character used to separate map entries
str_vector get_vector(offset_t offset) const
std::map< std::string, std::string > str_map
offset_t insert(offset_t offset, const char *str)
str_map get_map(offset_t offset) const
offset_t add(const char *str)
virtual const char * string_area_read() const =0
read pointer for the string area
double offset