This is Unofficial EPICS BASE Doxygen Site
comQueRecv.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 
10 /*
11  *
12  *
13  * L O S A L A M O S
14  * Los Alamos National Laboratory
15  * Los Alamos, New Mexico 87545
16  *
17  * Copyright, 1986, The Regents of the University of California.
18  *
19  *
20  * Author Jeffrey O. Hill
21  * johill@lanl.gov
22  * 505 665 1831
23  */
24 
25 #ifndef INC_comQueRecv_H
26 #define INC_comQueRecv_H
27 
28 #include "comBuf.h"
29 
30 class comQueRecv {
31 public:
33  ~comQueRecv ();
34  unsigned occupiedBytes () const;
35  unsigned copyOutBytes ( epicsInt8 *pBuf, unsigned nBytes );
36  unsigned removeBytes ( unsigned nBytes );
37  void pushLastComBufReceived ( comBuf & );
38  void clear ();
39  bool popOldMsgHeader ( struct caHdrLargeArray & );
40  epicsInt8 popInt8 ();
48  void popString ( epicsOldString * );
49 private:
51  comBufMemoryManager & comBufMemMgr;
52  unsigned nBytesPending;
53  epicsUInt16 multiBufferPopUInt16 ();
54  epicsUInt32 multiBufferPopUInt32 ();
55  void removeAndDestroyBuf ( comBuf & );
56  comQueRecv ( const comQueRecv & );
57  comQueRecv & operator = ( const comQueRecv & );
58 };
59 
60 inline unsigned comQueRecv::occupiedBytes () const
61 {
62  return this->nBytesPending;
63 }
64 
66 {
67  return static_cast < epicsInt8 > ( this->popUInt8() );
68 }
69 
71 {
72  return static_cast < epicsInt16 > ( this->popUInt16() );
73 }
74 
76 {
77  return static_cast < epicsInt32 > ( this->popUInt32() );
78 }
79 
80 // this has been optimized to aligned convert, maybe more could be done,
81 // but since it is currently not used ...
83 {
84  union {
85  epicsUInt8 _wire[ sizeof ( epicsFloat32 ) ];
86  epicsFloat32 _fp;
87  } tmp;
88  // optimizer will unroll this loop
89  for ( unsigned i = 0u; i < sizeof ( tmp._wire ); i++ ) {
90  tmp._wire[i] = this->popUInt8 ();
91  }
92  return AlignedWireRef < epicsFloat32 > ( tmp._fp );
93 }
94 
95 // this has been optimized to aligned convert, maybe more could be done,
96 // but since it is currently not used ...
98 {
99  union {
100  epicsUInt8 _wire[ sizeof ( epicsFloat64 ) ];
101  epicsFloat64 _fp;
102  } tmp;
103  // optimizer will unroll this loop
104  for ( unsigned i = 0u; i < sizeof ( tmp._wire ); i++ ) {
105  tmp._wire[i] = this->popUInt8 ();
106  }
107  return AlignedWireRef < epicsFloat64 > ( tmp._fp );
108 }
109 
110 #endif // ifndef INC_comQueRecv_H
epicsUInt8 popUInt8()
Definition: comQueRecv.cpp:174
void clear()
Definition: comQueRecv.cpp:38
char epicsOldString[MAX_STRING_SIZE]
Definition: epicsTypes.h:66
double epicsFloat64
Definition: epicsTypes.h:49
int i
Definition: scan.c:967
unsigned short epicsUInt16
Definition: epicsTypes.h:41
bool popOldMsgHeader(struct caHdrLargeArray &)
Definition: comQueRecv.cpp:230
unsigned char epicsUInt8
Definition: epicsTypes.h:39
epicsInt8 popInt8()
Definition: comQueRecv.h:65
unsigned int epicsUInt32
Definition: epicsTypes.h:43
epicsUInt16 popUInt16()
Definition: comQueRecv.cpp:192
comQueRecv(comBufMemoryManager &)
Definition: comQueRecv.cpp:28
float epicsFloat32
Definition: epicsTypes.h:48
unsigned removeBytes(unsigned nBytes)
Definition: comQueRecv.cpp:69
epicsFloat32 popFloat32()
Definition: comQueRecv.h:82
unsigned occupiedBytes() const
Definition: comQueRecv.h:60
char epicsInt8
Definition: epicsTypes.h:38
void popString(epicsOldString *)
Definition: comQueRecv.cpp:95
epicsInt32 popInt32()
Definition: comQueRecv.h:75
Definition: comBuf.h:75
unsigned copyOutBytes(epicsInt8 *pBuf, unsigned nBytes)
Definition: comQueRecv.cpp:48
epicsInt16 popInt16()
Definition: comQueRecv.h:70
short epicsInt16
Definition: epicsTypes.h:40
void pushLastComBufReceived(comBuf &)
Definition: comQueRecv.cpp:102
int epicsInt32
Definition: epicsTypes.h:42
epicsUInt32 popUInt32()
Definition: comQueRecv.cpp:211
epicsFloat64 popFloat64()
Definition: comQueRecv.h:97