restructured

This commit is contained in:
Jeff Hill
2002-04-30 22:14:26 +00:00
parent 5b4426baf8
commit 877518ab26
2 changed files with 300 additions and 199 deletions

View File

@@ -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 ();
}