|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
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. | |
| typedef void(* | AnalyzeFunction )(const void *data, int siz, const std::type_info &type) |
| Definition of the buffer analyzer. | |
Public Member Functions | |
| StreamBuffer (bool do_swap=true) | |
| Standard constructor. | |
| virtual | ~StreamBuffer () |
| Standard destructor. | |
| const char * | data () const |
| Read access to data buffer. | |
| char * | data () |
| write access to data buffer | |
| void | erase () |
| Reset the buffer. | |
| void | reserve (long len) |
| Reserve buffer space; Default: 16 k buffer size. | |
| void | extend (long len) |
| Extend the buffer. | |
| long | size () const |
| Total buffer size. | |
| ContainedLinks & | containedLinks () |
| Access to contained links. | |
| const ContainedLinks & | containedLinks () const |
| CONST Access to contained links. | |
| IdentifiedLinks & | identifiedLinks () |
| Access to identified links. | |
| const IdentifiedLinks & | identifiedLinks () const |
| CONST Access to identified links. | |
| void | setMode (Mode m) |
| Set mode of the stream and allocate buffer. | |
| bool | isReading () const |
| Get stream buffer state. | |
| bool | isWriting () const |
| Get stream buffer state. | |
| long | buffPointer () const |
| Retrieve current buffer pointer. | |
| void | setBuffPointer (long ptr) |
| Retrieve current buffer pointer. | |
| void | setAnalyzer (AnalyzeFunction fun=0) |
| Enable user analysis function. | |
| void | swapToBuffer (const void *source, int siz) |
| Swap buffers: int, long, short, float and double. | |
| void | swapFromBuffer (void *target, int siz) |
| Swap buffers: int, long, short, float and double. | |
| StreamBuffer & | writeBytes (const char *str, long len) |
| Write string to output stream. | |
| 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<< (longlong data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (longlong &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (int data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (int &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (unsigned int data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (unsigned int &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (long data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (long &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (unsigned long data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (unsigned long &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (short data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (short &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (unsigned short data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (unsigned short &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (char data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (char &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (unsigned char data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (unsigned char &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (float data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (float &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (double data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (double &data) |
| Input Streamer. | |
| StreamBuffer & | operator>> (char *data) |
| Streamer to read strings in (char*) format. | |
| StreamBuffer & | operator<< (const char *data) |
| Streamer to write strings in (char*) format. | |
| StreamBuffer & | operator>> (std::string &data) |
| Streamer to read strings in (std::string) format. | |
| StreamBuffer & | operator<< (const std::string &data) |
| Streamer to write strings in (std::string) format. | |
| template<class TYPE > | |
| StreamBuffer & | operator>> (TYPE *&refpObject) |
| Streamer to read links to contained or identified objects. | |
| StreamBuffer & | operator<< (const ContainedObject *pObject) |
| Streamer to write links to contained objects. | |
| StreamBuffer & | operator<< (const DataObject *pObject) |
| Streamer to write links to identified objects. | |
| void | serialize (DataIO &ioObject) |
| Serialize the buffer using an IO object. | |
Protected Member Functions | |
| SwapAction | swapBuffer (int siz) const |
| Check for byte swapping. | |
| template<class TYPE > | |
| StreamBuffer & | getObjectPointer (const DataObject *pObject, TYPE *&refpObject) |
| Helper to distinguis between identified pointers and contained pointers. | |
| template<class TYPE > | |
| StreamBuffer & | getObjectPointer (const ContainedObject *pObject, TYPE *&refpObject) |
| Helper to distinguis between identified pointers and contained pointers. | |
Protected Attributes | |
| Mode | m_mode |
| Boolean indicating wether the stream is in read or write mode. | |
| long | m_pointer |
| Current buffer pointer. | |
| long | m_length |
| Total buffer length. | |
| char * | m_buffer |
| Pointer to heap buffer. | |
| bool | m_swapEnabled |
| Flag indicating swapping. | |
| ContainedLinks | m_containedLinks |
| Container with links to contained objects. | |
| IdentifiedLinks | m_identifiedLinks |
| Container with links to contained objects. | |
| AnalyzeFunction | m_analyzer |
| Hook function for analysis of data to the stream. | |
Friends | |
| class | DataObject |
| DataObject is friend. | |
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) 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 40 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 153 of file StreamBuffer.h.
Definition at line 149 of file StreamBuffer.h.
Definition of the identifiable link set.
Definition at line 151 of file StreamBuffer.h.
| enum StreamBuffer::Mode |
Streamer mode.
Definition at line 114 of file StreamBuffer.h.
00114 {UNINITIALIZED, READING, WRITING};
| enum StreamBuffer::State |
Link state defintions.
Definition at line 118 of file StreamBuffer.h.
Data Sawp actions.
Definition at line 116 of file StreamBuffer.h.
00116 {SINGLE_BYTE, SWAP, NOSWAP};
| StreamBuffer::StreamBuffer | ( | bool | do_swap = true |
) | [inline] |
Standard constructor.
Definition at line 207 of file StreamBuffer.h.
00208 : 00209 m_mode(UNINITIALIZED), 00210 m_pointer(0), 00211 m_length(0), 00212 m_buffer(0), 00213 m_swapEnabled(do_swap) 00214 { 00215 m_analyzer = 0; }
| virtual StreamBuffer::~StreamBuffer | ( | ) | [inline, virtual] |
Standard destructor.
Definition at line 217 of file StreamBuffer.h.
00217 { 00218 ::free( m_buffer ); 00219 }
| void StreamBuffer::addContainedLink | ( | const ContainedObject * | pObject, | |
| long | hint, | |||
| long | link | |||
| ) | [inline] |
Definition at line 332 of file StreamBuffer.h.
00332 { 00333 m_containedLinks.push_back( ContainedLink((ContainedObject*)pObject, hint, link) ); 00334 }
| void StreamBuffer::addIdentifiedLink | ( | const DataObject * | pObject, | |
| long | hint | |||
| ) | [inline] |
Definition at line 321 of file StreamBuffer.h.
00321 { 00322 m_identifiedLinks.push_back( IdentifiedLink((DataObject*)pObject, hint) ); 00323 }
| long StreamBuffer::buffPointer | ( | ) | const [inline] |
Retrieve current buffer pointer.
Definition at line 289 of file StreamBuffer.h.
00289 { 00290 return m_pointer; 00291 }
| const ContainedLinks& StreamBuffer::containedLinks | ( | ) | const [inline] |
CONST Access to contained links.
Definition at line 258 of file StreamBuffer.h.
00258 { 00259 return m_containedLinks; 00260 }
| ContainedLinks& StreamBuffer::containedLinks | ( | ) | [inline] |
Access to contained links.
Definition at line 254 of file StreamBuffer.h.
00254 { 00255 return m_containedLinks; 00256 }
| char* StreamBuffer::data | ( | ) | [inline] |
write access to data buffer
Definition at line 225 of file StreamBuffer.h.
00225 { 00226 return m_buffer; 00227 }
| const char* StreamBuffer::data | ( | ) | const [inline] |
Read access to data buffer.
Definition at line 221 of file StreamBuffer.h.
00221 { 00222 return m_buffer; 00223 }
| void StreamBuffer::erase | ( | ) | [inline] |
Reset the buffer.
Definition at line 229 of file StreamBuffer.h.
00229 { 00230 m_pointer = 0; 00231 }
| void StreamBuffer::extend | ( | long | len | ) | [inline] |
Extend the buffer.
Definition at line 240 of file StreamBuffer.h.
| void StreamBuffer::getContainedLink | ( | ContainedObject *& | pObject, | |
| long & | hint, | |||
| long & | link | |||
| ) | [inline] |
Definition at line 325 of file StreamBuffer.h.
00325 { 00326 ContainedLink& l = m_containedLinks.back(); 00327 pObject = l.first; 00328 hint = l.second; 00329 link = l.third; 00330 m_containedLinks.pop_back(); 00331 }
| void StreamBuffer::getIdentifiedLink | ( | DataObject *& | pObject, | |
| long & | hint | |||
| ) | [inline] |
Definition at line 315 of file StreamBuffer.h.
00315 { 00316 IdentifiedLink& l = m_identifiedLinks.back(); 00317 pObject = l.first; 00318 hint = l.second; 00319 m_identifiedLinks.pop_back(); 00320 }
| StreamBuffer& StreamBuffer::getObjectPointer | ( | const ContainedObject * | pObject, | |
| TYPE *& | refpObject | |||
| ) | [inline, protected] |
Helper to distinguis between identified pointers and contained pointers.
This entry resolves contained pointers (= Pointers to ContainedObject instances.)
Definition at line 198 of file StreamBuffer.h.
00198 { 00199 ContainedLink& link = m_containedLinks.back(); 00200 ContainedObject* pObj = link.first; 00201 m_containedLinks.pop_back(); 00202 refpObject = dynamic_cast<TYPE*>(pObj); 00203 return *this; 00204 }
| StreamBuffer& StreamBuffer::getObjectPointer | ( | const DataObject * | pObject, | |
| TYPE *& | refpObject | |||
| ) | [inline, protected] |
Helper to distinguis between identified pointers and contained pointers.
This entry resolves identified pointers (= Pointers to DataObject instances.)
Definition at line 188 of file StreamBuffer.h.
00188 { 00189 IdentifiedLink& link = m_identifiedLinks.back(); 00190 DataObject* pObj = link.first; 00191 m_identifiedLinks.pop_back(); 00192 refpObject = dynamic_cast<TYPE*>(pObj); 00193 return *this; 00194 }
| const IdentifiedLinks& StreamBuffer::identifiedLinks | ( | ) | const [inline] |
CONST Access to identified links.
Definition at line 267 of file StreamBuffer.h.
00267 { 00268 return m_identifiedLinks; 00269 }
| IdentifiedLinks& StreamBuffer::identifiedLinks | ( | ) | [inline] |
Access to identified links.
Definition at line 263 of file StreamBuffer.h.
00263 { 00264 return m_identifiedLinks; 00265 }
| bool StreamBuffer::isReading | ( | ) | const [inline] |
Get stream buffer state.
Definition at line 280 of file StreamBuffer.h.
| bool StreamBuffer::isWriting | ( | ) | const [inline] |
Get stream buffer state.
Definition at line 285 of file StreamBuffer.h.
| StreamBuffer& StreamBuffer::operator<< | ( | const DataObject * | pObject | ) | [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 549 of file StreamBuffer.h.
00549 { 00550 STREAM_ANALYSE(pObject, sizeof(pObject)); 00551 addIdentifiedLink(pObject, INVALID); 00552 return *this; 00553 }
| StreamBuffer& StreamBuffer::operator<< | ( | const ContainedObject * | pObject | ) | [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 537 of file StreamBuffer.h.
00537 { 00538 STREAM_ANALYSE(pObject, sizeof(pObject)); 00539 addContainedLink(pObject, INVALID, INVALID); 00540 return *this; 00541 }
| StreamBuffer& StreamBuffer::operator<< | ( | const std::string & | data | ) | [inline] |
Streamer to write strings in (std::string) format.
Definition at line 510 of file StreamBuffer.h.
00510 { 00511 if ( 0 == m_analyzer) { 00512 const char* ptr = data.c_str(); 00513 long len = data.length(); 00514 writeBytes(ptr, len); 00515 } 00516 else { 00517 STREAM_ANALYSE(data, sizeof(data)); 00518 } 00519 return *this; 00520 }
| StreamBuffer& StreamBuffer::operator<< | ( | const char * | data | ) | [inline] |
Streamer to write strings in (char*) format.
Definition at line 490 of file StreamBuffer.h.
00490 { 00491 const char* ptr = 0 == data ? "" : data; 00492 int len = strlen(ptr)+1; 00493 if ( 0 == m_analyzer ) 00494 writeBytes(ptr, len); 00495 else { 00496 STREAM_ANALYSE(data, len); 00497 } 00498 return *this; 00499 }
| StreamBuffer& StreamBuffer::operator<< | ( | double | data | ) | [inline] |
Output Streamer.
Definition at line 470 of file StreamBuffer.h.
00470 { 00471 swapToBuffer(&data, sizeof(data)); 00472 STREAM_ANALYSE(data, sizeof(data)); 00473 return *this; 00474 }
| StreamBuffer& StreamBuffer::operator<< | ( | float | data | ) | [inline] |
Output Streamer.
Definition at line 459 of file StreamBuffer.h.
00459 { 00460 swapToBuffer(&data, sizeof(data)); 00461 STREAM_ANALYSE(data, sizeof(data)); 00462 return *this; 00463 }
| StreamBuffer& StreamBuffer::operator<< | ( | unsigned char | data | ) | [inline] |
Output Streamer.
Definition at line 448 of file StreamBuffer.h.
00448 { 00449 swapToBuffer(&data, sizeof(data)); 00450 STREAM_ANALYSE(data, sizeof(data)); 00451 return *this; 00452 }
| StreamBuffer& StreamBuffer::operator<< | ( | char | data | ) | [inline] |
Output Streamer.
Definition at line 437 of file StreamBuffer.h.
00437 { 00438 swapToBuffer(&data, sizeof(data)); 00439 STREAM_ANALYSE(data, sizeof(data)); 00440 return *this; 00441 }
| StreamBuffer& StreamBuffer::operator<< | ( | unsigned short | data | ) | [inline] |
Output Streamer.
Definition at line 426 of file StreamBuffer.h.
00426 { 00427 swapToBuffer(&data, sizeof(data)); 00428 STREAM_ANALYSE(data, sizeof(data)); 00429 return *this; 00430 }
| StreamBuffer& StreamBuffer::operator<< | ( | short | data | ) | [inline] |
Output Streamer.
Definition at line 415 of file StreamBuffer.h.
00415 { 00416 swapToBuffer(&data, sizeof(data)); 00417 STREAM_ANALYSE(data, sizeof(data)); 00418 return *this; 00419 }
| StreamBuffer& StreamBuffer::operator<< | ( | unsigned long | data | ) | [inline] |
Output Streamer.
Definition at line 404 of file StreamBuffer.h.
00404 { 00405 swapToBuffer(&data, sizeof(data)); 00406 STREAM_ANALYSE(data, sizeof(data)); 00407 return *this; 00408 }
| StreamBuffer& StreamBuffer::operator<< | ( | long | data | ) | [inline] |
Output Streamer.
Definition at line 393 of file StreamBuffer.h.
00393 { 00394 swapToBuffer(&data, sizeof(data)); 00395 STREAM_ANALYSE(data, sizeof(data)); 00396 return *this; 00397 }
| StreamBuffer& StreamBuffer::operator<< | ( | unsigned int | data | ) | [inline] |
Output Streamer.
Definition at line 382 of file StreamBuffer.h.
00382 { 00383 swapToBuffer(&data, sizeof(data)); 00384 STREAM_ANALYSE(data, sizeof(data)); 00385 return *this; 00386 }
| StreamBuffer& StreamBuffer::operator<< | ( | int | data | ) | [inline] |
Output Streamer.
Definition at line 371 of file StreamBuffer.h.
00371 { 00372 swapToBuffer(&data, sizeof(data)); 00373 STREAM_ANALYSE(data, sizeof(data)); 00374 return *this; 00375 }
| StreamBuffer& StreamBuffer::operator<< | ( | longlong | data | ) | [inline] |
Output Streamer.
Definition at line 360 of file StreamBuffer.h.
00360 { 00361 swapToBuffer(&data, sizeof(data)); 00362 STREAM_ANALYSE(data, sizeof(data)); 00363 return *this; 00364 }
| StreamBuffer& StreamBuffer::operator>> | ( | TYPE *& | refpObject | ) | [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 527 of file StreamBuffer.h.
00527 { 00528 return getObjectPointer(refpObject, refpObject); 00529 }
| StreamBuffer& StreamBuffer::operator>> | ( | std::string & | data | ) | [inline] |
Streamer to read strings in (std::string) format.
Definition at line 501 of file StreamBuffer.h.
| StreamBuffer& StreamBuffer::operator>> | ( | char * | data | ) | [inline] |
| StreamBuffer& StreamBuffer::operator>> | ( | double & | data | ) | [inline] |
Input Streamer.
Definition at line 476 of file StreamBuffer.h.
00476 { 00477 swapFromBuffer(&data, sizeof(data)); 00478 return *this; 00479 }
| StreamBuffer& StreamBuffer::operator>> | ( | float & | data | ) | [inline] |
Input Streamer.
Definition at line 465 of file StreamBuffer.h.
00465 { 00466 swapFromBuffer(&data, sizeof(data)); 00467 return *this; 00468 }
| StreamBuffer& StreamBuffer::operator>> | ( | unsigned char & | data | ) | [inline] |
Input Streamer.
Definition at line 454 of file StreamBuffer.h.
00454 { 00455 swapFromBuffer(&data, sizeof(data)); 00456 return *this; 00457 }
| StreamBuffer& StreamBuffer::operator>> | ( | char & | data | ) | [inline] |
Input Streamer.
Definition at line 443 of file StreamBuffer.h.
00443 { 00444 swapFromBuffer(&data, sizeof(data)); 00445 return *this; 00446 }
| StreamBuffer& StreamBuffer::operator>> | ( | unsigned short & | data | ) | [inline] |
Input Streamer.
Definition at line 432 of file StreamBuffer.h.
00432 { 00433 swapFromBuffer(&data, sizeof(data)); 00434 return *this; 00435 }
| StreamBuffer& StreamBuffer::operator>> | ( | short & | data | ) | [inline] |
Input Streamer.
Definition at line 421 of file StreamBuffer.h.
00421 { 00422 swapFromBuffer(&data, sizeof(data)); 00423 return *this; 00424 }
| StreamBuffer& StreamBuffer::operator>> | ( | unsigned long & | data | ) | [inline] |
Input Streamer.
Definition at line 410 of file StreamBuffer.h.
00410 { 00411 swapFromBuffer(&data, sizeof(data)); 00412 return *this; 00413 }
| StreamBuffer& StreamBuffer::operator>> | ( | long & | data | ) | [inline] |
Input Streamer.
Definition at line 399 of file StreamBuffer.h.
00399 { 00400 swapFromBuffer(&data, sizeof(data)); 00401 return *this; 00402 }
| StreamBuffer& StreamBuffer::operator>> | ( | unsigned int & | data | ) | [inline] |
Input Streamer.
Definition at line 388 of file StreamBuffer.h.
00388 { 00389 swapFromBuffer(&data, sizeof(data)); 00390 return *this; 00391 }
| StreamBuffer& StreamBuffer::operator>> | ( | int & | data | ) | [inline] |
Input Streamer.
Definition at line 377 of file StreamBuffer.h.
00377 { 00378 swapFromBuffer(&data, sizeof(data)); 00379 return *this; 00380 }
| StreamBuffer& StreamBuffer::operator>> | ( | longlong & | data | ) | [inline] |
Input Streamer.
Definition at line 366 of file StreamBuffer.h.
00366 { 00367 swapFromBuffer(&data, sizeof(data)); 00368 return *this; 00369 }
| void StreamBuffer::reserve | ( | long | len | ) | [inline] |
| void StreamBuffer::serialize | ( | DataIO & | ioObject | ) | [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 561 of file StreamBuffer.h.
00561 { 00562 ioObject.serialize ( *this ); 00563 m_pointer = 0; 00564 }
| void StreamBuffer::setAnalyzer | ( | AnalyzeFunction | fun = 0 |
) | [inline] |
Enable user analysis function.
Definition at line 297 of file StreamBuffer.h.
00297 { 00298 m_analyzer = fun; 00299 }
| void StreamBuffer::setBuffPointer | ( | long | ptr | ) | [inline] |
Retrieve current buffer pointer.
Definition at line 293 of file StreamBuffer.h.
00293 { 00294 m_pointer = ptr; 00295 }
| void StreamBuffer::setMode | ( | Mode | m | ) | [inline] |
Set mode of the stream and allocate buffer.
Definition at line 272 of file StreamBuffer.h.
00272 { 00273 m_mode = m; 00274 m_pointer = 0; 00275 m_containedLinks.erase (m_containedLinks.begin(), m_containedLinks.end()); 00276 m_identifiedLinks.erase(m_identifiedLinks.begin(),m_identifiedLinks.end()); 00277 }
| long StreamBuffer::size | ( | ) | const [inline] |
Total buffer size.
Definition at line 250 of file StreamBuffer.h.
00250 { 00251 return m_length; 00252 }
| StreamBuffer::SwapAction StreamBuffer::swapBuffer | ( | int | siz | ) | const [inline, protected] |
Check for byte swapping.
Definition at line 570 of file StreamBuffer.h.
00570 { 00571 switch(siz) { 00572 case 1: 00573 return SINGLE_BYTE; 00574 default: 00575 #if defined(__alpha) && !defined(__VMS) 00576 // return m_swapEnabled ? SWAP : NOSWAP; 00577 return NOSWAP; 00578 #elif defined(__sun) && defined(__SVR4) && defined(__i386) 00579 // return m_swapEnabled ? SWAP : NOSWAP; 00580 return NOSWAP; 00581 #elif defined(__APPLE__) 00582 // return m_swapEnabled ? SWAP : NOSWAP; 00583 return SWAP; 00584 #elif defined(__linux) && !defined(__powerpc) 00585 // return m_swapEnabled ? SWAP : NOSWAP; 00586 return NOSWAP; 00587 #elif defined(BORLAND) || defined(_WIN32) || defined(WIN32) 00588 // return m_swapEnabled ? SWAP : NOSWAP; 00589 return NOSWAP; 00590 #else 00591 return m_swapEnabled ? SWAP : NOSWAP; 00592 // return NOSWAP; 00593 #endif 00594 } 00595 }
| void StreamBuffer::swapFromBuffer | ( | void * | target, | |
| int | siz | |||
| ) | [inline] |
Swap buffers: int, long, short, float and double.
Swap bytes from the stream buffer to target buffer with arbitray size.
Definition at line 621 of file StreamBuffer.h.
00621 { 00622 char* tar = (char*)target; 00623 char* src = (char*)m_buffer+m_pointer; 00624 switch ( swapBuffer(siz) ) { 00625 case SINGLE_BYTE: 00626 *tar = *src; 00627 break; 00628 case SWAP: 00629 #ifdef __APPLE__ 00630 for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i]; 00631 #else 00632 ::_swab (src, tar, siz); 00633 #endif 00634 break; 00635 case NOSWAP: 00636 ::memcpy(tar, src, siz); 00637 break; 00638 } 00639 m_pointer += siz; 00640 }
| void StreamBuffer::swapToBuffer | ( | const void * | source, | |
| int | siz | |||
| ) | [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 598 of file StreamBuffer.h.
00598 { 00599 char buff[8], *tar, *src = (char*)source; 00600 extend (m_pointer+siz); 00601 tar = (char*)m_buffer+m_pointer; 00602 switch ( swapBuffer(siz) ) { 00603 case SINGLE_BYTE: 00604 *tar = *src; 00605 break; 00606 case SWAP: 00607 #ifdef __APPLE__ 00608 for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i]; 00609 #else 00610 ::_swab (src, buff, siz); 00611 #endif 00612 src = buff; 00613 case NOSWAP: 00614 memcpy(tar, src, siz); 00615 break; 00616 } 00617 m_pointer += siz; 00618 }
| StreamBuffer& StreamBuffer::writeBytes | ( | const char * | str, | |
| long | len | |||
| ) | [inline] |
Write string to output stream.
Definition at line 307 of file StreamBuffer.h.
00307 { 00308 extend( m_pointer+len+4 ); 00309 *this << len; 00310 memcpy(data()+buffPointer(), str, len); 00311 m_pointer += len; 00312 return *this; 00313 }
friend class DataObject [friend] |
DataObject is friend.
Definition at line 155 of file StreamBuffer.h.
AnalyzeFunction StreamBuffer::m_analyzer [protected] |
Hook function for analysis of data to the stream.
Definition at line 180 of file StreamBuffer.h.
char* StreamBuffer::m_buffer [protected] |
Pointer to heap buffer.
Definition at line 168 of file StreamBuffer.h.
ContainedLinks StreamBuffer::m_containedLinks [protected] |
Container with links to contained objects.
Definition at line 174 of file StreamBuffer.h.
IdentifiedLinks StreamBuffer::m_identifiedLinks [protected] |
Container with links to contained objects.
Definition at line 177 of file StreamBuffer.h.
long StreamBuffer::m_length [protected] |
Total buffer length.
Definition at line 165 of file StreamBuffer.h.
Mode StreamBuffer::m_mode [protected] |
Boolean indicating wether the stream is in read or write mode.
Definition at line 159 of file StreamBuffer.h.
long StreamBuffer::m_pointer [protected] |
Current buffer pointer.
Definition at line 162 of file StreamBuffer.h.
bool StreamBuffer::m_swapEnabled [protected] |
Flag indicating swapping.
Definition at line 171 of file StreamBuffer.h.