Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8a04138b0 | ||
|
|
9f5aec1609 | ||
|
|
8dadad8101 | ||
|
|
9cc7c65df6 | ||
|
|
518718357c | ||
|
|
1ae93ddaed | ||
|
|
99bf23e8fa | ||
|
|
b5846433bf | ||
|
|
8760d5e314 | ||
|
|
a25a89fadc | ||
|
|
49312d62d5 | ||
|
|
42fb15211a | ||
|
|
86ee0c5295 | ||
|
|
1fca4d5757 |
5
.hgtags
5
.hgtags
@@ -2,3 +2,8 @@ b9a943e6828731a8a89e811818b2d91faff69d86 1.0-BETA
|
||||
aaa5f5840b7eea8afaafb4d13a49bf78975aac0f 4.0.0
|
||||
aaa5f5840b7eea8afaafb4d13a49bf78975aac0f 4.0.0
|
||||
df4c65e13c2cfaa92e42f84a7afc97c81b5f3888 4.0.0
|
||||
df4c65e13c2cfaa92e42f84a7afc97c81b5f3888 4.0.0
|
||||
ec29bda853f50fa501cbcf3ffd836a1ef2adcdd4 4.0.0
|
||||
0daade17a7440f970750db4a8388e0cee2d04f17 4.0.1
|
||||
0daade17a7440f970750db4a8388e0cee2d04f17 4.0.1
|
||||
1c140dd0e1993ac0a2798e8148b90ccce44ad407 4.0.1
|
||||
|
||||
@@ -32,6 +32,6 @@ endif
|
||||
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
|
||||
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
|
||||
|
||||
-include $(TOP)/../CONFIG_SITE.local
|
||||
-include $(TOP)/configure/CONFIG_SITE.local
|
||||
-include $(TOP)/../CONFIG.local
|
||||
|
||||
|
||||
@@ -46,16 +46,16 @@
|
||||
</dd>
|
||||
<dt>This version:</dt>
|
||||
<dd><a
|
||||
href="ntCPP_20140919.html">ntCPP_20140919.html</a>
|
||||
href="ntCPP_20141009.html">ntCPP_20141009.html</a>
|
||||
</dd>
|
||||
<dt>Previous version:</dt>
|
||||
<dd><a
|
||||
href="ntCPP_20140723.html">ntCPP_20140723.html</a>
|
||||
href="ntCPP_20140919.html">ntCPP_20140919.html</a>
|
||||
</dd>
|
||||
<dt>Editors:</dt>
|
||||
<dd> Marty Kraimer, BNL<br />
|
||||
Matej Sekoranja, CosyLab<br />
|
||||
David Hicken, Diamond Light Source
|
||||
David Hickin, Diamond Light Source
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@@ -125,7 +125,7 @@ pvDataCPP.html
|
||||
A primary use of this type is to access data from a set of pvAccess channels.
|
||||
Each element of value holds data from a channel.</dd>
|
||||
<dt>NTNDArray</dt>
|
||||
<dd>This type holds NDArray data as defined by the areaDetector facilility.
|
||||
<dd>This type holds NDArray data as defined by the areaDetector facility.
|
||||
</dd>
|
||||
</dl>
|
||||
<p>Each normative type consists of a set of mandatory fields, a set of optional fields,
|
||||
@@ -243,7 +243,7 @@ An alarm field attached to the top level structure can be used for either:
|
||||
<p>If alarms do appear at multiple levels then an alarm is always
|
||||
provided at the top level.
|
||||
It uses "maximize severity" to report the highest level severity
|
||||
of all alarms, i. e. the top level severity is the maximum severity
|
||||
of all alarms, i.e. the top level severity is the maximum severity
|
||||
of all the alarms.</p>
|
||||
<p>An example is:</p>
|
||||
<pre>
|
||||
@@ -343,8 +343,8 @@ structure display
|
||||
string format
|
||||
string units
|
||||
</pre>
|
||||
<p>Note that the format should be a simplifed version of the standard
|
||||
C formattimg conventions.</p>
|
||||
<p>Note that the format should be a simplified version of the standard
|
||||
C formatting conventions.</p>
|
||||
<h3>enumerated</h3>
|
||||
<p>This is used to specify a set of choices and an index that selects one
|
||||
of the choices.
|
||||
@@ -403,7 +403,7 @@ PVData can be used to generate a valueAlarm field as an extra field.
|
||||
For example <b>NTScalar</b>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>Each bulder also has a number of additional methods for optional fields
|
||||
<p>Each builder also has a number of additional methods for optional fields
|
||||
and a method to add extra fields.</p>
|
||||
<h3>Normative Type Class</h3>
|
||||
<p>
|
||||
@@ -840,9 +840,9 @@ where
|
||||
<pre>
|
||||
epics:nt/NTNameValue:1.0
|
||||
string[] name // mandatory
|
||||
double[] value // madatory, can be any type, must be same length as name
|
||||
string descriptor // optional
|
||||
alarm_t alarm // optional
|
||||
double[] value // mandatory, can be any type, must be same length as name
|
||||
string descriptor // optional
|
||||
alarm_t alarm // optional
|
||||
int severity
|
||||
int status
|
||||
string message
|
||||
@@ -980,7 +980,7 @@ where
|
||||
<pre>
|
||||
epics:nt/NTTable:1.0
|
||||
string[] labels [column0,column1,column2] // mandatory
|
||||
structure value // mandatory;
|
||||
structure value // mandatory
|
||||
double[] column0 [] // name=labels[0]; can be any scalar type
|
||||
string[] column1 [] // name=labels[1]; can be any scalar type
|
||||
int[] column2 [] // name=labels[2]; can be any scalar type
|
||||
@@ -1121,14 +1121,14 @@ where
|
||||
structure NTMultiChannel
|
||||
union_t[] value // mandatory
|
||||
string[] channelName // mandatory; must be same length as value
|
||||
time_t timeStamp //optional; time when data collected
|
||||
alarm_t alarm //optional; alarm associated with data collection
|
||||
int[] severity //optional; alarm severity for each value
|
||||
int[] status //optional; alarm status for each value
|
||||
string[] message //optional; alarm message for each value
|
||||
long[] secondsPastEpoch //optional; seconds for each value.
|
||||
int[] nanoseconds //optional; nanoseconds for each value
|
||||
string descriptor //optional; descriptor data
|
||||
time_t timeStamp // optional; time when data collected
|
||||
alarm_t alarm // optional; alarm associated with data collection
|
||||
int[] severity // optional; alarm severity for each value
|
||||
int[] status // optional; alarm status for each value
|
||||
string[] message // optional; alarm message for each value
|
||||
long[] secondsPastEpoch // optional; seconds for each value.
|
||||
int[] nanoseconds // optional; nanoseconds for each value
|
||||
string descriptor // optional; descriptor data
|
||||
</pre>
|
||||
<h3>NTMultiChannelBuilder</h3>
|
||||
<p><b>ntmultiChannel.h</b> defines the following:</p>
|
||||
@@ -1292,13 +1292,13 @@ where
|
||||
<h2>Normative Type NTNDArray</h2>
|
||||
<pre>
|
||||
epics:nt/NTNDArray:1.0
|
||||
union value //mandatory
|
||||
codec_t codec //mandatory
|
||||
union value // mandatory
|
||||
codec_t codec // mandatory
|
||||
string name
|
||||
any parameters
|
||||
long compressedSize //mandatory
|
||||
long uncompressedSize //mandatory
|
||||
dimension_t[] dimension //mandatory
|
||||
long compressedSize // mandatory
|
||||
long uncompressedSize // mandatory
|
||||
dimension_t[] dimension // mandatory
|
||||
dimension_t[]
|
||||
dimension_t
|
||||
int size
|
||||
@@ -1306,12 +1306,12 @@ epics:nt/NTNDArray:1.0
|
||||
int fullSize
|
||||
int binning
|
||||
boolean reverse
|
||||
int uniqueId //mandatory
|
||||
time_t dataTimeStamp //mandatory
|
||||
int uniqueId // mandatory
|
||||
time_t dataTimeStamp // mandatory
|
||||
long secondsPastEpoch
|
||||
int nanoseconds
|
||||
int userTag
|
||||
epics:nt/NTAttribute:1.0[] attribute //mandatory
|
||||
epics:nt/NTAttribute:1.0[] attribute // mandatory
|
||||
epics:nt/NTAttribute:1.0[]
|
||||
epics:nt/NTAttribute:1.0
|
||||
string name
|
||||
@@ -1334,7 +1334,7 @@ epics:nt/NTNDArray:1.0
|
||||
string description
|
||||
string format
|
||||
string units
|
||||
string extra1 //extra
|
||||
string extra1 // extra
|
||||
</pre>
|
||||
<h3>NTNDArrayBuilder</h3>
|
||||
<p><b>ntndArray.h</b> defines the following:</p>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<dt>Editors:</dt>
|
||||
<dd> Marty Kraimer, BNL<br />
|
||||
Matej Sekoranja, CosyLab<br />
|
||||
David Hicken, Diamond Light Source
|
||||
David Hickin, Diamond Light Source
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@@ -125,7 +125,7 @@ pvDataCPP.html
|
||||
A primary use of this type is to access data from a set of pvAccess channels.
|
||||
Each element of value holds data from a channel.</dd>
|
||||
<dt>NTNDArray</dt>
|
||||
<dd>This type holds NDArray data as defined by the areaDetector facilility.
|
||||
<dd>This type holds NDArray data as defined by the areaDetector facility.
|
||||
</dd>
|
||||
</dl>
|
||||
<p>Each normative type consists of a set of mandatory fields, a set of optional fields,
|
||||
|
||||
1490
documentation/ntCPP_20141009.html
Normal file
1490
documentation/ntCPP_20141009.html
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
ntutilsTest_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