compatibility with vxWorks

This commit is contained in:
Unknown
2012-09-05 14:11:07 +02:00
parent cfc9ebefb0
commit 55df2e06e2
9 changed files with 29 additions and 84 deletions

View File

@@ -33,3 +33,4 @@ INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
-include $(TOP)/configure/CONFIG_SITE.local
-include $(TOP)/../CONFIG.local

View File

@@ -24,3 +24,4 @@ EPICS_BASE=/home/install/epics/base
# EPICS_BASE=/home/install/epics/base
-include $(TOP)/configure/RELEASE.local
-include $(TOP)/../RELEASE.local

View File

@@ -23,6 +23,7 @@
using std::tr1::static_pointer_cast;
using std::size_t;
using std::min;
namespace epics { namespace pvData {
@@ -69,11 +70,7 @@ template<typename T>
void BasePVScalar<T>::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const {
pflusher->ensureBuffer(sizeof(T));
#if defined (__GNUC__) &&__GNUC__ < 3
pbuffer->put(value);
#else
pbuffer->put<T>(value);
#endif
}
template<typename T>
@@ -81,11 +78,7 @@ void BasePVScalar<T>::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher)
{
pflusher->ensureData(sizeof(T));
#if defined (__GNUC__) &&__GNUC__ < 3
value = pbuffer->get(pbuffer);
#else
value = pbuffer->get<T>();
#endif
value = pbuffer->GET(T);
}
typedef BasePVScalar<boolean> BasePVBoolean;
@@ -342,12 +335,12 @@ void DefaultPVArray<T>::deserialize(ByteBuffer *pbuffer,
size_t i = 0;
while(true) {
/*
size_t maxIndex = std::min(size-i, (int)(pbuffer->getRemaining()/sizeof(T)))+i;
size_t maxIndex = min(size-i, (int)(pbuffer->getRemaining()/sizeof(T)))+i;
for(; i<maxIndex; i++)
value[i] = pbuffer->get<T>();
*/
size_t maxCount = std::min(size-i, (pbuffer->getRemaining()/sizeof(T)));
pbuffer->getArray<T>(get(), maxCount);
size_t maxCount = min(size-i, (pbuffer->getRemaining()/sizeof(T)));
pbuffer->getArray(get(), maxCount);
i += maxCount;
if(i<size)
@@ -384,14 +377,14 @@ void DefaultPVArray<T>::serialize(ByteBuffer *pbuffer,
while(true) {
/*
size_t maxIndex = std::min<int>(end-i, (int)(pbuffer->getRemaining()/sizeof(T)))+i;
size_t maxIndex = min<int>(end-i, (int)(pbuffer->getRemaining()/sizeof(T)))+i;
for(; i<maxIndex; i++)
pbuffer->put<T>(value[i]);
*/
size_t maxCount = std::min<int>(end-i, (int)(pbuffer->getRemaining()/sizeof(T)));
size_t maxCount = min<int>(end-i, (int)(pbuffer->getRemaining()/sizeof(T)));
T * pvalue = const_cast<T *>(get());
pbuffer->putArray<T>(pvalue, maxCount);
pbuffer->putArray(pvalue, maxCount);
i += maxCount;
if(i<end)

View File

@@ -168,6 +168,12 @@ inline double swap(double val)
#define ADAPTIVE_ACCESS true
#define USE_INLINE_MEMCPY true
#if defined (__GNUC__) && (__GNUC__ < 3)
#define GET(T) get((T*)0)
#else
#define GET(T) get<T>()
#endif
/**
* This class implements {@code Bytebuffer} that is like the {@code java.nio.ByteBuffer}.
* <p>A {@code BitSet} is not safe for multithreaded use without
@@ -322,7 +328,7 @@ public:
*
* @return The object.
*/
#if defined (__GNUC__) && __GNUC__ < 3
#if defined (__GNUC__) && (__GNUC__ < 3)
template<typename T>
inline T get(const T*);
#else
@@ -494,102 +500,48 @@ public:
* @param value The value.
*/
inline void putDouble (std::size_t index, double value) { put<double>(index, value); }
#if defined (__GNUC__) && __GNUC__ < 3
/**
* Get a boolean value from the byte buffer.
*
* @return The value.
*/
inline bool getBoolean() { return get((int8*)0) != 0; }
inline bool getBoolean() { return GET( int8) != 0; }
/**
* Get a byte value from the byte buffer.
*
* @return The value.
*/
inline int8 getByte () { return get((int8*)0); }
inline int8 getByte () { return GET( int8); }
/**
* Get a short value from the byte buffer.
*
* @return The value.
*/
inline int16 getShort () { return get((int16*)0); }
inline int16 getShort () { return GET( int16); }
/**
* Get a int value from the byte buffer.
*
* @return The value.
*/
inline int32 getInt () { return get((int32*)0); }
inline int32 getInt () { return GET( int32); }
/**
* Get a long value from the byte buffer.
*
* @return The value.
*/
inline int64 getLong () { return get((int64*)0); }
inline int64 getLong () { return GET( int64); }
/**
* Get a float value from the byte buffer.
*
* @return The value.
*/
inline float getFloat () { return get((float*)0); }
inline float getFloat () { return GET( float); }
/**
* Get a double value from the byte buffer.
*
* @return The value.
*/
inline double getDouble () { return get((double*)0); }
/**
* Get a boolean value from the byte buffer at the specified index.
*
* @param index The offset in the byte buffer.
* @return The value.
*/
#else
/**
* Get a boolean value from the byte buffer.
*
* @return The value.
*/
inline bool getBoolean() { return get< int8>() != 0; }
/**
* Get a byte value from the byte buffer.
*
* @return The value.
*/
inline int8 getByte () { return get< int8>(); }
/**
* Get a short value from the byte buffer.
*
* @return The value.
*/
inline int16 getShort () { return get< int16>(); }
/**
* Get a int value from the byte buffer.
*
* @return The value.
*/
inline int32 getInt () { return get< int32>(); }
/**
* Get a long value from the byte buffer.
*
* @return The value.
*/
inline int64 getLong () { return get< int64>(); }
/**
* Get a float value from the byte buffer.
*
* @return The value.
*/
inline float getFloat () { return get< float>(); }
/**
* Get a double value from the byte buffer.
*
* @return The value.
*/
inline double getDouble () { return get<double>(); }
#endif
inline double getDouble () { return GET(double); }
/**
* Get a boolean value from the byte buffer at the specified index.
*
@@ -765,7 +717,7 @@ private:
}
#if defined (__GNUC__) && __GNUC__ < 3
#if defined (__GNUC__) && (__GNUC__ < 3)
template<typename T>
inline T ByteBuffer::get(const T*)
#else

View File

@@ -8,7 +8,6 @@
* @author mrk
*/
#include <vector>
#include <tr1/memory>
#include <cstddef>
#include <stdexcept>
#include <pv/sharedPtr.h>

View File

@@ -16,7 +16,7 @@ namespace epics { namespace pvData {
const char* Status::StatusTypeName[] = { "OK", "WARNING", "ERROR", "FATAL" };
epics::pvData::String Status::m_emptyString;
Status Status::OK;
Status Status::Ok;
//PVDATA_REFCOUNT_MONITOR_DEFINE(status);

View File

@@ -39,7 +39,7 @@ namespace epics { namespace pvData {
static const char* StatusTypeName[];
static Status OK;
static Status Ok;
/**
* Creates OK status; STATUSTYPE_OK, empty message and stackDump.

View File

@@ -12,7 +12,6 @@
#include <string>
#include <map>
#include <stdexcept>
#include <ostream>
#include <algorithm>
#include <iterator>
#include <pv/pvIntrospect.h>

View File

@@ -128,7 +128,7 @@ static void longArray()
PVLongArrayPtr pvLongArray = static_pointer_cast<PVLongArray>(pvScalarArray);
LongArray value;
value.reserve(length);
int64 xxx = 0x7fffffffffffffffL;
int64 xxx = 0x7fffffffffffffffLL;
for(size_t i = 0; i<length; i++) value.push_back(xxx++);
pvLongArray->put(0,length,value,0);
builder.clear();
@@ -169,7 +169,7 @@ static void ulongArray()
PVULongArrayPtr pvULongArray = static_pointer_cast<PVULongArray>(pvScalarArray);
ULongArray value;
value.reserve(length);
uint64 xxx = 0x7fffffffffffffffL;
uint64 xxx = 0x7fffffffffffffffLL;
for(size_t i = 0; i<length; i++) value.push_back(xxx++);
pvULongArray->put(0,length,value,0);
builder.clear();