restructured
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
epicsSingleton < tsFreeList < class comBuf, 0x20 > > comBuf::pFreeList;
|
||||
|
||||
bool comBuf::flushToWire ( wireSendAdapter &wire )
|
||||
bool comBuf::flushToWire ( wireSendAdapter & wire )
|
||||
{
|
||||
unsigned occupied = this->occupiedBytes ();
|
||||
while ( occupied ) {
|
||||
@@ -36,3 +36,87 @@ bool comBuf::flushToWire ( wireSendAdapter &wire )
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned comBuf::push ( const epicsInt16 *pValue, unsigned nElem )
|
||||
{
|
||||
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
|
||||
for ( unsigned i = 0u; i < nElem; i++ ) {
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 8u );
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 0u );
|
||||
}
|
||||
return nElem;
|
||||
}
|
||||
|
||||
unsigned comBuf::push ( const epicsUInt16 *pValue, unsigned nElem )
|
||||
{
|
||||
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
|
||||
for ( unsigned i = 0u; i < nElem; i++ ) {
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 8u );
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 0u );
|
||||
}
|
||||
return nElem;
|
||||
}
|
||||
|
||||
unsigned comBuf::push ( const epicsInt32 *pValue, unsigned nElem )
|
||||
{
|
||||
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
|
||||
for ( unsigned i = 0u; i < nElem; i++ ) {
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 24u );
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 16u );
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 8u );
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 0u );
|
||||
}
|
||||
return nElem;
|
||||
}
|
||||
|
||||
unsigned comBuf::push ( const epicsUInt32 *pValue, unsigned nElem )
|
||||
{
|
||||
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
|
||||
for ( unsigned i = 0u; i < nElem; i++ ) {
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 24u );
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 16u );
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 8u );
|
||||
this->buf[this->nextWriteIndex++] =
|
||||
static_cast < epicsUInt8 > ( pValue[i] >> 0u );
|
||||
}
|
||||
return nElem;
|
||||
}
|
||||
|
||||
unsigned comBuf::push ( const epicsFloat32 *pValue, unsigned nElem )
|
||||
{
|
||||
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
|
||||
for ( unsigned i = 0u; i < nElem; i++ ) {
|
||||
// allow native floating point formats to be converted to IEEE
|
||||
osiConvertToWireFormat ( pValue[i], &this->buf[this->nextWriteIndex] );
|
||||
this->nextWriteIndex += sizeof ( *pValue );
|
||||
}
|
||||
return nElem;
|
||||
}
|
||||
|
||||
unsigned comBuf::push ( const epicsFloat64 *pValue, unsigned nElem )
|
||||
{
|
||||
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
|
||||
for ( unsigned i = 0u; i < nElem; i++ ) {
|
||||
// allow native floating point formats to be converted to IEEE
|
||||
osiConvertToWireFormat ( pValue[i], &this->buf[this->nextWriteIndex] );
|
||||
this->nextWriteIndex += sizeof ( *pValue );
|
||||
}
|
||||
return nElem;
|
||||
}
|
||||
|
||||
// throwing the exception from a function that isnt inline
|
||||
// shrinks the GNU compiled object code
|
||||
void comBuf::throwInsufficentBytesException ()
|
||||
{
|
||||
throw insufficentBytesAvailable ();
|
||||
}
|
||||
Reference in New Issue
Block a user