diff --git a/pvDataCPP.files b/pvDataCPP.files index 0985d44..bacbe8e 100644 --- a/pvDataCPP.files +++ b/pvDataCPP.files @@ -208,4 +208,166 @@ testApp/pv/testStandardPVField.cpp COPYRIGHT Doxyfile LICENSE -README.html \ No newline at end of file +README.html +include/pv/alarm.h +include/pv/bitSet.h +include/pv/bitSetUtil.h +include/pv/byteBuffer.h +include/pv/control.h +include/pv/convert.h +include/pv/createRequest.h +include/pv/current_function.h +include/pv/destroyable.h +include/pv/display.h +include/pv/epicsException.h +include/pv/event.h +include/pv/executor.h +include/pv/factory.h +include/pv/localStaticLock.h +include/pv/lock.h +include/pv/messageQueue.h +include/pv/monitor.h +include/pv/monitorPlugin.h +include/pv/noDefaultMethods.h +include/pv/printer.h +include/pv/pvAlarm.h +include/pv/pvControl.h +include/pv/pvCopy.h +include/pv/pvData.h +include/pv/pvDisplay.h +include/pv/pvEnumerated.h +include/pv/pvIntrospect.h +include/pv/pvSubArrayCopy.h +include/pv/pvTimeStamp.h +include/pv/pvType.h +include/pv/queue.h +include/pv/requester.h +include/pv/serialize.h +include/pv/serializeHelper.h +include/pv/sharedPtr.h +include/pv/sharedVector.h +include/pv/standardField.h +include/pv/standardPVField.h +include/pv/status.h +include/pv/templateMeta.h +include/pv/thread.h +include/pv/timeFunction.h +include/pv/timer.h +include/pv/timeStamp.h +include/pv/typeCast.h +src/copy/createRequest.cpp +src/copy/createRequest.h +src/copy/pvCopy.cpp +src/copy/pvCopy.h +src/factory/Compare.cpp +src/factory/Convert.cpp +src/factory/factory.h +src/factory/FieldCreateFactory.cpp +src/factory/printer.cpp +src/factory/PVArray.cpp +src/factory/PVDataCreateFactory.cpp +src/factory/PVField.cpp +src/factory/PVScalar.cpp +src/factory/PVScalarArray.cpp +src/factory/PVStructure.cpp +src/factory/PVStructureArray.cpp +src/factory/pvSubArrayCopy.cpp +src/factory/PVUnion.cpp +src/factory/PVUnionArray.cpp +src/factory/StandardField.cpp +src/factory/StandardPVField.cpp +src/factory/TypeFunc.cpp +src/misc/bitSet.cpp +src/misc/bitSet.h +src/misc/byteBuffer.cpp +src/misc/byteBuffer.h +src/misc/current_function.h +src/misc/destroyable.h +src/misc/epicsException.cpp +src/misc/epicsException.h +src/misc/event.cpp +src/misc/event.h +src/misc/executor.cpp +src/misc/executor.h +src/misc/localStaticLock.cpp +src/misc/localStaticLock.h +src/misc/lock.h +src/misc/messageQueue.cpp +src/misc/messageQueue.h +src/misc/noDefaultMethods.h +src/misc/parseToPOD.cpp +src/misc/queue.h +src/misc/requester.cpp +src/misc/requester.h +src/misc/serialize.h +src/misc/serializeHelper.cpp +src/misc/serializeHelper.h +src/misc/sharedPtr.h +src/misc/sharedVector.h +src/misc/status.cpp +src/misc/status.h +src/misc/templateMeta.h +src/misc/thread.h +src/misc/timeFunction.cpp +src/misc/timeFunction.h +src/misc/timer.cpp +src/misc/timer.h +src/misc/typeCast.cpp +src/misc/typeCast.h +src/monitor/monitor.cpp +src/monitor/monitor.h +src/monitor/monitorPlugin.cpp +src/monitor/monitorPlugin.h +src/property/alarm.cpp +src/property/alarm.h +src/property/control.h +src/property/display.h +src/property/pvAlarm.cpp +src/property/pvAlarm.h +src/property/pvControl.cpp +src/property/pvControl.h +src/property/pvDisplay.cpp +src/property/pvDisplay.h +src/property/pvEnumerated.cpp +src/property/pvEnumerated.h +src/property/pvTimeStamp.cpp +src/property/pvTimeStamp.h +src/property/timeStamp.cpp +src/property/timeStamp.h +src/pv/convert.h +src/pv/printer.h +src/pv/pvData.h +src/pv/pvIntrospect.h +src/pv/pvSubArrayCopy.h +src/pv/pvType.h +src/pv/standardField.h +src/pv/standardPVField.h +src/pvMisc/bitSetUtil.cpp +src/pvMisc/bitSetUtil.h +testApp/copy/testCreateRequest.cpp +testApp/copy/testPVCopy.cpp +testApp/misc/testBaseException.cpp +testApp/misc/testBitSet.cpp +testApp/misc/testByteBuffer.cpp +testApp/misc/testByteOrder.cpp +testApp/misc/testMessageQueue.cpp +testApp/misc/testOverrunBitSet.cpp +testApp/misc/testQueue.cpp +testApp/misc/testSerialization.cpp +testApp/misc/testSharedVector.cpp +testApp/misc/testThread.cpp +testApp/misc/testTimer.cpp +testApp/misc/testTimeStamp.cpp +testApp/misc/testTypeCast.cpp +testApp/property/testProperty.cpp +testApp/pv/testBitSetUtil.cpp +testApp/pv/testConvert.cpp +testApp/pv/testFieldBuilder.cpp +testApp/pv/testIntrospect.cpp +testApp/pv/testOperators.cpp +testApp/pv/testPVData.cpp +testApp/pv/testPVScalarArray.cpp +testApp/pv/testPVStructureArray.cpp +testApp/pv/testPVType.cpp +testApp/pv/testStandardField.cpp +testApp/pv/testStandardPVField.cpp diff --git a/src/factory/FieldCreateFactory.cpp b/src/factory/FieldCreateFactory.cpp index 21ca6a0..fc87b44 100644 --- a/src/factory/FieldCreateFactory.cpp +++ b/src/factory/FieldCreateFactory.cpp @@ -88,10 +88,10 @@ int8 Scalar::getTypeCodeLUT() const 0x21, // pvShort 0x22, // pvInt 0x23, // pvLong - 0x28, // pvUByte - 0x29, // pvUShort - 0x2A, // pvUInt - 0x2B, // pvULong + 0x24, // pvUByte + 0x25, // pvUShort + 0x26, // pvUInt + 0x27, // pvULong 0x42, // pvFloat 0x43, // pvDouble 0x60 // pvString @@ -206,6 +206,7 @@ ScalarArray::ScalarArray(ScalarType elementType) ScalarArray::~ScalarArray() {} +// TODO remove duplication, see Scalar::getTypeCodeLUT() int8 ScalarArray::getTypeCodeLUT() const { static const int8 typeCodeLUT[] = { @@ -214,10 +215,10 @@ int8 ScalarArray::getTypeCodeLUT() const 0x21, // pvShort 0x22, // pvInt 0x23, // pvLong - 0x28, // pvUByte - 0x29, // pvUShort - 0x2A, // pvUInt - 0x2B, // pvULong + 0x24, // pvUByte + 0x25, // pvUShort + 0x26, // pvUInt + 0x27, // pvULong 0x42, // pvFloat 0x43, // pvDouble 0x60 // pvString @@ -256,7 +257,7 @@ std::ostream& ScalarArray::dump(std::ostream& o) const void ScalarArray::serialize(ByteBuffer *buffer, SerializableControl *control) const { control->ensureBuffer(1); - buffer->putByte((int8)0x10 | getTypeCodeLUT()); + buffer->putByte((int8)0x08 | getTypeCodeLUT()); } void ScalarArray::deserialize(ByteBuffer* /*buffer*/, DeserializableControl* /*control*/) { @@ -289,7 +290,7 @@ std::ostream& StructureArray::dump(std::ostream& o) const void StructureArray::serialize(ByteBuffer *buffer, SerializableControl *control) const { control->ensureBuffer(1); - buffer->putByte((int8)0x90); + buffer->putByte((int8)0x88); control->cachedSerialize(pstructure, buffer); } @@ -326,11 +327,11 @@ void UnionArray::serialize(ByteBuffer *buffer, SerializableControl *control) con if (punion->isVariant()) { // unrestricted/variant union - buffer->putByte((int8)0x92); + buffer->putByte((int8)0x8A); } else { - buffer->putByte((int8)0x91); + buffer->putByte((int8)0x89); control->cachedSerialize(punion, buffer); } } @@ -904,22 +905,14 @@ static int decodeScalar(int8 code) { static const int integerLUT[] = { - pvByte, // 8-bits - pvShort, // 16-bits - pvInt, // 32-bits - pvLong, // 64-bits - -1, - -1, - -1, - -1, + pvByte, // 8-bits + pvShort, // 16-bits + pvInt, // 32-bits + pvLong, // 64-bits pvUByte, // unsigned 8-bits pvUShort, // unsigned 16-bits pvUInt, // unsigned 32-bits - pvULong, // unsigned 64-bits - -1, - -1, - -1, - -1 + pvULong // unsigned 64-bits }; static const int floatLUT[] = @@ -931,22 +924,14 @@ static int decodeScalar(int8 code) -1, -1, -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, -1 }; // bits 7-5 switch (code >> 5) { case 0: return pvBoolean; - case 1: return integerLUT[code & 0x0F]; - case 2: return floatLUT[code & 0x0F]; + case 1: return integerLUT[code & 0x07]; + case 2: return floatLUT[code & 0x07]; case 3: return pvString; default: return -1; } @@ -959,8 +944,9 @@ FieldConstPtr FieldCreate::deserialize(ByteBuffer* buffer, DeserializableControl if (code == -1) return FieldConstPtr(); - int typeCode = code & 0xEF; - bool notArray = ((code & 0x10) == 0); + int typeCode = code & 0xE7; + int scalarOrArray = code & 0x18; + bool notArray = (scalarOrArray == 0); if (notArray) { if (typeCode < 0x80) @@ -991,28 +977,56 @@ FieldConstPtr FieldCreate::deserialize(ByteBuffer* buffer, DeserializableControl } else // array { + bool isVariable = (scalarOrArray == 0x08); + // bounded == 0x10; + bool isFixed = (scalarOrArray == 0x18); + + size_t size = (isVariable ? 0 : SerializeHelper::readSize(buffer, control)); + if (typeCode < 0x80) { // Type type = Type.scalarArray; int scalarType = decodeScalar(code); if (scalarType == -1) throw std::invalid_argument("invalid scalarArray type encoding"); - return scalarArrays[scalarType]; + if (isVariable) + return scalarArrays[scalarType]; + /* + else if (isFixed) + return FieldConstPtr(new ScalarFixedArray(scalarType, size), Field::Deleter()); + else + return FieldConstPtr(new ScalarBoundedArray(scalarType, size), Field::Deleter()); + */ + // TODO + else + throw std::invalid_argument("only variant array supported for now"); } else if (typeCode == 0x80) { + // TODO fixed and bounded array support + if (!isVariable) + throw std::invalid_argument("fixed and bounded structure array not supported"); + // Type type = Type.structureArray; StructureConstPtr elementStructure = std::tr1::static_pointer_cast(control->cachedDeserialize(buffer)); return FieldConstPtr(new StructureArray(elementStructure), Field::Deleter()); } else if (typeCode == 0x81) { + // TODO fixed and bounded array support + if (!isVariable) + throw std::invalid_argument("fixed and bounded structure array not supported"); + // Type type = Type.unionArray; UnionConstPtr elementUnion = std::tr1::static_pointer_cast(control->cachedDeserialize(buffer)); return FieldConstPtr(new UnionArray(elementUnion), Field::Deleter()); } else if (typeCode == 0x82) { + // TODO fixed and bounded array support + if (!isVariable) + throw std::invalid_argument("fixed and bounded structure array not supported"); + // Type type = Type.unionArray; variant union (aka any type) return variantUnionArray; }