merge
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#ifndef NT_H
|
||||
#define NT_H
|
||||
|
||||
/*
|
||||
* Include all the normative types here.
|
||||
*/
|
||||
#include <pv/ntfield.h>
|
||||
#include <pv/ntscalar.h>
|
||||
#include <pv/ntscalarArray.h>
|
||||
|
||||
@@ -6,11 +6,14 @@
|
||||
*/
|
||||
|
||||
#include <pv/lock.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/ntfield.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::tr1::static_pointer_cast;
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
namespace epics { namespace nt {
|
||||
|
||||
NTFieldPtr NTField::get()
|
||||
{
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define ntfieldEpicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/standardField.h>
|
||||
#include <pv/standardPVField.h>
|
||||
#include <pv/alarm.h>
|
||||
@@ -17,7 +22,14 @@
|
||||
#include <pv/pvTimeStamp.h>
|
||||
#include <pv/sharedVector.h>
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
#ifdef ntfieldEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef ntfieldEpicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics { namespace nt {
|
||||
/**
|
||||
* Convenience Class for introspection fields of a Normative Type
|
||||
* @author mrk
|
||||
@@ -30,7 +42,7 @@ typedef std::tr1::shared_ptr<NTField> NTFieldPtr;
|
||||
class PVNTField;
|
||||
typedef std::tr1::shared_ptr<PVNTField> PVNTFieldPtr;
|
||||
|
||||
class NTField {
|
||||
class epicsShareClass NTField {
|
||||
public:
|
||||
POINTER_DEFINITIONS(NTField);
|
||||
/**
|
||||
@@ -47,83 +59,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;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -131,7 +143,7 @@ private:
|
||||
* @author mrk
|
||||
*
|
||||
*/
|
||||
class PVNTField {
|
||||
class epicsShareClass PVNTField {
|
||||
public:
|
||||
POINTER_DEFINITIONS(PVNTField);
|
||||
/**
|
||||
@@ -148,54 +160,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;
|
||||
};
|
||||
|
||||
|
||||
@@ -5,9 +5,12 @@
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
|
||||
#include <pv/ntmultiChannel.h>
|
||||
#include <algorithm>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/ntmultiChannel.h>
|
||||
#include <pv/ntutils.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace epics::pvData;
|
||||
|
||||
@@ -155,7 +158,7 @@ StructureConstPtr NTMultiChannelBuilder::createStructure()
|
||||
return st;
|
||||
}
|
||||
|
||||
PVStructurePtr NTMultiChannelBuilder::NTMultiChannelBuilder::createPVStructure()
|
||||
PVStructurePtr NTMultiChannelBuilder::createPVStructure()
|
||||
{
|
||||
return pvDataCreate->createPVStructure(createStructure());
|
||||
}
|
||||
@@ -210,7 +213,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)
|
||||
|
||||
@@ -7,10 +7,26 @@
|
||||
#ifndef NTMULTICHANNEL_H
|
||||
#define NTMULTICHANNEL_H
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define ntmultiChannelEpicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/pvDisplay.h>
|
||||
#include <pv/pvControl.h>
|
||||
|
||||
#ifdef ntmultiChannelEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef ntmultiChannelEpicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
|
||||
namespace epics { namespace nt {
|
||||
|
||||
@@ -140,7 +156,7 @@ namespace detail {
|
||||
typedef std::tr1::shared_ptr<detail::NTMultiChannelBuilder> NTMultiChannelBuilderPtr;
|
||||
|
||||
|
||||
class NTMultiChannel
|
||||
class epicsShareClass NTMultiChannel
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(NTMultiChannel);
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/ntnameValue.h>
|
||||
#include <pv/ntutils.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace epics::pvData;
|
||||
@@ -123,7 +125,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)
|
||||
|
||||
@@ -7,8 +7,23 @@
|
||||
#ifndef NTNAMEVALUE_H
|
||||
#define NTNAMEVALUE_H
|
||||
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define ntnameValueEpicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/pvDisplay.h>
|
||||
#include <pv/pvControl.h>
|
||||
|
||||
#ifdef ntnameValueEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef ntnameValueEpicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics { namespace nt {
|
||||
|
||||
class NTNameValue;
|
||||
@@ -111,7 +126,7 @@ typedef std::tr1::shared_ptr<detail::NTNameValueBuilder> NTNameValueBuilderPtr;
|
||||
* Convenience Class for NTNameValue
|
||||
* @author mrk
|
||||
*/
|
||||
class NTNameValue
|
||||
class epicsShareClass NTNameValue
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(NTNameValue);
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/ntndarray.h>
|
||||
#include <pv/ntutils.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace epics::pvData;
|
||||
@@ -217,7 +219,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)
|
||||
|
||||
@@ -7,11 +7,26 @@
|
||||
#ifndef NTNDARRAY_H
|
||||
#define NTNDARRAY_H
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define ntscalarArrayEpicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/pvDisplay.h>
|
||||
#include <pv/pvControl.h>
|
||||
|
||||
#ifdef ntscalarArrayEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef ntscalarArrayEpicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics { namespace nt {
|
||||
|
||||
class NTNDArray;
|
||||
@@ -108,7 +123,7 @@ typedef std::tr1::shared_ptr<detail::NTNDArrayBuilder> NTNDArrayBuilderPtr;
|
||||
* Convenience Class for NTNDArray
|
||||
* @author dgh
|
||||
*/
|
||||
class NTNDArray
|
||||
class epicsShareClass NTNDArray
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(NTNDArray);
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/ntscalar.h>
|
||||
#include <pv/ntutils.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace epics::pvData;
|
||||
@@ -143,7 +145,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)
|
||||
|
||||
@@ -7,10 +7,23 @@
|
||||
#ifndef NTSCALAR_H
|
||||
#define NTSCALAR_H
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define ntscalarEpicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/pvDisplay.h>
|
||||
#include <pv/pvControl.h>
|
||||
|
||||
#ifdef ntscalarEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef ntscalarEpicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics { namespace nt {
|
||||
|
||||
class NTScalar;
|
||||
@@ -126,7 +139,7 @@ typedef std::tr1::shared_ptr<detail::NTScalarBuilder> NTScalarBuilderPtr;
|
||||
* Convenience Class for NTScalar
|
||||
* @author mrk
|
||||
*/
|
||||
class NTScalar
|
||||
class epicsShareClass NTScalar
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(NTScalar);
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/ntscalarArray.h>
|
||||
#include <pv/ntutils.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace epics::pvData;
|
||||
@@ -140,7 +142,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)
|
||||
|
||||
@@ -7,10 +7,24 @@
|
||||
#ifndef NTSCALARARRAY_H
|
||||
#define NTSCALARARRAY_H
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define ntscalarArrayEpicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/pvDisplay.h>
|
||||
#include <pv/pvControl.h>
|
||||
|
||||
#ifdef ntscalarArrayEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef ntscalarArrayEpicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
|
||||
namespace epics { namespace nt {
|
||||
|
||||
class NTScalarArray;
|
||||
@@ -126,7 +140,7 @@ typedef std::tr1::shared_ptr<detail::NTScalarArrayBuilder> NTScalarArrayBuilderP
|
||||
* Convenience Class for NTScalarArray
|
||||
* @author mrk
|
||||
*/
|
||||
class NTScalarArray
|
||||
class epicsShareClass NTScalarArray
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(NTScalarArray);
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/nttable.h>
|
||||
#include <pv/ntutils.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace epics::pvData;
|
||||
@@ -138,7 +140,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)
|
||||
|
||||
@@ -7,11 +7,26 @@
|
||||
#ifndef NTTABLE_H
|
||||
#define NTTABLE_H
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define nttableEpicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/pvDisplay.h>
|
||||
#include <pv/pvControl.h>
|
||||
|
||||
#ifdef nttableEpicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# undef nttableEpicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <pv/ntfield.h>
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics { namespace nt {
|
||||
|
||||
class NTTable;
|
||||
@@ -114,7 +129,7 @@ typedef std::tr1::shared_ptr<detail::NTTableBuilder> NTTableBuilderPtr;
|
||||
* Convenience Class for NTTable
|
||||
* @author mrk
|
||||
*/
|
||||
class NTTable
|
||||
class epicsShareClass NTTable
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(NTTable);
|
||||
|
||||
25
src/nt/ntutils.cpp
Normal file
25
src/nt/ntutils.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <pv/ntutils.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}}
|
||||
39
src/nt/ntutils.h
Normal file
39
src/nt/ntutils.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/* 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 <string>
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics { namespace nt {
|
||||
|
||||
/**
|
||||
* Utility methods for NT types.
|
||||
* @author mse
|
||||
*/
|
||||
class epicsShareClass 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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <pv/nt.h>
|
||||
|
||||
using namespace epics::nt;
|
||||
using namespace epics::pvData;
|
||||
using std::string;
|
||||
using std::cout;
|
||||
|
||||
@@ -106,7 +106,7 @@ static void test()
|
||||
pvSeverity->replace(freeze(severities));
|
||||
if(debug) {cout << *pvStructure << endl;}
|
||||
PVBooleanArrayPtr pvIsConnected = multiChannel->getIsConnected();
|
||||
shared_vector<const boolean> isConnected = pvIsConnected->view();
|
||||
shared_vector<const epics::pvData::boolean> isConnected = pvIsConnected->view();
|
||||
multiChannel = builder->
|
||||
value(unionPtr) ->
|
||||
addDescriptor()->
|
||||
|
||||
36
test/nt/ntutilsTest.cpp
Normal file
36
test/nt/ntutilsTest.cpp
Normal file
@@ -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 <epicsUnitTest.h>
|
||||
#include <testMain.h>
|
||||
|
||||
#include <pv/ntutils.h>
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user