size_t changes
This commit is contained in:
@@ -244,9 +244,9 @@ public:
|
||||
* Returns the current position.
|
||||
* @return The current position in the raw data.
|
||||
*/
|
||||
inline std::ptrdiff_t getPosition()
|
||||
inline std::size_t getPosition()
|
||||
{
|
||||
return (((std::ptrdiff_t)(const void *)_position) - ((std::ptrdiff_t)(const void *)_buffer));
|
||||
return (std::size_t)(((std::ptrdiff_t)(const void *)_position) - ((std::ptrdiff_t)(const void *)_buffer));
|
||||
}
|
||||
/**
|
||||
* Sets the buffer position.
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
* @param pos The offset into the raw buffer.
|
||||
* The new position value; must be no larger than the current limit
|
||||
*/
|
||||
inline void setPosition(std::ptrdiff_t pos)
|
||||
inline void setPosition(std::size_t pos)
|
||||
{
|
||||
_position = _buffer + pos;
|
||||
}
|
||||
@@ -264,9 +264,9 @@ public:
|
||||
*
|
||||
* @return The offset into the raw buffer.
|
||||
*/
|
||||
inline std::ptrdiff_t getLimit()
|
||||
inline std::size_t getLimit()
|
||||
{
|
||||
return (((std::ptrdiff_t)(const void *)_limit) - ((std::ptrdiff_t)(const void *)_buffer));
|
||||
return (std::size_t)(((std::ptrdiff_t)(const void *)_limit) - ((std::ptrdiff_t)(const void *)_buffer));
|
||||
}
|
||||
/**
|
||||
* Sets this buffer's limit.
|
||||
@@ -276,7 +276,7 @@ public:
|
||||
* @param limit The new position value;
|
||||
* must be no larger than the current limit
|
||||
*/
|
||||
inline void setLimit(std::ptrdiff_t limit)
|
||||
inline void setLimit(std::size_t limit)
|
||||
{
|
||||
_limit = _buffer + limit;
|
||||
}
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
*/
|
||||
inline std::size_t getRemaining()
|
||||
{
|
||||
return (((std::ptrdiff_t)(const void *)_limit) - ((std::ptrdiff_t)(const void *)_position));
|
||||
return (std::size_t)(((std::ptrdiff_t)(const void *)_limit) - ((std::ptrdiff_t)(const void *)_position));
|
||||
}
|
||||
/**
|
||||
* Returns The size, i.e. capacity of the raw data buffer in bytes.
|
||||
@@ -625,9 +625,9 @@ public:
|
||||
* Size MUST be a power of 2.
|
||||
* @param size The alignment requirement.
|
||||
*/
|
||||
inline void align(int size)
|
||||
inline void align(std::size_t size)
|
||||
{
|
||||
const std::size_t k = size - 1;
|
||||
const std::size_t k = size - 1;
|
||||
_position = (char*)((((std::ptrdiff_t)(const void *)_position) + k) & ~(k));
|
||||
}
|
||||
/**
|
||||
@@ -721,7 +721,7 @@ public:
|
||||
* @param index The offset in the byte buffer,
|
||||
* @param value The value.
|
||||
*/
|
||||
inline void putDouble (std::size_t index,double value) { put<double>(index, value); }
|
||||
inline void putDouble (std::size_t index, double value) { put<double>(index, value); }
|
||||
|
||||
/**
|
||||
* Get a boolean value from the byte buffer.
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace epics { namespace pvData {
|
||||
virtual ~SerializableControl(){}
|
||||
virtual void flushSerializeBuffer() =0;
|
||||
virtual void ensureBuffer(std::size_t size) =0;
|
||||
virtual void alignBuffer(int alignment) =0;
|
||||
virtual void alignBuffer(std::size_t alignment) =0;
|
||||
virtual void cachedSerialize(std::tr1::shared_ptr<const Field> const & field, ByteBuffer* buffer) = 0;
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace epics { namespace pvData {
|
||||
public:
|
||||
virtual ~DeserializableControl(){}
|
||||
virtual void ensureData(std::size_t size) =0;
|
||||
virtual void alignData(int alignment) =0;
|
||||
virtual void alignData(std::size_t alignment) =0;
|
||||
virtual std::tr1::shared_ptr<const Field> cachedDeserialize(ByteBuffer* buffer) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace epics {
|
||||
}
|
||||
|
||||
void SerializeHelper::writeSize(std::size_t s, ByteBuffer* buffer) {
|
||||
if(s==-1) // null
|
||||
if(s==(std::size_t)-1) // null // TODO remove
|
||||
buffer->putByte(-1);
|
||||
else if(s<254)
|
||||
buffer->putByte(s);
|
||||
|
||||
@@ -31,19 +31,15 @@ class MonitorElement {
|
||||
public:
|
||||
POINTER_DEFINITIONS(MonitorElement);
|
||||
MonitorElement(){}
|
||||
MonitorElement(PVStructurePtr &pvStructurePtr);
|
||||
MonitorElement(PVStructurePtr &pvStructurePtr): pvStructurePtr(pvStructurePtr),
|
||||
changedBitSet(BitSet::create(pvStructurePtr->getNumberFields())),
|
||||
overrunBitSet(BitSet::create(pvStructurePtr->getNumberFields()))
|
||||
{}
|
||||
PVStructurePtr pvStructurePtr;
|
||||
BitSet::shared_pointer changedBitSet;
|
||||
BitSet::shared_pointer overrunBitSet;
|
||||
};
|
||||
|
||||
MonitorElement::MonitorElement(PVStructurePtr &pvStructurePtr)
|
||||
: pvStructurePtr(pvStructurePtr),
|
||||
changedBitSet(BitSet::create(pvStructurePtr->getNumberFields())),
|
||||
overrunBitSet(BitSet::create(pvStructurePtr->getNumberFields()))
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for Monitor.
|
||||
* @author mrk
|
||||
|
||||
@@ -71,7 +71,7 @@ void testBasicOperations(std::ostream& ofile) {
|
||||
assert(buff->getFloat(16)==testFloat);
|
||||
assert(buff->getDouble(20)==testDouble);
|
||||
/*
|
||||
uintptr_t sp = buff->getPosition();
|
||||
std::size_t sp = buff->getPosition();
|
||||
buff->setPosition(0);
|
||||
assert(buff->getBoolean()==true);
|
||||
assert(buff->getByte()==-12);
|
||||
|
||||
@@ -55,10 +55,10 @@ public:
|
||||
virtual void flushSerializeBuffer() {
|
||||
}
|
||||
|
||||
virtual void ensureBuffer(size_t size) {
|
||||
virtual void ensureBuffer(std::size_t size) {
|
||||
}
|
||||
|
||||
virtual void alignBuffer(int alignment) {
|
||||
virtual void alignBuffer(std::size_t alignment) {
|
||||
buffer->align(alignment);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
virtual void ensureData(size_t size) {
|
||||
}
|
||||
|
||||
virtual void alignData(int alignment) {
|
||||
virtual void alignData(size_t alignment) {
|
||||
buffer->align(alignment);
|
||||
}
|
||||
|
||||
@@ -377,13 +377,13 @@ void testArray(std::ostream& ofile) {
|
||||
assert(factory.get()!=NULL);
|
||||
|
||||
ofile<<"\tPVBooleanArray\n";
|
||||
bool boolEmpty[] = { false };
|
||||
bool bv[] = { false, true, false, true, true };
|
||||
//bool boolEmpty[] = { false };
|
||||
//bool bv[] = { false, true, false, true, true };
|
||||
PVBooleanArrayPtr pvBoolean =
|
||||
std::tr1::static_pointer_cast<PVBooleanArray>(factory->createPVScalarArray(epics::pvData::pvBoolean));
|
||||
//TODO pvBoolean->put(0, 0, boolEmpty, 0);
|
||||
//pvBoolean->put(0, 0, boolEmpty, 0);
|
||||
serializationTest(pvBoolean);
|
||||
//TODO pvBoolean->put(0, 5, bv, 0);
|
||||
//pvBoolean->put(0, 5, bv, 0);
|
||||
serializationTest(pvBoolean);
|
||||
|
||||
ofile<<"\tPVByteArray\n";
|
||||
@@ -429,8 +429,7 @@ void testArray(std::ostream& ofile) {
|
||||
serializationTest(pvLong);
|
||||
pvLong->put(0, 8, lv, 0);
|
||||
serializationTest(pvLong);
|
||||
// TODO
|
||||
/*
|
||||
|
||||
ofile<<"\tPVUByteArray\n";
|
||||
uint8 ubyteEmpty[] = { 0 };
|
||||
uint8 ubyv[] = { 0, 1, 2, -1, BYTE_MAX_VALUE, BYTE_MAX_VALUE-1,
|
||||
@@ -439,7 +438,7 @@ void testArray(std::ostream& ofile) {
|
||||
std::tr1::static_pointer_cast<PVUByteArray>(factory->createPVScalarArray(epics::pvData::pvUByte));
|
||||
pvUByte->put(0, 0, ubyteEmpty, 0);
|
||||
serializationTest(pvUByte);
|
||||
pvByte->put(0, 9, ubyv, 0);
|
||||
pvUByte->put(0, 9, ubyv, 0);
|
||||
serializationTest(pvUByte);
|
||||
|
||||
ofile<<"\tPVUShortArray\n";
|
||||
@@ -448,9 +447,9 @@ void testArray(std::ostream& ofile) {
|
||||
SHORT_MIN_VALUE+1, SHORT_MIN_VALUE, USHORT_MAX_VALUE };
|
||||
PVUShortArrayPtr pvUShort =
|
||||
std::tr1::static_pointer_cast<PVUShortArray>(factory->createPVScalarArray(epics::pvData::pvUShort));
|
||||
pvShort->put(0, 0, ushortEmpty, 0);
|
||||
pvUShort->put(0, 0, ushortEmpty, 0);
|
||||
serializationTest(pvUShort);
|
||||
pvShort->put(0, 8, usv, 0);
|
||||
pvUShort->put(0, 8, usv, 0);
|
||||
serializationTest(pvUShort);
|
||||
|
||||
ofile<<"\tPVUIntArray\n";
|
||||
@@ -459,9 +458,9 @@ void testArray(std::ostream& ofile) {
|
||||
INT_MIN_VALUE+1, INT_MIN_VALUE, UINT_MAX_VALUE };
|
||||
PVUIntArrayPtr pvUInt =
|
||||
std::tr1::static_pointer_cast<PVUIntArray>(factory->createPVScalarArray(epics::pvData::pvUInt));
|
||||
pvInt->put(0, 0, uintEmpty, 0);
|
||||
pvUInt->put(0, 0, uintEmpty, 0);
|
||||
serializationTest(pvUInt);
|
||||
pvInt->put(0, 9, uiv, 0);
|
||||
pvUInt->put(0, 9, uiv, 0);
|
||||
serializationTest(pvUInt);
|
||||
|
||||
ofile<<"\tPVULongArray\n";
|
||||
@@ -470,11 +469,11 @@ void testArray(std::ostream& ofile) {
|
||||
LONG_MIN_VALUE+1, LONG_MIN_VALUE, ULONG_MAX_VALUE };
|
||||
PVULongArrayPtr pvULong =
|
||||
std::tr1::static_pointer_cast<PVULongArray>(factory->createPVScalarArray(epics::pvData::pvULong));
|
||||
pvLong->put(0, 0, ulongEmpty, 0);
|
||||
pvULong->put(0, 0, ulongEmpty, 0);
|
||||
serializationTest(pvULong);
|
||||
pvLong->put(0, 9, ulv, 0);
|
||||
pvULong->put(0, 9, ulv, 0);
|
||||
serializationTest(pvULong);
|
||||
*/
|
||||
|
||||
ofile<<"\tPVFloatArray\n";
|
||||
float floatEmpty[] = { (float)0.0 };
|
||||
float fv[] = { (float)0.0, (float)1.1, (float)2.3, (float)-1.4,
|
||||
|
||||
@@ -275,9 +275,9 @@ static void stringArray()
|
||||
PVStringArrayPtr pvStringArray = static_pointer_cast<PVStringArray>(pvScalarArray);
|
||||
StringArray value;
|
||||
value.reserve(length);
|
||||
for(int i = 0; i<length; i++) {
|
||||
for(size_t i = 0; i<length; i++) {
|
||||
char val[20];
|
||||
sprintf(val,"value%d",i);
|
||||
sprintf(val,"value%d",(int)i);
|
||||
value.push_back(val);
|
||||
}
|
||||
pvStringArray->put(0,length,value,0);
|
||||
|
||||
Reference in New Issue
Block a user