![]() |
The Gaudi Framework
v31r0 (aeb156f0)
|
The stream buffer is a small object collecting object data. More...
#include <GaudiKernel/StreamBuffer.h>
Classes | |
class | ContainedLink |
Definition of the contained link set. More... | |
class | DataIO |
A small base class to handle generic data streaming. More... | |
class | IdentifiedLink |
Definition of the contained link set. More... | |
class | Istream |
Reader for standard input streams. More... | |
class | Ostream |
Writer for standard output streams. More... | |
Public Types | |
enum | Mode { UNINITIALIZED, READING, WRITING } |
Streamer mode. More... | |
enum | SwapAction { SINGLE_BYTE, SWAP, NOSWAP } |
Data Sawp actions. More... | |
enum | State { INVALID = -1, VALID } |
Link state defintions. More... | |
typedef std::vector< ContainedLink > | ContainedLinks |
typedef std::vector< IdentifiedLink > | IdentifiedLinks |
Definition of the identifiable link set. More... | |
typedef void(* | AnalyzeFunction) (const void *data, int siz, const std::type_info &type) |
Definition of the buffer analyzer. More... | |
Public Member Functions | |
StreamBuffer (bool do_swap=true) | |
Standard constructor. More... | |
virtual | ~StreamBuffer () |
Standard destructor. More... | |
const char * | data () const |
Read access to data buffer. More... | |
char * | data () |
write access to data buffer More... | |
void | erase () |
Reset the buffer. More... | |
char * | adopt () const |
Remove the data buffer and pass it to client. It's the client responsability to free the memory. More... | |
void | reserve (long len) |
Reserve buffer space; Default: 16 k buffer size. More... | |
void | extend (long len) |
Extend the buffer. More... | |
long | size () const |
Total buffer size. More... | |
ContainedLinks & | containedLinks () |
Access to contained links. More... | |
const ContainedLinks & | containedLinks () const |
CONST Access to contained links. More... | |
IdentifiedLinks & | identifiedLinks () |
Access to identified links. More... | |
const IdentifiedLinks & | identifiedLinks () const |
CONST Access to identified links. More... | |
void | setMode (Mode m) |
Set mode of the stream and allocate buffer. More... | |
bool | isReading () const |
Get stream buffer state. More... | |
bool | isWriting () const |
Get stream buffer state. More... | |
long | buffPointer () const |
Retrieve current buffer pointer. More... | |
void | setBuffPointer (long ptr) |
Retrieve current buffer pointer. More... | |
void | setAnalyzer (AnalyzeFunction fun=nullptr) |
Enable user analysis function. More... | |
void | swapToBuffer (const void *source, int siz) |
Swap buffers: int, long, short, float and double. More... | |
void | swapFromBuffer (void *target, int siz) |
Swap buffers: int, long, short, float and double. More... | |
StreamBuffer & | writeBytes (const char *str, long len) |
Write string to output stream. More... | |
void | getIdentifiedLink (DataObject *&pObject, long &hint) |
void | addIdentifiedLink (const DataObject *pObject, long hint) |
void | getContainedLink (ContainedObject *&pObject, long &hint, long &link) |
void | addContainedLink (const ContainedObject *pObject, long hint, long link) |
StreamBuffer & | operator<< (long long data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (long long &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (int data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (int &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (unsigned int data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (unsigned int &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (long data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (long &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (unsigned long data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (unsigned long &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (short data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (short &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (unsigned short data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (unsigned short &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (char data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (char &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (unsigned char data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (unsigned char &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (float data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (float &data) |
Input Streamer. More... | |
StreamBuffer & | operator<< (double data) |
Output Streamer. More... | |
StreamBuffer & | operator>> (double &data) |
Input Streamer. More... | |
StreamBuffer & | operator>> (char *data) |
Streamer to read strings in (char*) format. More... | |
StreamBuffer & | operator<< (const char *data) |
Streamer to write strings in (char*) format. More... | |
StreamBuffer & | operator>> (std::string &data) |
Streamer to read strings in (std::string) format. More... | |
StreamBuffer & | operator<< (const std::string &data) |
Streamer to write strings in (std::string) format. More... | |
template<class TYPE > | |
StreamBuffer & | operator>> (TYPE *&refpObject) |
Streamer to read links to contained or identified objects. More... | |
StreamBuffer & | operator<< (const ContainedObject *pObject) |
Streamer to write links to contained objects. More... | |
StreamBuffer & | operator<< (const DataObject *pObject) |
Streamer to write links to identified objects. More... | |
void | serialize (DataIO &ioObject) |
Serialize the buffer using an IO object. More... | |
Protected Member Functions | |
SwapAction | swapBuffer (int siz) const |
Check for byte swapping. More... | |
template<class TYPE > | |
StreamBuffer & | getObjectPointer (const DataObject *, TYPE *&refpObject) |
Helper to distinguish between identified pointers and contained pointers. More... | |
template<class TYPE > | |
StreamBuffer & | getObjectPointer (const ContainedObject *, TYPE *&refpObject) |
Helper to distinguish between identified pointers and contained pointers. More... | |
Protected Attributes | |
Mode | m_mode = UNINITIALIZED |
Boolean indicating wether the stream is in read or write mode. More... | |
long | m_pointer = 0 |
Current buffer pointer. More... | |
long | m_length = 0 |
Total buffer length. More... | |
char * | m_buffer = nullptr |
Pointer to heap buffer. More... | |
bool | m_swapEnabled = true |
Flag indicating swapping. More... | |
ContainedLinks | m_containedLinks |
Container with links to contained objects. More... | |
IdentifiedLinks | m_identifiedLinks |
Container with links to contained objects. More... | |
AnalyzeFunction | m_analyzer = nullptr |
Hook function for analysis of data to the stream. More... | |
Friends | |
class | DataObject |
DataObject is friend. More... | |
The stream buffer is a small object collecting object data.
The basic idea behind the StreamBuffer is generic object conversion. The StreamBuffer acts as a byte stream (hence inheriting from a std::string: DP: this is not true anymore and it is not a bad thing in my opinion) and stores any information streamed to the buffer. Since the information must be represented in a generic way on the fly byte swapping is performed. However, not only primitive data can be stored in the buffer, but also pointers to DataObjects (symbolic links) and pointers to contained objects. Automatically during serialization the persistent references to the corresponding objects and containers must be stored. These objects are accessible from the StreamBuffer object.
"On the fly" data conversion to non persistent
Definition at line 41 of file StreamBuffer.h.
typedef void( * StreamBuffer::AnalyzeFunction) (const void *data, int siz, const std::type_info &type) |
Definition of the buffer analyzer.
Definition at line 136 of file StreamBuffer.h.
Definition at line 132 of file StreamBuffer.h.
Definition of the identifiable link set.
Definition at line 134 of file StreamBuffer.h.
enum StreamBuffer::Mode |
Streamer mode.
Enumerator | |
---|---|
UNINITIALIZED | |
READING | |
WRITING |
Definition at line 107 of file StreamBuffer.h.
enum StreamBuffer::State |
Link state defintions.
Enumerator | |
---|---|
INVALID | |
VALID |
Definition at line 111 of file StreamBuffer.h.
Data Sawp actions.
Enumerator | |
---|---|
SINGLE_BYTE | |
SWAP | |
NOSWAP |
Definition at line 109 of file StreamBuffer.h.
|
inline |
Standard constructor.
Definition at line 193 of file StreamBuffer.h.
|
inlinevirtual |
|
inline |
Definition at line 292 of file StreamBuffer.h.
|
inline |
Definition at line 281 of file StreamBuffer.h.
|
inline |
Remove the data buffer and pass it to client. It's the client responsability to free the memory.
Definition at line 203 of file StreamBuffer.h.
|
inline |
|
inline |
Access to contained links.
Definition at line 232 of file StreamBuffer.h.
|
inline |
CONST Access to contained links.
Definition at line 234 of file StreamBuffer.h.
|
inline |
|
inline |
|
inline |
|
inline |
Extend the buffer.
Definition at line 220 of file StreamBuffer.h.
|
inline |
Definition at line 285 of file StreamBuffer.h.
|
inline |
Definition at line 275 of file StreamBuffer.h.
|
inlineprotected |
Helper to distinguish between identified pointers and contained pointers.
This entry resolves identified pointers (= Pointers to DataObject instances.)
Definition at line 172 of file StreamBuffer.h.
|
inlineprotected |
Helper to distinguish between identified pointers and contained pointers.
This entry resolves contained pointers (= Pointers to ContainedObject instances.)
Definition at line 183 of file StreamBuffer.h.
|
inline |
Access to identified links.
Definition at line 237 of file StreamBuffer.h.
|
inline |
CONST Access to identified links.
Definition at line 239 of file StreamBuffer.h.
|
inline |
Get stream buffer state.
Definition at line 250 of file StreamBuffer.h.
|
inline |
Get stream buffer state.
Definition at line 253 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 321 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 332 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 343 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 354 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 365 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 376 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 387 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 398 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 409 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 420 of file StreamBuffer.h.
|
inline |
Output Streamer.
Definition at line 431 of file StreamBuffer.h.
|
inline |
Streamer to write strings in (char*) format.
Definition at line 449 of file StreamBuffer.h.
|
inline |
Streamer to write strings in (std::string) format.
Definition at line 467 of file StreamBuffer.h.
|
inline |
Streamer to write links to contained objects.
Links to contained objects are not stored immediately, but collected instead and analyzed later.
pObject | Pointer to object to be loaded. |
Definition at line 494 of file StreamBuffer.h.
|
inline |
Streamer to write links to identified objects.
Links to identified objects are not stored immediately, but collected instead and analyzed later.
pObject | Pointer to object to be loaded. |
Definition at line 506 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 327 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 338 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 349 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 360 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 371 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 382 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 393 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 404 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 415 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 426 of file StreamBuffer.h.
|
inline |
Input Streamer.
Definition at line 437 of file StreamBuffer.h.
|
inline |
Streamer to read strings in (char*) format.
Definition at line 442 of file StreamBuffer.h.
|
inline |
Streamer to read strings in (std::string) format.
Definition at line 460 of file StreamBuffer.h.
|
inline |
Streamer to read links to contained or identified objects.
The specified internal function call distinguishes between contained and identified objects.
refpObject | Reference to pointer to object to be loaded. |
Definition at line 484 of file StreamBuffer.h.
|
inline |
Reserve buffer space; Default: 16 k buffer size.
Definition at line 213 of file StreamBuffer.h.
|
inline |
Serialize the buffer using an IO object.
The streambuffer object will make use of a DataIO object, which can be specialized for streaming to any representation like e.g. disk files, Root files, Objectivity etc.
ioObject | Reference to data IO object. |
Definition at line 518 of file StreamBuffer.h.
|
inline |
Enable user analysis function.
Definition at line 259 of file StreamBuffer.h.
|
inline |
|
inline |
Set mode of the stream and allocate buffer.
Definition at line 242 of file StreamBuffer.h.
|
inline |
|
inlineprotected |
Check for byte swapping.
Definition at line 527 of file StreamBuffer.h.
|
inline |
Swap buffers: int, long, short, float and double.
Swap bytes from the stream buffer to target buffer with arbitray size.
Definition at line 581 of file StreamBuffer.h.
|
inline |
Swap buffers: int, long, short, float and double.
Swap bytes from a source buffer to the stream buffer with arbitray size.
Definition at line 555 of file StreamBuffer.h.
|
inline |
Write string to output stream.
Definition at line 267 of file StreamBuffer.h.
|
friend |
DataObject is friend.
Definition at line 138 of file StreamBuffer.h.
|
protected |
Hook function for analysis of data to the stream.
Definition at line 163 of file StreamBuffer.h.
|
mutableprotected |
Pointer to heap buffer.
Definition at line 151 of file StreamBuffer.h.
|
mutableprotected |
Container with links to contained objects.
Definition at line 157 of file StreamBuffer.h.
|
mutableprotected |
Container with links to contained objects.
Definition at line 160 of file StreamBuffer.h.
|
mutableprotected |
Total buffer length.
Definition at line 148 of file StreamBuffer.h.
|
protected |
Boolean indicating wether the stream is in read or write mode.
Definition at line 142 of file StreamBuffer.h.
|
mutableprotected |
Current buffer pointer.
Definition at line 145 of file StreamBuffer.h.
|
protected |
Flag indicating swapping.
Definition at line 154 of file StreamBuffer.h.