diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html new file mode 100644 index 0000000..2a0b3c2 --- /dev/null +++ b/documentation/RELEASE_NOTES.html @@ -0,0 +1,4 @@ +

Release 4.0 IN DEVELOPMENT

+

This is the first release of normativeTypesCPP that is part of an official +EPICS V4 release. +It is a major rewrite of the previous versions of normativeTypesCPP.

\ No newline at end of file diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md new file mode 100644 index 0000000..7e4ddad --- /dev/null +++ b/documentation/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +Release 4.0 IN DEVELOPMENT +=========== + +This is the first release of normativeTypesCPP that is part of an official +EPICS V4 release. +It is a major rewrite of the previous versions of normativeTypesCPP. + diff --git a/documentation/TODO.html b/documentation/TODO.html new file mode 100644 index 0000000..c4c5863 --- /dev/null +++ b/documentation/TODO.html @@ -0,0 +1,2 @@ +

TODO

+

lots of code is a copy paste, consider inheritance and templates

\ No newline at end of file diff --git a/documentation/ntCPP.html b/documentation/ntCPP.html index c6b8ef3..1c7f237 100644 --- a/documentation/ntCPP.html +++ b/documentation/ntCPP.html @@ -4,7 +4,7 @@ - EPICS pvDataCPP + EPICS ntCPP
-

EPICS pvDataCPP

+

EPICS ntCPP

-

EPICS v4 Working Group, Working Draft, 23-July-2014

+

EPICS v4 Working Group, Working Draft, 19-Sept-2014

Latest version:
pvDataCPP.html + href="ntCPP.html">ntCPP.html
This version:
pvDataCPP_20140708.html + href="ntCPP_20140919.html">ntCPP_20140919.html
Previous version:
pvDataCPP_20140501.html + href="ntCPP_20140723.html">ntCPP_20140723.html
Editors:
-
Marty Kraimer, BNL
-
Michael Davidsaver, BNL
-
Matej Sekoranja, CosyLab
+
Marty Kraimer, BNL
+ Matej Sekoranja, CosyLab
+ David Hicken, Diamond Light Source +

EPICS Version 4 provides efficient storage, access, and communication, of memory resident structured data. -pvData is the storage compoment. -pvDataCPP is the C++ implementation of pvData. +The EPICS V4 Normative Types are a collection of structured data types +that can be used by the application level of EPICS V4 network endpoints, +to interoperably exchange scientific data. +normativeTypesCPP is the C++ implementation. It is one part of the set of related products in the EPICS V4 control system programming environment:
relatedDocumentsV4.html @@ -77,11 +80,10 @@ V4 control system programming environment:

Status of this Document

-

For now this is a working copy so it is not the same as "This version" shown above.

- -

This is the 23-July-2014 version of the C++ implementation of pvData. +

This is the 19-Sept-2014 version of the C++ implementation of pvData.

+

RELEASE_NOTES.md provides changes since the last release. TODO.md describes things to do before the next release.

@@ -93,51 +95,105 @@ TODO.md describes things to do before the next release.
- -

EPICS normative type C++ implementation -

- -

Draft, 4-Nov-2012

-
-
This version:
-
ntCPP.html
-
Editors:
-
Matej Sekoranja, CosyLab
- Marty Kraimer, BNL -
-
-
-

Introduction

-

This section describes the C++ implemmentation of normative types. Two (2) helper classes are implemented, -ntNameValue and NTTable respectively.

+

This manual assumes that the reader is familiar with the material in + +pvDataCPP.html + +

+

At present the following normative types are implemented:

+
+
NTScalar
+
This has a value field that has type scalar
+
NTScalarArray
+
This has a value field that has type scalarArray
+
NTNameValue
+
This has a field names that is a string array + and a field values that has type scalarArray. + Each names[i] is associated with values[i]. +
+
NTTable
+
This has a string array field named labels + For each label there is a scalar array field with name = label. +
+
NTMultiChannel
+
This has a value field that is a union array. + 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.
+
NTNDArray
+
This type holds NDArray data as defined by the areaDetector facilility. +
+
+

Each normative type consists of a set of mandatory fields, a set of optional fields, +and any arbitrary number of extra fields. +The mandatory and optional fields are meant for use by standard tools such +as Display Managers and Alarm Handlers. +The extra fields are for specialized tools. +

+

+A helper class NTField is provided to enforce the proper implementation of property fields +as defined by pvData. +A property field is normally associated with a field that has the name "value". +The property fields currently used are alarm, timeStamp, display, control, and valueAlarm. +In addition pvData defines a standard structure for a value field that represents +enumerated values. +NTField has methods associated with each of these. +

+

An include file "nt.h" includes all the other header files that are provided by ntCPP. +

+

The next section describes NTField. +Next a set of standard optional fields used by many normative types is described. +Then each normative type is described. +

-

Normative Type Fields.

+ +

NTField

These are helper classes for creating standard fields for normative types. There is a single instance of this class, which is obtained via NTField::get().

-
class NTField: NoDefaultMethods {
+
class NTField{
 public:
     static NTFieldPtr get();
     ~NTField() {}
 
-    PVStructurePtr createEnumerated(StringArray const & choices);
-    PVStructurePtr createTimeStamp();
-    PVStructurePtr createAlarm();
-    PVStructurePtr createDisplay();
-    PVStructurePtr createAlarmLimit();
-    PVStructurePtr createControl();
+    bool isEnumerated(FieldConstPtr const & field);
+    bool isTimeStamp(FieldConstPtr const & field);
+    bool isAlarm(FieldConstPtr const & field);
+    bool isDisplay(FieldConstPtr const & field);
+    bool isAlarmLimit(FieldConstPtr const & field);
+    bool isControl(FieldConstPtr const & field);
 
-    PVStructureArrayPtr createEnumeratedArray();
-    PVStructureArrayPtr createTimeStampArray();
-    PVStructureArrayPtr createAlarmArray();
+    StructureConstPtr createEnumerated();
+    StructureConstPtr createTimeStamp();
+    StructureConstPtr createAlarm();
+    StructureConstPtr createDisplay();
+    StructureConstPtr createAlarmLimit();
+    StructureConstPtr createControl();
+
+    StructureArrayConstPtr createEnumeratedArray();
+    StructureArrayConstPtr createTimeStampArray();
+    StructureArrayConstPtr createAlarmArray();
 };

where

+
isEnumerated
+
Is the field an enumerated structure?
+
isTimeStamp
+
Is the field an timeStamp structure?
+
isAlarm
+
Is the field an alarm structure?
+
isDisplay
+
Is the field an display structure?
+
isAlarmLimit
+
Is the field an alarmLimit structure?
+
isControl
+
Is the field an control structure?
createEnumerated
Create an introspection interface for an enumerated structure.
createTimeStamp
@@ -160,130 +216,1256 @@ public:
Create an introspection interface for an structureArray of alarm structures.
- -

NTNameValue

- -

These are helper classes for NTNameValue

-
class NTNameValue : private NoDefaultMethods
-{
-public:
-    static bool isNTNameValue(PVStructurePtr const & pvStructure);
-    static NTNameValuePtr create(
-        bool hasFunction,bool hasTimeStamp, bool hasAlarm);
-    static NTNameValuePtr create(
-        PVStructurePtr const & pvStructure);
-    ~NTNameValue();
-    PVStringPtr getFunction();
-    void attachTimeStamp(PVTimeStamp &pvTimeStamp);
-    void attachAlarm(PVAlarm &pvAlarm);
-    PVStructurePtr getPVStructure();
-    PVStructurePtr getTimeStamp();
-    PVStructurePtr getAlarm();
-    PVStringArrayPtr getNames();
-    PVStringArrayPtr getValues();
-};
- -

where

-
-
isNTNameValue
-
Is the structure a NTNameValue structure?
-
create
-
Create an NTNameValue that has the associated fields.
-
~NTNameValue
-
The destructor.
-
getFunction
-
Get the function field. This can be null.
-
attachTimeStamp
-
The timeStamp field of the NTNameValue is atttached to the - pvTimeStamp.
-
attachAlarm
-
The alarm field of the NTNameValue is atttached to the alarm.
-
getPVStructure
-
Get the pvStructure that this NTNameValue contains.
-
getTimeStamp
-
Get the timeStamp field.
-
getAlarm
-
Get the alarm field.
-
getNames
-
Get the names field.
-
getValues
-
Get the values field.
-
- -

NTTable

- -

These are helper classes for NTTable

-
class NTTable: private NoDefaultMethods
-{
-public:
-    static bool isNTTable(PVStructurePtr const & pvStructure);
-    static PVStructure::shared_pointer create(
-        bool hasFunction,bool hasTimeStamp, bool hasAlarm,
-        int numberValues,
-        FieldConstPtrArray valueFields);
-        static NTTablePtr create(
-            bool hasFunction,bool hasTimeStamp, bool hasAlarm,
-            StringArray const & valueNames,
-            FieldConstPtrArray const &valueFields);
-        static NTTablePtr clone(PVStructurePtr const &);
-    ~NTTable();
-    PVStringPtr getFunction();
-    void attachTimeStamp(PVTimeStamp &pvTimeStamp);
-    void attachAlarm(PVAlarm &pvAlarm);
-    PVStructurePtr getPVStructure();
-    PVStructurePtr getTimeStamp();
-    PVStructurePtr getAlarm();
-    PVStringArrayPtr getLabel();
-    size_t getNumberValues();
-    FieldConstPtr getField(int index);
-    PVFieldPtr getPVField(int index);
-};
- -

where

-
-
isNTTable
-
y
-
create
-
Create an NTTable that has the associated fields.
-
~NTTable
-
The destructor.
-
getFunction
-
Get the function field. This can be null.
-
attachTimeStamp
-
The timeStamp field of the NTTable is atttached to the pvTimeStamp.
-
attachAlarm
-
The alarm field of the NTTable is atttached to the alarm.
-
getPVStructure
-
Get the pvStructure that this NTTable contains.
-
getTimeStamp
-
Get the timeStamp field.
-
getAlarm
-
Get the alarm field.
-
getLabel
-
Get the label field.
-
getNumberValues
-
Get the number of value fields.
-
getField
-
Get the introspection interface for the specified field.
-
getPVField
-
Get the data field for the specified field.
-
- -

MTMultiChannel

+

Property Field Definitions

+

Definition: value

+

Often a property field is associated with another field. +This other field is refered to as the value field. +Usually the value field will have the field name "value". +An example is:

-structure NTMultiChannel
-  union_t[] value       
-  string[]  channelName    
-  time_t    timeStamp        :opt // time when data collected
-  alarm_t   alarm            :opt // alarm associated with data collection
-  int[]     severity         :opt // alarm severity for each value
-  int[]     status           :opt // alarm status for each value
-  string[]  message          :opt // alarm message for each value
-  long[]    secondsPastEpoch :opt // seconds for each value.
-  int[]     nanoseconds      :opt // nanoseconds for each value
-  string    descriptor       :opt // descriptor data
+structure parent
+    double    value
+    structure alarm
+
+

In this example the alarm field reports alarms for the value field.

+ +

alarm

+

An alarm structure is used to report alarms and other problems to the client. +An alarm may be associated with a value field or can be used by a server +to report problems to the client. +An alarm attached to a substructure of the top level structure is normally +associated with a value field. +An alarm field attached to the top level structure can be used for either: +

    +
  1. If the top level structure has a value field then it is an alarm + for that field. +
  2. To report other problems to the client.
  3. +
+

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 the alarms.

+

An example is:

+
+structure top
+   structure alarm
+   structure power
+       double value
+       structure alarm
+   structure voltage
+       double value
+       structure alarm
+   structure current
+       double value
+       structure alarm
+
+

In this example power, voltage, and current all have an associated alarm. +The top level alarm would have a severity that matches the highest level +severity of power, voltage, an current.

+ +

A alarm structure has the following fields:

+
+structure alarm
+    int severity
+    int status
+    string message
+
+

Clients and Servers should use alarm.h and pvAlarm.h which are +provided by pvDataCPP intead of directly using the alarm structure itself. +In particular severity and status are defined as:

+
+enum AlarmSeverity {
+ noAlarm,minorAlarm,majorAlarm,invalidAlarm,undefinedAlarm
+};
+
+enum AlarmStatus {
+    noStatus,deviceStatus,driverStatus,recordStatus,
+    dbStatus,confStatus,undefinedStatus,clientStatus
+};
+
+

timeStamp

+

A timeStamp provides the time when the server executes or the time when +a the data for a value field was collected. +There can be multiple timeStamp fields. +A timeStamp associated with a substructure is usually associated with +a value field. +An timeStamp field attached to the top level structure can be used for either: +

    +
  1. If the top level structure has a value field then it can be the + timeStamp for that field. +
  2. The time when the server executed.
  3. +
+

NTNDArray is an example that has two top level timeStamp field with different +field names because it wants to report both.

+ +

A timeStamp structure has the following fields:

+
+structure timeStamp
+    long secondsPastEpoch
+    int nanoseconds
+    int userTag
+
+

Clients and Servers should use timeStamp.h and pvTimeStamp.h +which are provided by pvDataCPP intead of directly using the timeStamp structure itself. +Note that timeStamp.h provides many methods for manipulating time. +

+

The meaning of the fields is:

+
+
secondsPastEpoch
+
seconds since the posix epoch, i.e. Jan 1, 1970 00:00:00 UTC.
+
nanoseconds
+
nanoseconds since the secondsPastEpoch.
+
userTag
+
service specific.
+
+ +

control

+

This is used to specify operational limits for a numeric scalar value field.

+
+structure control
+    double limitLow
+    double limitHigh
+    double minStep
+
+

Servers should use control.h and pvControl.h which are +provided by pvDataCPP intead of directly using the control structure itself. +Note that control.h provides many methods for manipulating time. +

+

display

+

This is used to specify display limits and other information for a numeric scalar value field.

+
+structure display
+    double limitLow
+    double limitHigh
+    string description
+    string format
+    string units
+
+

Note that the format should be a simplifed version of the standard +C formattimg conventions.

+

alarmLimit

+

This is used to specify alarm limits for a numeric scalar value field. +It can be used by plotting tools to show alarm limits and asociated severities. +

+
+structure 
+    boolean active
+    double lowAlarmLimit
+    double lowWarningLimit
+    double highWarningLimit
+    double highAlarmLimit
+    int lowAlarmSeverity
+    int lowWarningSeverity
+    int highWarningSeverity
+    int highAlarmSeverity
+    double hysteresis
+
+

enumerated

+

This is used to specify a set of choices and an index that selects one +of the choices. +For readers familiar with EPICS core this is like the ENUM types.

+
+structure
+    int index
+    string[] choices
 
+

Normative Type Common Features

+

Each normative type has two classes: a builder and a class for the normative type itself.

+

Normative Type Builder

+

This is a class that can create one of the following:

+
+
Structure
+
The introspection instance for the data structure associated with the type.
+
PVStructure
+
The data instance for the data structure associated with the type.
+
NTXXX
+
The instance for the NT type. +
+
+

Each bulder also has a number of additional methods for optional fields +and a method to add extra fields.

+

Normative Type Class

+

+This has methods to do the following:

+
+
Create instance
+
A instance of a object can be created via a builder of from an existing PVStructure
+
Attach a Property
+
For the following optional fields an object to manipulate the fields can be attached: + alarm, timeStamp, display, and control.
+
Get Data Interfaces
+
Each type has a method getPVStructure to get the entire data structure. + In addition there is a method to get the data interface for each manditory + and optional field.
+
+

Normative Type NTScalar

+

This has the following fields:

+
+uri:ev4:nt/2014/pwd:NTScalar
+    double value                        // mandatory and can be any numeric type
+    string descriptor                   // optional
+    alarm_t alarm                       // optional
+        int severity
+        int status 
+        string message
+    time_t timeStamp                    // optional
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    display_t display                   // optional
+        double limitLow
+        double limitHigh
+        string description
+        string format
+        string units
+    control_t control                   // optional
+        double limitLow
+        double limitHigh
+        double minStep
+    string extra1                       // extra
+    string[] extra2                     //
+
+

NTScalarBuilder

+

This is a class that creates the introspection and data instances for NTScalar and +an a NTScalar instance itself.

+

ntscalar.h defines the following:

+
+class NTScalar;
+typedef std::tr1::shared_ptr<NTScalar> NTScalarPtr;
+
+class NTScalarBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTScalarBuilder);
+    shared_pointer value(ScalarType scalarType);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    shared_pointer addDisplay();
+    shared_pointer addControl();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTScalarPtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
value
+
This determines the scalar type for the value field. + This must be specified or createStructure will throw an exception.
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
addDisplay
+
Add optional field display
+
addControl
+
Add optional field control
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

An NTScalaBuilder can be used to create multiple PVStructure and/or NTScalar instances. +Each time createPVScalar is called it clears all interval data after the PVStructure +is created.

+

NTScalarBuilder Examples

+

An example of creating an NTScalar instance is:

+
+NTScalarBuilderPtr builder = NTScalar::createBuilder();
+NTScalarPtr ntScalar = builder->
+    value(pvInt)->
+    addDescriptor()->
+    addAlarm()->
+    addTimeStamp()->
+    addDisplay()->
+    addControl()->
+    create();
+
+

The same results could be done by:

+
+NTScalarBuilderPtr builder = NTScalar::createBuilder();
+builder->value(pvInt);
+builder->addDescriptor();
+builder->addAlarm();
+builder->addTimeStamp();
+builder->addDisplay();
+builder->addControl();
+NTScalarPtr ntScalar = builder->create();
+
+ +

NTScalar

+

ntscalar.h defines the following:

+
+class NTScalar;
+typedef std::tr1::shared_ptr NTScalarPtr;
+
+class NTScalar
+{
+public:
+    POINTER_DEFINITIONS(NTScalar);
+    ~NTScalar() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTScalarBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    bool attachDisplay(PVDisplay &pvDisplay) const;
+    bool attachControl(PVControl &pvControl) const;
+    PVStructurePtr getPVStructure() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVStructurePtr getDisplay() const;
+    PVStructurePtr getControl() const;
+    PVFieldPtr getValue() const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getValue() const
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTScalar that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null PVScalar if is_a returns false. +
+The primary use of narrow is by pvAccess client code. +The server creates a pvStructure that is valid for an NTScalar +and passes it to the client. +The client can call narrow to create an NTScalar for it;s own use. +An example is: +
+void myCallback(PVStructurePtr const & pvStructure)
+{
+     NTScalarPtr ntscalar = NTScalar::narrow(pvStructure);
+     if(!ntscalar) {
+       // not a valid NTScalar
+     }
+     ...
+}
+
+
+
narrow_unsafe
+
Given a pvStructure this creates an NTScalar that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTScalar.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTScalar. +
+
createBuilder
+
This method creates an NTScalarBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTScalar is attached to the pvTimeStamp. +
+An example is: +
+PVTimeStamp pvTimeStamp;
+TimeStamp timeStamp;
+
+ntscalar-&attachTimeStamp(pvTimeStamp);
+pvTimeStamp.get(timeStamp);
+TimeStamp current;
+current.getCurrent();
+double diff = TimeStamp::diff(timeStamp,current); // timeStamp = current
+
+
+
attachAlarm
+
The alarm field of the NTScalar is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields.
+An example is: +
+PVAlarm pvAlarm;
+Alarm alarm;
+
+ntscalar-&attachAlarm(pvAlarm);
+pvAlarm.get(alarm);
+int severity = alarm.getSeverity();
+int status = alarm.getStatus();
+string message = alarm.getMessage();
+
+
+
attachDisplay
+
The display field of the NTScalar is attached to the pvDisplay. + Used similar to attachAlarm. +
+
attachControl
+
The control field of the NTScalar is attached to the pvControl. + Used similar to attachAlarm. +
+
getPVStructure
+
Returns the pvStructure that NTScalar wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getDisplay
+
Returns the top level display. + If the display was not selected as an optional field + a null pvStructure is returned. +
+
getControl
+
Returns the top level control. + If the control was not selected as an optional field + a null pvStructure is returned. +
+
getValue
+
Returns the value field.
+
+

Normative Type NTScalarArray

+

This class is similar to NTScalarArray except that the value +field is a scalar array field instead of just a scalar.

+

This has the following fields:

+
+uri:ev4:nt/2014/pwd:NTScalarArray
+    double[] value                      // mandatory and can be any numeric type
+    string descriptor                   // optional
+    alarm_t alarm                       // optional
+        int severity
+        int status 
+        string message
+    time_t timeStamp                    // optional
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    display_t display                   // optional
+        double limitLow
+        double limitHigh
+        string description
+        string format
+        string units
+    control_t control                   // optional
+        double limitLow
+        double limitHigh
+        double minStep
+    string extra1                       // extra
+    string[] extra2                     //
+
+

NTScalarArrayBuilder

+

ntscalarArray.h defines the following:

+
+class NTScalarArray;
+typedef std::tr1::shared_ptr<NTScalarArray> NTScalarArrayPtr;
+
+class NTScalarArrayBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTScalarArrayBuilder);
+    shared_pointer arrayValue(ScalarType elementType);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    shared_pointer addDisplay();
+    shared_pointer addControl();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTScalarArrayPtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
value
+
This determines the element type for the value field. + This must be specified or createStructure will throw an exception.
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
addDisplay
+
Add optional field display
+
addControl
+
Add optional field control
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

NTScalarArray

+

ntscalarArray.h defines the following:

+
+class NTScalarArray;
+typedef std::tr1::shared_ptr NTScalarArrayPtr;
+
+class NTScalarArray
+{
+public:
+    POINTER_DEFINITIONS(NTScalarArray);
+    ~NTScalarArray() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTScalarArrayBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    bool attachDisplay(PVDisplay &pvDisplay) const;
+    bool attachControl(PVControl &pvControl) const;
+    PVStructurePtr getPVStructure() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVStructurePtr getDisplay() const;
+    PVStructurePtr getControl() const;
+    PVFieldPtr getValue() const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getValue() const
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTScalarArray that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null PVScalarArrayPtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTScalarArray that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTScalarArray.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTScalarArray. +
+
createBuilder
+
This method creates a NTScalarArrayBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTScalarArray is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTScalarArray is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
attachDisplay
+
The display field of the NTScalarArray is attached to the pvDisplay. + Used similar to attachAlarm. +
+
attachControl
+
The control field of the NTScalarArray is attached to the pvControl. + Used similar to attachAlarm. +
+
getPVStructure
+
Returns the pvStructure that NTScalarArray wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getDisplay
+
Returns the top level display. + If the display was not selected as an optional field + a null pvStructure is returned. +
+
getControl
+
Returns the top level control. + If the control was not selected as an optional field + a null pvStructure is returned. +
+
getValue
+
Returns the value field.
+
+ +

Normative Type NTNameValue

+
+uri:ev4:nt/2014/pwd:NTNameValue
+    string[] names                 // mandatory
+    double[] values                // madatory, can be any type, must be same length as names
+    string descriptor              // optional
+    alarm_t alarm                  // optional
+        int severity
+        int status
+        string message
+    time_t timeStamp              // optional
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    string extra1                 // extra
+    string[] extra2               // extra
+
+ +

NTNameValueBuilder

+

ntnameValue.h defines the following:

+
+class NTNameValue;
+typedef std::tr1::shared_ptr<NTNameValue> NTNameValuePtr;
+
+class NTNameValueBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTNameValueBuilder);
+    shared_pointer value(ScalarType scalarType);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTNameValuePtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
value
+
This determines the element type for the value field. + This must be specified or createStructure will throw an exception.
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+ +

NTNameValue

+
+class NTNameValue;
+typedef std::tr1::shared_ptr NTNameValuePtr;
+
+class NTNameValue
+{
+public:
+    POINTER_DEFINITIONS(NTNameValue);
+    ~NTNameValue() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTNameValueBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    PVStructurePtr getPVStructure() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVStringArrayPtr getNames() const;
+    PVFieldPtr getValues() const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getValue() const
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTNameValue that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null NTNameValuePtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTNameValue that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTNameValue.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTNameValue. +
+
createBuilder
+
This method creates an NTNameValueBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTNameValue is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTNameValue is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
getPVStructure
+
Returns the pvStructure that NTNameValue wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getNames
+
Returns field names.
+
getValues
+
Returns field values.
+
+ +

Normative Type NTTable

+
+uri:ev4:nt/2014/pwd:NTTable 
+    string[] labels [column0,column1,column2]    // 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
+    string descriptor                            // optional
+    alarm_t alarm                                // optional
+        int severity 
+        int status 
+        string
+    time_t timeStamp                             // optional
+        long secondsPastEpoch
+        int nanoseconds 498486530
+        int userTag
+    string extra1                                // extra
+
+ +

NTTableBuilder

+

nttable.h defines the following:

+
+class NTTable;
+typedef std::tr1::shared_ptr<NTTable> NTTablePtr;
+
+class NTTableBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTTableBuilder);
+    shared_pointer add(string const & name,ScalarType scalarType);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTTablePtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
add
+
This is the name and elementType for the next column
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

NTTable

+
+class NTTable;
+typedef std::tr1::shared_ptr NTTablePtr;
+
+class NTTable
+{
+public:
+    POINTER_DEFINITIONS(NTTable);
+    ~NTTable() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTTableBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    PVStructurePtr getPVStructure() const;
+    PVStringPtr getDescriptor() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVStringArrayPtr getLabels() const;
+    PVFieldPtr getColumn(string const & columnName) const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getColumn(string const & columnName) const;
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTTable that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null NTTablePtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTTable that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTTable.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTTable. +
+
createBuilder
+
This method creates an NTTableBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTTable is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTTable is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
getPVStructure
+
Returns the pvStructure that NTTable wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getLabels
+
Returns the labels field.
+
getColumn
+
Returns the column with the specified name.
+
+ +

Normative Type NTMultiChannel

+
+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
+
+

NTMultiChannelBuilder

+

ntmultiChannel.h defines the following:

+
+class NTMultiChannel;
+typedef std::tr1::shared_ptr<NTMultiChannel> NTMultiChannelPtr;
+
+class NTMultiChannelBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTMultiChannelBuilder);
+    shared_pointer value(UnionConstPtr valuePtr);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    shared_pointer addSeverity();
+    shared_pointer addStatus();
+    shared_pointer addMessage();
+    shared_pointer addSecondsPastEpoch();
+    shared_pointer addNanoseconds();
+    shared_pointer addUserTag();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTMultiChannelPtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
value
+
This determines the element type for the value field. + If not specified the type will be a variant union. +
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
addSeverity
+
Add a field that has the alarm severity for each channel.
+
addStatus
+
Add a field that has the alarm status for each channel.
+
addMessage
+
Add a field that has the alarm message for each channel.
+
addSecondsPastEpoch
+
Add a field that has the secondsPastEpoch for each channel.
+
addNanoseconds
+
Add a field that has the nanoseconds for each channel.
+
addUserTag
+
Add a field that has the userTag for each channel.
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

NTMultiChannel

+
+class NTMultiChannel;
+typedef std::tr1::shared_ptr NTMultiChannelPtr;
+
+class NTMultiChannel
+{
+public:
+    POINTER_DEFINITIONS(NTMultiChannel);
+    ~NTMultiChannel() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTMultiChannelBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    PVStructurePtr getPVStructure() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVUnionArrayPtr getValue() const;
+    PVStringArrayPtr getChannelName() const;
+    PVBooleanArrayPtr getIsConnected() const;
+    PVIntArrayPtr getSeverity() const;
+    PVIntArrayPtr getStatus() const;
+    PVStringArrayPtr getMessage() const;
+    PVLongArrayPtr getSecondsPastEpoch() const;
+    PVIntArrayPtr getNanoseconds() const;
+    PVIntArrayPtr getUserTag() const;
+    PVStringPtr getDescriptor() const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getValue() const
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTMultiChannel that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null NTMultiChannelPtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTMultiChannel that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTMultiChannel.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTMultiChannel. +
+
createBuilder
+
This method creates an NTMultiChannelBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTMultiChannel is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTMultiChannel is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
getPVStructure
+
Returns the pvStructure that NTMultiChannel wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getValue
+
Returns the value field.
+
getChannelName
+
Returns the name of each channel.
+
getIsConnected
+
Returns connection state of each channel.
+
getSeverity
+
Returns the severity of each channel.
+
getStatus
+
Returns the status of each channel.
+
getMessage
+
Returns the message of each channel.
+
getSecondsPastEpoch
+
Returns the secondsPastEpoch of each channel.
+
getNanoseconds
+
Returns the nanoseconds of each channel.
+
getUserTag
+
Returns the userTag of each channel.
+
+ +

Normative Type NTNDArray

+
+uri:ev4:nt/2014/pwd:NTNDArray 
+    union value                                 //mandatory
+    long compressedSize                         //mandatory
+    long uncompressedSize                       //mandatory
+    codec_t codec                               //mandatory
+        string name 
+        any parameters
+    dimension_t[] dimension                     //mandatory
+        dimension_t[]
+            dimension_t
+                int size
+                int offset
+                int fullSize
+                int binning
+                boolean reverse
+    int uniqueId                                //mandatory
+    time_t dataTimeStamp                        //mandatory
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    uri:ev4:nt/2014/pwd:NTAttribute[] attribute //mandatory
+        uri:ev4:nt/2014/pwd:NTAttribute[]
+            uri:ev4:nt/2014/pwd:NTAttribute
+                string name
+                any value
+                string description
+                int sourceType
+                string source
+    string descriptor                           // optional
+    time_t timeStamp                            // optional
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    alarm_t alarm                               // optional
+        int severity
+        int status
+        string message 
+    display_t display                           // optional
+        double limitLow
+        double limitHigh
+        string description 
+        string format 
+        string units 
+    string extra1                               //extra
+
+

NTNDArrayBuilder

+

ntndArray.h defines the following:

+
+class NTNDArray;
+typedef std::tr1::shared_ptr<NTNDArray> NTNDArrayPtr;
+
+class NTNDArrayBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTNDArrayBuilder);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    shared_pointer addDisplay();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTNDArrayPtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
addDisplay
+
Add optional field display
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

NTNDArray

+
+class NTNDArray;
+typedef std::tr1::shared_ptr NTNDArrayPtr;
+
+class NTNDArray
+{
+public:
+    POINTER_DEFINITIONS(NTNDArray);
+    ~NTNDArray() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTNDArrayBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachDataTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    PVStructurePtr getPVStructure() const;
+    PVUnionPtr getValue() const;
+    PVLongPtr getCompressedDataSize() const;
+    PVLongPtr getUncompressedDataSize() const;
+    PVStructurePtr getCodec() const;
+    PVStructureArrayPtr getAttribute() const;
+    PVStructureArrayPtr getDimension() const;
+    PVIntPtr getUniqueId() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getDataTimeStamp() const;
+    PVStringPtr getDescriptor() const;
+    PVStructurePtr getAlarm() const;
+    PVStructurePtr getDisplay() const;
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTNDArray that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null NTNDArrayPtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTNDArray that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTNDArray.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTNDArray. +
+
createBuilder
+
This method creates an NTNDArrayBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTNDArray is attached to the pvTimeStamp. +
+
attachDataTimeStamp
+
The dataTimeStamp field of the NTNDArray is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTNDArray is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
getPVStructure
+
Returns the pvStructure that NTNDArray wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getDisplay
+
Returns the top level display. + If the display was not selected as an optional field + a null pvStructure is returned. +
+
getValue
+
Returns the value field.
+
getCompressedDataSize
+
Returns the name of each channel.
+
getUncompressedDataSize
+
Returns connection state of each channel.
+
getCodec
+
Returns the severity of each channel.
+
getAttribute
+
Returns the status of each channel.
+
getDimension
+
Returns the message of each channel.
+
getUniqueId
+
Returns the secondsPastEpoch of each channel.
+
diff --git a/documentation/ntCPP_20140723.html b/documentation/ntCPP_20140723.html new file mode 100644 index 0000000..b741ff7 --- /dev/null +++ b/documentation/ntCPP_20140723.html @@ -0,0 +1,289 @@ + + + + + + EPICS pvDataCPP + + + + + + + + +
+

EPICS pvDataCPP

+ + +

EPICS v4 Working Group, Working Draft, 23-July-2014

+ +
+
Latest version:
+
ntCPP.html +
+
This version:
+
ntCPP_20140723.html +
+
Previous version:
+
None
+
Editors:
+
Marty Kraimer, BNL
+
Michael Davidsaver, BNL
+
Matej Sekoranja, CosyLab
+
+ + +
+
+

Abstract

+ +

EPICS Version 4 provides efficient +storage, access, and communication, of memory resident structured data. +pvData is the storage compoment. +pvDataCPP is the C++ implementation of pvData. +It is one part of the set of related products in the EPICS +V4 control system programming environment:
+relatedDocumentsV4.html +

+ + +

Status of this Document

+ +

For now this is a working copy so it is not the same as "This version" shown above.

+ +

This is the 23-July-2014 version of the C++ implementation of pvData. +

+ +

RELEASE_NOTES.md provides changes since the last release. +TODO.md describes things to do before the next release. +

+ + + +
+

Table of Contents

+
+
+ + +

EPICS normative type C++ implementation +

+ +

Draft, 4-Nov-2012

+
+
This version:
+
ntCPP.html
+
Editors:
+
Matej Sekoranja, CosyLab
+ Marty Kraimer, BNL +
+
+
+
+ +

Introduction

+ +

This section describes the C++ implemmentation of normative types. Two (2) helper classes are implemented, +ntNameValue and NTTable respectively.

+ +

Normative Type Fields.

+ +

These are helper classes for creating standard fields for normative types. +There is a single instance of this class, which is obtained via NTField::get(). +

+
class NTField: NoDefaultMethods {
+public:
+    static NTFieldPtr get();
+    ~NTField() {}
+
+    PVStructurePtr createEnumerated(StringArray const & choices);
+    PVStructurePtr createTimeStamp();
+    PVStructurePtr createAlarm();
+    PVStructurePtr createDisplay();
+    PVStructurePtr createAlarmLimit();
+    PVStructurePtr createControl();
+
+    PVStructureArrayPtr createEnumeratedArray();
+    PVStructureArrayPtr createTimeStampArray();
+    PVStructureArrayPtr createAlarmArray();
+};
+ +

where

+
+
createEnumerated
+
Create an introspection interface for an enumerated structure.
+
createTimeStamp
+
Create an interspection interface for a timeStamp structure.
+
createAlarm
+
Create an interspection interface for an alarm structure.
+
createDisplay
+
Create an introsepecion interface for a display structure.
+
createAlarmLimit
+
Create an introspection interface for an alarm limit structure.
+
createControl
+
Create an introspection interface for a control structure.
+
createEnumeratedArray
+
Create an introspection interface for an structureArray of enumerated + structures.
+
createTimeStampArray
+
Create an introspection interface for an structureArray of timeStamp + structures.
+
createAlarmArray
+
Create an introspection interface for an structureArray of alarm + structures.
+
+ +

NTNameValue

+ +

These are helper classes for NTNameValue

+
class NTNameValue : private NoDefaultMethods
+{
+public:
+    static bool isNTNameValue(PVStructurePtr const & pvStructure);
+    static NTNameValuePtr create(
+        bool hasFunction,bool hasTimeStamp, bool hasAlarm);
+    static NTNameValuePtr create(
+        PVStructurePtr const & pvStructure);
+    ~NTNameValue();
+    PVStringPtr getFunction();
+    void attachTimeStamp(PVTimeStamp &pvTimeStamp);
+    void attachAlarm(PVAlarm &pvAlarm);
+    PVStructurePtr getPVStructure();
+    PVStructurePtr getTimeStamp();
+    PVStructurePtr getAlarm();
+    PVStringArrayPtr getNames();
+    PVStringArrayPtr getValues();
+};
+ +

where

+
+
isNTNameValue
+
Is the structure a NTNameValue structure?
+
create
+
Create an NTNameValue that has the associated fields.
+
~NTNameValue
+
The destructor.
+
getFunction
+
Get the function field. This can be null.
+
attachTimeStamp
+
The timeStamp field of the NTNameValue is atttached to the + pvTimeStamp.
+
attachAlarm
+
The alarm field of the NTNameValue is atttached to the alarm.
+
getPVStructure
+
Get the pvStructure that this NTNameValue contains.
+
getTimeStamp
+
Get the timeStamp field.
+
getAlarm
+
Get the alarm field.
+
getNames
+
Get the names field.
+
getValues
+
Get the values field.
+
+ +

NTTable

+ +

These are helper classes for NTTable

+
class NTTable: private NoDefaultMethods
+{
+public:
+    static bool isNTTable(PVStructurePtr const & pvStructure);
+    static PVStructure::shared_pointer create(
+        bool hasFunction,bool hasTimeStamp, bool hasAlarm,
+        int numberValues,
+        FieldConstPtrArray valueFields);
+        static NTTablePtr create(
+            bool hasFunction,bool hasTimeStamp, bool hasAlarm,
+            StringArray const & valueNames,
+            FieldConstPtrArray const &valueFields);
+        static NTTablePtr clone(PVStructurePtr const &);
+    ~NTTable();
+    PVStringPtr getFunction();
+    void attachTimeStamp(PVTimeStamp &pvTimeStamp);
+    void attachAlarm(PVAlarm &pvAlarm);
+    PVStructurePtr getPVStructure();
+    PVStructurePtr getTimeStamp();
+    PVStructurePtr getAlarm();
+    PVStringArrayPtr getLabel();
+    size_t getNumberValues();
+    FieldConstPtr getField(int index);
+    PVFieldPtr getPVField(int index);
+};
+ +

where

+
+
isNTTable
+
y
+
create
+
Create an NTTable that has the associated fields.
+
~NTTable
+
The destructor.
+
getFunction
+
Get the function field. This can be null.
+
attachTimeStamp
+
The timeStamp field of the NTTable is atttached to the pvTimeStamp.
+
attachAlarm
+
The alarm field of the NTTable is atttached to the alarm.
+
getPVStructure
+
Get the pvStructure that this NTTable contains.
+
getTimeStamp
+
Get the timeStamp field.
+
getAlarm
+
Get the alarm field.
+
getLabel
+
Get the label field.
+
getNumberValues
+
Get the number of value fields.
+
getField
+
Get the introspection interface for the specified field.
+
getPVField
+
Get the data field for the specified field.
+
+ +

MTMultiChannel

+
+structure NTMultiChannel
+  union_t[] value       
+  string[]  channelName    
+  time_t    timeStamp        :opt // time when data collected
+  alarm_t   alarm            :opt // alarm associated with data collection
+  int[]     severity         :opt // alarm severity for each value
+  int[]     status           :opt // alarm status for each value
+  string[]  message          :opt // alarm message for each value
+  long[]    secondsPastEpoch :opt // seconds for each value.
+  int[]     nanoseconds      :opt // nanoseconds for each value
+  string    descriptor       :opt // descriptor data
+
+ + + + + + diff --git a/documentation/ntCPP_20140919.html b/documentation/ntCPP_20140919.html new file mode 100644 index 0000000..1c7f237 --- /dev/null +++ b/documentation/ntCPP_20140919.html @@ -0,0 +1,1473 @@ + + + + + + EPICS ntCPP + + + + + + + + +
+

EPICS ntCPP

+ + +

EPICS v4 Working Group, Working Draft, 19-Sept-2014

+ +
+
Latest version:
+
ntCPP.html +
+
This version:
+
ntCPP_20140919.html +
+
Previous version:
+
ntCPP_20140723.html +
+
Editors:
+
Marty Kraimer, BNL
+ Matej Sekoranja, CosyLab
+ David Hicken, Diamond Light Source +
+
+ + +
+
+

Abstract

+ +

EPICS Version 4 provides efficient +storage, access, and communication, of memory resident structured data. +The EPICS V4 Normative Types are a collection of structured data types +that can be used by the application level of EPICS V4 network endpoints, +to interoperably exchange scientific data. +normativeTypesCPP is the C++ implementation. +It is one part of the set of related products in the EPICS +V4 control system programming environment:
+relatedDocumentsV4.html +

+ + +

Status of this Document

+ +

This is the 19-Sept-2014 version of the C++ implementation of pvData. +

+ + +

RELEASE_NOTES.md provides changes since the last release. +TODO.md describes things to do before the next release. +

+ + + +
+

Table of Contents

+
+
+ + +

Introduction

+ +

This manual assumes that the reader is familiar with the material in + +pvDataCPP.html + +

+

At present the following normative types are implemented:

+
+
NTScalar
+
This has a value field that has type scalar
+
NTScalarArray
+
This has a value field that has type scalarArray
+
NTNameValue
+
This has a field names that is a string array + and a field values that has type scalarArray. + Each names[i] is associated with values[i]. +
+
NTTable
+
This has a string array field named labels + For each label there is a scalar array field with name = label. +
+
NTMultiChannel
+
This has a value field that is a union array. + 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.
+
NTNDArray
+
This type holds NDArray data as defined by the areaDetector facilility. +
+
+

Each normative type consists of a set of mandatory fields, a set of optional fields, +and any arbitrary number of extra fields. +The mandatory and optional fields are meant for use by standard tools such +as Display Managers and Alarm Handlers. +The extra fields are for specialized tools. +

+

+A helper class NTField is provided to enforce the proper implementation of property fields +as defined by pvData. +A property field is normally associated with a field that has the name "value". +The property fields currently used are alarm, timeStamp, display, control, and valueAlarm. +In addition pvData defines a standard structure for a value field that represents +enumerated values. +NTField has methods associated with each of these. +

+

An include file "nt.h" includes all the other header files that are provided by ntCPP. +

+

The next section describes NTField. +Next a set of standard optional fields used by many normative types is described. +Then each normative type is described. +

+ + +

NTField

+ +

These are helper classes for creating standard fields for normative types. +There is a single instance of this class, which is obtained via NTField::get(). +

+
class NTField{
+public:
+    static NTFieldPtr get();
+    ~NTField() {}
+
+    bool isEnumerated(FieldConstPtr const & field);
+    bool isTimeStamp(FieldConstPtr const & field);
+    bool isAlarm(FieldConstPtr const & field);
+    bool isDisplay(FieldConstPtr const & field);
+    bool isAlarmLimit(FieldConstPtr const & field);
+    bool isControl(FieldConstPtr const & field);
+
+    StructureConstPtr createEnumerated();
+    StructureConstPtr createTimeStamp();
+    StructureConstPtr createAlarm();
+    StructureConstPtr createDisplay();
+    StructureConstPtr createAlarmLimit();
+    StructureConstPtr createControl();
+
+    StructureArrayConstPtr createEnumeratedArray();
+    StructureArrayConstPtr createTimeStampArray();
+    StructureArrayConstPtr createAlarmArray();
+};
+ +

where

+
+
isEnumerated
+
Is the field an enumerated structure?
+
isTimeStamp
+
Is the field an timeStamp structure?
+
isAlarm
+
Is the field an alarm structure?
+
isDisplay
+
Is the field an display structure?
+
isAlarmLimit
+
Is the field an alarmLimit structure?
+
isControl
+
Is the field an control structure?
+
createEnumerated
+
Create an introspection interface for an enumerated structure.
+
createTimeStamp
+
Create an interspection interface for a timeStamp structure.
+
createAlarm
+
Create an interspection interface for an alarm structure.
+
createDisplay
+
Create an introsepecion interface for a display structure.
+
createAlarmLimit
+
Create an introspection interface for an alarm limit structure.
+
createControl
+
Create an introspection interface for a control structure.
+
createEnumeratedArray
+
Create an introspection interface for an structureArray of enumerated + structures.
+
createTimeStampArray
+
Create an introspection interface for an structureArray of timeStamp + structures.
+
createAlarmArray
+
Create an introspection interface for an structureArray of alarm + structures.
+
+

Property Field Definitions

+

Definition: value

+

Often a property field is associated with another field. +This other field is refered to as the value field. +Usually the value field will have the field name "value". +An example is:

+
+structure parent
+    double    value
+    structure alarm
+
+

In this example the alarm field reports alarms for the value field.

+ +

alarm

+

An alarm structure is used to report alarms and other problems to the client. +An alarm may be associated with a value field or can be used by a server +to report problems to the client. +An alarm attached to a substructure of the top level structure is normally +associated with a value field. +An alarm field attached to the top level structure can be used for either: +

    +
  1. If the top level structure has a value field then it is an alarm + for that field. +
  2. To report other problems to the client.
  3. +
+

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 the alarms.

+

An example is:

+
+structure top
+   structure alarm
+   structure power
+       double value
+       structure alarm
+   structure voltage
+       double value
+       structure alarm
+   structure current
+       double value
+       structure alarm
+
+

In this example power, voltage, and current all have an associated alarm. +The top level alarm would have a severity that matches the highest level +severity of power, voltage, an current.

+ +

A alarm structure has the following fields:

+
+structure alarm
+    int severity
+    int status
+    string message
+
+

Clients and Servers should use alarm.h and pvAlarm.h which are +provided by pvDataCPP intead of directly using the alarm structure itself. +In particular severity and status are defined as:

+
+enum AlarmSeverity {
+ noAlarm,minorAlarm,majorAlarm,invalidAlarm,undefinedAlarm
+};
+
+enum AlarmStatus {
+    noStatus,deviceStatus,driverStatus,recordStatus,
+    dbStatus,confStatus,undefinedStatus,clientStatus
+};
+
+

timeStamp

+

A timeStamp provides the time when the server executes or the time when +a the data for a value field was collected. +There can be multiple timeStamp fields. +A timeStamp associated with a substructure is usually associated with +a value field. +An timeStamp field attached to the top level structure can be used for either: +

    +
  1. If the top level structure has a value field then it can be the + timeStamp for that field. +
  2. The time when the server executed.
  3. +
+

NTNDArray is an example that has two top level timeStamp field with different +field names because it wants to report both.

+ +

A timeStamp structure has the following fields:

+
+structure timeStamp
+    long secondsPastEpoch
+    int nanoseconds
+    int userTag
+
+

Clients and Servers should use timeStamp.h and pvTimeStamp.h +which are provided by pvDataCPP intead of directly using the timeStamp structure itself. +Note that timeStamp.h provides many methods for manipulating time. +

+

The meaning of the fields is:

+
+
secondsPastEpoch
+
seconds since the posix epoch, i.e. Jan 1, 1970 00:00:00 UTC.
+
nanoseconds
+
nanoseconds since the secondsPastEpoch.
+
userTag
+
service specific.
+
+ +

control

+

This is used to specify operational limits for a numeric scalar value field.

+
+structure control
+    double limitLow
+    double limitHigh
+    double minStep
+
+

Servers should use control.h and pvControl.h which are +provided by pvDataCPP intead of directly using the control structure itself. +Note that control.h provides many methods for manipulating time. +

+

display

+

This is used to specify display limits and other information for a numeric scalar value field.

+
+structure display
+    double limitLow
+    double limitHigh
+    string description
+    string format
+    string units
+
+

Note that the format should be a simplifed version of the standard +C formattimg conventions.

+

alarmLimit

+

This is used to specify alarm limits for a numeric scalar value field. +It can be used by plotting tools to show alarm limits and asociated severities. +

+
+structure 
+    boolean active
+    double lowAlarmLimit
+    double lowWarningLimit
+    double highWarningLimit
+    double highAlarmLimit
+    int lowAlarmSeverity
+    int lowWarningSeverity
+    int highWarningSeverity
+    int highAlarmSeverity
+    double hysteresis
+
+

enumerated

+

This is used to specify a set of choices and an index that selects one +of the choices. +For readers familiar with EPICS core this is like the ENUM types.

+
+structure
+    int index
+    string[] choices
+
+ +

Normative Type Common Features

+

Each normative type has two classes: a builder and a class for the normative type itself.

+

Normative Type Builder

+

This is a class that can create one of the following:

+
+
Structure
+
The introspection instance for the data structure associated with the type.
+
PVStructure
+
The data instance for the data structure associated with the type.
+
NTXXX
+
The instance for the NT type. +
+
+

Each bulder also has a number of additional methods for optional fields +and a method to add extra fields.

+

Normative Type Class

+

+This has methods to do the following:

+
+
Create instance
+
A instance of a object can be created via a builder of from an existing PVStructure
+
Attach a Property
+
For the following optional fields an object to manipulate the fields can be attached: + alarm, timeStamp, display, and control.
+
Get Data Interfaces
+
Each type has a method getPVStructure to get the entire data structure. + In addition there is a method to get the data interface for each manditory + and optional field.
+
+

Normative Type NTScalar

+

This has the following fields:

+
+uri:ev4:nt/2014/pwd:NTScalar
+    double value                        // mandatory and can be any numeric type
+    string descriptor                   // optional
+    alarm_t alarm                       // optional
+        int severity
+        int status 
+        string message
+    time_t timeStamp                    // optional
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    display_t display                   // optional
+        double limitLow
+        double limitHigh
+        string description
+        string format
+        string units
+    control_t control                   // optional
+        double limitLow
+        double limitHigh
+        double minStep
+    string extra1                       // extra
+    string[] extra2                     //
+
+

NTScalarBuilder

+

This is a class that creates the introspection and data instances for NTScalar and +an a NTScalar instance itself.

+

ntscalar.h defines the following:

+
+class NTScalar;
+typedef std::tr1::shared_ptr<NTScalar> NTScalarPtr;
+
+class NTScalarBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTScalarBuilder);
+    shared_pointer value(ScalarType scalarType);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    shared_pointer addDisplay();
+    shared_pointer addControl();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTScalarPtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
value
+
This determines the scalar type for the value field. + This must be specified or createStructure will throw an exception.
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
addDisplay
+
Add optional field display
+
addControl
+
Add optional field control
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

An NTScalaBuilder can be used to create multiple PVStructure and/or NTScalar instances. +Each time createPVScalar is called it clears all interval data after the PVStructure +is created.

+

NTScalarBuilder Examples

+

An example of creating an NTScalar instance is:

+
+NTScalarBuilderPtr builder = NTScalar::createBuilder();
+NTScalarPtr ntScalar = builder->
+    value(pvInt)->
+    addDescriptor()->
+    addAlarm()->
+    addTimeStamp()->
+    addDisplay()->
+    addControl()->
+    create();
+
+

The same results could be done by:

+
+NTScalarBuilderPtr builder = NTScalar::createBuilder();
+builder->value(pvInt);
+builder->addDescriptor();
+builder->addAlarm();
+builder->addTimeStamp();
+builder->addDisplay();
+builder->addControl();
+NTScalarPtr ntScalar = builder->create();
+
+ +

NTScalar

+

ntscalar.h defines the following:

+
+class NTScalar;
+typedef std::tr1::shared_ptr NTScalarPtr;
+
+class NTScalar
+{
+public:
+    POINTER_DEFINITIONS(NTScalar);
+    ~NTScalar() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTScalarBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    bool attachDisplay(PVDisplay &pvDisplay) const;
+    bool attachControl(PVControl &pvControl) const;
+    PVStructurePtr getPVStructure() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVStructurePtr getDisplay() const;
+    PVStructurePtr getControl() const;
+    PVFieldPtr getValue() const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getValue() const
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTScalar that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null PVScalar if is_a returns false. +
+The primary use of narrow is by pvAccess client code. +The server creates a pvStructure that is valid for an NTScalar +and passes it to the client. +The client can call narrow to create an NTScalar for it;s own use. +An example is: +
+void myCallback(PVStructurePtr const & pvStructure)
+{
+     NTScalarPtr ntscalar = NTScalar::narrow(pvStructure);
+     if(!ntscalar) {
+       // not a valid NTScalar
+     }
+     ...
+}
+
+
+
narrow_unsafe
+
Given a pvStructure this creates an NTScalar that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTScalar.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTScalar. +
+
createBuilder
+
This method creates an NTScalarBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTScalar is attached to the pvTimeStamp. +
+An example is: +
+PVTimeStamp pvTimeStamp;
+TimeStamp timeStamp;
+
+ntscalar-&attachTimeStamp(pvTimeStamp);
+pvTimeStamp.get(timeStamp);
+TimeStamp current;
+current.getCurrent();
+double diff = TimeStamp::diff(timeStamp,current); // timeStamp = current
+
+
+
attachAlarm
+
The alarm field of the NTScalar is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields.
+An example is: +
+PVAlarm pvAlarm;
+Alarm alarm;
+
+ntscalar-&attachAlarm(pvAlarm);
+pvAlarm.get(alarm);
+int severity = alarm.getSeverity();
+int status = alarm.getStatus();
+string message = alarm.getMessage();
+
+
+
attachDisplay
+
The display field of the NTScalar is attached to the pvDisplay. + Used similar to attachAlarm. +
+
attachControl
+
The control field of the NTScalar is attached to the pvControl. + Used similar to attachAlarm. +
+
getPVStructure
+
Returns the pvStructure that NTScalar wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getDisplay
+
Returns the top level display. + If the display was not selected as an optional field + a null pvStructure is returned. +
+
getControl
+
Returns the top level control. + If the control was not selected as an optional field + a null pvStructure is returned. +
+
getValue
+
Returns the value field.
+
+

Normative Type NTScalarArray

+

This class is similar to NTScalarArray except that the value +field is a scalar array field instead of just a scalar.

+

This has the following fields:

+
+uri:ev4:nt/2014/pwd:NTScalarArray
+    double[] value                      // mandatory and can be any numeric type
+    string descriptor                   // optional
+    alarm_t alarm                       // optional
+        int severity
+        int status 
+        string message
+    time_t timeStamp                    // optional
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    display_t display                   // optional
+        double limitLow
+        double limitHigh
+        string description
+        string format
+        string units
+    control_t control                   // optional
+        double limitLow
+        double limitHigh
+        double minStep
+    string extra1                       // extra
+    string[] extra2                     //
+
+

NTScalarArrayBuilder

+

ntscalarArray.h defines the following:

+
+class NTScalarArray;
+typedef std::tr1::shared_ptr<NTScalarArray> NTScalarArrayPtr;
+
+class NTScalarArrayBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTScalarArrayBuilder);
+    shared_pointer arrayValue(ScalarType elementType);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    shared_pointer addDisplay();
+    shared_pointer addControl();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTScalarArrayPtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
value
+
This determines the element type for the value field. + This must be specified or createStructure will throw an exception.
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
addDisplay
+
Add optional field display
+
addControl
+
Add optional field control
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

NTScalarArray

+

ntscalarArray.h defines the following:

+
+class NTScalarArray;
+typedef std::tr1::shared_ptr NTScalarArrayPtr;
+
+class NTScalarArray
+{
+public:
+    POINTER_DEFINITIONS(NTScalarArray);
+    ~NTScalarArray() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTScalarArrayBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    bool attachDisplay(PVDisplay &pvDisplay) const;
+    bool attachControl(PVControl &pvControl) const;
+    PVStructurePtr getPVStructure() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVStructurePtr getDisplay() const;
+    PVStructurePtr getControl() const;
+    PVFieldPtr getValue() const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getValue() const
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTScalarArray that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null PVScalarArrayPtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTScalarArray that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTScalarArray.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTScalarArray. +
+
createBuilder
+
This method creates a NTScalarArrayBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTScalarArray is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTScalarArray is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
attachDisplay
+
The display field of the NTScalarArray is attached to the pvDisplay. + Used similar to attachAlarm. +
+
attachControl
+
The control field of the NTScalarArray is attached to the pvControl. + Used similar to attachAlarm. +
+
getPVStructure
+
Returns the pvStructure that NTScalarArray wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getDisplay
+
Returns the top level display. + If the display was not selected as an optional field + a null pvStructure is returned. +
+
getControl
+
Returns the top level control. + If the control was not selected as an optional field + a null pvStructure is returned. +
+
getValue
+
Returns the value field.
+
+ +

Normative Type NTNameValue

+
+uri:ev4:nt/2014/pwd:NTNameValue
+    string[] names                 // mandatory
+    double[] values                // madatory, can be any type, must be same length as names
+    string descriptor              // optional
+    alarm_t alarm                  // optional
+        int severity
+        int status
+        string message
+    time_t timeStamp              // optional
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    string extra1                 // extra
+    string[] extra2               // extra
+
+ +

NTNameValueBuilder

+

ntnameValue.h defines the following:

+
+class NTNameValue;
+typedef std::tr1::shared_ptr<NTNameValue> NTNameValuePtr;
+
+class NTNameValueBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTNameValueBuilder);
+    shared_pointer value(ScalarType scalarType);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTNameValuePtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
value
+
This determines the element type for the value field. + This must be specified or createStructure will throw an exception.
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+ +

NTNameValue

+
+class NTNameValue;
+typedef std::tr1::shared_ptr NTNameValuePtr;
+
+class NTNameValue
+{
+public:
+    POINTER_DEFINITIONS(NTNameValue);
+    ~NTNameValue() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTNameValueBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    PVStructurePtr getPVStructure() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVStringArrayPtr getNames() const;
+    PVFieldPtr getValues() const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getValue() const
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTNameValue that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null NTNameValuePtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTNameValue that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTNameValue.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTNameValue. +
+
createBuilder
+
This method creates an NTNameValueBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTNameValue is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTNameValue is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
getPVStructure
+
Returns the pvStructure that NTNameValue wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getNames
+
Returns field names.
+
getValues
+
Returns field values.
+
+ +

Normative Type NTTable

+
+uri:ev4:nt/2014/pwd:NTTable 
+    string[] labels [column0,column1,column2]    // 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
+    string descriptor                            // optional
+    alarm_t alarm                                // optional
+        int severity 
+        int status 
+        string
+    time_t timeStamp                             // optional
+        long secondsPastEpoch
+        int nanoseconds 498486530
+        int userTag
+    string extra1                                // extra
+
+ +

NTTableBuilder

+

nttable.h defines the following:

+
+class NTTable;
+typedef std::tr1::shared_ptr<NTTable> NTTablePtr;
+
+class NTTableBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTTableBuilder);
+    shared_pointer add(string const & name,ScalarType scalarType);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTTablePtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
add
+
This is the name and elementType for the next column
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

NTTable

+
+class NTTable;
+typedef std::tr1::shared_ptr NTTablePtr;
+
+class NTTable
+{
+public:
+    POINTER_DEFINITIONS(NTTable);
+    ~NTTable() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTTableBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    PVStructurePtr getPVStructure() const;
+    PVStringPtr getDescriptor() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVStringArrayPtr getLabels() const;
+    PVFieldPtr getColumn(string const & columnName) const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getColumn(string const & columnName) const;
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTTable that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null NTTablePtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTTable that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTTable.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTTable. +
+
createBuilder
+
This method creates an NTTableBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTTable is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTTable is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
getPVStructure
+
Returns the pvStructure that NTTable wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getLabels
+
Returns the labels field.
+
getColumn
+
Returns the column with the specified name.
+
+ +

Normative Type NTMultiChannel

+
+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
+
+

NTMultiChannelBuilder

+

ntmultiChannel.h defines the following:

+
+class NTMultiChannel;
+typedef std::tr1::shared_ptr<NTMultiChannel> NTMultiChannelPtr;
+
+class NTMultiChannelBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTMultiChannelBuilder);
+    shared_pointer value(UnionConstPtr valuePtr);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    shared_pointer addSeverity();
+    shared_pointer addStatus();
+    shared_pointer addMessage();
+    shared_pointer addSecondsPastEpoch();
+    shared_pointer addNanoseconds();
+    shared_pointer addUserTag();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTMultiChannelPtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
value
+
This determines the element type for the value field. + If not specified the type will be a variant union. +
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
addSeverity
+
Add a field that has the alarm severity for each channel.
+
addStatus
+
Add a field that has the alarm status for each channel.
+
addMessage
+
Add a field that has the alarm message for each channel.
+
addSecondsPastEpoch
+
Add a field that has the secondsPastEpoch for each channel.
+
addNanoseconds
+
Add a field that has the nanoseconds for each channel.
+
addUserTag
+
Add a field that has the userTag for each channel.
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

NTMultiChannel

+
+class NTMultiChannel;
+typedef std::tr1::shared_ptr NTMultiChannelPtr;
+
+class NTMultiChannel
+{
+public:
+    POINTER_DEFINITIONS(NTMultiChannel);
+    ~NTMultiChannel() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTMultiChannelBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    PVStructurePtr getPVStructure() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getAlarm() const;
+    PVUnionArrayPtr getValue() const;
+    PVStringArrayPtr getChannelName() const;
+    PVBooleanArrayPtr getIsConnected() const;
+    PVIntArrayPtr getSeverity() const;
+    PVIntArrayPtr getStatus() const;
+    PVStringArrayPtr getMessage() const;
+    PVLongArrayPtr getSecondsPastEpoch() const;
+    PVIntArrayPtr getNanoseconds() const;
+    PVIntArrayPtr getUserTag() const;
+    PVStringPtr getDescriptor() const;
+    template<typename PVT>
+    std::tr1::shared_ptr<PV> getValue() const
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTMultiChannel that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null NTMultiChannelPtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTMultiChannel that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTMultiChannel.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTMultiChannel. +
+
createBuilder
+
This method creates an NTMultiChannelBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTMultiChannel is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTMultiChannel is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
getPVStructure
+
Returns the pvStructure that NTMultiChannel wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getValue
+
Returns the value field.
+
getChannelName
+
Returns the name of each channel.
+
getIsConnected
+
Returns connection state of each channel.
+
getSeverity
+
Returns the severity of each channel.
+
getStatus
+
Returns the status of each channel.
+
getMessage
+
Returns the message of each channel.
+
getSecondsPastEpoch
+
Returns the secondsPastEpoch of each channel.
+
getNanoseconds
+
Returns the nanoseconds of each channel.
+
getUserTag
+
Returns the userTag of each channel.
+
+ +

Normative Type NTNDArray

+
+uri:ev4:nt/2014/pwd:NTNDArray 
+    union value                                 //mandatory
+    long compressedSize                         //mandatory
+    long uncompressedSize                       //mandatory
+    codec_t codec                               //mandatory
+        string name 
+        any parameters
+    dimension_t[] dimension                     //mandatory
+        dimension_t[]
+            dimension_t
+                int size
+                int offset
+                int fullSize
+                int binning
+                boolean reverse
+    int uniqueId                                //mandatory
+    time_t dataTimeStamp                        //mandatory
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    uri:ev4:nt/2014/pwd:NTAttribute[] attribute //mandatory
+        uri:ev4:nt/2014/pwd:NTAttribute[]
+            uri:ev4:nt/2014/pwd:NTAttribute
+                string name
+                any value
+                string description
+                int sourceType
+                string source
+    string descriptor                           // optional
+    time_t timeStamp                            // optional
+        long secondsPastEpoch
+        int nanoseconds
+        int userTag
+    alarm_t alarm                               // optional
+        int severity
+        int status
+        string message 
+    display_t display                           // optional
+        double limitLow
+        double limitHigh
+        string description 
+        string format 
+        string units 
+    string extra1                               //extra
+
+

NTNDArrayBuilder

+

ntndArray.h defines the following:

+
+class NTNDArray;
+typedef std::tr1::shared_ptr<NTNDArray> NTNDArrayPtr;
+
+class NTNDArrayBuilder
+{
+public:
+    POINTER_DEFINITIONS(NTNDArrayBuilder);
+    shared_pointer addDescriptor();
+    shared_pointer addAlarm();
+    shared_pointer addTimeStamp();
+    shared_pointer addDisplay();
+    StructureConstPtr createStructure();
+    PVStructurePtr createPVStructure();
+    NTNDArrayPtr create();
+    shared_pointer add(
+         string const & name,
+         FieldConstPtr const & field);
+private:
+}
+
+where +
+
addDescriptor
+
Add optional field descriptor
+
addAlarm
+
Add optional field alarm
+
addTimeStamp
+
Add optional field timeStamp
+
addDisplay
+
Add optional field display
+
createStructure
+
Create a introspection instance.
+
createPVStructure
+
Create the data instance.
+
create
+
create an PVScalar instance.
+
add
+
Add an extra field. As many fields as desired can be added but each must have + a unique name that is not the name of any manditory or possible optional field.
+
+

NTNDArray

+
+class NTNDArray;
+typedef std::tr1::shared_ptr NTNDArrayPtr;
+
+class NTNDArray
+{
+public:
+    POINTER_DEFINITIONS(NTNDArray);
+    ~NTNDArray() {}
+    static shared_pointer narrow(PVStructurePtr const & structure);
+    static shared_pointer narrow_unsafe(PVStructurePtr const & structure);
+    static bool is_a(StructureConstPtr const & structure);
+    static bool is_compatible(PVStructurePtr const &pvStructure);
+    static NTNDArrayBuilderPtr createBuilder();
+
+    bool attachTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachDataTimeStamp(PVTimeStamp &pvTimeStamp) const;
+    bool attachAlarm(PVAlarm &pvAlarm) const;
+    PVStructurePtr getPVStructure() const;
+    PVUnionPtr getValue() const;
+    PVLongPtr getCompressedDataSize() const;
+    PVLongPtr getUncompressedDataSize() const;
+    PVStructurePtr getCodec() const;
+    PVStructureArrayPtr getAttribute() const;
+    PVStructureArrayPtr getDimension() const;
+    PVIntPtr getUniqueId() const;
+    PVStructurePtr getTimeStamp() const;
+    PVStructurePtr getDataTimeStamp() const;
+    PVStringPtr getDescriptor() const;
+    PVStructurePtr getAlarm() const;
+    PVStructurePtr getDisplay() const;
+private:
+}
+
+where +
+
narrow
+
Given a pvStructure this creates an NTNDArray that warps it. + It calls is_a on the introspection interface of the + pvStructure and returns a null NTNDArrayPtr if is_a returns false. +
+
narrow_unsafe
+
Given a pvStructure this creates an NTNDArray that warps it. + It does not check that the introspection interface is compatible. + This method is dangerous.
+
is_a
+
This method checks to see if the structure has an ID that is + correct for NTNDArray.
+
is_compatible
+
This method checks to see if the pvStructure has appropriate + fields to be an NTNDArray. +
+
createBuilder
+
This method creates an NTNDArrayBuilder.
+
attachTimeStamp
+
The timeStamp field of the NTNDArray is attached to the pvTimeStamp. +
+
attachDataTimeStamp
+
The dataTimeStamp field of the NTNDArray is attached to the pvTimeStamp. +
+
attachAlarm
+
The alarm field of the NTNDArray is attached to the pvAlarm. + If alarm is not selected as an optional field false is returned. + If this is successful then the pvAlarm can be used to access that alarm + fields. +
+
getPVStructure
+
Returns the pvStructure that NTNDArray wraps.
+
getDescriptor
+
Get the descriptor.
+
getTimeStamp
+
Returns the top level timeStamp. + If the timeStamp was not selected as an optional field + a null pvStructure is returned. +
+
getAlarm
+
Returns the top level alarm. + If the alarm was not selected as an optional field + a null pvStructure is returned. +
+
getDisplay
+
Returns the top level display. + If the display was not selected as an optional field + a null pvStructure is returned. +
+
getValue
+
Returns the value field.
+
getCompressedDataSize
+
Returns the name of each channel.
+
getUncompressedDataSize
+
Returns connection state of each channel.
+
getCodec
+
Returns the severity of each channel.
+
getAttribute
+
Returns the status of each channel.
+
getDimension
+
Returns the message of each channel.
+
getUniqueId
+
Returns the secondsPastEpoch of each channel.
+
+ + +
+ + diff --git a/src/nt/ntmultiChannel.cpp b/src/nt/ntmultiChannel.cpp index 8b4c6fe..0bce9e3 100644 --- a/src/nt/ntmultiChannel.cpp +++ b/src/nt/ntmultiChannel.cpp @@ -20,10 +20,9 @@ static NTFieldPtr ntField = NTField::get(); namespace detail { -NTMultiChannelBuilder::shared_pointer NTMultiChannelBuilder::addValue(UnionConstPtr valuePtr) +NTMultiChannelBuilder::shared_pointer NTMultiChannelBuilder::value(UnionConstPtr valuePtr) { - value = true; - valueUnion = valuePtr; + valueType = valuePtr; return shared_from_this(); } @@ -101,8 +100,8 @@ StructureConstPtr NTMultiChannelBuilder::createStructure() StringArray names(nfields); size_t ind = 0; names[ind] = "value"; - if(value) { - fields[ind++] = fieldCreate->createUnionArray(valueUnion); + if(valueType) { + fields[ind++] = fieldCreate->createUnionArray(valueType); } else { fields[ind++] = fieldCreate->createVariantUnion(); } @@ -173,10 +172,9 @@ NTMultiChannelBuilder::NTMultiChannelBuilder() void NTMultiChannelBuilder::reset() { - valueUnion.reset(); + valueType.reset(); extraFieldNames.clear(); extraFields.clear(); - value = false; descriptor = false; alarm = false; timeStamp = false; @@ -266,13 +264,13 @@ NTMultiChannel::NTMultiChannel(PVStructurePtr const & pvStructure) } -void NTMultiChannel::attachTimeStamp(PVTimeStamp &pv) +void NTMultiChannel::attachTimeStamp(PVTimeStamp &pv) const { if(!pvTimeStamp) return; pv.attach(pvTimeStamp); } -void NTMultiChannel::attachAlarm(PVAlarm &pv) +void NTMultiChannel::attachAlarm(PVAlarm &pv) const { if(!pvAlarm) return; pv.attach(pvAlarm); diff --git a/src/nt/ntmultiChannel.h b/src/nt/ntmultiChannel.h index b91b989..d24c20b 100644 --- a/src/nt/ntmultiChannel.h +++ b/src/nt/ntmultiChannel.h @@ -41,7 +41,7 @@ namespace detail { * If this is not called then a variantUnion is the default. * @return this instance of a {@code NTMultiChannelBuilder}. */ - shared_pointer addValue(epics::pvData::UnionConstPtr valuePtr); + shared_pointer value(epics::pvData::UnionConstPtr valuePtr); /** * Add descriptor field to the NTMultiChannel. * @return this instance of a {@code NTMultiChannelBuilder}. @@ -117,8 +117,7 @@ namespace detail { void reset(); - epics::pvData::UnionConstPtr valueUnion; - bool value; + epics::pvData::UnionConstPtr valueType; bool descriptor; bool alarm; bool timeStamp; @@ -194,78 +193,91 @@ public: * @param pvTimeStamp The pvTimeStamp that will be attached. * Does nothing if no timeStamp */ - void attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp); + void attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const; /** * Attach a pvAlarm. * @param pvAlarm The pvAlarm that will be attached. * Does nothing if no alarm */ - void attachAlarm(epics::pvData::PVAlarm &pvAlarm); + void attachAlarm(epics::pvData::PVAlarm &pvAlarm) const; /** * Get the pvStructure. * @return PVStructurePtr. */ - epics::pvData::PVStructurePtr getPVStructure(){return pvNTMultiChannel;} + epics::pvData::PVStructurePtr getPVStructure() const + {return pvNTMultiChannel;} /** * Get the timeStamp. * @return PVStructurePtr which may be null. */ - epics::pvData::PVStructurePtr getTimeStamp(){return pvTimeStamp;} + epics::pvData::PVStructurePtr getTimeStamp() const + {return pvTimeStamp;} /** * Get the alarm. * @return PVStructurePtr which may be null. */ - epics::pvData::PVStructurePtr getAlarm() {return pvAlarm;} + epics::pvData::PVStructurePtr getAlarm() const + {return pvAlarm;} /** * Get the value of each channel. * @return PVUnionArrayPtr */ - epics::pvData::PVUnionArrayPtr getValue() {return pvValue;} + epics::pvData::PVUnionArrayPtr getValue() const + {return pvValue;} /** * Get the channelName of each channel. * @return PVStringArrayPtr */ - epics::pvData::PVStringArrayPtr getChannelName() { return pvChannelName;}; + epics::pvData::PVStringArrayPtr getChannelName() const + { return pvChannelName;}; /** * Get the connection state of each channel. * @return PVBooleanArrayPtr */ - epics::pvData::PVBooleanArrayPtr getIsConnected() { return pvIsConnected;}; + epics::pvData::PVBooleanArrayPtr getIsConnected() const + { return pvIsConnected;}; /** * Get the severity of each channel. * @return PVIntArrayPtr which may be null. */ - epics::pvData::PVIntArrayPtr getSeverity() {return pvSeverity;} + epics::pvData::PVIntArrayPtr getSeverity() const + {return pvSeverity;} /** * Get the status of each channel. * @return PVIntArrayPtr which may be null. */ - epics::pvData::PVIntArrayPtr getStatus() {return pvStatus;} + epics::pvData::PVIntArrayPtr getStatus() const + {return pvStatus;} /** * Get the message of each chnnel. * @return PVStringArrayPtr which may be null. */ - epics::pvData::PVStringArrayPtr getMessage() {return pvMessage;} + epics::pvData::PVStringArrayPtr getMessage() const + {return pvMessage;} /** * Get the secondsPastEpoch of each channel. * @return PVLongArrayPtr which may be null. */ - epics::pvData::PVLongArrayPtr getSecondsPastEpoch() {return pvSecondsPastEpoch;} + epics::pvData::PVLongArrayPtr getSecondsPastEpoch() const + {return pvSecondsPastEpoch;} /** * Get the nanoseconds of each channel. * @return PVIntArrayPtr which may be null. */ - epics::pvData::PVIntArrayPtr getNanoseconds() {return pvNanoseconds;} + epics::pvData::PVIntArrayPtr getNanoseconds() const + {return pvNanoseconds;} /** * Get the userTag of each channel. * @return PVIntArrayPtr which may be null. */ - epics::pvData::PVIntArrayPtr getUserTag() {return pvUserTag;} + epics::pvData::PVIntArrayPtr getUserTag() const + {return pvUserTag;} /** * Get the descriptor. * @return PVStringPtr which may be null. */ - epics::pvData::PVStringPtr getDescriptor() {return pvDescriptor;} + epics::pvData::PVStringPtr getDescriptor() const + {return pvDescriptor;} private: NTMultiChannel(epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr pvNTMultiChannel; diff --git a/src/nt/ntndarray.cpp b/src/nt/ntndarray.cpp index 8683b04..6757330 100644 --- a/src/nt/ntndarray.cpp +++ b/src/nt/ntndarray.cpp @@ -329,6 +329,11 @@ PVStructurePtr NTNDArray::getAlarm() const return pvNTNDArray->getSubField("alarm"); } +PVStructurePtr NTNDArray::getDisplay() const +{ + return pvNTNDArray->getSubField("display"); +} + NTNDArray::NTNDArray(PVStructurePtr const & pvStructure) : pvNTNDArray(pvStructure) diff --git a/src/nt/ntndarray.h b/src/nt/ntndarray.h index 0b75cfc..8932a82 100644 --- a/src/nt/ntndarray.h +++ b/src/nt/ntndarray.h @@ -252,6 +252,12 @@ public: */ epics::pvData::PVStructurePtr getAlarm() const; + /** + * Get the display field. + * @return PVStructurePtr which may be null. + */ + epics::pvData::PVStructurePtr getDisplay() const; + private: NTNDArray(epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr pvNTNDArray; diff --git a/src/nt/nttable.h b/src/nt/nttable.h index aef1f76..d282ff4 100644 --- a/src/nt/nttable.h +++ b/src/nt/nttable.h @@ -34,10 +34,10 @@ namespace detail { /** * Add a column of given {@code Scalar} type. * @param name name of the column. - * @param scalarType column type, a scalar array. + * @param elementType column type, a scalar array. * @return this instance of a {@code NTTableBuilder}. */ - shared_pointer add(std::string const & name, epics::pvData::ScalarType scalarType); + shared_pointer add(std::string const & name, epics::pvData::ScalarType elememtType); /** * Add descriptor field to the NTTable. diff --git a/test/nt/ntmultiChannelTest.cpp b/test/nt/ntmultiChannelTest.cpp index 3748d0e..10e1bca 100644 --- a/test/nt/ntmultiChannelTest.cpp +++ b/test/nt/ntmultiChannelTest.cpp @@ -72,7 +72,7 @@ static void test() add("intValue", pvInt)-> createUnion(); multiChannel = builder-> - addValue(unionPtr) -> + value(unionPtr) -> addDescriptor()-> addAlarm()-> addTimeStamp()-> @@ -108,7 +108,7 @@ static void test() PVBooleanArrayPtr pvIsConnected = multiChannel->getIsConnected(); shared_vector isConnected = pvIsConnected->view(); multiChannel = builder-> - addValue(unionPtr) -> + value(unionPtr) -> addDescriptor()-> addAlarm()-> addTimeStamp()->