From 42fb15211a56d25048a6326e918bd4c87de7c390 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Mon, 10 Nov 2014 10:04:32 +0100 Subject: [PATCH 1/3] NTUtils added, is_a for new URI scheme --- src/Makefile | 2 ++ src/nt/nt.h | 3 ++ src/nt/ntfield.cpp | 3 +- src/nt/ntfield.h | 60 +++++++++++++++++++-------------------- src/nt/ntmultiChannel.cpp | 3 +- src/nt/ntnameValue.cpp | 3 +- src/nt/ntndarray.cpp | 3 +- src/nt/ntscalar.cpp | 3 +- src/nt/ntscalarArray.cpp | 3 +- src/nt/nttable.cpp | 3 +- src/nt/ntutils.cpp | 24 ++++++++++++++++ src/nt/ntutils.h | 38 +++++++++++++++++++++++++ test/nt/Makefile | 4 +++ test/nt/ntfieldTest.cpp | 1 + test/nt/ntutilsTest.cpp | 36 +++++++++++++++++++++++ 15 files changed, 152 insertions(+), 37 deletions(-) create mode 100644 src/nt/ntutils.cpp create mode 100644 src/nt/ntutils.h create mode 100644 test/nt/ntutilsTest.cpp diff --git a/src/Makefile b/src/Makefile index 6b96e13..f7e58bf 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,6 +6,7 @@ SRC = $(TOP)/src/ SRC_DIRS += $(SRC)/nt INC += nt.h +INC += ntutils.h INC += ntfield.h INC += ntscalar.h INC += ntscalarArray.h @@ -14,6 +15,7 @@ INC += nttable.h INC += ntmultiChannel.h INC += ntndarray.h +LIBSRCS += ntutils.cpp LIBSRCS += ntfield.cpp LIBSRCS += ntscalar.cpp LIBSRCS += ntscalarArray.cpp diff --git a/src/nt/nt.h b/src/nt/nt.h index 3544cfe..7c6ddff 100644 --- a/src/nt/nt.h +++ b/src/nt/nt.h @@ -7,6 +7,9 @@ #ifndef NT_H #define NT_H +/* + * Include all the normative types here. + */ #include #include #include diff --git a/src/nt/ntfield.cpp b/src/nt/ntfield.cpp index b364651..a8c29b4 100644 --- a/src/nt/ntfield.cpp +++ b/src/nt/ntfield.cpp @@ -8,9 +8,10 @@ #include #include +using namespace epics::pvData; using std::tr1::static_pointer_cast; -namespace epics { namespace pvData { +namespace epics { namespace nt { NTFieldPtr NTField::get() { diff --git a/src/nt/ntfield.h b/src/nt/ntfield.h index da70787..d3a3f58 100644 --- a/src/nt/ntfield.h +++ b/src/nt/ntfield.h @@ -17,7 +17,7 @@ #include #include -namespace epics { namespace pvData { +namespace epics { namespace nt { /** * Convenience Class for introspection fields of a Normative Type * @author mrk @@ -47,83 +47,83 @@ public: * @param field The field to test. * @return (false,true) if field (is not,is) an enumerated structure. */ - bool isEnumerated(FieldConstPtr const & field); + bool isEnumerated(epics::pvData::FieldConstPtr const & field); /** * Is field a timeStamp structure. * @param field The field to test. * @return (false,true) if field (is not,is) a timeStamp structure. */ - bool isTimeStamp(FieldConstPtr const & field); + bool isTimeStamp(epics::pvData::FieldConstPtr const & field); /** * Is field an alarm structure. * @param field The field to test. * @return (false,true) if field (is not,is) an alarm structure. */ - bool isAlarm(FieldConstPtr const & field); + bool isAlarm(epics::pvData::FieldConstPtr const & field); /** * Is field a display structure. * @param field The field to test. * @return (false,true) if field (is not,is) a display structure. */ - bool isDisplay(FieldConstPtr const & field); + bool isDisplay(epics::pvData::FieldConstPtr const & field); /** * Is field an alarmLimit structure. * @param field The field to test. * @return (false,true) if field (is not,is) an alarmLimit structure. */ - bool isAlarmLimit(FieldConstPtr const & field); + bool isAlarmLimit(epics::pvData::FieldConstPtr const & field); /** * Is field a control structure. * @param field The field to test. * @return (false,true) if field (is not,is) a control structure. */ - bool isControl(FieldConstPtr const & field); + bool isControl(epics::pvData::FieldConstPtr const & field); /** * Create an enumerated structure. * @return an enumerated structure. */ - StructureConstPtr createEnumerated(); + epics::pvData::StructureConstPtr createEnumerated(); /** * Create a timeStamp structure. * @return a timeStamp structure. */ - StructureConstPtr createTimeStamp(); + epics::pvData::StructureConstPtr createTimeStamp(); /** * Create an alarm structure. * @return an alarm structure. */ - StructureConstPtr createAlarm(); + epics::pvData::StructureConstPtr createAlarm(); /** * Create a display structure. * @return a displayalarm structure. */ - StructureConstPtr createDisplay(); + epics::pvData::StructureConstPtr createDisplay(); /** * Create a control structure. * @return a control structure. */ - StructureConstPtr createControl(); + epics::pvData::StructureConstPtr createControl(); /** * Create an array of enumerated structures. * @return an array of enumerated structures. */ - StructureArrayConstPtr createEnumeratedArray(); + epics::pvData::StructureArrayConstPtr createEnumeratedArray(); /** * Create an array of timeStamp structures. * @return an array of timeStamp structures. */ - StructureArrayConstPtr createTimeStampArray(); + epics::pvData::StructureArrayConstPtr createTimeStampArray(); /** * Create an array of alarm structures. * @return an array of alarm structures. */ - StructureArrayConstPtr createAlarmArray(); + epics::pvData::StructureArrayConstPtr createAlarmArray(); private: NTField(); - FieldCreatePtr fieldCreate; - StandardFieldPtr standardField; + epics::pvData::FieldCreatePtr fieldCreate; + epics::pvData::StandardFieldPtr standardField; }; /** @@ -148,54 +148,54 @@ public: * @param choices The array of choices. * @return an enumerated PVStructure.. */ - PVStructurePtr createEnumerated( - StringArray const & choices); + epics::pvData::PVStructurePtr createEnumerated( + epics::pvData::StringArray const & choices); /** * Create a timeStamp PVStructure. * @return a timeStamp PVStructure.. */ - PVStructurePtr createTimeStamp(); + epics::pvData::PVStructurePtr createTimeStamp(); /** * Create an alarm PVStructure. * @return an alarm PVStructure.. */ - PVStructurePtr createAlarm(); + epics::pvData::PVStructurePtr createAlarm(); /** * Create a display PVStructure. * @return a display PVStructure.. */ - PVStructurePtr createDisplay(); + epics::pvData::PVStructurePtr createDisplay(); /** * Create an alarmLimit PVStructure. * @return an alarmLimit PVStructure.. */ - PVStructurePtr createAlarmLimit(); + epics::pvData::PVStructurePtr createAlarmLimit(); /** * Create a control PVStructure. * @return a control PVStructure.. */ - PVStructurePtr createControl(); + epics::pvData::PVStructurePtr createControl(); /** * Create an enumerated PVStructureArray. * @return an enumerated PVStructureArray.. */ - PVStructureArrayPtr createEnumeratedArray(); + epics::pvData::PVStructureArrayPtr createEnumeratedArray(); /** * Create a timeStamp PVStructureArray. * @return a timeStamp PVStructureArray */ - PVStructureArrayPtr createTimeStampArray(); + epics::pvData::PVStructureArrayPtr createTimeStampArray(); /** * Create an alarm PVStructureArray. * @return an alarm PVStructureArray.. */ - PVStructureArrayPtr createAlarmArray(); + epics::pvData::PVStructureArrayPtr createAlarmArray(); private: PVNTField(); - PVDataCreatePtr pvDataCreate; - StandardFieldPtr standardField; - StandardPVFieldPtr standardPVField; + epics::pvData::PVDataCreatePtr pvDataCreate; + epics::pvData::StandardFieldPtr standardField; + epics::pvData::StandardPVFieldPtr standardPVField; NTFieldPtr ntstructureField; }; diff --git a/src/nt/ntmultiChannel.cpp b/src/nt/ntmultiChannel.cpp index 0fc53e2..b625741 100644 --- a/src/nt/ntmultiChannel.cpp +++ b/src/nt/ntmultiChannel.cpp @@ -6,6 +6,7 @@ */ #include +#include #include using namespace std; @@ -210,7 +211,7 @@ NTMultiChannel::shared_pointer NTMultiChannel::wrapUnsafe(PVStructurePtr const & bool NTMultiChannel::is_a(StructureConstPtr const &structure) { - return structure->getID() == URI; + return NTUtils::is_a(structure->getID(), URI); } bool NTMultiChannel::isCompatible(PVStructurePtr const &pvStructure) diff --git a/src/nt/ntnameValue.cpp b/src/nt/ntnameValue.cpp index e80b558..384dafd 100644 --- a/src/nt/ntnameValue.cpp +++ b/src/nt/ntnameValue.cpp @@ -6,6 +6,7 @@ */ #include +#include using namespace std; using namespace epics::pvData; @@ -123,7 +124,7 @@ NTNameValue::shared_pointer NTNameValue::wrapUnsafe(PVStructurePtr const & struc bool NTNameValue::is_a(StructureConstPtr const & structure) { - return structure->getID() == URI; + return NTUtils::is_a(structure->getID(), URI); } bool NTNameValue::isCompatible(PVStructurePtr const & pvStructure) diff --git a/src/nt/ntndarray.cpp b/src/nt/ntndarray.cpp index 14b5016..b6c7d65 100644 --- a/src/nt/ntndarray.cpp +++ b/src/nt/ntndarray.cpp @@ -8,6 +8,7 @@ #include #include +#include using namespace std; using namespace epics::pvData; @@ -217,7 +218,7 @@ NTNDArray::shared_pointer NTNDArray::wrapUnsafe(PVStructurePtr const & structure bool NTNDArray::is_a(StructureConstPtr const & structure) { - return structure->getID() == URI; + return NTUtils::is_a(structure->getID(), URI); } bool NTNDArray::isCompatible(PVStructurePtr const & pvStructure) diff --git a/src/nt/ntscalar.cpp b/src/nt/ntscalar.cpp index e28b729..0f9d624 100644 --- a/src/nt/ntscalar.cpp +++ b/src/nt/ntscalar.cpp @@ -6,6 +6,7 @@ */ #include +#include using namespace std; using namespace epics::pvData; @@ -143,7 +144,7 @@ NTScalar::shared_pointer NTScalar::wrapUnsafe(PVStructurePtr const & structure) bool NTScalar::is_a(StructureConstPtr const & structure) { - return structure->getID() == URI; + return NTUtils::is_a(structure->getID(), URI); } bool NTScalar::isCompatible(PVStructurePtr const & pvStructure) diff --git a/src/nt/ntscalarArray.cpp b/src/nt/ntscalarArray.cpp index 6e6addf..e510eb3 100644 --- a/src/nt/ntscalarArray.cpp +++ b/src/nt/ntscalarArray.cpp @@ -6,6 +6,7 @@ */ #include +#include using namespace std; using namespace epics::pvData; @@ -140,7 +141,7 @@ NTScalarArray::shared_pointer NTScalarArray::wrapUnsafe(PVStructurePtr const & s bool NTScalarArray::is_a(StructureConstPtr const & structure) { - return structure->getID() == URI; + return NTUtils::is_a(structure->getID(), URI); } bool NTScalarArray::isCompatible(PVStructurePtr const & pvStructure) diff --git a/src/nt/nttable.cpp b/src/nt/nttable.cpp index dc96906..240d6b9 100644 --- a/src/nt/nttable.cpp +++ b/src/nt/nttable.cpp @@ -8,6 +8,7 @@ #include #include +#include using namespace std; using namespace epics::pvData; @@ -138,7 +139,7 @@ NTTable::shared_pointer NTTable::wrapUnsafe(PVStructurePtr const & structure) bool NTTable::is_a(StructureConstPtr const & structure) { - return structure->getID() == URI; + return NTUtils::is_a(structure->getID(), URI); } bool NTTable::isCompatible(PVStructurePtr const & pvStructure) diff --git a/src/nt/ntutils.cpp b/src/nt/ntutils.cpp new file mode 100644 index 0000000..a736082 --- /dev/null +++ b/src/nt/ntutils.cpp @@ -0,0 +1,24 @@ +/* ntutils.cpp */ +/** + * Copyright - See the COPYRIGHT that is included with this distribution. + * EPICS pvDataCPP is distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. + */ + +#include + +using namespace std; + +namespace epics { namespace nt { + +bool NTUtils::is_a(const std::string &u1, const std::string &u2) +{ + // remove minor for the u2 + size_t pos = u2.find_last_of('.'); + std::string su2 = (pos == string::npos) ? u2 : u2.substr(0, pos); + + // "starts with comparison" + return su2.size() <= u1.size() && u1.compare(0, su2.size(), su2) == 0; +} + +}} diff --git a/src/nt/ntutils.h b/src/nt/ntutils.h new file mode 100644 index 0000000..3e99336 --- /dev/null +++ b/src/nt/ntutils.h @@ -0,0 +1,38 @@ +/* ntutils.h */ +/** + * Copyright - See the COPYRIGHT that is included with this distribution. + * EPICS pvDataCPP is distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. + */ +#ifndef NTUTILS_H +#define NTUTILS_H + +#include + +namespace epics { namespace nt { + +/** + * Utility methods for NT types. + * @author mse + */ +class NTUtils { +public: + + /** + * Checks whether NT types are compatible by checking their IDs, + * i.e. their names and major version must match. + * @param u1 the first uri. + * @param u2 the second uri. + * @return true of URIs are compatible, false otherwise. + */ + static bool is_a(const std::string &u1, const std::string &u2); + +private: + // disable object creation + NTUtils() {} +}; + +}} + +#endif /* NTUTILS_H */ + diff --git a/test/nt/Makefile b/test/nt/Makefile index c1f47ea..3b0b4b6 100644 --- a/test/nt/Makefile +++ b/test/nt/Makefile @@ -32,6 +32,10 @@ TESTPROD_HOST += ntndarrayTest ntndarrayTest_SRCS = ntndarrayTest.cpp TESTS += ntndarrayTest +TESTPROD_HOST += ntutilsTest +ntndarrayTest_SRCS = ntutilsTest.cpp +TESTS += ntutilsTest + TESTSCRIPTS_HOST += $(TESTS:%=%.t) include $(TOP)/configure/RULES diff --git a/test/nt/ntfieldTest.cpp b/test/nt/ntfieldTest.cpp index f394533..dccee87 100644 --- a/test/nt/ntfieldTest.cpp +++ b/test/nt/ntfieldTest.cpp @@ -15,6 +15,7 @@ #include +using namespace epics::nt; using namespace epics::pvData; using std::string; using std::cout; diff --git a/test/nt/ntutilsTest.cpp b/test/nt/ntutilsTest.cpp new file mode 100644 index 0000000..5180657 --- /dev/null +++ b/test/nt/ntutilsTest.cpp @@ -0,0 +1,36 @@ +/** + * Copyright - See the COPYRIGHT that is included with this distribution. + * EPICS pvDataCPP is distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. + */ + +#include +#include + +#include + + +using namespace epics::nt; + +void test_is_a() +{ + testDiag("test_is_a"); + + testOk1(NTUtils::is_a("epics:nt/NTTable:1.0", "epics:nt/NTTable:1.0")); + testOk1(NTUtils::is_a("epics:nt/NTTable:2.0", "epics:nt/NTTable:2.0")); + testOk1(NTUtils::is_a("epics:nt/NTTable:1.0", "epics:nt/NTTable:1.1")); + testOk1(NTUtils::is_a("epics:nt/NTTable:1.1", "epics:nt/NTTable:1.0")); + + testOk1(!NTUtils::is_a("epics:nt/NTTable:1.0", "epics:nt/NTTable:2.0")); + testOk1(!NTUtils::is_a("epics:nt/NTTable:2.0", "epics:nt/NTTable:1.0")); + testOk1(!NTUtils::is_a("epics:nt/NTTable:1.3", "epics:nt/NTTable:2.3")); + testOk1(!NTUtils::is_a("epics:nt/NTTable:1.0", "epics:nt/NTMatrix:1.0")); +} + +MAIN(testNTUtils) { + testPlan(8); + test_is_a(); + return testDone(); +} + + From 49312d62d515cd1cbe57b59857eaf91e4b081b27 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Mon, 10 Nov 2014 10:24:10 +0100 Subject: [PATCH 2/3] added epicsShared export declarations --- src/nt/ntfield.cpp | 2 ++ src/nt/ntfield.h | 16 ++++++++++++++-- src/nt/ntmultiChannel.cpp | 4 +++- src/nt/ntmultiChannel.h | 20 ++++++++++++++++++-- src/nt/ntnameValue.cpp | 1 + src/nt/ntnameValue.h | 17 ++++++++++++++++- src/nt/ntndarray.cpp | 1 + src/nt/ntndarray.h | 21 ++++++++++++++++++--- src/nt/ntscalar.cpp | 1 + src/nt/ntscalar.h | 17 +++++++++++++++-- src/nt/ntscalarArray.cpp | 1 + src/nt/ntscalarArray.h | 18 ++++++++++++++++-- src/nt/nttable.cpp | 1 + src/nt/nttable.h | 21 ++++++++++++++++++--- src/nt/ntutils.cpp | 1 + src/nt/ntutils.h | 3 ++- 16 files changed, 128 insertions(+), 17 deletions(-) diff --git a/src/nt/ntfield.cpp b/src/nt/ntfield.cpp index a8c29b4..450ee3e 100644 --- a/src/nt/ntfield.cpp +++ b/src/nt/ntfield.cpp @@ -6,6 +6,8 @@ */ #include + +#define epicsExportSharedSymbols #include using namespace epics::pvData; diff --git a/src/nt/ntfield.h b/src/nt/ntfield.h index d3a3f58..4da2cbc 100644 --- a/src/nt/ntfield.h +++ b/src/nt/ntfield.h @@ -9,6 +9,11 @@ #include +#ifdef epicsExportSharedSymbols +# define ntfieldEpicsExportSharedSymbols +# undef epicsExportSharedSymbols +#endif + #include #include #include @@ -17,6 +22,13 @@ #include #include +#ifdef ntfieldEpicsExportSharedSymbols +# define epicsExportSharedSymbols +# undef ntfieldEpicsExportSharedSymbols +#endif + +#include + namespace epics { namespace nt { /** * Convenience Class for introspection fields of a Normative Type @@ -30,7 +42,7 @@ typedef std::tr1::shared_ptr NTFieldPtr; class PVNTField; typedef std::tr1::shared_ptr PVNTFieldPtr; -class NTField { +class epicsShareClass NTField { public: POINTER_DEFINITIONS(NTField); /** @@ -131,7 +143,7 @@ private: * @author mrk * */ -class PVNTField { +class epicsShareClass PVNTField { public: POINTER_DEFINITIONS(PVNTField); /** diff --git a/src/nt/ntmultiChannel.cpp b/src/nt/ntmultiChannel.cpp index b625741..ae73c43 100644 --- a/src/nt/ntmultiChannel.cpp +++ b/src/nt/ntmultiChannel.cpp @@ -5,9 +5,11 @@ * in file LICENSE that is included with this distribution. */ +#include + +#define epicsExportSharedSymbols #include #include -#include using namespace std; using namespace epics::pvData; diff --git a/src/nt/ntmultiChannel.h b/src/nt/ntmultiChannel.h index 30aa35a..3fcc6ef 100644 --- a/src/nt/ntmultiChannel.h +++ b/src/nt/ntmultiChannel.h @@ -7,10 +7,26 @@ #ifndef NTMULTICHANNEL_H #define NTMULTICHANNEL_H -#include #include #include +#ifdef epicsExportSharedSymbols +# define ntmultiChannelEpicsExportSharedSymbols +# undef epicsExportSharedSymbols +#endif + +#include +#include + +#ifdef ntmultiChannelEpicsExportSharedSymbols +# define epicsExportSharedSymbols +# undef ntmultiChannelEpicsExportSharedSymbols +#endif + +#include + +#include + namespace epics { namespace nt { @@ -140,7 +156,7 @@ namespace detail { typedef std::tr1::shared_ptr NTMultiChannelBuilderPtr; -class NTMultiChannel +class epicsShareClass NTMultiChannel { public: POINTER_DEFINITIONS(NTMultiChannel); diff --git a/src/nt/ntnameValue.cpp b/src/nt/ntnameValue.cpp index 384dafd..c396758 100644 --- a/src/nt/ntnameValue.cpp +++ b/src/nt/ntnameValue.cpp @@ -5,6 +5,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include #include diff --git a/src/nt/ntnameValue.h b/src/nt/ntnameValue.h index d5e5a93..1101ed9 100644 --- a/src/nt/ntnameValue.h +++ b/src/nt/ntnameValue.h @@ -7,8 +7,23 @@ #ifndef NTNAMEVALUE_H #define NTNAMEVALUE_H +#ifdef epicsExportSharedSymbols +# define ntnameValueEpicsExportSharedSymbols +# undef epicsExportSharedSymbols +#endif + +#include +#include + +#ifdef ntnameValueEpicsExportSharedSymbols +# define epicsExportSharedSymbols +# undef ntnameValueEpicsExportSharedSymbols +#endif + #include +#include + namespace epics { namespace nt { class NTNameValue; @@ -111,7 +126,7 @@ typedef std::tr1::shared_ptr NTNameValueBuilderPtr; * Convenience Class for NTNameValue * @author mrk */ -class NTNameValue +class epicsShareClass NTNameValue { public: POINTER_DEFINITIONS(NTNameValue); diff --git a/src/nt/ntndarray.cpp b/src/nt/ntndarray.cpp index b6c7d65..0c8b7cd 100644 --- a/src/nt/ntndarray.cpp +++ b/src/nt/ntndarray.cpp @@ -7,6 +7,7 @@ #include +#define epicsExportSharedSymbols #include #include diff --git a/src/nt/ntndarray.h b/src/nt/ntndarray.h index d84776b..cd4b235 100644 --- a/src/nt/ntndarray.h +++ b/src/nt/ntndarray.h @@ -7,11 +7,26 @@ #ifndef NTNDARRAY_H #define NTNDARRAY_H -#include - #include #include +#ifdef epicsExportSharedSymbols +# define ntscalarArrayEpicsExportSharedSymbols +# undef epicsExportSharedSymbols +#endif + +#include +#include + +#ifdef ntscalarArrayEpicsExportSharedSymbols +# define epicsExportSharedSymbols +# undef ntscalarArrayEpicsExportSharedSymbols +#endif + +#include + +#include + namespace epics { namespace nt { class NTNDArray; @@ -108,7 +123,7 @@ typedef std::tr1::shared_ptr NTNDArrayBuilderPtr; * Convenience Class for NTNDArray * @author dgh */ -class NTNDArray +class epicsShareClass NTNDArray { public: POINTER_DEFINITIONS(NTNDArray); diff --git a/src/nt/ntscalar.cpp b/src/nt/ntscalar.cpp index 0f9d624..969a4f2 100644 --- a/src/nt/ntscalar.cpp +++ b/src/nt/ntscalar.cpp @@ -5,6 +5,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include #include diff --git a/src/nt/ntscalar.h b/src/nt/ntscalar.h index bffca71..3e04f6f 100644 --- a/src/nt/ntscalar.h +++ b/src/nt/ntscalar.h @@ -7,10 +7,23 @@ #ifndef NTSCALAR_H #define NTSCALAR_H -#include +#ifdef epicsExportSharedSymbols +# define ntscalarEpicsExportSharedSymbols +# undef epicsExportSharedSymbols +#endif + #include #include +#ifdef ntscalarEpicsExportSharedSymbols +# define epicsExportSharedSymbols +# undef ntscalarEpicsExportSharedSymbols +#endif + +#include + +#include + namespace epics { namespace nt { class NTScalar; @@ -126,7 +139,7 @@ typedef std::tr1::shared_ptr NTScalarBuilderPtr; * Convenience Class for NTScalar * @author mrk */ -class NTScalar +class epicsShareClass NTScalar { public: POINTER_DEFINITIONS(NTScalar); diff --git a/src/nt/ntscalarArray.cpp b/src/nt/ntscalarArray.cpp index e510eb3..07bc2d2 100644 --- a/src/nt/ntscalarArray.cpp +++ b/src/nt/ntscalarArray.cpp @@ -5,6 +5,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include #include diff --git a/src/nt/ntscalarArray.h b/src/nt/ntscalarArray.h index b94e65a..cc92d71 100644 --- a/src/nt/ntscalarArray.h +++ b/src/nt/ntscalarArray.h @@ -7,10 +7,24 @@ #ifndef NTSCALARARRAY_H #define NTSCALARARRAY_H -#include +#ifdef epicsExportSharedSymbols +# define ntscalarArrayEpicsExportSharedSymbols +# undef epicsExportSharedSymbols +#endif + #include #include +#ifdef ntscalarArrayEpicsExportSharedSymbols +# define epicsExportSharedSymbols +# undef ntscalarArrayEpicsExportSharedSymbols +#endif + +#include + +#include + + namespace epics { namespace nt { class NTScalarArray; @@ -126,7 +140,7 @@ typedef std::tr1::shared_ptr NTScalarArrayBuilderP * Convenience Class for NTScalarArray * @author mrk */ -class NTScalarArray +class epicsShareClass NTScalarArray { public: POINTER_DEFINITIONS(NTScalarArray); diff --git a/src/nt/nttable.cpp b/src/nt/nttable.cpp index 240d6b9..e455cf8 100644 --- a/src/nt/nttable.cpp +++ b/src/nt/nttable.cpp @@ -7,6 +7,7 @@ #include +#define epicsExportSharedSymbols #include #include diff --git a/src/nt/nttable.h b/src/nt/nttable.h index 2746397..6272951 100644 --- a/src/nt/nttable.h +++ b/src/nt/nttable.h @@ -7,11 +7,26 @@ #ifndef NTTABLE_H #define NTTABLE_H -#include - #include #include +#ifdef epicsExportSharedSymbols +# define nttableEpicsExportSharedSymbols +# undef epicsExportSharedSymbols +#endif + +#include +#include + +#ifdef nttableEpicsExportSharedSymbols +# define epicsExportSharedSymbols +# undef nttableEpicsExportSharedSymbols +#endif + +#include + +#include + namespace epics { namespace nt { class NTTable; @@ -114,7 +129,7 @@ typedef std::tr1::shared_ptr NTTableBuilderPtr; * Convenience Class for NTTable * @author mrk */ -class NTTable +class epicsShareClass NTTable { public: POINTER_DEFINITIONS(NTTable); diff --git a/src/nt/ntutils.cpp b/src/nt/ntutils.cpp index a736082..0e38f31 100644 --- a/src/nt/ntutils.cpp +++ b/src/nt/ntutils.cpp @@ -5,6 +5,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include using namespace std; diff --git a/src/nt/ntutils.h b/src/nt/ntutils.h index 3e99336..a1d100f 100644 --- a/src/nt/ntutils.h +++ b/src/nt/ntutils.h @@ -8,6 +8,7 @@ #define NTUTILS_H #include +#include namespace epics { namespace nt { @@ -15,7 +16,7 @@ namespace epics { namespace nt { * Utility methods for NT types. * @author mse */ -class NTUtils { +class epicsShareClass NTUtils { public: /** From a25a89fadc2a9d59e27e038ee49e7aba3fb25207 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Mon, 10 Nov 2014 21:52:10 +0100 Subject: [PATCH 3/3] win32 build, all test pass --- src/nt/ntmultiChannel.cpp | 2 +- test/nt/ntmultiChannelTest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nt/ntmultiChannel.cpp b/src/nt/ntmultiChannel.cpp index ae73c43..da3e6c5 100644 --- a/src/nt/ntmultiChannel.cpp +++ b/src/nt/ntmultiChannel.cpp @@ -158,7 +158,7 @@ StructureConstPtr NTMultiChannelBuilder::createStructure() return st; } -PVStructurePtr NTMultiChannelBuilder::NTMultiChannelBuilder::createPVStructure() +PVStructurePtr NTMultiChannelBuilder::createPVStructure() { return pvDataCreate->createPVStructure(createStructure()); } diff --git a/test/nt/ntmultiChannelTest.cpp b/test/nt/ntmultiChannelTest.cpp index 9ba1fec..8d4c1fe 100644 --- a/test/nt/ntmultiChannelTest.cpp +++ b/test/nt/ntmultiChannelTest.cpp @@ -106,7 +106,7 @@ static void test() pvSeverity->replace(freeze(severities)); if(debug) {cout << *pvStructure << endl;} PVBooleanArrayPtr pvIsConnected = multiChannel->getIsConnected(); - shared_vector isConnected = pvIsConnected->view(); + shared_vector isConnected = pvIsConnected->view(); multiChannel = builder-> value(unionPtr) -> addDescriptor()->