use placement new

This commit is contained in:
Jeff Hill
2002-10-23 23:37:30 +00:00
parent 340e0c1d58
commit e36083d5ef
22 changed files with 712 additions and 455 deletions

View File

@@ -22,14 +22,14 @@
* johill@lanl.gov
*/
#include <stdexcept>
#define epicsAssertAuthor "Jeff Hill johill@lanl.gov"
#include "iocinf.h"
#include "comBuf.h"
epicsSingleton < tsFreeList < class comBuf, 0x20 > > comBuf::pFreeList;
bool comBuf::flushToWire ( wireSendAdapter & wire )
bool comBuf::flushToWire ( wireSendAdapter & wire ) throw ()
{
unsigned occupied = this->occupiedBytes ();
while ( occupied ) {
@@ -44,7 +44,7 @@ bool comBuf::flushToWire ( wireSendAdapter & wire )
return true;
}
unsigned comBuf::push ( const epicsInt16 * pValue, unsigned nElem )
unsigned comBuf::push ( const epicsInt16 * pValue, unsigned nElem ) throw ()
{
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
for ( unsigned i = 0u; i < nElem; i++ ) {
@@ -56,7 +56,7 @@ unsigned comBuf::push ( const epicsInt16 * pValue, unsigned nElem )
return nElem;
}
unsigned comBuf::push ( const epicsUInt16 * pValue, unsigned nElem )
unsigned comBuf::push ( const epicsUInt16 * pValue, unsigned nElem ) throw ()
{
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
for ( unsigned i = 0u; i < nElem; i++ ) {
@@ -68,7 +68,7 @@ unsigned comBuf::push ( const epicsUInt16 * pValue, unsigned nElem )
return nElem;
}
unsigned comBuf::push ( const epicsInt32 * pValue, unsigned nElem )
unsigned comBuf::push ( const epicsInt32 * pValue, unsigned nElem ) throw ()
{
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
for ( unsigned i = 0u; i < nElem; i++ ) {
@@ -84,7 +84,7 @@ unsigned comBuf::push ( const epicsInt32 * pValue, unsigned nElem )
return nElem;
}
unsigned comBuf::push ( const epicsUInt32 * pValue, unsigned nElem )
unsigned comBuf::push ( const epicsUInt32 * pValue, unsigned nElem ) throw ()
{
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
for ( unsigned i = 0u; i < nElem; i++ ) {
@@ -100,7 +100,7 @@ unsigned comBuf::push ( const epicsUInt32 * pValue, unsigned nElem )
return nElem;
}
unsigned comBuf::push ( const epicsFloat32 * pValue, unsigned nElem )
unsigned comBuf::push ( const epicsFloat32 * pValue, unsigned nElem ) throw ()
{
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
for ( unsigned i = 0u; i < nElem; i++ ) {
@@ -111,7 +111,7 @@ unsigned comBuf::push ( const epicsFloat32 * pValue, unsigned nElem )
return nElem;
}
unsigned comBuf::push ( const epicsFloat64 * pValue, unsigned nElem )
unsigned comBuf::push ( const epicsFloat64 * pValue, unsigned nElem ) throw ()
{
nElem = this->unoccupiedElem ( sizeof (*pValue), nElem );
for ( unsigned i = 0u; i < nElem; i++ ) {
@@ -124,7 +124,17 @@ unsigned comBuf::push ( const epicsFloat64 * pValue, unsigned nElem )
// throwing the exception from a function that isnt inline
// shrinks the GNU compiled object code
void comBuf::throwInsufficentBytesException ()
void comBuf::throwInsufficentBytesException ()
throw ( insufficentBytesAvailable )
{
throw insufficentBytesAvailable ();
}
void comBuf::operator delete ( void *pCadaver )
throw ( std::logic_error )
{
throw std::logic_error
( "compiler is confused about placement delete" );
}
comBufMemoryManager::~comBufMemoryManager () {}