diff --git a/documentation/pvDataCpp.html b/documentation/pvDataCpp.html index 8fe5dc8..a4a032d 100644 --- a/documentation/pvDataCpp.html +++ b/documentation/pvDataCpp.html @@ -1852,56 +1852,41 @@ and a timeStamp and alarm. Do it the easy way.

Definition of Property

-

NOTE: The use of property is discouraged. But the Interfaces for standard -properties are encouraged.

-

Only fields named "value" have properties. A record can have multiple value fields, which can appear in the top level structure of a record or in a substructure. All other fields in the structure containing a value field are considered properties of the value field. The fieldname is also the property name. The value field can have any type, i.e. scalar, scalarArray, or structure. Typical property fields are timeStamp, alarm, display, control, -and history.

+and history

-

The timeStamp is a special case. If it appears anywhere in the structure -hieraracy above a value field it is a property of the value field.

- -

For example the following record has a single value field. The value field -has propertys alarm, timeStamp, and display.

-
<record name = "counterOutput" >
-    <structure name = "alarm" extends = "alarm" />
-    <structure name = "timeStamp" extends = "timeStamp" />
-    <scalar name = "value" scalarType = "double" />
-    <structure name = "display" extends = "display" >
-        <scalar name = "description">Sample Description</scalar>
-        <scalar name = "format">%f</scalar>
-        <scalar name = "units">volts</scalar>
-        <structure name = "limit">
-            <scalar name ="low">0.0</scalar>
-            <scalar name ="high">10.0</scalar>
-        </structure>
-    </structure>
-</record>
+

For example the following top level structure has a single value field. +The value field has propertys alarm, timeStamp, and display.

+
structure counterOutput
+    structure alarm
+    structure timeStamp
+    double value
+    structure display
+        string description "Sample Description"
+        string format "%f"
+        string units volts
+        structure limit
+            double low 0.0
+            double high 10.0

The following example has three value fields each with properties alarm and timeStamp. Voltage, Current, and Power each have a different alarms but all share the timeStamp.

-
<record name = "psSimple">
-    <structure name = "alarm" extends = "alarm" />
-    <structure name = "timeStamp" extends = "timeStamp" />
-    <structure name = "voltage">
-        <scalar name = "value" scalarType = "double" />
-        <structure name = "alarm" extends = "alarm" />
-    </structure>
-    <structure name = "current">
-        <scalar name = "value" scalarType = "double" />
-        <structure name = "alarm" extends = "alarm" />
-    </structure>
-    <structure name = "power">
-        <scalar name = "value" scalarType = "double" />
-        <structure name = "alarm" extends = "alarm" />
-    </structure>
-</record>
+
structure powerSupplyValueStructure
+    double value
+    structure alarm
+
+structure powerSupplySimple
+    structure alarm
+    structure timeStamp
+    powerSupplyValueStructure voltage
+    powerSupplyValueStructure power
+    powerSupplyValueStructure current

Standard Properties

@@ -1972,175 +1957,247 @@ structures that support the PVData data model. For example a powerSupport record can have fields power, voltage, current that each support the PVData data model.

-

PVProperty

+

timeStamp

-

Interface and factory for finding a field within a structure.

-
NOT DONE
- +

Two header files are provided for manipulating time stamps: timeStamp.h and pvTimeStamp.h timeStamp.h defines a time stamp +independent of pvData, i.e. it is a generally useful class for manipulating +timeStamps. pvTimeStamp.h is a +class that can be attached to a time stamp pvData structure. It provides get +and set methods to get/set a TimeStamp as defined by timeStamp.h

-

Enumeration

+

timeStamp.h

+
extern int32 milliSecPerSec;
+extern int32 microSecPerSec;
+extern int32 nanoSecPerSec;
+extern int64 posixEpochAtEpicsEpoch;
 
-

Enumerated is a convenience interface for a structure that happens to be -an enumerated structure, which is a structure that has fields index and -choices. Index is an integer and choices is an array of strings. Both index -selects one of the choices.

-
class Enumerated ;
+class TimeStamp {
 public:
+    TimeStamp();
+    TimeStamp(int64 secondsPastEpoch,int32 nanoSeconds = 0);
     //default constructors and destructor are OK
     //This class should not be extended
+    void normalize();
+    void fromTime_t(const time_t &);
+    void toTime_t(time_t &) const;
+    int64 getSecondsPastEpoch();
+    int64 getEpicsSecondsPastEpoch() const;
+    int32 getNanoSeconds() const;
+    void put(int64 secondsPastEpoch,int32 nanoSeconds = 0);
+    void put(int64 milliseconds);
+    void getCurrent();
+    double toSeconds() const ;
+    bool operator==(TimeStamp const &) const;
+    bool operator!=(TimeStamp const &) const;
+    bool operator<=(TimeStamp const &) const;
+    bool operator< (TimeStamp const &) const;
+    bool operator>=(TimeStamp const &) const;
+    bool operator> (TimeStamp const &) const;
+    static double diff(TimeStamp const & a,TimeStamp const & b);
+    TimeStamp & operator+=(int64 seconds);
+    TimeStamp & operator-=(int64 seconds);
+    TimeStamp & operator+=(double seconds);
+    TimeStamp & operator-=(double seconds);
+    int64 getMilliseconds(); // milliseconds since epoch
+};
- //returns (false,true) if pvField(isNot, is valid enumerated structure +

where

+ +

pvTimeStamp.h

+
class PVTimeStamp {
+public:
+    PVTimeStamp();
+    //default constructors and destructor are OK
+    //This class should not be extended
+    //returns (false,true) if pvField(isNot, is valid timeStamp structure
     bool attach(PVField *pvField);
-    ~Enumerated();
+    void detach();
+    // following throw logic_error is not attached to PVField
+    // a set returns false if field is immutable
+    TimeStamp get() const;
+    bool set(TimeStamp timeStamp);
+};
+ +

where

+ +

alarm

+ +

Two header files are provided for manipulating alarms: alarm.h and pvAlarm.h alarm.h defines a time stamp independent +of pvData, i.e. it is a generally useful class for manipulating alarms. pvAlarm.h is a class that can be +attached to a time stamp pvData structure. It provides get and set methods to +get/set a Alarm as defined by alarm.h

+ +

alarm.h

+
enum AlarmSeverity {
+ noAlarm,minorAlarm,majorAlarm,invalidAlarm
+};
+
+class AlarmSeverityFunc {
+public:
+    static AlarmSeverity getSeverity(int value);
+    static StringArray getSeverityNames();
+};
+
+class Alarm {
+public:
+    Alarm();
+    //default constructors and destructor are OK
+    String getMessage();
+    void setMessage(String value);
+    AlarmSeverity getSeverity() const;
+    void setSeverity(AlarmSeverity value);
+};
+
+ +

where

+ +

pvAlarm.h

+
class PVAlarm {
+public:
+    PVAlarm() : pvSeverity(0),pvMessage(0) {}
+    //default constructors and destructor are OK
+    //returns (false,true) if pvField(isNot, is valid enumerated structure
+    //An automatic detach is issued if already attached.
+    bool attach(PVField *pvField);
+    void detach();
     // each of the following throws logic_error is not attached to PVField
-    void putIndex(int32 index);
+    // set returns false if field is immutable
+    Alarm get() const;
+    bool set(Alarm alarm); 
+};
+
+ +

where

+ +

control

+ +

Two header files are provided for manipulating controls: control.h and pvControl.h control.h defines a time stamp +independent of pvData, i.e. it is a generally useful class for manipulating +controls. pvControl.h is a class +that can be attached to a time stamp pvData structure. It provides get and +set methods to get/set a Control as defined by control.h

+ +

control.h

+
class Control {
+public:
+    Control();
+    //default constructors and destructor are OK
+    double getLow() const;
+    double getHigh() const;
+    void setLow(double value);
+    void setHigh(double value);
+};
+
+ +

where

+ +

pvControl.h

+
class PVControl {
+public:
+    PVControl();
+    //default constructors and destructor are OK
+    //returns (false,true) if pvField(isNot, is valid enumerated structure
+    //An automatic detach is issued if already attached.
+    bool attach(PVField *pvField);
+    void detach();
+    // each of the following throws logic_error is not attached to PVField
+    // set returns false if field is immutable
+    Control get() const;
+    bool set(Control control);
+};
+
+ +

where

+ +

display

+ +

Two header files are provided for manipulating controls: display.h and pvDisplay.h display.h defines display information +independent of pvData, i.e. it is a generally useful class for manipulating +display infomation. pvDisplay.h is +a class that can be attached to a display pvData structure. It provides get +and set methods to get/set a Diaplay as defined by diaplay.h

+ +

display.h

+
class Display {
+public:
+    Display();
+    //default constructors and destructor are OK
+    double getLow() const;
+    double getHigh() const;
+    void setLow(double value);
+    void setHigh(double value);
+    String getDescription() const;
+    void setDescription(String value);
+    String getFormat() const;
+    void setFormat(String value);
+    String getUnits() const;
+    void setUnits(String value);
+};
+ +

where

+ +

pvDisplay.h

+
class PVDisplay {
+public:
+    PVDisplay()
+    : pvDescription(0),pvFormat(),pvUnits(),pvLow(),pvHigh() {}
+    //default constructors and destructor are OK
+    //An automatic detach is issued if already attached.
+    bool attach(PVField *pvField); 
+    void detach();
+    // each of the following throws logic_error is not attached to PVField
+    // a set returns false if field is immutable
+    Display get() const;
+    bool set(Display display);
+};
+
+ +

where

+
+
+ +

pvEnumerated

+ +

For enumerated structures a single header file pvEnumerted.h is available

+
class PVEnumerated {
+public:
+    PVEnumerated();
+    //default constructors and destructor are OK
+    //This class should not be extended
+    //returns (false,true) if pvField(isNot, is valid enumerated structure
+    //An automatic detach is issued if already attached.
+    bool attach(PVField *pvField);
+    void detach();
+    // each of the following throws logic_error is not attached to PVField
+    // a set returns false if field is immutable
+    bool setIndex(int32 index);
     int32 getIndex();
     String getChoice();
     bool choicesMutable();
     StringArray getChoices();
     int32 getNumberChoices();
-    // also throws logic_error of immutable
-    void putChoices(StringArray choices,int32 numberChoices);
-private:
-    PVInt *pvIndex;
-    PVStringArray *pvChoices;
+    bool setChoices(StringArray choices,int32 numberChoices);
 };

where

-
-
getIndex
-
Returns the interface for field index.
-
getChoice
-
Returns the choice for the current index.
-
getChoices
-
Returns the interface for field choices.
-
getPV
-
Returns the interface for the PVStructure for the enumerated - structure.
-
replacePVField
-
Replace the PVField implementation. The new implementation implements - interface Enumerated and also replaces the implementations of fields - index, choice, and choices. The new implementation updates index when - choice is changed and choice when index is changed. If choices is - changed the index is set to 0.
-
getEnumerated
-
If the field is an enumerated structure and replacePVField was called - for the field then interface Enumerated is returned.
-
- -

Standard Properties

- -

This section has structure definitions that support standard properties. -These definitions are defined in project javaIOC.

- -

TimeStamp

-
<structure name = "timeStamp">
-  <scalar name = "secondsPastEpoch" scalarType = "long" />
-  <scalar name = "nanoSeconds" scalarType = "int" />
-</structure>
- -

Alarm

-
<structure name = "alarmSeverity" extends = "enumerated" >
-  <array name = "choices"  immutable = "true" >none,minor,major,invalid</array>
-</structure>
-
-<structure name = "alarm">
-  <structure name = "severity" extends = "alarmSeverity" />
-  <scalar name = "message" scalarType = "string" />
-</structure>
- -

Limits

-
<structure name = "byteLimit">
-    <scalar name = "low" scalarType = "byte" />
-    <scalar name = "high" scalarType = "byte" />
-</structure>
-
-<structure name = "shortLimit">
-    <scalar name = "low" scalarType = "short" />
-    <scalar name = "high" scalarType = "short" />
-</structure>
-
-<structure name = "intLimit">
-    <scalar name = "low" scalarType = "int" />
-    <scalar name = "high" scalarType = "int" />
-</structure>
-
-<structure name = "longLimit">
-    <scalar name = "low" scalarType = "long" />
-    <scalar name = "high" scalarType = "long" />
-</structure>
-
-<structure name = "floatLimit">
-    <scalar name = "low" scalarType = "float" />
-    <scalar name = "high" scalarType = "float" />
-</structure>
-
-<structure name = "doubleLimit">
-    <scalar name = "low" scalarType = "double" />
-    <scalar name = "high" scalarType = "double" />
-</structure>
- -

Display

-
<structure name = "display">
-    <scalar name = "description" scalarType = "string" />
-    <scalar name = "format" scalarType = "string" />
-    <scalar name = "units" scalarType = "string" />
-    <structure name = "limit" extends = "doubleLimit" />
-</structure>
- -

Control

-
<structure name = "control">
-    <structure name = "limit" extends = "doubleLimit" />
-    <scalar name = "minStep" scalarType = "double" />
-</structure>
- -

Interfaces for Standard Properties

- -

PVTimeStamp

- -

The following priovides convient access to a timeStamp structure.

-
class PVTimeStamp {
-public:
-    //default constructors and destructor are OK
-    //This class should not be extended
-
-    //returns (false,true) if pvField(isNot, is valid timeStamp structure
-    bool attach(PVField *pvField);
-    // throws logic_error is not attached to PVField
-    TimeStamp &get();
-    // throws logic_error is not attached to PVField
-    void put (TimeStamp &timeStamp);
-private:
-    PVLong* pvSecs;
-    PVInt* pvNano;
-};
- -

Alarm

- -

The following provides convient access to the fields of an alarm -structure.

-
NOT DONE
- -

Limits

- -

Display

- -

Control


PVData Abstract and Base Classes