win32 port: visibility, warnings, templates
This commit is contained in:
@@ -102,6 +102,7 @@ LIBSRCS += bitSetUtil.cpp
|
||||
|
||||
SRC_DIRS += $(PVDATA)/monitor
|
||||
INC += monitor.h
|
||||
LIBSRCS += monitor.cpp
|
||||
|
||||
LIBRARY = pvData
|
||||
pvData_LIBS += Com
|
||||
|
||||
@@ -46,7 +46,7 @@ static std::vector<String> split(String commaSeparatedList) {
|
||||
return valueList;
|
||||
}
|
||||
|
||||
void Convert::getString(StringBuilder buf,PVField const *pvField,int indentLevel)
|
||||
void Convert::getString(StringBuilder buf,PVField const *pvField,int /*indentLevel*/)
|
||||
{
|
||||
// TODO indextLevel ignored
|
||||
std::ostringstream strm;
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
/**
|
||||
* @author mrk
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
@@ -269,7 +274,7 @@ void ScalarArray::toString(StringBuilder buffer,int /*indentLevel*/) const{
|
||||
|
||||
void ScalarArray::serialize(ByteBuffer *buffer, SerializableControl *control) const {
|
||||
control->ensureBuffer(1);
|
||||
buffer->putByte(0x10 | getTypeCodeLUT());
|
||||
buffer->putByte((int8)0x10 | getTypeCodeLUT());
|
||||
}
|
||||
|
||||
void ScalarArray::deserialize(ByteBuffer* /*buffer*/, DeserializableControl* /*control*/) {
|
||||
@@ -298,7 +303,7 @@ void StructureArray::toString(StringBuilder buffer,int indentLevel) const {
|
||||
|
||||
void StructureArray::serialize(ByteBuffer *buffer, SerializableControl *control) const {
|
||||
control->ensureBuffer(1);
|
||||
buffer->putByte(0x90);
|
||||
buffer->putByte((int8)0x90);
|
||||
control->cachedSerialize(pstructure, buffer);
|
||||
}
|
||||
|
||||
@@ -331,11 +336,11 @@ void UnionArray::serialize(ByteBuffer *buffer, SerializableControl *control) con
|
||||
if (punion->isVariant())
|
||||
{
|
||||
// unrestricted/variant union
|
||||
buffer->putByte(0x92);
|
||||
buffer->putByte((int8)0x92);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->putByte(0x91);
|
||||
buffer->putByte((int8)0x91);
|
||||
control->cachedSerialize(punion, buffer);
|
||||
}
|
||||
}
|
||||
@@ -454,7 +459,7 @@ void Structure::toStringCommon(StringBuilder buffer,int indentLevel) const{
|
||||
|
||||
void Structure::serialize(ByteBuffer *buffer, SerializableControl *control) const {
|
||||
control->ensureBuffer(1);
|
||||
buffer->putByte(0x80);
|
||||
buffer->putByte((int8)0x80);
|
||||
serializeStructureField(this, buffer, control);
|
||||
}
|
||||
|
||||
@@ -594,11 +599,11 @@ void Union::serialize(ByteBuffer *buffer, SerializableControl *control) const {
|
||||
if (fields.size() == 0)
|
||||
{
|
||||
// unrestricted/variant union
|
||||
buffer->putByte(0x82);
|
||||
buffer->putByte((int8)0x82);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->putByte(0x81);
|
||||
buffer->putByte((int8)0x81);
|
||||
serializeUnionField(this, buffer, control);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,11 @@
|
||||
/**
|
||||
* @author mrk
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
@@ -257,8 +257,8 @@ void PVField::computeOffset(const PVField * pvField) {
|
||||
} else {
|
||||
while(pvTop->getParent()!=NULL) pvTop = pvTop->getParent();
|
||||
}
|
||||
int offset = 0;
|
||||
int nextOffset = 1;
|
||||
size_t offset = 0;
|
||||
size_t nextOffset = 1;
|
||||
PVFieldPtrArray pvFields = pvTop->getPVFields();
|
||||
for(size_t i=0; i < pvTop->getStructure()->getNumberFields(); i++) {
|
||||
offset = nextOffset;
|
||||
@@ -288,8 +288,8 @@ void PVField::computeOffset(const PVField * pvField) {
|
||||
}
|
||||
|
||||
void PVField::computeOffset(const PVField * pvField,size_t offset) {
|
||||
int beginOffset = offset;
|
||||
int nextOffset = offset + 1;
|
||||
size_t beginOffset = offset;
|
||||
size_t nextOffset = offset + 1;
|
||||
const PVStructure *pvStructure = static_cast<const PVStructure *>(pvField);
|
||||
const PVFieldPtrArray pvFields = pvStructure->getPVFields();
|
||||
for(size_t i=0; i < pvStructure->getStructure()->getNumberFields(); i++) {
|
||||
|
||||
@@ -643,7 +643,7 @@ void PVStructure::serialize(ByteBuffer *pbuffer,
|
||||
PVStructure* nonConstThis = const_cast<PVStructure*>(this);
|
||||
size_t numberFields = nonConstThis->getNumberFields();
|
||||
size_t offset = nonConstThis->getFieldOffset();
|
||||
int32 next = pbitSet->nextSetBit(offset);
|
||||
int32 next = pbitSet->nextSetBit(static_cast<uint32>(offset));
|
||||
|
||||
// no more changes or no changes in this structure
|
||||
if(next<0||next>=static_cast<int32>(offset+numberFields)) return;
|
||||
@@ -658,8 +658,8 @@ void PVStructure::serialize(ByteBuffer *pbuffer,
|
||||
for(size_t i = 0; i<fieldsSize; i++) {
|
||||
PVFieldPtr pvField = pvFields[i];
|
||||
offset = pvField->getFieldOffset();
|
||||
int32 inumberFields = pvField->getNumberFields();
|
||||
next = pbitSet->nextSetBit(offset);
|
||||
int32 inumberFields = static_cast<int32>(pvField->getNumberFields());
|
||||
next = pbitSet->nextSetBit(static_cast<uint32>(offset));
|
||||
|
||||
// no more changes
|
||||
if(next<0) return;
|
||||
@@ -680,7 +680,7 @@ void PVStructure::deserialize(ByteBuffer *pbuffer,
|
||||
DeserializableControl *pcontrol, BitSet *pbitSet) {
|
||||
size_t offset = getFieldOffset();
|
||||
size_t numberFields = getNumberFields();
|
||||
int32 next = pbitSet->nextSetBit(offset);
|
||||
int32 next = pbitSet->nextSetBit(static_cast<uint32>(offset));
|
||||
|
||||
// no more changes or no changes in this structure
|
||||
if(next<0||next>=static_cast<int32>(offset+numberFields)) return;
|
||||
@@ -695,8 +695,8 @@ void PVStructure::deserialize(ByteBuffer *pbuffer,
|
||||
for(size_t i = 0; i<fieldsSize; i++) {
|
||||
PVFieldPtr pvField = pvFields[i];
|
||||
offset = pvField->getFieldOffset();
|
||||
int32 inumberFields = pvField->getNumberFields();
|
||||
next = pbitSet->nextSetBit(offset);
|
||||
int32 inumberFields = static_cast<int32>(pvField->getNumberFields());
|
||||
next = pbitSet->nextSetBit(static_cast<uint32>(offset));
|
||||
// no more changes
|
||||
if(next<0) return;
|
||||
// no change in this pvField
|
||||
|
||||
@@ -93,7 +93,7 @@ PVFieldPtr PVUnion::select(int32 index)
|
||||
|
||||
PVFieldPtr PVUnion::select(String const & fieldName)
|
||||
{
|
||||
int32 index = variant ? -1 : unionPtr->getFieldIndex(fieldName);
|
||||
int32 index = variant ? -1 : static_cast<int32>(unionPtr->getFieldIndex(fieldName));
|
||||
if (index == -1)
|
||||
throw std::invalid_argument("no such fieldName");
|
||||
return select(index);
|
||||
@@ -175,7 +175,7 @@ void PVUnion::deserialize(ByteBuffer *pbuffer, DeserializableControl *pcontrol)
|
||||
}
|
||||
else
|
||||
{
|
||||
selector = SerializeHelper::readSize(pbuffer, pcontrol);
|
||||
selector = static_cast<int32>(SerializeHelper::readSize(pbuffer, pcontrol));
|
||||
if (selector != UNDEFINED_INDEX)
|
||||
{
|
||||
FieldConstPtr field = unionPtr->getField(selector);
|
||||
|
||||
@@ -347,7 +347,7 @@ namespace epics { namespace pvData {
|
||||
|
||||
void BitSet::deserialize(ByteBuffer* buffer, DeserializableControl* control) {
|
||||
|
||||
uint32 bytes = SerializeHelper::readSize(buffer, control); // in bytes
|
||||
uint32 bytes = static_cast<uint32>(SerializeHelper::readSize(buffer, control)); // in bytes
|
||||
|
||||
wordsInUse = (bytes + 7) / 8;
|
||||
if (wordsInUse > wordsLength)
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
/**
|
||||
* @author mes
|
||||
* @author mse
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
#ifndef EPICSEXCEPTION_H_
|
||||
#define EPICSEXCEPTION_H_
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable: 4251)
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
#include <epicsString.h>
|
||||
#include <epicsConvert.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "typeCast.h"
|
||||
|
||||
// need to use "long long" when sizeof(int)==sizeof(long)
|
||||
// TODO does not work on Darwin 10.6
|
||||
#if ULONG_MAX == 0xfffffffful
|
||||
//#if ULONG_MAX == 0xfffffffful
|
||||
#if ULONG_MAX != UINT_MAX
|
||||
#define NEED_LONGLONG
|
||||
#endif
|
||||
|
||||
@@ -138,7 +139,7 @@ epicsParseInt8(const char *str, epicsInt8 *to, int base, char **units)
|
||||
if (value < -0x80 || value > 0x7f)
|
||||
return S_stdlib_overflow;
|
||||
|
||||
*to = value;
|
||||
*to = (epicsInt8)value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -154,7 +155,7 @@ epicsParseUInt8(const char *str, epicsUInt8 *to, int base, char **units)
|
||||
if (value > 0xff && value <= ~0xffUL)
|
||||
return S_stdlib_overflow;
|
||||
|
||||
*to = value;
|
||||
*to = (epicsUInt8)value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -170,7 +171,7 @@ epicsParseInt16(const char *str, epicsInt16 *to, int base, char **units)
|
||||
if (value < -0x8000 || value > 0x7fff)
|
||||
return S_stdlib_overflow;
|
||||
|
||||
*to = value;
|
||||
*to = (epicsInt16)value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -186,7 +187,7 @@ epicsParseUInt16(const char *str, epicsUInt16 *to, int base, char **units)
|
||||
if (value > 0xffff && value <= ~0xffffUL)
|
||||
return S_stdlib_overflow;
|
||||
|
||||
*to = value;
|
||||
*to = (epicsUInt16)value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -204,7 +205,7 @@ epicsParseInt32(const char *str, epicsInt32 *to, int base, char **units)
|
||||
return S_stdlib_overflow;
|
||||
#endif
|
||||
|
||||
*to = value;
|
||||
*to = (epicsInt32)value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -222,7 +223,7 @@ epicsParseUInt32(const char *str, epicsUInt32 *to, int base, char **units)
|
||||
return S_stdlib_overflow;
|
||||
#endif
|
||||
|
||||
*to = value;
|
||||
*to = (epicsUInt32)value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -241,12 +242,12 @@ epicsParseFloat(const char *str, float *to, char **units)
|
||||
if (finite(value) && abs >= FLT_MAX)
|
||||
return S_stdlib_overflow;
|
||||
|
||||
*to = value;
|
||||
*to = (float)value;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(NEED_LONGLONG) && defined(__vxworks)
|
||||
#if defined(NEED_LONGLONG) && (defined(__vxworks) || defined (_WIN32))
|
||||
static
|
||||
long long strtoll(const char *ptr, char ** endp, int base)
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
private:
|
||||
queueElementPtr nullElement;
|
||||
queueElementPtrArray elements;
|
||||
// TODO use size_t instead
|
||||
int size;
|
||||
int numberFree;
|
||||
int numberUsed;
|
||||
@@ -49,7 +50,7 @@ private:
|
||||
|
||||
template <typename T>
|
||||
Queue<T>::Queue(std::vector<queueElementPtr> &xxx)
|
||||
: size(xxx.size()),
|
||||
: size(static_cast<int>(xxx.size())),
|
||||
numberFree(size),
|
||||
numberUsed(0),
|
||||
nextGetFree(0),
|
||||
|
||||
@@ -33,11 +33,11 @@ namespace epics {
|
||||
if(s==(std::size_t)-1) // null // TODO remove
|
||||
buffer->putByte(-1);
|
||||
else if(s<254)
|
||||
buffer->putByte(s);
|
||||
buffer->putByte((int8)s);
|
||||
else
|
||||
{
|
||||
buffer->putByte(-2);
|
||||
buffer->putInt(s); // (byte)-2 + size
|
||||
buffer->putInt((int8)s); // (byte)-2 + size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
#ifndef SHAREDVECTOR_H
|
||||
#define SHAREDVECTOR_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <ostream>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
@@ -86,12 +90,19 @@ namespace detail {
|
||||
}
|
||||
public:
|
||||
|
||||
#ifdef _WIN32
|
||||
template<typename A>
|
||||
shared_vector_base(A* v, size_t o, size_t c)
|
||||
:m_data(v, detail::default_array_deleter<A*>())
|
||||
,m_offset(o), m_count(c), m_total(c)
|
||||
{_null_input();}
|
||||
#else
|
||||
template<typename A>
|
||||
shared_vector_base(A v, size_t o, size_t c)
|
||||
:m_data(v, detail::default_array_deleter<A>())
|
||||
,m_offset(o), m_count(c), m_total(c)
|
||||
{_null_input();}
|
||||
|
||||
#endif
|
||||
shared_vector_base(const std::tr1::shared_ptr<E>& d, size_t o, size_t c)
|
||||
:m_data(d), m_offset(o), m_count(c), m_total(c)
|
||||
{_null_input();}
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
/**
|
||||
* @author mrk
|
||||
*/
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "typeCast.h"
|
||||
|
||||
using epics::pvData::castUnsafe;
|
||||
|
||||
@@ -38,8 +38,8 @@ class epicsShareClass MonitorElement {
|
||||
MonitorElement(){}
|
||||
MonitorElement(PVStructurePtr const & pvStructurePtr)
|
||||
: pvStructurePtr(pvStructurePtr),
|
||||
changedBitSet(BitSet::create(pvStructurePtr->getNumberFields())),
|
||||
overrunBitSet(BitSet::create(pvStructurePtr->getNumberFields()))
|
||||
changedBitSet(BitSet::create(static_cast<uint32>(pvStructurePtr->getNumberFields()))),
|
||||
overrunBitSet(BitSet::create(static_cast<uint32>(pvStructurePtr->getNumberFields())))
|
||||
{}
|
||||
PVStructurePtr pvStructurePtr;
|
||||
BitSet::shared_pointer changedBitSet;
|
||||
|
||||
@@ -98,7 +98,7 @@ int32 PVEnumerated::getNumberChoices()
|
||||
if(pvIndex.get()==NULL ) {
|
||||
throw std::logic_error(notAttached);
|
||||
}
|
||||
return pvChoices->getLength();
|
||||
return static_cast<int32>(pvChoices->getLength());
|
||||
}
|
||||
|
||||
bool PVEnumerated:: setChoices(const StringArray & choices)
|
||||
|
||||
@@ -57,7 +57,7 @@ void TimeStamp::fromTime_t(const time_t & tt)
|
||||
void TimeStamp::toTime_t(time_t &tt) const
|
||||
{
|
||||
epicsTimeStamp epicsTime;
|
||||
epicsTime.secPastEpoch = secondsPastEpoch-posixEpochAtEpicsEpoch;
|
||||
epicsTime.secPastEpoch = static_cast<epicsUInt32>(secondsPastEpoch-posixEpochAtEpicsEpoch);
|
||||
epicsTime.nsec = nanoSeconds;
|
||||
epicsTimeToTime_t(&tt,&epicsTime);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ void TimeStamp::getCurrent()
|
||||
|
||||
double TimeStamp::toSeconds() const
|
||||
{
|
||||
double value = secondsPastEpoch;
|
||||
double value = static_cast<double>(secondsPastEpoch);
|
||||
double nano = nanoSeconds;
|
||||
value += nano/1e9;
|
||||
return value;
|
||||
@@ -141,7 +141,7 @@ bool TimeStamp::operator>(TimeStamp const &right) const
|
||||
|
||||
double TimeStamp::diff(TimeStamp const & a,TimeStamp const & b)
|
||||
{
|
||||
double result = a.secondsPastEpoch - b.secondsPastEpoch;
|
||||
double result = static_cast<double>(a.secondsPastEpoch - b.secondsPastEpoch);
|
||||
result += (a.nanoSeconds - b.nanoSeconds)/1e9;
|
||||
return result;
|
||||
}
|
||||
@@ -163,7 +163,7 @@ TimeStamp & TimeStamp::operator+=(double seconds)
|
||||
{
|
||||
int64 secs = static_cast<int64>(seconds);
|
||||
int64 nano = static_cast<int64>((seconds - secs)*1e9);
|
||||
nanoSeconds += nano;
|
||||
nanoSeconds += static_cast<int32>(nano);
|
||||
if(nanoSeconds>nanoSecPerSec) {
|
||||
nanoSeconds -= nanoSecPerSec;
|
||||
secondsPastEpoch += 1;
|
||||
|
||||
@@ -10,12 +10,16 @@
|
||||
#ifndef PVDATA_H
|
||||
#define PVDATA_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !(defined(__vxworks) && !defined(_WRS_VXWORKS_MAJOR))
|
||||
#define USAGE_DEPRECATED __attribute__((deprecated))
|
||||
#define USAGE_ERROR(MSG) __attribute__((error(MSG)))
|
||||
#else
|
||||
#define USAGE_DEPRECATED
|
||||
#define USAGE_ERROR(MSG)
|
||||
#define USAGE_ERROR(MSG) { throw std::runtime_error(MSG); }
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
@@ -282,6 +286,10 @@ class epicsShareClass PVField
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(PVField);
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
PVField() {};
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
@@ -531,14 +539,16 @@ public:
|
||||
|
||||
// get operator
|
||||
// double value; doubleField >>= value;
|
||||
void operator>>=(T& value) const
|
||||
// NOTE: virtual is needed for MS C++ compiler to get this operator exported
|
||||
virtual void operator>>=(T& value) const
|
||||
{
|
||||
value = get();
|
||||
}
|
||||
|
||||
// put operator
|
||||
// double value = 12.8; doubleField <<= value;
|
||||
void operator<<=(T value)
|
||||
// NOTE: virtual is needed for MS C++ compiler to get this operator exported
|
||||
virtual void operator<<=(T value)
|
||||
{
|
||||
put(value);
|
||||
}
|
||||
@@ -631,6 +641,10 @@ typedef std::tr1::shared_ptr<PVString> PVStringPtr;
|
||||
class epicsShareClass PVArray : public PVField, public SerializableArray {
|
||||
public:
|
||||
POINTER_DEFINITIONS(PVArray);
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
PVArray(){};
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
@@ -714,6 +728,10 @@ public:
|
||||
class epicsShareClass PVScalarArray : public PVArray {
|
||||
public:
|
||||
POINTER_DEFINITIONS(PVScalarArray);
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
PVScalarArray() {};
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
|
||||
#ifndef PVTYPE_H
|
||||
#define PVTYPE_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#pragma warning(disable: 4251)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
void createFloatAlarm();
|
||||
void createDoubleAlarm();
|
||||
void createEnumeratedAlarm();
|
||||
friend StandardFieldPtr getStandardField();
|
||||
//friend StandardFieldPtr getStandardField();
|
||||
};
|
||||
|
||||
epicsShareExtern StandardFieldPtr getStandardField();
|
||||
|
||||
@@ -21,7 +21,7 @@ static bool checkBitSetPVField(
|
||||
PVFieldPtr const &pvField,BitSetPtr const &bitSet,int32 initialOffset)
|
||||
{
|
||||
int32 offset = initialOffset;
|
||||
int32 nbits = pvField->getNumberFields();
|
||||
int32 nbits = static_cast<int32>(pvField->getNumberFields());
|
||||
if(nbits==1) return bitSet->get(offset);
|
||||
int32 nextSetBit = bitSet->nextSetBit(offset);
|
||||
if(nextSetBit>=(offset+nbits)) return false;
|
||||
@@ -36,10 +36,10 @@ static bool checkBitSetPVField(
|
||||
bool atLeastOneBitSet = false;
|
||||
bool allBitsSet = true;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
offset = pvStructure->getFieldOffset() + 1;
|
||||
offset = static_cast<int32>(pvStructure->getFieldOffset()) + 1;
|
||||
while(offset<initialOffset + nbits) {
|
||||
PVFieldPtr pvSubField = pvStructure->getSubField(offset);
|
||||
int32 nbitsNow = pvSubField->getNumberFields();
|
||||
int32 nbitsNow = static_cast<int32>(pvSubField->getNumberFields());
|
||||
if(nbitsNow==1) {
|
||||
if(bitSet->get(offset)) {
|
||||
atLeastOneBitSet = true;
|
||||
@@ -57,7 +57,7 @@ static bool checkBitSetPVField(
|
||||
} else {
|
||||
allBitsSet = false;
|
||||
}
|
||||
offset += pvSubField->getNumberFields();
|
||||
offset += static_cast<int32>(pvSubField->getNumberFields());
|
||||
}
|
||||
}
|
||||
if(allBitsSet) {
|
||||
|
||||
@@ -52,7 +52,7 @@ void testBasicOperations() {
|
||||
testOk1(buff->getPosition()==16);
|
||||
testOk1(buff->getRemaining()==16);
|
||||
|
||||
float testFloat = 34.67;
|
||||
float testFloat = 34.67f;
|
||||
buff->putFloat(testFloat);
|
||||
testOk1(buff->getPosition()==20);
|
||||
testOk1(buff->getRemaining()==12);
|
||||
|
||||
@@ -32,21 +32,21 @@ void test()
|
||||
String properties("alarm,timeStamp,display");
|
||||
PVStructurePtr pvStructure = standardPVField->scalar(pvDouble,properties);
|
||||
PVDoublePtr pvValue = pvStructure->getDoubleField("value");
|
||||
uint32 valueOffset = pvValue->getFieldOffset();
|
||||
uint32 valueOffset = (uint32) pvValue->getFieldOffset();
|
||||
PVStructurePtr pvAlarm = pvStructure->getStructureField("alarm");
|
||||
PVIntPtr pvSeverity = pvAlarm->getIntField("severity");
|
||||
PVStringPtr pvMessage = pvAlarm->getStringField("message");
|
||||
uint32 severityOffset = pvSeverity->getFieldOffset();
|
||||
uint32 messageOffset = pvMessage->getFieldOffset();
|
||||
uint32 severityOffset = (uint32) pvSeverity->getFieldOffset();
|
||||
uint32 messageOffset = (uint32) pvMessage->getFieldOffset();
|
||||
PVStructurePtr pvTimeStamp = pvStructure->getStructureField("timeStamp");
|
||||
PVLongPtr pvSeconds = pvTimeStamp->getLongField("secondsPastEpoch");
|
||||
PVIntPtr pvNanoSeconds = pvTimeStamp->getIntField("nanoSeconds");
|
||||
PVIntPtr pvUserTag = pvTimeStamp->getIntField("userTag");
|
||||
uint32 timeStampOffset = pvTimeStamp->getFieldOffset();
|
||||
uint32 secondsOffset = pvSeconds->getFieldOffset();
|
||||
uint32 nanoSecondsOffset = pvNanoSeconds->getFieldOffset();
|
||||
uint32 userTagOffset = pvUserTag->getFieldOffset();
|
||||
uint32 nfields = pvStructure->getNumberFields();
|
||||
uint32 timeStampOffset = (uint32) pvTimeStamp->getFieldOffset();
|
||||
uint32 secondsOffset = (uint32) pvSeconds->getFieldOffset();
|
||||
uint32 nanoSecondsOffset = (uint32) pvNanoSeconds->getFieldOffset();
|
||||
uint32 userTagOffset = (uint32) pvUserTag->getFieldOffset();
|
||||
uint32 nfields = (uint32) pvStructure->getNumberFields();
|
||||
BitSetPtr changeBitSet = BitSet::create(nfields);
|
||||
BitSetPtr userChangeBitSet = BitSet::create(nfields);
|
||||
BitSetPtr userOverrunBitSet = BitSet::create(nfields);
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
* Created on: Oct 25, 2010
|
||||
* Author: Miha Vitorovic
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
@@ -321,7 +323,7 @@ void testArrayType(const typename PVT::value_type* rdata, size_t len)
|
||||
serializationTest(pv);
|
||||
}
|
||||
|
||||
static const boolean bdata[] = {0, 1, 0, 1, 1};
|
||||
static const epics::pvData::boolean bdata[] = {0, 1, 0, 1, 1};
|
||||
|
||||
static const int8 i8data[] = { 0, 1, 2, -1, BYTE_MAX_VALUE, static_cast<int8>(BYTE_MAX_VALUE-1),
|
||||
static_cast<int8>(BYTE_MIN_VALUE+1), BYTE_MIN_VALUE };
|
||||
|
||||
@@ -336,7 +336,7 @@ static void testPush()
|
||||
size_t cap = vect.capacity();
|
||||
|
||||
for(size_t s=0; s<16*1024; s++) {
|
||||
vect.push_back(s);
|
||||
vect.push_back((int)s);
|
||||
|
||||
if(cap!=vect.capacity()) {
|
||||
nallocs++;
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
*/
|
||||
/* Author: Michael Davidsaver */
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
@@ -298,12 +302,12 @@ try {
|
||||
|
||||
testDiag("Float to int w/ round towards zero (aka truncation)");
|
||||
|
||||
TEST(int32_t, 2, float, 2.1);
|
||||
TEST(int32_t, 2, float, 2.5);
|
||||
TEST(int32_t, 2, float, 2.7);
|
||||
TEST(int32_t, -2, float, -2.1);
|
||||
TEST(int32_t, -2, float, -2.5);
|
||||
TEST(int32_t, -2, float, -2.7);
|
||||
TEST(int32_t, 2, float, 2.1f);
|
||||
TEST(int32_t, 2, float, 2.5f);
|
||||
TEST(int32_t, 2, float, 2.7f);
|
||||
TEST(int32_t, -2, float, -2.1f);
|
||||
TEST(int32_t, -2, float, -2.5f);
|
||||
TEST(int32_t, -2, float, -2.7f);
|
||||
|
||||
testDiag("String Printing/parsing");
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ static void test()
|
||||
builder.clear();
|
||||
pvs->toString(&builder);
|
||||
if(debug) printf("pvs\n%s\n",builder.c_str());
|
||||
int32 nfields = pvs->getNumberFields();
|
||||
int32 nfields = (int32)pvs->getNumberFields();
|
||||
BitSetPtr bitSet = BitSet::create(nfields);
|
||||
for(int32 i=0; i<nfields; i++) bitSet->set(i);
|
||||
builder.clear();
|
||||
@@ -75,13 +75,13 @@ static void test()
|
||||
if(debug) printf("bitSet\n%s\n",builder.c_str());
|
||||
bitSet->clear();
|
||||
PVFieldPtr pvField = pvs->getSubField("timeStamp");
|
||||
int32 offsetTimeStamp = pvField->getFieldOffset();
|
||||
int32 offsetTimeStamp = (int32)pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("timeStamp.secondsPastEpoch");
|
||||
int32 offsetSeconds = pvField->getFieldOffset();
|
||||
int32 offsetSeconds = (int32)pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("timeStamp.nanoSeconds");
|
||||
int32 offsetNano = pvField->getFieldOffset();
|
||||
int32 offsetNano = (int32)pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("timeStamp.userTag");
|
||||
int32 offsetUserTag = pvField->getFieldOffset();
|
||||
int32 offsetUserTag = (int32)pvField->getFieldOffset();
|
||||
bitSet->set(offsetSeconds);
|
||||
BitSetUtil::compress(bitSet,pvs);
|
||||
testOk1(bitSet->get(offsetSeconds)==true);
|
||||
@@ -99,17 +99,17 @@ static void test()
|
||||
bitSet->clear();
|
||||
|
||||
pvField = pvs->getSubField("current");
|
||||
int32 offsetCurrent = pvField->getFieldOffset();
|
||||
int32 offsetCurrent = (int32)pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.value");
|
||||
int32 offsetValue = pvField->getFieldOffset();
|
||||
int32 offsetValue = (int32)pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.alarm");
|
||||
int32 offsetAlarm = pvField->getFieldOffset();
|
||||
int32 offsetAlarm = (int32)pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.alarm.severity");
|
||||
int32 offsetSeverity = pvField->getFieldOffset();
|
||||
int32 offsetSeverity = (int32)pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.alarm.status");
|
||||
int32 offsetStatus = pvField->getFieldOffset();
|
||||
int32 offsetStatus = (int32)pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.alarm.message");
|
||||
int32 offsetMessage = pvField->getFieldOffset();
|
||||
int32 offsetMessage = (int32)pvField->getFieldOffset();
|
||||
bitSet->set(offsetValue);
|
||||
bitSet->set(offsetSeverity);
|
||||
bitSet->set(offsetStatus);
|
||||
|
||||
@@ -235,7 +235,7 @@ static void testMapping()
|
||||
testOk1(typeid(ScalarTypeTraits<ENUM>::type)==typeid(TYPE)); \
|
||||
testOk1(ENUM==(ScalarType)ScalarTypeID<TYPE>::value); \
|
||||
testOk1(ENUM==(ScalarType)ScalarTypeID<const TYPE>::value);
|
||||
OP(boolean, pvBoolean)
|
||||
OP(epics::pvData::boolean, pvBoolean)
|
||||
OP(int8, pvByte)
|
||||
OP(int16, pvShort)
|
||||
OP(int32, pvInt)
|
||||
|
||||
@@ -66,7 +66,7 @@ struct basicTestData {
|
||||
data.resize(100);
|
||||
for(size_t i=0; i<data.size(); i++)
|
||||
{
|
||||
data[i] = 10*i;
|
||||
data[i] = static_cast<int32>(10*i);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user