From 0ca43eb89b7984124612e7014ca733fab2064853 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Tue, 24 Jul 2012 23:40:50 +0200 Subject: [PATCH] IntrospectionRegistry changes, compiles --- pvAccessApp/Makefile | 2 +- pvAccessApp/remote/serializationHelper.h | 18 ++--- pvAccessApp/utils/introspectionRegistry.cpp | 74 +-------------------- 3 files changed, 12 insertions(+), 82 deletions(-) diff --git a/pvAccessApp/Makefile b/pvAccessApp/Makefile index ddadcff..df43651 100644 --- a/pvAccessApp/Makefile +++ b/pvAccessApp/Makefile @@ -56,7 +56,7 @@ LIBSRCS += simpleChannelSearchManagerImpl.cpp LIBSRCS += abstractResponseHandler.cpp LIBSRCS += blockingTCPAcceptor.cpp LIBSRCS += transportRegistry.cpp -#LIBSRCS += serializationHelper.cpp +LIBSRCS += serializationHelper.cpp SRC_DIRS += $(PVACCESS)/remoteClient INC += clientContextImpl.h diff --git a/pvAccessApp/remote/serializationHelper.h b/pvAccessApp/remote/serializationHelper.h index 6989078..b755499 100644 --- a/pvAccessApp/remote/serializationHelper.h +++ b/pvAccessApp/remote/serializationHelper.h @@ -20,9 +20,9 @@ namespace epics { - namespace pvData { + namespace pvAccess { - class SerializationHelper : public NoDefaultMethods { + class SerializationHelper : public epics::pvData::NoDefaultMethods { public: static epics::pvData::PVDataCreatePtr _pvDataCreate; @@ -32,7 +32,7 @@ namespace epics { * @param payloadBuffer data buffer. * @return deserialized PVRequest, can be null. */ - static PVStructure::shared_pointer deserializePVRequest(ByteBuffer* payloadBuffer, DeserializableControl* control); + static epics::pvData::PVStructure::shared_pointer deserializePVRequest(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control); /** * Deserialize Structure and create PVStructure instance. @@ -40,7 +40,7 @@ namespace epics { * @param control deserialization control. * @return PVStructure instance, can be null. */ - static PVStructure::shared_pointer deserializeStructureAndCreatePVStructure(ByteBuffer* payloadBuffer, DeserializableControl* control); + static epics::pvData::PVStructure::shared_pointer deserializeStructureAndCreatePVStructure(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control); /** * Deserialize Structure and create PVStructure instance, if necessary. @@ -50,28 +50,28 @@ namespace epics { * existingStructure instance is returned. null value is allowed. * @return PVStructure instance, can be null. */ - static PVStructure deserializeStructureAndCreatePVStructure(ByteBuffer* payloadBuffer, DeserializableControl* control, PVStructure::shared_pointer const & existingStructure); + static epics::pvData::PVStructure::shared_pointer deserializeStructureAndCreatePVStructure(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control, epics::pvData::PVStructure::shared_pointer const & existingStructure); /** * Deserialize optional PVStructrue. * @param payloadBuffer data buffer. * @return deserialized PVStructure, can be null. */ - static PVStructure::shared_pointer deserializeStructureFull(ByteBuffer* payloadBuffer, DeserializableControl* control); + static epics::pvData::PVStructure::shared_pointer deserializeStructureFull(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control); - static void serializeNullField(ByteBuffer* buffer, SerializableControl* control); + static void serializeNullField(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control); /** * Serialize PVRequest. * @param buffer data buffer. */ - static void serializePVRequest(ByteBuffer* buffer, SerializableControl* control, PVStructure::shared_pointer const & pvRequest); + static void serializePVRequest(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control, epics::pvData::PVStructure::shared_pointer const & pvRequest); /** * Serialize optional PVStructrue. * @param buffer data buffer. */ - static void serializeStructureFull(ByteBuffer* buffer, SerializableControl* control, PVStructure::shared_pointer const & pvStructure); + static void serializeStructureFull(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control, epics::pvData::PVStructure::shared_pointer const & pvStructure); }; diff --git a/pvAccessApp/utils/introspectionRegistry.cpp b/pvAccessApp/utils/introspectionRegistry.cpp index a5fe623..e97e8cc 100644 --- a/pvAccessApp/utils/introspectionRegistry.cpp +++ b/pvAccessApp/utils/introspectionRegistry.cpp @@ -6,6 +6,7 @@ #include #include +#include using namespace epics::pvData; using namespace std; @@ -102,10 +103,7 @@ void IntrospectionRegistry::serialize(FieldConstPtr const & field, ByteBuffer* b { if (field.get() == NULL) { - // TODO - //SerializationHelper::serializeNullField(buffer, control); - control->ensureBuffer(1); - buffer->putByte(IntrospectionRegistry::NULL_TYPE_CODE); + SerializationHelper::serializeNullField(buffer, control); } else { @@ -161,73 +159,5 @@ FieldConstPtr IntrospectionRegistry::deserialize(ByteBuffer* buffer, Deserializa return _fieldCreate->deserialize(buffer, control); } -/* -void IntrospectionRegistry::serializeFull(FieldConstPtr field, ByteBuffer* buffer, SerializableControl* control) -{ - serialize(field, StructureConstPtr(), buffer, control, NULL); -} - -FieldConstPtr IntrospectionRegistry::deserializeFull(ByteBuffer* buffer, DeserializableControl* control) -{ - return deserialize(buffer, control, NULL); -} - -void IntrospectionRegistry::serializeStructure(ByteBuffer* buffer, SerializableControl* control, PVStructurePtr pvStructure) -{ - if (pvStructure == NULL) - { - serialize(StructureConstPtr(), buffer, control); - } - else - { - serialize(pvStructure->getField(), buffer, control); - pvStructure->serialize(buffer, control); - } -} - -PVStructurePtr IntrospectionRegistry::deserializeStructure(ByteBuffer* buffer, DeserializableControl* control) -{ - PVStructurePtr pvStructure; - FieldConstPtr structureField = deserialize(buffer, control); - if (structureField.get() != NULL) - { - pvStructure = _pvDataCreate->createPVStructure(static_pointer_cast(structureField)); - pvStructure->deserialize(buffer, control); - } - return pvStructure; -} - -void IntrospectionRegistry::serializePVRequest(ByteBuffer* buffer, SerializableControl* control, PVStructurePtr pvRequest) -{ - // for now ordinary structure, later can be changed - serializeStructure(buffer, control, pvRequest); -} - -PVStructurePtr IntrospectionRegistry::deserializePVRequest(ByteBuffer* buffer, DeserializableControl* control) -{ - // for now ordinary structure, later can be changed - return deserializeStructure(buffer, control); -} - -PVStructurePtr IntrospectionRegistry::deserializeStructureAndCreatePVStructure(ByteBuffer* buffer, DeserializableControl* control) -{ - FieldConstPtr field = deserialize(buffer, control); - if (field == NULL) - return PVStructurePtr(); - - return _pvDataCreate->createPVStructure(static_pointer_cast(field)); -} - -void IntrospectionRegistry::serializeStatus(ByteBuffer* buffer, SerializableControl* control, const Status& status) -{ - status.serialize(buffer, control); -} - -void IntrospectionRegistry::deserializeStatus(Status &status, ByteBuffer* buffer, DeserializableControl* control) -{ - status.deserialize(buffer, control); -} -*/ - }}