From 66fb300873627b32e42526cfb270061c8c1b2f00 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Fri, 17 Aug 2012 06:45:20 -0400 Subject: [PATCH] documentation updated; changes for Field::ID --- documentation/pvDataCPP.html | 4312 ++++++++++----------- pvDataApp/factory/Convert.cpp | 22 +- pvDataApp/factory/FieldCreateFactory.cpp | 35 +- pvDataApp/factory/PVArray.cpp | 130 +- pvDataApp/factory/PVDataCreateFactory.cpp | 28 +- pvDataApp/factory/PVField.cpp | 35 +- pvDataApp/factory/PVStructure.cpp | 10 + pvDataApp/factory/PVStructureArray.cpp | 32 +- pvDataApp/factory/StandardField.cpp | 54 +- pvDataApp/factory/StandardPVField.cpp | 42 +- pvDataApp/misc/status.cpp | 4 +- pvDataApp/misc/status.h | 4 +- pvDataApp/property/control.h | 3 + pvDataApp/property/pvAlarm.cpp | 2 +- pvDataApp/property/pvAlarm.h | 2 +- pvDataApp/property/pvControl.cpp | 2 +- pvDataApp/property/pvControl.h | 2 +- pvDataApp/property/pvDisplay.cpp | 2 +- pvDataApp/property/pvDisplay.h | 2 +- pvDataApp/property/pvEnumerated.cpp | 2 +- pvDataApp/property/pvEnumerated.h | 2 +- pvDataApp/property/pvTimeStamp.cpp | 2 +- pvDataApp/property/pvTimeStamp.h | 2 +- pvDataApp/pv/convert.h | 9 +- pvDataApp/pv/pvData.h | 94 +- pvDataApp/pv/pvIntrospect.h | 5 +- pvDataApp/pv/pvType.h | 247 +- pvDataApp/pv/standardField.h | 19 +- pvDataApp/pv/standardPVField.h | 6 +- test/plate.sh | 10 - test/testAll.sh | 18 - test/testBaseException | 45 - test/testBaseException.sh | 33 - test/testBaseExceptionDiff | 74 - test/testBaseExceptionGold | 37 - test/testBitSet | 2 - test/testBitSet.sh | 33 - test/testBitSetDiff | 6 - test/testBitSetGold | 3 - test/testByteBuffer | 5 - test/testByteBuffer.sh | 33 - test/testByteBufferDiff | 0 test/testByteBufferGold | 5 - test/testIntrospect | 84 - test/testIntrospect.sh | 33 - test/testIntrospectDiff | 85 - test/testIntrospectGold | 88 - test/testMessageQueue | 2 - test/testMessageQueue.sh | 33 - test/testMessageQueueAux | 0 test/testMessageQueueDiff | 8 - test/testMessageQueueGold | 5 - test/testPVAppend | 34 - test/testPVAppend.sh | 33 - test/testPVAppendDiff | 48 - test/testPVAppendGold | 32 - test/testPVAuxInfo | 45 - test/testPVAuxInfo.sh | 33 - test/testPVAuxInfoDiff | 76 - test/testPVAuxInfoGold | 52 - test/testPVData | 456 --- test/testPVData.sh | 33 - test/testPVDataDiff | 533 --- test/testPVDataGold | 342 -- test/testPVStructureArray | 290 -- test/testPVStructureArray.sh | 33 - test/testPVStructureArrayDiff | 217 -- test/testPVStructureArrayGold | 207 - test/testPVType | 4 - test/testPVType.sh | 33 - test/testPVTypeDiff | 0 test/testPVTypeGold | 4 - test/testProperty | 76 - test/testProperty.sh | 33 - test/testPropertyAux | 1 - test/testPropertyDiff | 109 - test/testPropertyGold | 82 - test/testQueue | 0 test/testQueue.sh | 33 - test/testQueueAux | 20 - test/testQueueDiff | 6 - test/testQueueGold | 3 - test/testSerialization.sh | 33 - test/testSerializationGold | 39 - test/testThread | 5 - test/testThread.sh | 33 - test/testThreadAux | 1 - test/testThreadDiff | 14 - test/testThreadGold | 9 - test/testTimeStamp | 6 - test/testTimeStamp.sh | 33 - test/testTimeStampAux | 5 - test/testTimeStampDiff | 0 test/testTimeStampGold | 6 - test/testTimer | 0 test/testTimer.sh | 33 - test/testTimerAux | 60 - test/testTimerDiff | 8 - test/testTimerGold | 5 - test/testtestPVAuxInfoDiff | 0 testApp/pv/Makefile | 8 + testApp/pv/testPVData.cpp | 2 + testApp/pv/testPVScalarArray.cpp | 43 +- testApp/pv/testPVStructureArray.cpp | 1 - testApp/pv/testStandardField.cpp | 68 + testApp/pv/testStandardPVField.cpp | 84 + 106 files changed, 2659 insertions(+), 6458 deletions(-) delete mode 100755 test/plate.sh delete mode 100755 test/testAll.sh delete mode 100644 test/testBaseException delete mode 100755 test/testBaseException.sh delete mode 100644 test/testBaseExceptionDiff delete mode 100644 test/testBaseExceptionGold delete mode 100644 test/testBitSet delete mode 100755 test/testBitSet.sh delete mode 100644 test/testBitSetDiff delete mode 100644 test/testBitSetGold delete mode 100644 test/testByteBuffer delete mode 100755 test/testByteBuffer.sh delete mode 100644 test/testByteBufferDiff delete mode 100644 test/testByteBufferGold delete mode 100644 test/testIntrospect delete mode 100755 test/testIntrospect.sh delete mode 100644 test/testIntrospectDiff delete mode 100644 test/testIntrospectGold delete mode 100644 test/testMessageQueue delete mode 100755 test/testMessageQueue.sh delete mode 100644 test/testMessageQueueAux delete mode 100644 test/testMessageQueueDiff delete mode 100644 test/testMessageQueueGold delete mode 100644 test/testPVAppend delete mode 100755 test/testPVAppend.sh delete mode 100644 test/testPVAppendDiff delete mode 100644 test/testPVAppendGold delete mode 100644 test/testPVAuxInfo delete mode 100755 test/testPVAuxInfo.sh delete mode 100644 test/testPVAuxInfoDiff delete mode 100644 test/testPVAuxInfoGold delete mode 100644 test/testPVData delete mode 100755 test/testPVData.sh delete mode 100644 test/testPVDataDiff delete mode 100644 test/testPVDataGold delete mode 100644 test/testPVStructureArray delete mode 100755 test/testPVStructureArray.sh delete mode 100644 test/testPVStructureArrayDiff delete mode 100644 test/testPVStructureArrayGold delete mode 100644 test/testPVType delete mode 100755 test/testPVType.sh delete mode 100644 test/testPVTypeDiff delete mode 100644 test/testPVTypeGold delete mode 100644 test/testProperty delete mode 100755 test/testProperty.sh delete mode 100644 test/testPropertyAux delete mode 100644 test/testPropertyDiff delete mode 100644 test/testPropertyGold delete mode 100644 test/testQueue delete mode 100755 test/testQueue.sh delete mode 100644 test/testQueueAux delete mode 100644 test/testQueueDiff delete mode 100644 test/testQueueGold delete mode 100755 test/testSerialization.sh delete mode 100644 test/testSerializationGold delete mode 100644 test/testThread delete mode 100755 test/testThread.sh delete mode 100644 test/testThreadAux delete mode 100644 test/testThreadDiff delete mode 100644 test/testThreadGold delete mode 100644 test/testTimeStamp delete mode 100755 test/testTimeStamp.sh delete mode 100644 test/testTimeStampAux delete mode 100644 test/testTimeStampDiff delete mode 100644 test/testTimeStampGold delete mode 100644 test/testTimer delete mode 100755 test/testTimer.sh delete mode 100644 test/testTimerAux delete mode 100644 test/testTimerDiff delete mode 100644 test/testTimerGold delete mode 100644 test/testtestPVAuxInfoDiff create mode 100644 testApp/pv/testStandardField.cpp create mode 100644 testApp/pv/testStandardPVField.cpp diff --git a/documentation/pvDataCPP.html b/documentation/pvDataCPP.html index 6660eea..f9fda39 100644 --- a/documentation/pvDataCPP.html +++ b/documentation/pvDataCPP.html @@ -10,22 +10,35 @@ + span.opt { color: grey } + span.nterm { font-style:italic } + span.term { font-family:courier } + span.user { font-family:courier } + span.user:before { content:"<" } + span.user:after { content:">" } + .nonnorm { font-style:italic } + p.ed { color: #AA0000 } + span.ed { color: #AA0000 } + p.ed.priv { display: inline; } + span.ed.priv { display: inline; } + /*]]>*/ + +

EPICS pvDataCPP

- + -

EPICS v4 Working Group, Working Draft, -20-Dec-2011

+

EPICS v4 Working Group, Working Draft, 15-Aug-2012

This version:
Editors:
Marty Kraimer, BNL
-
-

Abstract

-

pvDataCPP is the Java implementation of pvData, which is one of a related -set of products:

+

Abstract

+ +

pvDataCPP is the CPP implementation of pvData, which is one of a related set +of products:

-
pvData
-
pvData (Process Variable Daata) defines and implements an efficent way +
pvData
+
pvData (Process Variable Data) defines and implements an efficent way to store, access, and transmit memory resident structured data
-
pvAccess
+
pvAccess
pvAccess is network support for transmitting pvData.
-
pvIOC
+
pvIOC
A pvIOC is a network accessable smart real time database. The database consists of memory resident records. Each record has a name that is - uniquie within the local area network and contains a top level pvData + unique within the local area network and contains a top level pvData structure. Each field of a record can optionally have support code attached to it. The support is called when a request is made to process the record. The support code is what makes the record "smart". A pvAccess server is provided so that the records can be accesed via the network.
+
pvService
+
A middle layer for implementing services.
-

Each of the products has a Java and a C++ implementation.

+

Each of the products has a CPP and a C++ implementation.

The products are all part of the V4 implementation of Experimental Physics and Industrial Control System.

+

Status of this Document

-

Status of this Document

- -

This is the 20-Dec-2011 version of the C++ implementation of pvData. It is a +

This is the 15-Aug-2012 version of the C++ implementation of pvData. It is a complete implementation of pvData as currently defined.

-

TODO

- +

TODO

-

CONTENTS

+

The following is a list of unresolved issues for pvDataCPP:

+
+
PVArray
+
The implementation of the different array types (PVBooleanArray, ..., + PVStructureArray) all store the data as a shared pointer holding a + vector. A test case should be created to make sure that vector.size() is + the same as getLength()
+
PVArray Examples
+
The following examples should be provided: 1) use all the get methods. + 2) create an example that makes it;s data available in chunks.
+
pvType Example
+
Create an example of how to use the array typedefs
+
-
- +
+

Table of Contents

-
-

Preface

-
+
+

Introduction

This product is available via an open source license

-

This is the overview for pvDataCPP. Doxygen documentation is available at pvData is one of a set of related projects. It describes and implements the +data that the other projects support. Thus it is not useful by itself but +understanding pvData is required in order to understand the other projects. The +reader should also become familar with projects pvAccess and pvIOC, which are +located via the same sourceforge site as this project.

+ +

The Java and C++ implementation of pvData implement the same data model but +differ in implementation because of the differences between Java and C++.

+ +

It is a good idea to read all of pvDataJava.html but read at least the +first two chapters:

+
+
Introduction
+
A brief descripton of pvData.
+
PVData Meta Language
+
A language used to describe data.
+
+ +

The material in these two chapters is NOT repeated in this documentation.

+ +

Doxygen documentation is available at doxygenDoc

-

pvData is one of a set of related projects:

+

Namespace and Memory Management

+ +

Namespace

+ +

All code in project pvDataCPP appears in namespace:

+
namespace epics { namespace pvData {
+     // ...
+}}
+ +

Memory Managemment

+ +

pvDataCPP introspection and data objects are designed to be shared. They are +made availiable via std::tr1::shared_ptr. In addition arrays are +implemented via std::vector. The following naming conventions are used +in typedefs:

-
pvData
-
Describes and implements structured data.
-
pvAccess
-
Provides networking for pvData.
-
pvIOC
-
Provides a database based on pvData together with record processing, - record scanning, and extensible support.
+
Ptr
+
When Ptr appears it stands for std::tr1::shared_ptr.
+
Array
+
When Array appears it stands for std::vector.
-

pvData

+

As an example pvType.h includes the following definitions:

+
typedef std::vector<double> DoubleArray;
+typedef std::tr1::shared_ptr<DoubleArray> DoubleArrayPtr;
+inline double * get(DoubleArray &value)
+{
+    return &value[0];
+}
+inline const double * get(const DoubleArray &value)
+{
+    return static_cast<const double *>(&value[0]);
+}
+typedef std::vector<double>::iterator DoubleArray_iterator;
+typedef std::vector<double>::const_iterator DoubleArray_const_iterator;
-

pvData describes and implements structured data. Interspection interfaces -are used to describe the data and for each type of data a data interface -provides a container to hold the data.

- -

Introspection

- -

pvData is modeled as a structured set of fields. A field has a name are a -type. The type must be one of:

+

where

-
scalar
-
A scalar has a scalar type which must be one of the following: -
-
boolean
-
Is always either true or false.
-
byte
-
An 8 bit signed integer.
-
short
-
A 16 bit signed integer.
-
int
-
A 32 bit signed integer.
-
long
-
A 64 bit signed integer.
-
float
-
A IEEE 32 bit float.
-
double
-
A IEEE 64 bit float.
-
string
-
A UTF8 string.
-
-
-
scalarArray
-
An array where all elements have the same scalar type.
-
structure
-
An array of fields. Each field can have a different type including - structure. Thus complex structured data is supported.
-
structureArray
-
An array of structure fields where each element has the exact same - introspection interface.
-
- -

Introspection interface Field provides the name and type for the field. In -addition each type has an introspection interface: Scalar, ScalarArray, -Structure, and StructureArray.

- -

Data

- -

Interface PVField provides access to the common information of every data -container. In addition every possible type has an interface for accessing the -data:

-
-
scalar
-
The interfaces are PVBoolean, PVByte, PVShort, PVInt, PVLong, PVFloat, - PVDouble, and PVString.
-
scalarArray
-
The interfaces are PVBooleanArray, PVByteArray, PVShortArray, - PVIntArray, PVLongArray, PVFloatArray, PVDoubleArray, and - PVStringArray.
-
structure
-
The interface is PVStructure.
-
structureArray
-
The interface is PVStructureArray.
-
- -

Property Structures

- -

pvData provides support, via pvData structures and associated support, for -the following:

-
-
timeStamp
-
Time since the POSIX Epoch.
-
alarm
-
Alarm information.
-
display
-
Display Info
-
control
-
Control Info.
-
enumerated structrure
-
This is a pvData structure with two field: index and choices.
-
- -

pvAccess

- -

pvAccess provides client/server support for transmitting pvData objects. The -server must provide access to objects identified by name. Each object must have -a network wide unique name. A client issues a create channel request, -specifying the channel name in order to connect to the object on the server. -After the client has connected, it can issue the following types of request.

-
-
process
-
Asks that the channel process. The process semantics are determined by - the server.
+
DoubleArray
+
This defines a vector for an array of the primitive type "double".
+
DoubleArrayPtr
+
This devices a shared pointer to a vector for an array of the primitive + type "double".
get
-
Ask the get data from the server. The client can optionally ask the - server to process before returning data.
-
put
-
Puts data to the server. The server can optionally be asked to process - after receiving the data.
-
putGet
-
Puts data to the server, optionally ask the server to process, and then - get data from the server.
-
monitor
-
Request that the server send data to the client when new data is - available.
-
channelArray
-
This can get and put a sub- array.
-
channelRPC
-
This is similar to a putGet except that the server will create a new - PVStructure and send it to the client.
+
This gets the raw array of doubles that the DoubleArray holds.
+
DoubleArray_iterator
+
This gets a iterator for the DoubleArray.
+
DoubleArray_const_iterator
+
This gets a constant iterator for the DoubleArray.
-

Associated with each type of request is a create method. The method has an -argument that allows the client to specify options. This argument is a top -level PVStructure called a pvRequest. The pvRequest is sent to the server. The -server side looks at what is requested and creates a top level PVStructrure -that will hold the data that is transfered between client and server. It then -sends the introspection info to the client side of pvAccess, which also creates -a top level PVStructure for holding data. At this time the client is notified -that it can start making requests. Thus when data is passed between client and -server it flows between the two top level PVStructures without requiring the -creation on new objects.

+

pvDataApp/pv

-

pvAccess provides many of the features of systems like CORBA and ICE -(Internet Communication Engine) but is designed to provide the following -features:

-
-
No IDL (Interface Definition Language) or associated compiler
-
The introspection interfaces replace the IDL.
-
Efficent use of network
-
Introspection info is only passed at creation time. For data requests - data is passed without any interspection information.
- Multiple small objects are automatically combined into a single network - packet.
- Large objects automatically span network packets.
-
- -

pvIOC

- -

IOC means Input/Output Controller, which is an EPICS term. A pvIOC is -modeled after an EPICS IOC but supports pvData instead of flat record -structures. At the present time the only implementation is in Java and called -javaIOC. The c++ implementaion will be called pvIOC and will be able to run in -an existing EPICS IOC.

- -

Like an EPICS IOC a pvIOC provides the followig features:

-
-
Record Processing
-
A record can be processed, i.e. records are "smart". Each field can - optionally have attached support. When a record is asked to process the - support attacked to the top level PVStructure is called.
-
Record Scanning
-
A record can be scanned. Two types are supported: periodic and event. - The way event scanning is implemented provides both the I/O Intr scanning - and event scanning implemented by a EPICS IOC.
-
Extensible Support
-
Each field can optionally have support attached. Support is written to - process particular types of fields. At initilization support uses - interspection to look at the fields to which it is attached. If the - fields are not what it expects it reports a problem and terminates.
-
- -

For pvAccess, the pvIOC provides the following:

-
-
Local channel implementation
-
The way the remote pvAccess server code works is to find one or more - local implementations of the Channel interface. It calls this to - implement the various operations it supports.
-
Access to data
-
Support is a available that allows a client to access an arbitrary set - of fields in a record. From this it creates a top level structure that - holds the copy of the fields. It also provides the support to copy date - between the copy and the record. It also provides support for monitor - queues and algortihms.
-
Access to EPICS V3 records
-
This is a local Channel implementation that privides support for - attaching to V3 records. It makes the V3 fields look like a pvData - structure.
-
Access to pvIOC records
-
This is a local Channel implementation that privides support for - attaching to pvIOC records.
-
-
- -

Introduction

-
- -

PVData is one of a set of related projects: pvData, pvAccess, and javaIOC. -It describes and implements the data that the other projects use. Thus it is -not useful by itself but understanding pvData is required in order to -understand the other projects. The reader should also become familar with -pvAccess and javaIOC, which are located via the same sourceforge site as this -project. Project PVAccess provides network support for transporting pvData. -Project javaIOC provides a memory resident "smart" database of pvData data.

- -

This document describes the C++ implementation of pvData, which was first -implemented in Java. A C++ implementation of pvAccess is being developed in -parallel with pvDataCPP. In the future a C++ implementation of javaIOC will be -developed and the name javaIOC will become pvIOC.

- -

pvData (Process Variable Data) defines and implements an efficent way to -store, access, and transmit memory resident structured data.

-
-
description
-
The header files pvIntrospect.h and pvData.h provide the C++ - description of pvData.
-
implementation
-
Directory factory provides a complete C++ definition for pvData. It - also provides abstract and base classes that support specialized - implementations of the data classes.
-
efficient
-
Small memory footprint, low cpu overhead, and concise code base.
-
data storage
-
pvData provides introspection and data interfaces. The introspection - interfaces provide access to immutable objects, which allows - introspection instances to be freely shared. The introspection interface - for a process variable can be accessed without requiring access to the - data.
-
data access
-
Client code can access pvData via the introspection and data - interfaces. For "well known" data, e.g. timeStamp, specialized interfaces - can be implemented without requiring any changes to the core - software.
-
data transfer
-
The separation of introspection and data interfaces allows for - efficient network data transfer. At connection time introspection - information is passed from server to client. Each side creates a data - instance. The data is transferred between these instances. The data in - the network packets does not have to be self describing since each side - has the introspection information.
-
memory resident
-
pvData only defines memory resident data.
-
structured data
-
pvData has four types: scalar, scalar array, structure, and structure - array. A scalar can be one of the following: boolean, byte, short, int, - long, float, double, string. A scalar array is a one dimensional array - with the element type being one of the scalar types. A structure is an - ordered set of fields where each field has a name and type. A structure - array is a one dimensional array of structures where each element has the - same introspection interface. Since a field can have type structure - complex structures are supported. No other types are needed since - structures can be defined that simulate types.
-
- -

The javaIOC implements a Process Variable (PV) Database, which is a memory -resident database holding pvData with the following features:

-
    -
  • A database has records.
  • -
  • Each record has a unique record name.
  • -
  • A record has a top level pvData structure.
  • -
- -

pvData was initially created to support the javaIOC and was part of the -javaIOC project. It is now a separate project that is used by the javaIOC. In -addition to the javaIOC, pvData is intended for use by 1) channel access -clients, 2) Interface between client and network, 3) Interface between network -and channel access server, 4) Interface between server and IOC database. Since -it is an interface to data, it could also be used by other systems, e.g. TANGO, -TINE, etc. A high level Physics application can hold data as pvData. By -starting a channel access server, the data can made available to network -clients.

- -

pvData contains everything required to support Channel Access and Channel -Access clients and servers.

- -

This project has many concepts that are similar to EPICS (Experimental -Physics and Industrial Control System). This C++ implementation uses the EPICS -build system and also EPICS libCom. The directory structure for this project is -a standard EPICS application. The following source directories appear under -pvDataApp:

-
-
misc
-
Support for pvData. This support is described in a major section - below.
-
pv
-
The C++ introspection and data descriptions for pvData.
-
factory
-
The C++ definitions for pvData.
-
property
-
Support code for "standard" pvData structures, e.g. timeStamp and - alarm.
-
-
- -

PVData Meta Language

-
- -

This section describes a meta language for describing pvData. Currently -there are no plans for a parser for the meta language. It is used for -documentation. The toString introspection and data methods described below do -present data in a format similar to the metadata syntax. The meta language is -used to describe both introspection interfaces and data interfaces.

- -

Definition

- -

PVData supports structured data. All data appears as a top level structure. -A structure has an ordered set of fields where each field has a fieldDef defined as follows:

-
type fieldName value // comment
- -

where value is present for data -objects and // indicates the the -rest of the line is a comment.

- -

type is one of the following:

-
-
scalar
-
A scalar field can be any of the following: -
-
boolean
-
Has the valuetrue or - false
-
byte
-
An 8 bit signed integer.
-
short
-
An 16 bit signed integer.
-
int
-
An 32 bit signed integer.
-
long
-
An 64 bit signed integer.
-
float
-
A IEEE float.
-
double
-
A IEEE double.
-
string
-
An immutable string.
-
-
-
scalarArray
-
A scalarArray field is an array of any of the scalar types. -
-
boolean[]
-
byte[]
-
short[]
-
int[]
-
long[]
-
float[]
-
double[]
-
string[]
-
-
-
structure
-
A structure field has the definition: -
     structure fieldName
-         fieldDef
-         ...
-      
- or -
     xxx_t fieldName
-         // if data object then following appear
-         fieldDef
-         ...
-      
- For structure fieldName each - fieldDef must have a unique - fieldName within the structure For "xxx_t fieldName" xxx_t must be a - previously structure definition of the form: -
    structure xxx_t
-        ...
-
-
structureArray
-
A structureArray field has the definition: -
     structure[] fieldName
-          structureDef
-          ...
-          
-

or

-
    xxx_t[] fieldName
-
      
-

Thus a structure array is an array where each element is a structure - but all elements have the same introspection interface. For introspection - the structureDef appears once without any data valuies.

-
-
- -

The above is used to describe introspection objects. Data objects are -describe in a similar way but each scalar field and each array field has data -values. The definition of the data values depends on the type. For scalars the -data value is whatever is valid for the type.

-
-
boolean
-
The value must be true or - false
-
byte,...long
-
Any valid integer or hex value, e.g. 3 0xff are valid values
-
float,double
-
Any valid integer or real e.g. 3 - 3.0 3e0 are valid values
-
string
-
The value can be an alphanumeric value or any set of characters - enclosed in "" Within quotes a - quote is expressed as \" - Examples are aValue "a value" "a\" - xxx" are valid values.
-
- -

For scalar arrays the syntax is:

-
      = [value,...,value]
- -

where each value is a valid -scalar data value depending on the type. Thus it is a comma separated set of -values enclosed in [] White space is -permitted surrounding each comma.

- -

Examples

- -

Define the following top level structure:

-
structure timeStamp_t
-    long secondsPastEpoch
-    int nanoSeconds 
- -

Then the following introspection objects can be defined:

-
structure scalarDoubleExample // introspection object
-    double value
-    timeStamp_t timeStamp
-or -
structure scalarDoubleExample // introspection object
-    double value
-    structure timeStamp
-        long secondsPastEpoch
-        int  nanoSeconds
- -

The following data objects can be defined:

-
structure scalarDoubleExample // data object
-    double value 1.0
-    timeStamp_t timeStamp
-         long secondsPastEpoch 0
-         int  nanoSeconds 0
-or -
scalar arrayDoubleExample
-    double[] value  [1.0,2.0]
-    structure timeStamp
-         long secondsPastEpoch 0
-         int  nanoSeconds 0
- -

If the following interface is defined:

-
structure point_t
-    double x
-    double y
- -

Then the following introspection objects can be defined:

-
structure lineExample
-    point_t begin
-    point_t end
-
-structure pointArrayExample
-    point_t[] points
-    
-or -
structure lineExample
-    structure begin
-        double x
-        double y
-    structure end
-        double x
-        double y
-
-structure pointArrayExample
-    structure[] points
-        structure point
-            double x
-            double y
- -

And the following data objects can be defined:

-
structure lineExample
-    point_t begin
-        double x 0.0
-        double y 0.0
-    point_t end
-        double x 10
-        double y 10
-
-structure pointArrayExample
-    point_t[] value
-        structure point
-            double x 0.0
-            double y 0.0
-        structure point
-            double x 10.0
-            double y 10.0
- -

or

-
structure lineExample
-    structure begin
-        double x 0
-        double y 0
-    structure end
-        double x 10
-        double y 10
-
-structure pointArrayExample
-    structure[] value
-        structure point
-            double x 0.0
-            double y 0.0
-        structure point
-            double x 10.0
-            double y 10.0
-
- -

PV - User Description

-
- -

Overview

+

Overview

Directory pvDataApp/pv has header files that completely describe pvData. The implementation is provided in directory pvDataApp/factory. Test programs -appears on testApp/pvTest.

+appears in testApp/pv.

+ +

NOTES:

+
+
interface
+
The documention uses the word interface. This is an analogy for + what the Java implementation implements, i. e. package pv provides Java + interfaces. C++ does not have interfaces but directory pv defines classes + with public members that are similar to the Java interfaces. Most of the + implementation is in factory.
+
Naming Convertions
+
The naming convertions for variables, methods, and classes follow the + Java convertions, i. e. class name begin with an upper case letter, + variables and methods begin with a lower case letter.
+

A PVStructure is a field that contains an array of subfields. Each field has -code for accessing the field. The interface for each field is PVField or an -interface that extends PVField. Each field also has an introspection interface, -which is Field or an extension of Field. This section describes the complete -set of data and introspection interfaces for pvData.

+code for accessing the field. The interface for each field is an interface that +extends PVField. Each field also has an introspection interface, which an +extension of Field. This section describes the complete set of C++ +introspection and data interfaces for pvData.

-

A class FieldCreate creates introspection objects. A class PVDataCreate -creates data objects. A class Convert provides a rich set of methods for -converting and copying data between fields.

+

Class FieldCreate creates introspection objects. Class PVDataCreate creates +data objects. Class Convert provides a rich set of methods for converting and +copying data between fields.

Directory pvDataApp/pv has the following header files:

-
pvType.h
-
C++ definitions for the pvData primitive types.
-
pvIntrospect.h
+
pvType.h
+
C++ definitions for primitive types.
+
pvIntrospect.h
A complete description of the introspection interfaces.
-
pvData.h
+
pvData.h
A complete description of the data interfaces.
-
convert.h
+
convert.h
A facility that converts between data fields.
-
standardField.h
+
standardField.h
Provides access to introspection interfaces for standard structures like timeStamp, alarm, etc.
-
standardPVField.h
+
standardPVField.h
Cteates data interfaces for standard data structures like timeStamp, alarm, etc.
-

pvType

+

pvType.h

This provides C/C++ definitions for the pvData primitive types: boolean, -byte, short, int, long, float, double, and string. Because pvData is network -data, the C++ implementation must implement the proper semantics for the -primitive types.

+byte, short, int, long, ubyte,ushort, uint,u long,float, double, and string. +Because pvData is network data, the C++ implementation must implement the +proper semantics for the primitive types.

-

pvType.h provides the proper semantics. It has the definitions:

-
typedef bool     boolean;
-typedef int8_t   byte;
+

pvType.h provides the proper semantics.

+ +

It has the definitions:

+
typedef uint8_t  boolean;
 typedef int8_t   int8;
 typedef int16_t  int16;
 typedef int32_t  int32;
 typedef int64_t  int64;
+typedef uint8_t   uint8;
+typedef uint16_t  uint16;
 typedef uint32_t uint32;
 typedef uint64_t uint64;
 // float and double are types
 typedef std::string String;
 
-typedef bool * BooleanArray;
-typedef int8 * ByteArray;
-typedef int16 * ShortArray;
-typedef int32 * IntArray;
-typedef int64 * LongArray;
-typedef float * FloatArray;
-typedef double * DoubleArray;
-typedef String* StringArray;
+/**
+ * A boolean array.
+ */
+typedef std::vector<uint8> BooleanArray;
+typedef std::tr1::shared_ptr<BooleanArray> BooleanArrayPtr;
+/* get is same is ubyte*/
+typedef std::vector<uint8>::iterator BooleanArray_iterator;
+typedef std::vector<uint8>::const_iterator BooleanArray_const_iterator;
 
-// convenience definition for toString methods
-typedef std::string * StringBuilder;
+/** + * A byte array. + */ +typedef std::vector<int8> ByteArray; +typedef std::tr1::shared_ptr<ByteArray> ByteArrayPtr; +inline int8 * get(ByteArray &value); +inline int8 const * get(ByteArray const &value); +inline int8 * get(ByteArrayPtr &value); +inline int8 const * get(ByteArrayPtr const &value); +inline ByteArray & getVector(ByteArrayPtr &value); +inline ByteArray const & getVector(ByteArrayPtr const &value); +typedef std::vector<int8>::iterator ByteArray_iterator; +typedef std::vector<int8>::const_iterator ByteArray_const_iterator; + +/* similar definitions are present for ALL the primitive types */ +

where

-
boolean
+
boolean
A c++ bool has the semantics required for boolean. Only the name is different. C++ code can use either bool or boolean.
-
int8,...,int64
+
int8,...,uint64
Integers present a problem because short, int, and long are C++ reserved words but do not have a well defined number of bits. Thus for - C++ the definitions above are used in C++ code. Note that byte and int8 - are both defined just for consistency. The unsigned 32 and 64 bit integer - definitions are provided because the serialization/deserialization code - uses them. Thus they must be compatable over the network.
-
String
+ C++ the definitions above are used in C++ code. The above definitions + have worked on all C++ implementations tested at present. If they break + in a future implementation they should be changes via "#ifdef" + preprocessor statements. +
String
pvData requires that a string be an immutable string that is transfered over the network as a UTF8 encoded string. Since std::string implements copy on write semantics, it can be used for support for immutable strings. It can also be serialized/deserialized as a UTF8 encoded string. Because it is not a C++ primitive the first letter is capitalized. This is the same convention the Java implementation uses.
-
StringBuilder
+
StringBuilder
This is defined here because to is used by the toString methods defined for both introsection and data objects. The definition above acts like the Java StringBuilder class.
Array definitions
-
A typedef is provided for an array of each of the primitive types.
+
typedefs are provided for an array of each of the primitive types. Note + that string is treated like a primitive type/
-

Process Variable Reflection

+

pvIntrospect.h

-

This subsection describes pvIntrospect.h

+

This subsection describes pvIntrospect.h This file is quite big so rather +than showing the entire file, it will be described in parts.

-

Given a pvname, which consists of a record name and field name, it is -possible to introspect the field without requiring access to data. The -reflection and data interfaces are separate because the data may not be -available. For example when a pvAccess client connects to a PV, the client -library can obtain the reflection information without obtaining any data. Only -when a client issues an I/O request will data be available. This separation is -especially important for arrays and structures so that a client can discover -the type without requiring that a large data array or structure be transported -over the network.

+

A primary reason for pvData is to support network access to structured data. +pvAccess transports top level pvStructures. In addition a pvAccess server holds +a set of pvnames, where each pvname if a unique name in the local network.

-

Type Description

+

Given a pvname PV), it is possible to introspect the field without requiring +access to data. The reflection and data interfaces are separate because the +data may not be available. For example when a pvAccess client connects to a PV, +the client library can obtain the reflection information without obtaining any +data. Only when a client issues an I/O request will data be available. This +separation is especially important for arrays and structures so that a client +can discover the type without requiring that a large data array or structure be +transported over the network.

+ +

Type Description

Types are defined as:

enum Type {
@@ -889,592 +347,589 @@ public:
     static void toString(StringBuilder buf,const Type type);
 };
 
-
 enum ScalarType {
     pvBoolean,
     pvByte, pvShort, pvInt, pvLong,
+    pvUByte, pvUShort, pvUInt, pvULong,
     pvFloat,pvDouble,
     pvString;
 };
 
-class ScalarTypeFunc {
+namespace ScalarTypeFunc {
 public:
-    static bool isInteger(ScalarType type);
-    static bool isNumeric(ScalarType type);
-    static bool isPrimitive(ScalarType type);
-    static ScalarType getScalarType(String value);
+    bool isInteger(ScalarType type);
+    bool isUInteger(ScalarType type);
+    bool isNumeric(ScalarType type);
+    bool isPrimitive(ScalarType type);
+    ScalarType getScalarType(String value);
     const char* name(ScalarType);
-    static void toString(StringBuilder buf,ScalarType scalarType);
+    void toString(StringBuilder buf,ScalarType scalarType);
 };
-

Type is one of the following:

+

Type is one of the following:

-
scalar
+
scalar
A scalar of one of the scalar types.
-
scalarArray
+
scalarArray
An array where every element has the same scalar type.
-
structure
+
structure
A structure where each field has a name and a type. Within a structure each field name must be unique but the types can be different.
-
structureArray
+
structureArray
An array where each element is a structure. Each element has the same structure introspection interface.
-

ScalarType is one of the -following:

+

ScalarType is one of the following:

-
pvBoolean
+
pvBoolean
Has the value false or true.
-
pvByte
+
pvByte
A signed 8 bit integer.
-
pvShort
+
pvShort
A signed 16 bit integer.
-
pvInt
+
pvInt
A signed 32 bit integer.
-
pvLong
+
pvLong
A signed 64 bit integer.
-
pvFloat
+
pvUByte
+
An unsigned 8 bit integer.
+
pvUShort
+
An unsigned 16 bit integer.
+
pvUInt
+
An unsigned 32 bit integer.
+
pvULong
+
An unsigned 64 bit integer.
+
pvFloat
A IEEE float.
-
pvDouble
+
pvDouble
A IEEE double,
-
pvString
+
pvString
An immutable string.
-

TypeFunction is a set of -convenience methods for Type

+

TypeFunction is a set of convenience methods for Type

-
name
+
name
Returns the name of the type.
-
toString
+
toString
Convert the type to a string.
-

ScalarTypeFunction is a set of -convenience methods for ScalarType

+

ScalarTypeFunction is a set of convenience methods for ScalarType

-
isInteger
-
Is the scalarType an integer type, i.e. one of pvByte,...pvlong.
-
isNumeric
+
isInteger
+
Is the scalarType an integer type, i.e. one of pvByte,...pvULong.
+
isUInteger
+
Is the scalarType an unsigned integer type, i.e. one of + pvUByte,...pvULong
+
isNumeric
Is the scalarType numeric, i.e. pvByte,...,pvDouble.
-
isPrimitive
-
Is the scvalarType primitive, i.e. not pvString
-
name
+
isPrimitive
+
Is the scalarType primitive, i.e. not pvString
+
name
Returns the name of the scalarType.
-
getScalarType
+
getScalarType
Given a string of the form String("boolean"),...,String("string") return the scalarType.
-
toString
+
toString
Convert the scalar type to a string.
-

Reflection Description

+

Introspection Description

This section describes the reflection interfaces which provide the following:

-
Field
+
Field
A field: -
-
Has a name.
-
Has a Type.
-
Can be converted to a string.
- Can be shared. A reference count is kept. When it becomes 0 the - instance is automatically deleted.
-
+
    +
  • Has a Type.
  • +
  • Can be converted to a string.
  • +
  • Can be shared. A reference count is kept. When it becomes 0 the + instance is automatically deleted.
  • +
-
Scalar
+
Scalar
A scalar has a scalarType
-
ScalarArray
+
ScalarArray
The element type is a scalarType
-
StructureArray
+
StructureArray
The field holds an array of structures. Each element has the same Structure interspection interface. A pvAccess client can only get/put entire PVStructure elements NOT subfields of array elements.
-
Structure
+
Structure
Has fields that can be any of the supported types.
-
FieldCreate
+
FieldCreate
This is an interface that provides methods to create introspection interfaces. A factory is provides to create FieldCreate.
-
getFieldCreate
+
getFieldCreate
Gets a pointer to the single instance of FieldCreate.
-
    
-class Field;
+
class Field;
 class Scalar;
 class ScalarArray;
 class Structure;
 class StructureArray;
 
 typedef std::tr1::shared_ptr<const Field> FieldConstPtr;
-typedef FieldConstPtr * FieldConstPtrArray;
+typedef std::vector<FieldConstPtr> FieldConstPtrArray;
 typedef std::tr1::shared_ptr<const Scalar> ScalarConstPtr;
 typedef std::tr1::shared_ptr<const ScalarArray> ScalarArrayConstPtr;
 typedef std::tr1::shared_ptr<const Structure> StructureConstPtr;
 typedef std::tr1::shared_ptr<const StructureArray> StructureArrayConstPtr;
 
 
-protected:class Field :  public std::tr1::enable_shared_from_this<Field> {
+class Field :
+    virtual public Serializable,
+    public std::tr1::enable_shared_from_this<Field>
+{
 public:
-    typedef std::tr1::shared_ptr<Field> shared_pointer;
-    typedef std::tr1::shared_ptr<const Field> const_shared_pointer;
-
-    String getFieldName() const{return m_fieldName;}
+    POINTER_DEFINITIONS(Field);
+    virtual ~Field();
     Type getType() const{return m_type;}
+    virtual String getID() const = 0;
     virtual void toString(StringBuilder buf) const{toString(buf,0);}
     virtual void toString(StringBuilder buf,int indentLevel) const;
-    void renameField(String  newName);
-    Field(String fieldName,Type type);
-    virtual ~Field();
+ ...
 };
 
 class Scalar : public Field{
 public:
-   typedef std::tr1::shared_ptr<Scalar> shared_pointer;
-   typedef std::tr1::shared_ptr<const Scalar> const_shared_pointer;
-   typedef Scalar& reference;
-   typedef const Scalar& const_reference;
+    POINTER_DEFINITIONS(Scalar);
+    virtual ~Scalar();
+    typedef Scalar& reference;
+    typedef const Scalar& const_reference;
 
-   ScalarType getScalarType() const {return scalarType;}
-   virtual void toString(StringBuilder buf) const{toString(buf,0);}
-   virtual void toString(StringBuilder buf,int indentLevel) const;
-protected:
-   Scalar(String fieldName,ScalarType scalarType);
-   virtual ~Scalar();
+    ScalarType getScalarType() const {return scalarType;}
+    virtual void toString(StringBuilder buf) const{toString(buf,0);}
+    virtual void toString(StringBuilder buf,int indentLevel) const;
+    virtual void toString(StringBuilder buf,int indentLevel) const;
+    virtual String getID() const;
+    virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const;
+    virtual void deserialize(ByteBuffer *buffer, DeserializableContol *control);
  ...
 };
 
 class ScalarArray : public Field{
 public:
-   typedef std::tr1::shared_ptr<ScalarArray> shared_pointer;
-   typedef std::tr1::shared_ptr<const ScalarArray> const_shared_pointer;
-   typedef ScalarArray& reference;
-   typedef const ScalarArray& const_reference;
+    POINTER_DEFINITIONS(ScalarArray);
+    typedef ScalarArray& reference;
+    typedef const ScalarArray& const_reference;
 
-   ScalarType  getElementType() const {return elementType;}
-   virtual void toString(StringBuilder buf) const{toString(buf,0);}
-   virtual void toString(StringBuilder buf,int indentLevel) const;
-protected:
-   ScalarArray(String fieldName,ScalarType scalarType);
-   virtual ~ScalarArray();
+    ScalarType  getElementType() const {return elementType;}
+    virtual void toString(StringBuilder buf) const{toString(buf,0);}
+    virtual void toString(StringBuilder buf,int indentLevel) const;
+    virtual String getID() const;
+    virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const;
+    virtual void deserialize(ByteBuffer *buffer, DeserializableControl *control);
  ...
 };
 
 class StructureArray : public Field{
 public:
-  typedef std::tr1::shared_ptr<StructureArray> shared_pointer;
-   typedef std::tr1::shared_ptr<const StructureArray> const_shared_pointer;
-   typedef StructureArray& reference;
-   typedef const StructureArray& const_reference;
+    POINTER_DEFINITIONS(StructureArray);
+    typedef StructureArray& reference;
+    typedef const StructureArray& const_reference;
 
-   const Structure& structure() const {return *pstructure;}
-   StructureConstPtr  getStructure() const {return pstructure;}
-   virtual void toString(StringBuilder buf,int indentLevel=0) const;
+    StructureConstPtr  getStructure() const {return pstructure;}
+    virtual void toString(StringBuilder buf,int indentLevel=0) const;
+    virtual String getID() const;
+    virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const;
+    virtual void deserialize(ByteBuffer *buffer, DeserializableControl *control);
+ ...
 };
 
 class Structure : public Field {
 public:
-   typedef std::tr1::shared_ptr<Structure> shared_pointer;
-   typedef std::tr1::shared_ptr<const Structure> const_shared_pointer;
-   typedef Structure& reference;
-   typedef const Structure& const_reference;
+    POINTER_DEFINITIONS(Structure);
+    typedef Structure& reference;
+    typedef const Structure& const_reference;
 
-   int getNumberFields() const {return numberFields;}
-   FieldConstPtr getField(String fieldName) const;
-   int getFieldIndex(String fieldName) const;
-   FieldConstPtrArray getFields() const {return fields;}
-   void appendField(FieldConstPtr field);
-   void appendFields(int numberFields,FieldConstPtrArray fields);
-   void removeField(int index);
-   virtual void toString(StringBuilder buf) const{toString(buf,0);}
+   std::size_t getNumberFields() const {return numberFields;}
+   FieldConstPtr getField(String const & fieldName) const;
+   FieldConstPtr getField(std::size_t index) const;
+   std::size_t getFieldIndex(String const &fieldName) const;
+   FieldConstPtrArray const & getFields() const {return fields;}
+   StringArray const & getFieldNames() const;
+   void renameField(std::size_t fieldIndex,String newName);
+   String getFieldName(std::size_t fieldIndex);
    virtual void toString(StringBuilder buf,int indentLevel) const;
-protected:
-   Structure(String fieldName, int numberFields,FieldConstPtrArray fields);
-   virtual ~Structure();
+   virtual String getID() const;
+   virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const;
+   virtual void deserialize(ByteBuffer *buffer, DeserializableControl *control);
  ...
 };
 
-class FieldCreate : NoDefaultMethods {
+class FieldCreate  {
 public:
-   FieldConstPtr  create(String fieldName,FieldConstPtr  field) const;
-   ScalarConstPtr  createScalar(String fieldName,ScalarType scalarType) const;
-   ScalarArrayConstPtr createScalarArray(String fieldName,
-       ScalarType elementType) const;
-   StructureConstPtr createStructure (String fieldName,
-       int numberFields,FieldConstPtrArray fields) const;
-   StructureArrayConstPtr createStructureArray(String fieldName,
-       StructureConstPtr structure) const;
+    static FieldCreatePtr getFieldCreate();
+    ScalarConstPtr  createScalar(ScalarType scalarType) const
+    ScalarArrayConstPtr createScalarArray(ScalarType elementType) const;
+    StructureArrayConstPtr createStructureArray(StructureConstPtr const & structure) const;
+    StructureConstPtr createStructure (
+        StringArray const & fieldNames,
+        FieldConstPtrArray const & fields) const;
+    StructureConstPtr createStructure (
+        String id,
+        StringArray const & fieldNames,
+        FieldConstPtrArray const & fields) const;
+    StructureConstPtr appendField(
+        StructureConstPtr const & structure,
+        String fieldName, FieldConstPtr const & field) const;
+    StructureConstPtr appendFields(
+        StructureConstPtr const & structure,
+        StringArray const & fieldNames,
+        FieldConstPtrArray const & fields) const;
+    FieldConstPtr deserialize(ByteBuffer* buffer, DeserializableControl* control) const;
+ ...
 };
 
-extern FieldCreate * getFieldCreate();
- -

The following methods are common to all of the reflection class -descriptions:

+extern FieldCreatePtr getFieldCreate();
-
Constructor and Destructor
-
Note that all constructors and destructors are protected or private. - The only way to create instances is via FieldCreate. The implementation - manages all storage and automatically calls delete when no client is - attached. A few details are discussed in a later section.
-
toString
+
Constructor
+
Note that all constructors are protected or private. The only way to + create instances is via FieldCreate. The implementation manages all + storage via shared pointers.
+
toString
Many classes provide this (actually two methods). This method is called to get a string that uses the metadata syntax described in a previous section.
-

Field has the methods:

+
Field
-
getReferenceCount
-
Get the total number of current references to this field instance.
-
getFieldName
-
Get the name of the field.
-
getType
+
getType
Get the field type.
-
renameField
-
Rename the field name.
-
incReferenceCount
-
Increment the reference count. This must be called by any code that - wants to "clone" an instance of the introspection interface and use it as - the introspection interface for a data field. The library that creates - data instances usually calls this so user code almost never calls this. - If the field is a structure then this is recursively called for each sub - field of the structure.
-
decReferenceCount
-
This must be called to match each incReferenceCount. It is called when - the "cloned" version is no longer needed. This is almost always called by - a PVField instance when it is being deleted for a field that has no - parents. If the field is a structure then this is recursively called for - each sub field of the structure. OTHER code should not call this.
-
dumpReferenceCount
-
Adds a report of the the current reference count for this field. If the - field is a structure then dumpReferenceCount is called for each sub - field.
-
operator==
-
Returns (false,true) if the two objects (do not,do) have the same - values. Thus means the same types and names.
-
operator!=
-
Returns (false,true) if the two objects (do,do not) have the same - values.
+
getID
+
Get an ID for this introspection interface
-

Scalar has the methods:

+
Scalar
-
getScalarType
+
getScalarType
Get that scalar type.
+
getID
+
For each scalarType there is one instance of Scalar. The ID for each is + the metadata name for the type, i. e. one of "boolean" , ... , "string". +
-

ScalarArray has the methods:

+
ScalarArray
-
getElementType
+
getElementType
Get the element type.
+
getID
+
For each elemnetType there is one instance of ScalarArray. The ID for + each is the metadata name for the type, i. e. one of "boolean[]" , ... , + "string[]".
-

StructureArray has the -methods:

+
StructureArray
-
getStructure
+
getStructure
Get the introspection interface that each element shares,
+
getID
+
This returns the ID[] where ID is the value returned by + structure->getID().
-

Structure has the methods:

+
Structure
-
getNumberFields
+
getNumberFields
Get the number of immediate subfields.
-
getField
-
Given a name get the introspection interface for the field.
-
getFieldIndex
+
getField
+
Given a name or an index get the introspection interface for the + field.
+
getFieldIndex
Given a name get the index, within the array returned by the next method, of the field.
-
getFields
+
getFields
Get the array of introspection interfaces for the field,
-
appendField
-
Append a field to the Structure.
-
appendFields
-
Append the fields to the Structure. The caller is responsible for the - storage for the array for the fields. It is OK if the array is allocate - on the stack.
-
removeField
-
Remove the field at the specified index. An exception is thrown if the - index is out of bounds.
+
getFieldNames
+
Get the array of field names for the subfields.
+
renameField
+
Rename the field.
+
getFieldName
+
Get the field name for the specified index.
-

FieldCreate has the methods:

+
FieldCreate
-
create
-
Given a field name and an existing introspection interface create a new - introspection object. The existing introspection interface can be any of - the allowed types. If the argument field is shared, i.e. has been - obtained from an existing oject, then field->incReferenceCount() must - be called before this method.
-
createScalar
+
getFieldCreate
+
Get the single instance of FieldCreate.
+
createScalar
Create a scalar introspection instance.
-
createScalarArray
+
createScalarArray
Create a scalar array introspection instance.
-
createStructure
-
Create a structure introspection instance. The FieldConstPtrArray - fields MUST be allocated on the heap NOT on the stack. It will - automatically be deleted when the structure instance is deleted. For any - element of fields that is shared, i.e. has been obtained from an existing - onject, then fields[index]->incReferenceCount() must be called before - this method.
-
createStructureArray
-
Create a structure array introspection instance. If the argument - structure is shared, i.e. has been obtained from an existing object, then - structure->incReferenceCount() must be called before this method.
+
createStructure
+
Create a structure introspection instance. Two methods are provided + where the only difference is that one provides an ID and the other does + not. The one without will result in ID "structure".
+
createStructureArray
+
Create a structure array introspection instance.
+
appendField
+
Append a field to a structure.
+
appendFields
+
Append fields to a structure.
+
deserialize
+
Deserialize from given byte buffer.
-

Standard Fields

+

standardField.h

The file standardField.h has a class description for creating or sharing -Field objects for standard fields. For each type of standard object two methods -are defined: one with no properties and with properties. The property field is -a comma separated string of property names of the following: alarm, timeStamp, -display, control, and valueAlarm. An example is "alarm,timeStamp,valueAlarm". -The method with properties creates a structure with fields named fieldName and -each of the property names. Each property field is a structure defining the -property. The details about each property is given in the section named -"Property". For example the call:

+Field objects for standard fields. For each type of field a method is provided. +Each creates a structure that has a field named "value" and a set of properyt +fields, The property field is a comma separated string of property names of the +following: alarm, timeStamp, display, control, and valueAlarm. An example is +"alarm,timeStamp,valueAlarm". The method with properties creates a structure +with fields named value and each of the property names. Each property field is +a structure defining the property. The details about each property is given in +the section named "Property". For example the call:

    StructureConstPtr example = standardField->scalar(
-        String("value"),
         pvDouble,
-        String("value,alarm,timeStamp"));
+ "value,alarm,timeStamp");

Will result in a Field definition that has the form:

structure example
     double value
-    structure alarm
-        structure severity
-            int index
-            string[] choices
-       structure timeStamp
-            long secondsPastEpoch
-            int  nanoSeconds
+ alarm_t alarm + int severity + int status + string message + timeStamp_t timeStamp + long secondsPastEpoch + int nanoSeconds + int userTag

In addition there are methods that create each of the property structures, i.e. the methods named: alarm, .... enumeratedAlarm."

standardField.h contains:

-
class StandardField : private NoDefaultMethods {
+
class StandardField;
+typedef std::tr1::shared_ptr<StandardField> StandardFieldPtr;
+
+class StandardField {
 public:
-    StandardField();
+    static StandardFieldPtr getStandardField();
     ~StandardField();
-    ScalarConstPtr scalar(String fieldName,ScalarType type);
-    StructureConstPtr scalar(String fieldName,
-        ScalarType type,String properties);
-    ScalarArrayConstPtr scalarArray(String fieldName,
-        ScalarType elementType);
-    StructureConstPtr scalarArray(String fieldName,
+    StructureConstPtr scalar(ScalarType type,String properties);
+    StructureConstPtr scalarArray(
         ScalarType elementType, String properties);
-    StructureArrayConstPtr structureArray(String fieldName,
-        StructureConstPtr structure);
-    StructureConstPtr structureArray(String fieldName,
-        StructureConstPtr structure,String properties);
-    StructureConstPtr structure(String fieldName,
-        int numFields,FieldConstPtrArray fields);
-    StructureConstPtr enumerated(String fieldName);
-    StructureConstPtr enumerated(String fieldName, String properties);
-    ScalarConstPtr scalarValue(ScalarType type);
-    StructureConstPtr scalarValue(ScalarType type,String properties);
-    ScalarArrayConstPtr scalarArrayValue(ScalarType elementType);
-    StructureConstPtr scalarArrayValue(ScalarType elementType,
-        String properties);
-    StructureArrayConstPtr structureArrayValue(StructureConstPtr structure);
-    StructureConstPtr structureArrayValue(StructureConstPtr structure,
-        String properties);
-    StructureConstPtr structureValue(
-        int numFields,FieldConstPtrArray fields);
-    StructureConstPtr enumeratedValue(StringArray choices);
-    StructureConstPtr enumeratedValue(StringArray choices,
-         String properties);
+    StructureConstPtr structureArray(
+        StructureConstPtr const & structure,String properties);
+    StructureConstPtr enumerated();
+    StructureConstPtr enumerated(String properties);
     StructureConstPtr alarm();
     StructureConstPtr timeStamp();
     StructureConstPtr display();
     StructureConstPtr control();
     StructureConstPtr booleanAlarm();
     StructureConstPtr byteAlarm();
+    StructureConstPtr ubyteAlarm();
     StructureConstPtr shortAlarm();
+    StructureConstPtr ushortAlarm();
     StructureConstPtr intAlarm();
+    StructureConstPtr uintAlarm();
     StructureConstPtr longAlarm();
+    StructureConstPtr ulongAlarm();
     StructureConstPtr floatAlarm();
     StructureConstPtr doubleAlarm();
     StructureConstPtr enumeratedAlarm();
-private:
-    static void init();
-};
-
-extern StandardField * getStandardField();
- -

Where

+ ... +};
-
scalar
-
Create a scalar with the specified scalar type and name. If properties - are specified then a structure will be created with the first element - being a scalar with the specified scalar type and name value. The other - fields in the structure will be the corresponding property - structures.
-
scalarArray
-
Create a scalarArray with each element having the specified scalar type - and name. If properties are specified then a structure will be created - with the first element being a scalarArray with name value. The other - fields in the structure will be the corresponding property - structures.
-
structureArray
-
Create a structureArray with the specified structure interface and - name. If properties are specified then a structure will be created with - the first element being a structureArray with the specified structure - interface and name value. The other fields in the structure will be the +
scalar
+
Create a scalar with the specified scalar type and name. A structure + will be created with the first element being a scalar with the specified + scalar type and name value. The other fields in the structure will be the corresponding property structures.
-
structure
+
scalarArray
+
Create a scalarArray with each element having the specified scalar type + and name. A structure will be created with the first element being a + scalarArray with name value. The other fields in the structure will be + the corresponding property structures.
+
structureArray
+
Create a structureArray with the specified structure interface and + name. A structure will be created with the first element being a + structureArray with the specified structure interface and name value. The + other fields in the structure will be the corresponding property + structures.
+
structure
Create a structure with the specified name and fields specified by - numFields and fields. If properties are specified then a structure will - be created with the first element being a structure with the name value - and fields specified by numFields and fields. The other fields in the - structure will be the corresponding property structures.
-
enumerated
+ numFields and fields. A structure will be created with the first element + being a structure with the name value and fields specified by numFields + and fields. The other fields in the structure will be the corresponding + property structures. +
enumerated
Create a structure with the specified name and fields for an enumerated structure. If properties are specified then a structure will be created with the first element being a structure with the name value and fields for an enumerated structure. The other fields in the structure will be the corresponding property structures.
-
scalarValue
-
scalarArrayValue
-
structureArrayValue
-
structureValue
-
enumeratedValue
-
These are all like the version without the "Value" suffix. The field - name will always be "value"
-
alarm
-
timeStamp
-
display
-
control
-
booleanAlarm
-
byteAlarm
-
shortAlarm
-
intAlarm
-
longAlarm
-
floatAlarm
-
doubleAlarm
-
enumeratedAlarm
+
alarm
+
timeStamp
+
display
+
control
+
booleanAlarm
+
byteAlarm
+
shortAlarm
+
intAlarm
+
longAlarm
+
floatAlarm
+
doubleAlarm
+
enumeratedAlarm
The above provide introspection interfaces for standard properties. See the section on Properties for a description of how these are defined.
-

PVField - Data Interfaces

+

pvData.h

-

This section defines the Java Interfaces for accessing the data within a PV -record.

+

This subsection describes pvData.h This file is quite big so rather than +showing the entire file, it will be described in parts.

-

PVField

+

typedefs

+ +

These are typedefs for Array and Ptr for the various pvData class +definitions, i.e. typdefs for "std::vector" and "std::tr1::shared_ptr".

+
class PVAuxInfo;
+class PostHandler;
+
+class PVField;
+class PVScalar;
+
+class PVScalarArray;
+
+class PVStructure;
+class PVStructureArray;
+
+typedef std::tr1::shared_ptr<PVAuxInfo> PVAuxInfoPtr;
+
+typedef std::tr1::shared_ptr<PostHandler> PostHandlerPtr;
+
+typedef std::tr1::shared_ptr<PVField> PVFieldPtr;
+typedef std::vector<PVFieldPtr> PVFieldPtrArray;
+typedef std::vector<PVFieldPtr>::iterator PVFieldPtrArray_iterator;
+typedef std::vector<PVFieldPtr>::const_iterator PVFieldPtrArray_const__iterator;
+
+typedef std::tr1::shared_ptr<PVScalar> PVScalarPtr;
+typedef std::tr1::shared_ptr<PVScalarArray> PVScalarArrayPtr;
+
+typedef std::tr1::shared_ptr<PVStructure> PVStructurePtr;
+typedef std::vector<PVStructurePtr> PVStructurePtrArray;
+typedef std::vector<PVStructurePtr>::iterator PVStructurePtrArray_iterator;
+typedef std::vector<PVStructurePtr>::const_iterator PVStructurePtrArray_const__iterator;
+
+typedef std::tr1::shared_ptr<PVStructureArray> PVStructureArrayPtrPostHandler
+ +

PostHandler is a class that must be implemented by any code that calls +setPostHandler. It's single virtual method. postPut is called whenever +PVField::postPut is called.

+
class PostHandler :
+  public std::tr1::enable_shared_from_this<PostHandler>
+{
+public:
+    POINTER_DEFINITIONS(PostHandler);
+    virtual ~PostHandler(){}
+    virtual void postPut() = 0;
+};
+ +

PVField

PVField is the base interface for accessing data. A data structure consists of a top level PVStructure. Every field of every structure of every top level structure has a PVField associated with it.

-
class PostHandler {
-public:
-    virtual void postPut() = 0;
-};
-
-class PVField
-: public Serializable,
-  private NoDefaultMethods
+
class PVField
+: virtual public Serializable,
+  public std::tr1::enable_shared_from_this<PVField>
 {
 public:
-    virtual ~PVField();
-    virtual void message(String message,MessageType messageType) ;
-    virtual void setRequester(Requester *prequester);
-    int getFieldOffset() ;
-    int getNextFieldOffset() ;
-    int getNumberFields() ;
-    PVAuxInfo * getPVAuxInfo();
-    bool isImmutable() ;
-    virtual void setImmutable();
-    FieldConstPtr getField() ;
-    PVStructure * getParent() ;
-    bool renameField(String  newName);
-    void postPut() ;
-    void setPostHandler(PostHandler *postHandler);
-    virtual bool equals(PVField &pv);
-    virtual void toString(StringBuilder buf) ;
-    virtual void toString(StringBuilder buf,int indentLevel) ;
-protected:
-    PVField(PVStructure *parent,FieldConstPtr field);
-    void setParent(PVStructure *parent);
-private:
-};
+ POINTER_DEFINITIONS(PVField); + virtual ~PVField(); + virtual void message(String message,MessageType messageType); + String getFieldName() const ; + virtual void setRequester(RequesterPtr const &prequester); + std::size_t getFieldOffset() const; + std::size_t getNextFieldOffset() const; + std::size_t getNumberFields() const; + PVAuxInfoPtr & getPVAuxInfo() + bool isImmutable() const; + virtual void setImmutable(); + const FieldConstPtr & getField() const ; + PVStructure * getParent() const + void replacePVField(const PVFieldPtr& newPVField); + void renameField(String newName); + void postPut() ; + void setPostHandler(PostHandlerPtr const &postHandler); + virtual bool equals(PVField &pv); + virtual void toString(StringBuilder buf) ; + virtual void toString(StringBuilder buf,int indentLevel); + ... +}
-

PostHandler is a class that must -be implemented by any code that calls setPostHandler. It's single virtual -method. postPut is called whenever -PVField::postPut is called.

- -

Serializable, and -NoDefaultMethods are described in a later section.

- -

The public methods for PVField -are:

+

The public methods for PVField are:

-
~PVField
-
destructor which must be called by whatever created the PVfield via a - call to one of the methods of PVDataCreate
-
message
+
~PVField
+
Destructor. Since shared pointers are used it should never be called by + user code.
+
message
Code attached to this field can call this method to report problems.
-
setRequester
+
getFieldName
+
Get the field name. If the field is a top level structure the field + name will be an empty string.
+
setRequester
Sets a requester to be called when message or getRequesterName are called. This is only legal for the top level PVField.
-
getFieldOffset
+
getFieldOffset
Get offset of the PVField field within top level structure. Every field within the PVStructure has a unique offset. The top level structure has an offset of 0. The first field within the structure has offset equal to 1. The other offsets are determined by recursively traversing each structure of the tree.
-
getNextFieldOffset
+
getNextFieldOffset
Get the next offset. If the field is a scalar or array field then this is just offset + 1. If the field is a structure it is the offset of the next field after this structure. Thus (nextOffset - offset) is always equal to the total number of fields within the field.
-
getNumberFields
+
getNumberFields
Get the total number of fields in this field. This is nextFieldOffset - fieldOffset.
-
getPVAuxInfo
+
getPVAuxInfo
Get the PVAuxInfo for this field. PVAuxInfo is described below.
-
isImmutable
+
isImmutable
Is the field immutable?
-
setImmutable
+
setImmutable
Make the field immutable. Once a field is immutable it can never be changed since there is no method to again make it mutable. This is an important design decision since it allows immutable array fields to share the internal primitive data array.
-
getField
+
getField
Get the reflection interface for the data.
-
getParent
+
getParent
Get the interface for the parent or null if this is the top level PVStructure.
-
renameField
-
Rename the field name. (false,true) is returned if the name (was - not,was) changed. It is not changed if the field is an an element of a - structure that already has a field with the same name.
-
postPut
+
replacePVField
+
Replace the data implementation for the field.
+
renameField
+
Rename the field name.
+
postPut
If a postHandler is registered it is called otherwise no action is taken.
-
setPostHandler
+
setPostHandler
Set the postHandler for the record. Only a single handler can be registered.
-
equals
+
equals
Compare this field with another field. The result will be true only if the fields have exactly the same field types and if the data values are equal.
-
-
-
toString
+
toString
Converts the field data to a string. This is mostly for debugging purposes.
-

PVAuxInfo

+

PVAuxInfo

AuxInfo (Auxillary Information) is information about a field that is application specific. It will not be available outside the application that @@ -1486,459 +941,583 @@ information. Each Field and each PVField can have have an arbitrary number of auxInfos. An auxInfo is a (key,PVScalar) pair where key is a string.

class PVAuxInfo : private NoDefaultMethods {
 public:
+    typedef std::map<String,PVScalarPtr> PVInfoMap;
+    typedef std::map<String,PVScalarPtr>::iterator PVInfoIter;
+    typedef std::pair<String,PVScalarPtr> PVInfoPair;
+
     PVAuxInfo(PVField *pvField);
     ~PVAuxInfo();
     PVField * getPVField();
-    PVScalar * createInfo(String key,ScalarType scalarType);
-    PVScalarMap getInfos();
-    PVScalar * getInfo(String key);
+    PVScalarPtr createInfo(String key,ScalarType scalarType);
+    PVScalarPtr getInfo(String key);
+    PVInfoMap & getInfoMap();
     void toString(StringBuilder buf);
     void toString(StringBuilder buf,int indentLevel);
-private:
+ ...
 };

where

-
getPVField
+
getPVField
Get the PVField to which this PVAuxInfo is attached.
-
createInfo
+
createInfo
Create a new PVScalar of type scalarType.
-
getInfos
-
Get a map of all the auxInfos.
-
getInfo
+
getInfo
Get the PVScalar with the specified key.
-
toString
+
getInfoMap
+
Get the map of all the PVScalars that hold the info.
+
toString
Print all the auxInfos
-

PVScalar and extensions

+

PVScalar

+ +

This is the base class for all scalar data.

class PVScalar : public PVField {
 public:
+    POINTER_DEFINITIONS(PVScalar);
     virtual ~PVScalar();
-    ScalarConstPtr getScalar() ;
-protected:
-    PVScalar(PVStructure *parent,ScalarConstPtr scalar);
-};
+ typedef PVScalar &reference; + typedef const PVScalar& const_reference; + const ScalarConstPtr getScalar() const ; + ... +} -
Primitive PVField types
+

where

+
+
getScalar
+
Get the introspection interface for the PVScalar.
+
+ +

PVScalarValue

The interfaces for primitive data types are:

template<typename T>
 class PVScalarValue : public PVScalar {
 public:
-    typedef std::tr1::shared_ptr<PVScalarValue> shared_pointer;
-    typedef std::tr1::shared_ptr<const PVScalarValue> const_shared_pointer;
-
+    POINTER_DEFINITIONS(PVScalarValue);
     typedef T value_type;
     typedef T* pointer;
     typedef const T* const_pointer;
-
     virtual ~PVScalarValue() {}
-    virtual T get() = 0;
+    virtual T get() const = 0;
     virtual void put(T value) = 0;
-protected:
-    PVScalarValue(PVStructure *parent,ScalarConstPtr scalar)
-    : PVScalar(parent,scalar) {}
-private:
-};
-
-typedef PVScalarValue<bool> PVBoolean;
-typedef PVScalarValue<int8> PVByte;
-typedef PVScalarValue<int16> PVShort;
-typedef PVScalarValue<int32> PVInt;
-typedef PVScalarValue<int64> PVLong;
-typedef PVScalarValue<float> PVFloat;
-typedef PVScalarValue<double> PVDouble;
+ ...
+}
 
 // PVString is special case, since it implements SerializableArray
 class PVString : public PVScalarValue<String>, SerializableArray {
 public:
     virtual ~PVString() {}
-protected:
-    PVString(PVStructure *parent,ScalarConstPtr scalar)
-    : PVScalarValue<String>(parent,scalar) {}
+ ...
 };
-

PVArray and Extensions

+

where

+
+
get
+
Get the value stored in the object.
+
put
+
Change the value stored in the object.
+
-

PVArray is the base interface for -all the other PV Array interfaces. It extends PVField and provides the -additional methods:

+

PVArray

+ +

PVArray is the base interface for all the other PV Array interfaces. It +extends PVField and provides the additional methods:

class PVArray : public PVField, public SerializableArray {
 public:
+    POINTER_DEFINITIONS(PVArray);
     virtual ~PVArray();
-    int getLength() ;
-    void setLength(int length);
-    int getCapacity() ;
-    bool isCapacityMutable() ;
+    virtual void setImmutable();
+    std::size_t getLength() const;
+    virtual void setLength(std::size_t length);
+    std::size_t getCapacity() const;
+    bool isCapacityMutable() const;
     void setCapacityMutable(bool isMutable);
-    virtual void setCapacity(int capacity) = 0;
-protected:
-    PVArray(PVStructure *parent,FieldConstPtr field);
-    void setCapacityLength(int capacity,int length);
+    virtual void setCapacity(std::size_t capacity) = 0;
+ ...
 };
-
getLength
+
setImmutable
+
Set the data immutable. Note that this is permanent since there is no + methods to make it mutable.
+
getLength
Get the current length. This is less than or equal to the capacity.
-
setLength
+
setLength
Set the length. If the PVField is not mutable then an exception is thrown. If this is greater than the capacity setCapacity is called.
-
getCapacity
+
getCapacity
Get the capacity, i.e. this is the size of the underlying data array.
-
setCapacity
+
setCapacity
Set the capacity. The semantics are implementation dependent but typical semantics are as follows: If the capacity is not mutable an exception is thrown. A new data array is created and data is copied from the old array to the new array.
-
isCapacityMutable
+
isCapacityMutable
Is the capacity mutable
-
setCapacityMutable
+
setCapacityMutable
Specify if the capacity can be changed.
+
setCapacity
+
Set the capaciity.
-
PVArray Extensions
+

PVArrayData

-

The interface for each array type has get and put methods which have the -same arguments except for the data type. For example PVDoubleArray is:

+

This is the argument to one of the get methods of PVValueArray.

template<typename T>
 class PVArrayData {
+private:
+    std::vector<T> init;
 public:
-    typedef std::tr1::shared_ptr<PVArrayData> shared_pointer;
-    typedef std::tr1::shared_ptr<const PVArrayData> const_shared_pointer;
-
+    POINTER_DEFINITIONS(PVArrayData);
     typedef T  value_type;
     typedef T* pointer;
     typedef const T* const_pointer;
+    std::vector<T> & data;
+    std::size_t offset;
+    PVArrayData()
+    : data(init)
+    {}
+};
- pointer data; - int offset; -}; +

PVScalarArray

- -class PVScalarArray : public PVArray { +

PVScalarArray is the base class for scalar array data. PVValueArray is a +templete for the various scalar array data classes. There is a class for each +possible scalar type, i. e. PVBooleanArray, ..., PVStringArray.

+
class PVScalarArray : public PVArray {
 public:
-    typedef std::tr1::shared_ptr<PVScalarArray> shared_pointer;
-    typedef std::tr1::shared_ptr<const PVScalarArray> const_shared_pointer;
-
+    POINTER_DEFINITIONS(PVScalarArray);
     virtual ~PVScalarArray();
-    ScalarArrayConstPtr getScalarArray() ;
+    typedef PVScalarArray &reference;
+    typedef const PVScalarArray& const_reference;
+    const ScalarArrayConstPtr getScalarArray() const ;
+ ...
+}
-protected: - PVScalarArray(PVStructure *parent,ScalarArrayConstPtr scalarArray); -private: -}; -template<typename T> +

where

+
+
getScalarArray
+
Get the introspection interface.
+
+ +

PVValueArray

+ +

This is a template class plus instances for PVBooleanArray, ..., +PVStringArray.

+
template<typename T>
 class PVValueArray : public PVScalarArray {
 public:
-    typedef std::tr1::shared_ptr<PVValueArray> shared_pointer;
-    typedef std::tr1::shared_ptr<const PVValueArray> const_shared_pointer;
-
+    POINTER_DEFINITIONS(PVValueArray);
     typedef T  value_type;
     typedef T* pointer;
     typedef const T* const_pointer;
     typedef PVArrayData<T> ArrayDataType;
+    typedef std::vector<T> vector;
+    typedef const std::vector<T> const_vector;
+    typedef std::tr1::shared_ptr<vector> shared_vector;
+    typedef PVValueArray & reference;
+    typedef const PVValueArray & const_reference;
 
     virtual ~PVValueArray() {}
-    virtual int get(int offset, int length, ArrayDataType *data) = 0;
-    virtual int put(int offset,int length, pointer from, int fromOffset) = 0;
-    virtual void shareData(pointer value,int capacity,int length) = 0;
+    virtual std::size_t get(
+         std::size_t offset, std::size_t length, ArrayDataType &data) = 0;
+    virtual std::size_t put(std::size_t offset,
+        std::size_t length, const_pointer from, std::size_t fromOffset) = 0;
+    virtual std::size_t put(std::size_t offset,
+        std::size_t length, const_vector &from, std::size_t fromOffset);
+    virtual void shareData(
+         shared_vector const & value,
+         std::size_t capacity,
+         std::size_t length) = 0;
+    virtual pointer get() = 0;
+    virtual pointer get() const = 0;
+    virtual vector const & getVector() = 0;
+    virtual shared_vector const & getSharedVector() = 0;
 protected:
-    PVValueArray(PVStructure *parent,ScalarArrayConstPtr scalar)
-    : PVScalarArray(parent,scalar) {}
-private:
+    PVValueArray(ScalarArrayConstPtr const & scalar)
+    : PVScalarArray(scalar) {}
+    friend class PVDataCreate;
 };
-typedef PVArrayData<bool> BooleanArrayData;
-typedef PVValueArray<bool> PVBooleanArray;
+
+template<typename T>
+std::size_t PVValueArray<T>::put(
+    std::size_t offset,
+    std::size_t length,
+    const_vector &from,
+    std::size_t fromOffset)
+{ return put(offset,length, &from[0], fromOffset); }
+
+/**
+ * Definitions for the various scalarArray types.
+ */
+typedef PVArrayData<uint8> BooleanArrayData;
+typedef PVValueArray<uint8> PVBooleanArray;
+typedef std::tr1::shared_ptr<PVBooleanArray> PVBooleanArrayPtr;
 
 typedef PVArrayData<int8> ByteArrayData;
 typedef PVValueArray<int8> PVByteArray;
+typedef std::tr1::shared_ptr<PVByteArray> PVByteArrayPtr;
 
 typedef PVArrayData<int16> ShortArrayData;
 typedef PVValueArray<int16> PVShortArray;
+typedef std::tr1::shared_ptr<PVShortArray> PVShortArrayPtr;
 
 typedef PVArrayData<int32> IntArrayData;
 typedef PVValueArray<int32> PVIntArray;
+typedef std::tr1::shared_ptr<PVIntArray> PVIntArrayPtr;
 
 typedef PVArrayData<int64> LongArrayData;
 typedef PVValueArray<int64> PVLongArray;
+typedef std::tr1::shared_ptr<PVLongArray> PVLongArrayPtr;
 
+typedef PVArrayData<uint8> UByteArrayData;
+typedef PVValueArray<uint8> PVUByteArray;
+typedef std::tr1::shared_ptr<PVUByteArray> PVUByteArrayPtr;
+
+typedef PVArrayData<uint16> UShortArrayData;
+typedef PVValueArray<uint16> PVUShortArray;
+typedef std::tr1::shared_ptr<PVUShortArray> PVUShortArrayPtr;
+
+typedef PVArrayData<uint32> UIntArrayData;
+typedef PVValueArray<uint32> PVUIntArray;
+typedef std::tr1::shared_ptr<PVUIntArray> PVUIntArrayPtr;
+
+typedef PVArrayData<uint64> ULongArrayData;
+typedef PVValueArray<uint64> PVULongArray;
+typedef std::tr1::shared_ptr<PVULongArray> PVULongArrayPtr;
 
 typedef PVArrayData<float> FloatArrayData;
 typedef PVValueArray<float> PVFloatArray;
+typedef std::tr1::shared_ptr<PVFloatArray> PVFloatArrayPtr;
 
 typedef PVArrayData<double> DoubleArrayData;
 typedef PVValueArray<double> PVDoubleArray;
+typedef std::tr1::shared_ptr<PVDoubleArray> PVDoubleArrayPtr;
 
 typedef PVArrayData<String> StringArrayData;
-typedef PVValueArray<String> PVStringArray;
+typedef PVValueArray<String> PVStringArray; +typedef std::tr1::shared_ptr<PVStringArray> PVStringArrayPtr; -

Get "exposes" it's internal array by setting data.data and data.offset. The -caller is responsible for copying the array elements. This violates the -principle that objects should not expose their internal data but is done for -efficency. For example it makes it possible to copy between arrays with -identical element types without requiring an intermediate array.

+

where

+
+
get( std::size_t offset, std::size_t length, ArrayDataType &data) +
+
This method "exposes" it's internal array by setting data.data and + data.offset. The caller is responsible for copying the array elements. + This violates the principle that objects should not expose their internal + data but is done for efficency. For example it makes it possible to copy + between arrays with identical element types without requiring an + intermediate array.
+
put(std::size_t offset, std::size_t length, const_pointer from, + std::size_t fromOffset)
+
Put data into the array. from is a raw array.
+
put(std::size_t offset, std::size_t length, const_vector &from, + std::size_t fromOffset)
+
Put data into the array from a vector holding the raw array.
+
shareData( shared_vector const & value, std::size_t capacity, + std::size_t length)
+
Make the instance share the raw data from value. This is most useful + for immutable arrays. In this case the caller must set the PVArray to be + immutable. In the PVArray is not immutable then it is the applications + responsibility to coordinate access to the array. Again this violates the + principle that objects should not expose their internal data but is + important for immutable arrays. For example pvData and the javaIOC define + many enumerated structures where an enumerated structure has two fields: + index and choices. Choices is a PVStringArray that holds the enumerated + choices. Index is a PVInt that is the index of the currently selected + choice. For many enumerated structures choices is immutable. Allowing the + choices internal String[] to be shared between all the instances of an + enumerated structure saves on storage. Another reason for allowing shared + data is so that an application which processes an array can be separated + into multiple modules that directly access the internal data array of a + PVArray. This can be required for minimizing CPU overhead. In this case + it is the applications responsibility to coordinate access to the + array.
+
get()
+
Get the raw array.
+
getVector()
+
Get the vector holding the raw array.
+
getSharedVector()
+
Get the shared vector holding the data.
+

Both get and put return the number of elements actually transfered. The arguments are:

-
offset
+
offset
The offset in the PV array.
-
len
+
len
The maximum number of elements to transfer. The number actually transfered will be less than or equal to this value.
-
data
+
data
Get sets data.data to it's internal array and data.offset to the offset into the array. The caller is responsible for the actual data transfer.
-
from
+
from
The array from which the data is taken. This array is supplied by the caller
-
fromOffset
-
The offset in from
+
fromOffset
+
The offset in from

The caller must be prepared to make multiple calls to retrieve or put an entire array. A caller should accept or put partial arrays. For example the following reads an entire array:

-
    void doubleArray getArray(PVDoubleArray *pv,doubleArray *to,int lenArray)
-    {
-        int len = pv->getLength();
-        if(lenArray<len) len = lenArray;
-        DoubleArrayData data;
-        int offset = 0;
-        while(offset < len) {
-            int num = pv->get(offset,(len-offset),&data);
-            doubleArray from = &data.data[data.offset];
-            doubleArray to = &to[offset]
-            int numbytes = num*sizeof(double);
-            memcopy(from,to,numBytes);
-            offset += num;
-        }
-    } 
+
void getArray(PVDoubleArrayPtr & pv,DoubleArray const & to)
+{
+    size_t len = pv->getLength();
+    if(to.size()<len) to.resize(len);
+    DoubleArrayData data;
+    size_t offset = 0;
+    while(offset<len) {
+        size_t num = pv->get(offset,(len-offset),data);
+        DoubleArray &from = data.data;
+        size_t fromOffset = data.offset;
+        for(size_t i=0; i<num; i++) to[i+offset] = from[i + fromOffset];
+        offset += num;
+    }
+} 
-

shareData results in the PVArray using the primitive array that is passed to -this method. This is most useful for immutable arrays. In this case the caller -must set the PVArray to be immutable. In the PVArray is not immutable then it -is the applications responsibility to coordinate access to the array. Again -this violates the principle that objects should not expose their internal data -but is important for immutable arrays. For example pvData and the javaIOC -define many enumerated structures where an enumerated structure has two fields: -index and choices. Choices is a PVStringArray that holds the enumerated -choices. Index is a PVInt that is the index of the currently selected choice. -For many enumerated structures choices is immutable. Allowing the choices -internal String[] to be shared between all the instances of an enumerated -structure saves on storage. Another reason for allowing shared data is so that -an application which processes an array can be separated into multiple modules -that directly access the internal data array of a PVArray. This can be required -for minimizing CPU overhead. In this case it is the applications responsibility -to coordinate access to the array.

+

-

PVStructure

+

PVStructure

The interface for a structure is:

class PVStructure : public PVField,public BitSetSerializable {
 public:
-    
-};virtual ~PVStructure();
-    StructureConstPtr getStructure();
-    PVFieldPtrArray getPVFields();
-    PVField *getSubField(String fieldName);
-    PVField *getSubField(int fieldOffset);
-    void appendPVField(PVField *pvField);
-    void appendPVFields(int numberFields,PVFieldPtrArray pvFields);
+    POINTER_DEFINITIONS(PVStructure);
+    virtual ~PVStructure();
+    typedef PVStructure & reference;
+    typedef const PVStructure & const_reference;
+    virtual void setImmutable();
+    StructureConstPtr getStructure() const;
+    const PVFieldPtrArray & getPVFields() const;
+    PVFieldPtr getSubField(String fieldName) const;
+    PVFieldPtr getSubField(std::size_t fieldOffset) const;
+    void appendPVField(
+        String fieldName,
+        PVFieldPtr const & pvField);
+    void appendPVFields(
+        StringArray const & fieldNames,
+        PVFieldPtrArray const & pvFields);
     void removePVField(String fieldName);
-    PVBoolean *getBooleanField(String fieldName);
-    PVByte *getByteField(String fieldName);
-    PVShort *getShortField(String fieldName);
-    PVInt *getIntField(String fieldName);
-    PVLong *getLongField(String fieldName);
-    PVFloat *getFloatField(String fieldName);
-    PVDouble *getDoubleField(String fieldName);
-    PVString *getStringField(String fieldName);
-    PVStructure *getStructureField(String fieldName);
-    PVScalarArray *getScalarArrayField(
-        String fieldName,ScalarType elementType);
-    PVStructureArray *getStructureArrayField(String fieldName);
-    String getExtendsStructureName();
+    PVBooleanPtr getBooleanField(String fieldName) ;
+    PVBytePtr getByteField(String fieldName) ;
+    PVShortPtr getShortField(String fieldName) ;
+    PVIntPtr getIntField(String fieldName) ;
+    PVLongPtr getLongField(String fieldName) ;
+    PVUBytePtr getUByteField(String fieldName) ;
+    PVUShortPtr getUShortField(String fieldName) ;
+    PVUIntPtr getUIntField(String fieldName) ;
+    PVULongPtr getULongField(String fieldName) ;
+    PVFloatPtr getFloatField(String fieldName) ;
+    PVDoublePtr getDoubleField(String fieldName) ;
+    PVStringPtr getStringField(String fieldName) ;
+    PVStructurePtr getStructureField(String fieldName) ;
+    PVScalarArrayPtr getScalarArrayField(
+        String fieldName,ScalarType elementType) ;
+    PVStructureArrayPtr getStructureArrayField(String fieldName) ;
+    String getExtendsStructureName() const;
     bool putExtendsStructureName(
         String extendsStructureName);
     virtual void serialize(
-        ByteBuffer *pbuffer,SerializableControl *pflusher) const;
+        ByteBuffer *pbuffer,SerializableControl *pflusher) const ;
     virtual void deserialize(
         ByteBuffer *pbuffer,DeserializableControl *pflusher);
     virtual void serialize(ByteBuffer *pbuffer,
         SerializableControl *pflusher,BitSet *pbitSet) const;
     virtual void deserialize(ByteBuffer *pbuffer,
         DeserializableControl*pflusher,BitSet *pbitSet);
-    PVStructure(PVStructure *parent,StructureConstPtr structure);
-    PVStructure(
-        PVStructure *parent,
-        StructureConstPtr structure,
-        PVFieldPtrArray pvFields);
+    PVStructure(StructureConstPtr const & structure);
+    PVStructure(StructureConstPtr const & structure,PVFieldPtrArray const & pvFields);
 };

where

-
getStructure
+
getStructure
Get the introspection interface for the structure.
-
getPVFields
+
getPVFields
Returns the array of subfields. The set of subfields must all have different field names.
-
getSubField(String fieldName)
+
getSubField(String fieldName)
Get a subField of a field. For a PVStructure a non-null result is returned if fieldName is a field of the PVStructure. The fieldName can be of the form name.name...
-
getSubField(int fieldOffset)
+
getSubField(int fieldOffset)
Get the field located a fieldOffset, where fieldOffset is relative to the top level structure. This returns null if the specified field is not located within this PVStructure.
-
appendPVField
+
appendPVField
Append pvField to the end of this PVStructure. This should NOT be called if any code is attached to any of the fields in the top level structure.
-
appendPVFields
+
appendPVFields
Append an array of pvFields to the end of this structure. Note that if the original number of fields is 0 than pvFields replaces the original. Thus the caller must NOT reuse pvFields after calling this method. This should NOT be called if any code is attached to any of the fields in the top level structure
-
removePVField
+
removePVField
Remove the specified field from this structure. This should NOT be called if any code is attached to any of the fields in the top level structure.
-
getBooleanField
+
getBooleanField
Look for fieldName. If found and it has the correct type return the interface. This and the following methods are convenience methods that allow a user to get the interface to a subfield without requiring introspection. fieldName can be of the form name.name...
-
getByteField
+
getByteField
Look for fieldName. If found and it has the correct type return the interface.
-
getShortField
+
getShortField
Look for fieldName. If found and it has the correct type return the interface.
-
getIntField
+
getIntField
Look for fieldName. If found and it has the correct type return the interface.
-
getLongField
+
getLongField
Look for fieldName. If found and it has the correct type return the interface.
-
getFloatField
+
getUByteField
Look for fieldName. If found and it has the correct type return the interface.
-
getDoubleField
+
getUShortField
Look for fieldName. If found and it has the correct type return the interface.
-
getStringField
+
getUIntField
Look for fieldName. If found and it has the correct type return the interface.
-
getScalarArrayField
+
getULongField
Look for fieldName. If found and it has the correct type return the interface.
-
getStructureArrayField
+
getFloatField
Look for fieldName. If found and it has the correct type return the interface.
-
getExtendsStructureName
+
getDoubleField
+
Look for fieldName. If found and it has the correct type return the + interface.
+
getStringField
+
Look for fieldName. If found and it has the correct type return the + interface.
+
getStructureField
+
Look for fieldName. If found and it has the correct type return the + interface.
+
getScalarArrayField
+
Look for fieldName. If found and it has the correct type return the + interface.
+
getStructureArrayField
+
Look for fieldName. If found and it has the correct type return the + interface.
+
getExtendsStructureName
Get the name of structure that this structure extends.
-
putExtendsStructureName
+
putExtendsStructureName
Specify the structure that this structure extends.
-

PVStructureArray

+

PVStructureArray

The interface for an array of structures is:

-
class StructureArrayData {
-public:
-    PVStructurePtrArray data;
-    int offset;
-};
+
typedef PVArrayData<PVStructurePtr> StructureArrayData;
 
-class PVStructureArray : public PVArray {
+class PVStructureArray : public PVArray
+{
 public:
+    POINTER_DEFINITIONS(PVStructureArray);
+    typedef PVStructurePtr  value_type;
+    typedef PVStructurePtr* pointer;
+    typedef const PVStructurePtr* const_pointer;
+    typedef PVArrayData<PVStructurePtr> ArrayDataType;
+    typedef std::vector<PVStructurePtr> vector;
+    typedef const std::vector<PVStructurePtr> const_vector;
+    typedef std::tr1::shared_ptr<vector> shared_vector;
+    typedef PVStructureArray &reference;
+    typedef const PVStructureArray& const_reference;
+
     virtual ~PVStructureArray() {}
-    virtual StructureArrayConstPtr getStructureArray() = 0;
-    virtual int append(int number) = 0;
-    virtual bool remove(int offset,int number) = 0;
-    virtual void compress() = 0;
-    virtual int get(int offset, int length,
-        StructureArrayData *data) = 0;
-    virtual int put(int offset,int length,
-        PVStructurePtrArray from, int fromOffset) = 0;
-    virtual void shareData( PVStructurePtrArray value,int capacity,int length) = 0;
-protected:
-    PVStructureArray(PVStructure *parent,
-        StructureArrayConstPtr structureArray);
-};
+ virtual void setCapacity(size_t capacity); + virtual void setLength(std::size_t length); + virtual StructureArrayConstPtr getStructureArray() const ; + virtual std::size_t append(std::size_t number); + virtual bool remove(std::size_t offset,std::size_t number); + virtual void compress(); + virtual std::size_t get(std::size_t offset, std::size_t length, + StructureArrayData &data); + virtual std::size_t put(std::size_t offset,std::size_t length, + const_vector const & from, std::size_t fromOffset); + virtual void shareData( + shared_vector const & value, + std::size_t capacity, + std::size_t length); + virtual void serialize(ByteBuffer *pbuffer, + SerializableControl *pflusher) const; + virtual void deserialize(ByteBuffer *buffer, + DeserializableControl *pflusher); + virtual void serialize(ByteBuffer *pbuffer, + SerializableControl *pflusher, std::size_t offset, std::size_t count) const ; + virtual pointer get() { return &((*value.get())[0]); } + virtual pointer get() const { return &((*value.get())[0]); } + virtual vector const & getVector() {return *value;} + virtual shared_vector const & getSharedVector() {return value;} + ... +}

where

-
getStructureArray
+
getStructureArray
Get the introspection interface shared by each element.
-
append
+
append
Create new elements and append them to the end of the array. It returns the index of the first new element.
-
remove
+
remove
Remove the specfied set of elements. It returns (false,true) if the elements (were not, were) removed. It will not removed any elements unless all requested elements exist or are null. Note that this deletes the element and sets the array element to null. It does not change the array capacity.
-
compres
+
compres
This moves all null elements and then changes the array capacity. When done there are no null elements.

The other methods are similar to the methods for other array types.

-

PVDataCreate

+

PVDataCreate

PVDataCreate is an interface that provides methods that create PVField interfaces. A factory is provided that creates PVDataCreate.

class PVDataCreate {
 public:
-   PVField *createPVField(PVStructure *parent,
-       FieldConstPtr field);
-   PVField *createPVField(PVStructure *parent,
-       String fieldName,PVField * fieldToClone);
-   PVScalar *createPVScalar(PVStructure *parent,ScalarConstPtr scalar);
-   PVScalar *createPVScalar(PVStructure *parent,
-       String fieldName,ScalarType scalarType);
-   PVScalar *createPVScalar(PVStructure *parent,
-       String fieldName,PVScalar * scalarToClone);
-   PVScalarArray *createPVScalarArray(PVStructure *parent,
-       ScalarArrayConstPtr scalarArray);
-   PVScalarArray *createPVScalarArray(PVStructure *parent,
-       String fieldName,ScalarType elementType);
-   PVScalarArray *createPVScalarArray(PVStructure *parent,
-       String fieldName,PVScalarArray * scalarArrayToClone);
-   PVStructureArray *createPVStructureArray(PVStructure *parent,
-       StructureArrayConstPtr structureArray);
-   PVStructure *createPVStructure(PVStructure *parent,
-       StructureConstPtr structure);
-   PVStructure *createPVStructure(PVStructure *parent,
-       String fieldName,int numberFields,FieldConstPtrArray fields);
-   PVStructure *createPVStructure(PVStructure *parent,
-       String fieldName,int numberFields,PVFieldPtrArray pvFields);
-   PVStructure *createPVStructure(PVStructure *parent,
-       String fieldName,PVStructure *structToClone);
-protected:
-   PVDataCreate();
-   friend PVDataCreate * getPVDataCreate();
+    static PVDataCreatePtr getPVDataCreate();
+    PVFieldPtr createPVField(FieldConstPtr const & field);
+    PVFieldPtr createPVField(PVFieldPtr const & fieldToClone);
+    PVScalarPtr createPVScalar(ScalarConstPtr const & scalar);
+    PVScalarPtr createPVScalar(ScalarType scalarType);
+    PVScalarPtr createPVScalar(PVScalarPtr const & scalarToClone);
+    PVScalarArrayPtr createPVScalarArray(ScalarArrayConstPtr const & scalarArray);
+    PVScalarArrayPtr createPVScalarArray(ScalarType elementType);
+    PVScalarArrayPtr createPVScalarArray(PVScalarArrayPtr const  & scalarArrayToClone);
+    PVStructureArrayPtr createPVStructureArray(StructureArrayConstPtr const & structureArray);
+    PVStructurePtr createPVStructure(StructureConstPtr const & structure);
+    PVStructurePtr createPVStructure(
+        StringArray const & fieldNames,PVFieldPtrArray const & pvFields);
+   PVStructurePtr createPVStructure(PVStructurePtr const & structToClone);
+ ...
 };
 
-extern PVDataCreate * getPVDataCreate();
+extern PVDataCreatePtr getPVDataCreate();

where

-
createPVField
+
createPVField
The PVField is created reusing the Field interface. Two methods are provided. Each calls the corresponding createPVScalar, createPVArray, or createPVStructure depending in the type of the last argument. WARNING If the FieldConstPtr field argument is passed and field is already used by another data object then the caller MUST call field->incReferenceCount() before calling this method.
-
createPVScalar
+
createPVScalar
Creates an instance of a PVScalar. Three versions are supplied. The first is passed an introspection interface. The second provides the field name and the scalarType. The last provides a field name and a PVScalar to @@ -1946,7 +1525,7 @@ extern PVDataCreate * getPVDataCreate(); original. WARNING If the ScalarAConstPtr scalar argument is passed and scalar is already used by another data object then the caller MUST call scalar->incReferenceCount() before calling this method.
-
createPVScalarArray
+
createPVScalarArray
Create an instance of a PVArray. Three versions are supplied. The first is passed an introspection interface. The second provides the field name and the elementType. The last provides a field name and a PVArray to @@ -1955,14 +1534,14 @@ extern PVDataCreate * getPVDataCreate(); passed and scalarArray is already used by another data object then the caller MUST call scalarArray->incReferenceCount() before calling this method.
-
createPVStructureArray
+
createPVStructureArray
Create a PVStructureArray. It must be passed a structureToClone. This will become the Structure interface for ALL elements of the PVStructureArray. It MUST be used to create any new array elements. If structureArray is alreadt used by another data object than structureArray->incReferenceCount() MUST be called before calling this method.
-
createPVStructure
+
createPVStructure
Create an instance of a PVStructure. Four methods are provided. The first method uses a previously created structure introspection interface. The second uses a Field array to initialize the sub-fields. For the third @@ -1977,7 +1556,7 @@ extern PVDataCreate * getPVDataCreate(); before calling this method.
-

Standard Data Fields

+

standardPVField.h

A class StandardPVField has methods for creating standard data fields. Like class StandardField it has two forms of the methods which create a field, one @@ -1985,54 +1564,25 @@ without properties and one with properties. Again the properties is some combination of alarm, timeStamp, control, display, and valueAlarm. And just like StandardField there are methods to create the standard properties. The methods are:

-
class StandardPVField : private NoDefaultMethods {
-public:
-    StandardPVField();
-    ~StandardPVField();
-    PVScalar * scalar(PVStructure *parent,String fieldName,ScalarType type);
-    PVStructure * scalar(PVStructure *parent,
-        String fieldName,ScalarType type,String properties);
-    PVScalarArray * scalarArray(PVStructure *parent,
-        String fieldName,ScalarType elementType);
-    PVStructure * scalarArray(PVStructure *parent,
-        String fieldName,ScalarType elementType, String properties);
-    PVStructureArray * structureArray(PVStructure *parent,
-        String fieldName,StructureConstPtr structure);
-    PVStructure* structureArray(PVStructure *parent,
-        String fieldName,StructureConstPtr structure,String properties);
-    PVStructure * enumerated(PVStructure *parent,
-        String fieldName,StringArray choices, int number);
-    PVStructure * enumerated(PVStructure *parent,
-        String fieldName,StringArray choices, int number, String properties);
-    PVScalar * scalarValue(PVStructure *parent,ScalarType type);
-    PVStructure * scalarValue(PVStructure *parent,
-        ScalarType type,String properties);
-    PVScalarArray * scalarArrayValue(PVStructure *parent,ScalarType elementType);
-    PVStructure * scalarArrayValue(PVStructure *parent,
-        ScalarType elementType, String properties);
-    PVStructureArray * structureArrayValue(PVStructure *parent,
-        StructureConstPtr structure);
-    PVStructure * structureArrayValue(PVStructure *parent,
-        StructureConstPtr structure,String properties);
-    PVStructure * enumeratedValue(PVStructure *parent,StringArray choices);
-    PVStructure * enumeratedValue(PVStructure *parent,
-        StringArray choices, String properties);
-    PVStructure * alarm(PVStructure *parent);
-    PVStructure * timeStamp(PVStructure *parent);
-    PVStructure * display(PVStructure *parent);
-    PVStructure * control(PVStructure *parent);
-    PVStructure * booleanAlarm(PVStructure *parent);
-    PVStructure * byteAlarm(PVStructure *parent);
-    PVStructure * shortAlarm(PVStructure *parent);
-    PVStructure * intAlarm(PVStructure *parent);
-    PVStructure * longAlarm(PVStructure *parent);
-    PVStructure * floatAlarm(PVStructure *parent);
-    PVStructure * doubleAlarm(PVStructure *parent);
-    PVStructure * enumeratedAlarm(PVStructure *parent);
-    PVStructure * powerSupply(PVStructure *parent);
-};
+
class StandardPVField;
+typedef std::tr1::shared_ptr<StandardPVField> StandardPVFieldPtr;
 
-

Convert

+class StandardPVField : private NoDefaultMethods { +public: + static StandardPVFieldPtr getStandardPVField(); + ~StandardPVField(); + PVStructurePtr scalar(ScalarType type,String properties); + PVStructurePtr scalarArray(ScalarType elementType, String properties); + PVStructurePtr structureArray(StructureConstPtr const &structure,String properties); + PVStructurePtr enumerated(StringArray const &choices); + PVStructurePtr enumerated(StringArray const &choices, String properties); + ... +} + + +extern StandardPVFieldPtr getStandardPVField();
+ +

convert.h

NOTE about copying immutable array fields. If an entire immutable array field is copied to another array that has the same elementType, both offsets @@ -2070,6 +1620,7 @@ Thus the source and target share the same primitive array.

static inline bool operator!=(PVField& a, PVField& b) {return !(a==b);} + bool operator==(const Field&, const Field&); bool operator==(const Scalar&, const Scalar&); bool operator==(const ScalarArray&, const ScalarArray&); @@ -2086,210 +1637,209 @@ static inline bool operator!=(const Structure& a, const Structure& b) {return !(a==b);} static inline bool operator!=(const StructureArray& a, const StructureArray& b) {return !(a==b);} +class Convert; +typedef std::tr1::shared_ptr<Convert> ConvertPtr; -class Convert : NoDefaultMethods { +class Convert { public: - Convert(); + static ConvertPtr getConvert(); ~Convert(); - void getFullName(StringBuilder buf,PVField *pvField); + void getFullName(StringBuilder buf,PVFieldPtr const & pvField); + bool equals(PVFieldPtr const &a,PVFieldPtr const &b); bool equals(PVField &a,PVField &b); - void getString(StringBuilder buf,PVField * pvField,int indentLevel); - void getString(StringBuilder buf,PVField *pvField); - void fromString(PVScalar *pv, String from); - int fromString(PVScalarArray *pv, String from); - int fromStringArray(PVScalarArray *pv, int offset, int length, - StringArray from, int fromOffset); - int toStringArray(PVScalarArray *pv, int offset, int length, - StringArray to, int toOffset); - bool isCopyCompatible(FieldConstPtr from, FieldConstPtr to); - void copy(PVField *from,PVField *to); + void getString(StringBuilder buf,PVFieldPtr const & pvField,int indentLevel); + void getString(StringBuilder buf,PVFieldPtr const & pvField); + void getString(StringBuilder buf,PVField const * pvField,int indentLevel); + void getString(StringBuilder buf,PVField const * pvField); + std::size_t fromString( + PVStructurePtr const &pv, + StringArray const & from, + std::size_t fromStartIndex = 0); + void fromString(PVScalarPtr const & pv, String from); + std::size_t fromString(PVScalarArrayPtr const & pv, String from); + std::size_t fromStringArray( + PVScalarArrayPtr const & pv, + std::size_t offset, std::size_t length, + StringArray const & from, + std::size_t fromOffset); + std::size_t toStringArray(PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + StringArray & to, + std::size_t toOffset); + bool isCopyCompatible(FieldConstPtr const & from, FieldConstPtr const & to); + void copy(PVFieldPtr const & from, PVFieldPtr const & to); bool isCopyScalarCompatible( - ScalarConstPtr from, ScalarConstPtr to); - void copyScalar(PVScalar *from, PVScalar *to); - bool isCopyScalarArrayCompatible(ScalarArrayConstPtr from, - ScalarArrayConstPtr to); - int copyScalarArray(PVScalarArray *from, int offset, - PVScalarArray *to, int toOffset, int length); + ScalarConstPtr const & from, + ScalarConstPtr const & to); + void copyScalar(PVScalarPtr const & from, PVScalarPtr const & to); + bool isCopyScalarArrayCompatible( + ScalarArrayConstPtr const & from, + ScalarArrayConstPtr const & to); + std::size_t copyScalarArray( + PVScalarArrayPtr const & from, + std::size_t offset, + PVScalarArrayPtr const & to, + std::size_t toOffset, + std::size_t length); bool isCopyStructureCompatible( - StructureConstPtr from, StructureConstPtr to); - void copyStructure(PVStructure *from, PVStructure *to); + StructureConstPtr const & from, StructureConstPtr const & to); + void copyStructure(PVStructurePtr const & from, PVStructurePtr const & to); bool isCopyStructureArrayCompatible( - StructureArrayConstPtr from, StructureArrayConstPtr to); + StructureArrayConstPtr const & from, StructureArrayConstPtr const & to); void copyStructureArray( - PVStructureArray *from, PVStructureArray *to); - int8 toByte(PVScalar *pv); - int16 toShort(PVScalar *pv); - int32 toInt(PVScalar *pv); - int64 toLong(PVScalar *pv); - float toFloat(PVScalar *pv); - double toDouble(PVScalar *pv); - String toString(PVScalar *pv); - void fromByte(PVScalar *pv,int8 from); - void fromShort(PVScalar *pv,int16 from); - void fromInt(PVScalar *pv, int32 from); - void fromLong(PVScalar *pv, int64 from); - void fromFloat(PVScalar* pv, float from); - void fromDouble(PVScalar *pv, double from); - int toByteArray(PVScalarArray *pv, int offset, int length, - ByteArray to, int toOffset); - int toShortArray(PVScalarArray *pv, int offset, int length, - ShortArray to, int toOffset); - int toIntArray(PVScalarArray *pv, int offset, int length, - IntArray to, int toOffset); - int toLongArray(PVScalarArray *pv, int offset, int length, - LongArray to, int toOffset); - int toFloatArray(PVScalarArray *pv, int offset, int length, - FloatArray to, int toOffset); - int toDoubleArray(PVScalarArray *pv, int offset, int length, - DoubleArray to, int toOffset); - int fromByteArray(PVScalarArray *pv, int offset, int length, - ByteArray from, int fromOffset); - int fromShortArray(PVScalarArray *pv, int offset, int length, - ShortArray from, int fromOffset); - int fromIntArray(PVScalarArray *pv, int offset, int length, - IntArray from, int fromOffset); - int fromLongArray(PVScalarArray *pv, int offset, int length, - LongArray from, int fromOffset); - int fromFloatArray(PVScalarArray *pv, int offset, int length, - FloatArray from, int fromOffset); - int fromDoubleArray(PVScalarArray *pv, int offset, int length, - DoubleArray from, int fromOffset); - void newLine(StringBuilder buf, int indentLevel); -}; + PVStructureArrayPtr const & from, PVStructureArrayPtr const & to); + int8 toByte(PVScalarPtr const & pv); + int16 toShort(PVScalarPtr const & pv); + int32 toInt(PVScalarPtr const & pv); + int64 toLong(PVScalarPtr const & pv); + uint8 toUByte(PVScalarPtr const & pv); + uint16 toUShort(PVScalarPtr const & pv); + uint32 toUInt(PVScalarPtr const & pv); + uint64 toULong(PVScalarPtr const & pv); + float toFloat(PVScalarPtr const & pv); + double toDouble(PVScalarPtr const & pv); + String toString(PVScalarPtr const & pv); + void fromByte(PVScalarPtr const & pv,int8 from); + void fromShort(PVScalarPtr const & pv,int16 from); + void fromInt(PVScalarPtr const & pv, int32 from); + void fromLong(PVScalarPtr const & pv, int64 from); + void fromUByte(PVScalarPtr const & pv,uint8 from); + void fromUShort(PVScalarPtr const & pv,uint16 from); + void fromUInt(PVScalarPtr const & pv, uint32 from); + void fromULong(PVScalarPtr const & pv, uint64 from); + void fromFloat(PVScalarPtr const & pv, float from); + void fromDouble(PVScalarPtr const & pv, double from); + std::size_t toByteArray(PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + int8* to, + std::size_t toOffset); + std::size_t toShortArray(PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + int16* to, + std::size_t toOffset); + std::size_t toIntArray(PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + int32* to, + std::size_t toOffset); + std::size_t toLongArray(PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + int64* to, + std::size_t toOffset); + std::size_t toUByteArray(PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + uint8* to, + std::size_t toOffset); + std::size_t toUShortArray(PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + uint16* to, + std::size_t toOffset); + std::size_t toUIntArray( + PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + uint32* to, + std::size_t toOffset); + std::size_t toULongArray( + PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + uint64* to, + std::size_t toOffset); + std::size_t toFloatArray( + PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + float* to, + std::size_t toOffset); + std::size_t toDoubleArray( + PVScalarArrayPtr const & pv, + std::size_t offset, + std::size_t length, + double* to, std::size_t + toOffset); + std::size_t fromByteArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const int8* from, std::size_t fromOffset); + std::size_t fromByteArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const ByteArray & from, std::size_t fromOffset); + std::size_t fromShortArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const int16* from, std::size_t fromOffset); + std::size_t fromShortArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const ShortArray & from, std::size_t fromOffset); + std::size_t fromIntArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const int32* from, std::size_t fromOffset); + std::size_t fromIntArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const IntArray & from, std::size_t fromOffset); + std::size_t fromLongArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const int64* from, std::size_t fromOffset); + std::size_t fromLongArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const LongArray & from, std::size_t fromOffset); + std::size_t fromUByteArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const uint8* from, std::size_t fromOffset); + std::size_t fromUByteArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const UByteArray & from, std::size_t fromOffset); + std::size_t fromUShortArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const uint16* from, std::size_t fromOffset); + std::size_t fromUShortArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const UShortArray & from, std::size_t fromOffset); + std::size_t fromUIntArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const uint32* from, std::size_t fromOffset); + std::size_t fromUIntArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const UIntArray & from, std::size_t fromOffset); + std::size_t fromULongArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const uint64* from, std::size_t fromOffset); + std::size_t fromULongArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const ULongArray & from, std::size_t fromOffset); + std::size_t fromFloatArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const float* from, std::size_t fromOffset); + std::size_t fromFloatArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const FloatArray & from, std::size_t fromOffset); + std::size_t fromDoubleArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const double* from, std::size_t fromOffset); + std::size_t fromDoubleArray( + PVScalarArrayPtr & pv, std::size_t offset, std::size_t length, + const DoubleArray & from, std::size_t fromOffset); + void newLine(StringBuilder buf, int indentLevel); + ... +} -extern Convert * getConvert(); +extern ConvertPtr getConvert();

The array methods all return the number of elements copied or converted. -This can be less than len if the -PVField array contains less than len elements.

+This can be less than len if the PVField array contains less than len +elements.

-

newLine is a convenience method -for code that implements toString It +

newLine is a convenience method for code that implements toString It generates a newline and inserts blanks at the beginning of the newline.

-
-

Namespace and Memory Management

-
+

pvDataApp/property

-

Namespace

- -

All code in project pvDataCPP appears in namespace:

-
namespace epics { namespace pvData {
-     // ...
-}}
- -

Memory Managemment

- -

NoDefaultMethods

- -

Any class that does not want the compiler to generate default methods can -privately extend the following class which is defined in file -noDefaultMethods.h:

-
class NoDefaultMethods {
-protected:
-    // allow by derived objects
-    NoDefaultMethods(){};
-    ~NoDefaultMethods(){}
-private:
-    // do not implment
-    NoDefaultMethods(const NoDefaultMethods&);
-    NoDefaultMethods & operator=(const NoDefaultMethods &);
-};
- -

PVData introspection objects

- -

Introspection objects are meant to be shared. They are all made available -via std::tri::shared_pointer.

- -

PVData data objects

- -

All PVData data objects must publically extend PVField, which does not allow -default methods but does have a virtual destructor. It is expected that each -data object is "owned" by some entity. For example a pvIOC (not implemented) -database will own all records and thus all PVData data objects in the database. -It is the ONLY entity that will create and destroy the data objects. All other -code only receives pointers to the data objects. Before a record is deleted any -code that is connected to a record is notified before the record is deleted. -After deletion all pointers to data in the record are invalid. Similarly -pvAccess creates and destroys PVData objects and notifies clients before -destroying PVData data objects.

- -

Other code in this project

- -

The classes in property, i.e. alarm, timeStamp, display, and control are all -meant to be free copied and shared. They can be created on the stack. In most -cases it is not necessary to create them on the heap.

- -

Other clases privately extend NoDefaultClasses and are not normally meant to -be extended. Thus they can only be created via "new" and must be destroyed via -"delete".

-
- -

Examples

-
- -

Accessing PVData

- -

Assume that code wants to print two fields from a PVStructure:

-
-
value
-
Must be a PVDouble.
-
timeStamp
-
Just look for field with this name.
-
- -

The following code uses introspection to get the desired information.

-
void getValueAndTimeStamp(PVStructurePtr pvStructure,StringBuilder buf) {
-   PVField *valuePV = pvStructure->getSubField(String("value"));
-   if(valuePV==0) {
-       buf += "value field not found";
-       return;
-   }
-   buf += "value ";
-   valuePV->toString(buf);
-   PVField *timeStampPV = pvStructure->getSubField(String("timeStamp"));
-   if(timeStampPV==0) {
-       buf += "timeStamp field not found";
-       return;
-   }
-   buf += " timeStamp ";
-   timeStampPV->toString(buf);
-}
- -

Creating PVData

- -

Example of creating a scalar field.

-
    PVDataCreate *pvDataCreate = getPVDataCreate();
-    PVDouble *pvValue = pvDataCreate->createPVScalar(
-      0,
-      String("value"),
-      pvDouble);
- -

Create an alarm structure the hard way

-
    FieldCreate *fieldCreate = getFieldCreate();
-    PVDataCreate *pvDataCreate = getPVDataCreate();
-    FieldConstPtrArray fields = new FieldConstPtr[2];
-    fields[0] = fieldCreate->createScalar(String("severity"),pvInt);
-    fields[1] = fieldCreate->createScalar(String("message"),pvString);
-    StructureConstPtralarmField = fieldCreate->createStructure(String("alarm"),2,fields);
- -

Create an alarm structure the easy way.

-
    StandardPVField *standardPVField = getStandardPVField();
-    PVStructure *pvAlarm = standardPVField->alarm(parent);
- -

Create a PVStructure with field name example that has a double value field -and a timeStamp and alarm. Do it the easy way.

-
    StandardPVField *standardPVField = getStandardPVField();
-    PVStructure *pvStructure = standardPVField->scalar(
-        0, //parent is null
-        String("example"),
-        String("timeStamp,alarm"))
-
- -

Property

-
- -

Definition of Property

+

Definition of Property

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 @@ -2297,82 +1847,105 @@ 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 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. -

+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 top level structure has a single value field. The value field has properties alarm, timeStamp, and display.

structure counterOutput
-    structure alarm
-    structure timeStamp
     double value
-    structure display
+    alarm_t
+        int severity 0
+        int status 0
+        string message
+    double value
+    display_t
+        double limitLow 0.0
+        double limitHigh 10.0
         string description "Sample Description"
         string format "%f"
-        string units volts
-        structure limit
-            double low 0.0
-            double high 10.0
+ string units volts

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.

-
structure powerSupplyValueStructure
+
structure powerSupplyValue
     double value
-    structure alarm
+    alarm_t
+        int severity 0
+        int status 0
+        string message
 
 structure powerSupplySimple
-    structure alarm
-    structure timeStamp
-    powerSupplyValueStructure voltage
-    powerSupplyValueStructure power
-    powerSupplyValueStructure current
+ alarm_t + int severity 0 + int status 0 + string message + timeStamp_t + long secondsPastEpoch + int nanoSeconds + int userTag + powerSupplyValue_t voltage + double value + alarm_t + int severity 0 + int status 0 + string message + powerSupplyValue_t power + double value + alarm_t + int severity 0 + int status 0 + string message + powerSupplyValue_t current + double value + alarm_t + int severity 0 + int status 0 + string message
-

Standard Properties

+

Standard Properties

The following field names have special meaning, i.e. support properties for general purpose clients.

-
value
+
value
This is normally defined since most general purpose clients access this field. All other fields in the structure support or describe the value field. The type can any supported type but is usually one of the following:
-
scalar
-
One of boolean, byte, short, int, long, float, double, or - string
-
scalarArray
+
scalar
+
Any of the scalar types.
+
scalarArray
An array with the elementType being a scalar type
-
enumerated structure
-
A structure that includes fields named index, choice, and - choices. index is an int that selects a choice. choice is the - currently selected choice. choices is an array of strings that - defines the complete set of choices.
-
other
+
enumerated structure
+
A structure that includes fields named index and choices. index + is an int that selects a choice. choices is an array of strings + that defines the complete set of choices.
+
other
Other structure or array types can also be defined if clients and support code agree on the meaning. Some examples are: 1) A structure defining a 2D matrix, 2) A structure defining an image, 3) A structure that simulates a remote method, ...
-
timeStamp
+
timeStamp
The timeStamp. The type MUST be a timeStamp structure. Also if the PVData structure does not have a timeStamp then a search up the parent tree is made to find a timeStamp.
-
alarm
+
alarm
The alarm. The type MUST be an alarm structure.
-
display
+
display
A display structure as described below. It provides display characteristics for the value field.
-
control
+
control
A control structure as described below. It provides control characteristics for the value field.
-
history
+
history
Provides a history buffer for the value field. Note that currently - PVData does not define history support.
-
other
+ PVData does not define history suppoprt. +
other
Other standard properties can be defined.
@@ -2380,38 +1953,37 @@ general purpose clients.

field but are not recognized by most general purpose client tools. Typical examples are:

-
input
+
input
A field with support that changes the value field. This can be anything. It can be a channel access link. It can obtain a value from hardware. Etc.
-
valueAlarm
+
valueAlarm
A field with support that looks for alarm conditions based on the value.
-
output
+
output
A field with support that reads the current value and sends it somewhere else. This can be anything. It can be a channel access link. It can write a value to hardware. Etc.

The model allows for device records. A device record has structure fields -that support the PVData data model. For example a powerSupport record can have -fields power, voltage, current that each support the PVData data model.

+that that support the PVData data model. For example a powerSupport record can +have fields power, voltage, current that each support the PVData data model. +

-

Overview of Property Support

+

Overview of Property Support

Except for enumerated, each property has two files: a property.h and a -pvProperty.h . For example: timeStamp.h -and pvTimeStamp.h In each case the +pvProperty.h . For example: timeStamp.h and pvTimeStamp.h In each case the property.h file defined methods for manipulating the property data and the pvProperty.h provides methods to transfer the property data to/from a pvData structure.

All methods copy data via copy by value semantics, i.e. not by pointer or by -reference. No property class calls new -or delete and all allow the compiler to +reference. No property class calls new or delete and all allow the compiler to generate default methods. All allow a class instance to be generated on the stack. For example the following is permitted:

-
void example(PVField *pvField) {
+
void example(PVFieldPtr const &pvField) {
     Alarm alarm;
     PVAlarm pvAlarm;
     bool result;
@@ -2426,13 +1998,13 @@ stack. For example the following is permitted:

... }
-

timeStamp

+

timeStamp

A timeStamp is represented by the following structure

structure timeStamp
-    int64 secondsPartEpoch
-    int32 nanoSeconds
-    int32 userTag
+ long secondsPartEpoch + int nanoSeconds + int userTag

The Epoch is the posix epoch, i.e. Jan 1, 1970 00:00:00 UTC. Both the seconds and nanoSeconds are signed integers and thus can be negative. Since the @@ -2443,39 +2015,47 @@ is greater than a little more than 2 seconds of less that about -2 seconds. The support code always adjust seconds so that the nanoSecconds part is normlized, i. e. it has is 0<=nanoSeconds<nanoSecPerSec..

-

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

+

Two header files are provided for manipulating time stamps:

+
+
timeStamp.h
+
Defines a time stamp independent of pvData, i.e. it is a generally + useful class for manipulating timeStamps.
+
pvTimeStamp.h
+
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
+
-

timeStamp.h

+

timeStamp.h

This provides

extern int32 milliSecPerSec;
 extern int32 microSecPerSec;
-extern int32 ;
+extern int32 nanoSecPerSec;
 extern int64 posixEpochAtEpicsEpoch;
 
 class TimeStamp {
 public:
-    TimeStamp();
-    TimeStamp(int64 secondsPastEpoch,int32 nanoSeconds = 0);
+    TimeStamp()
+    :secondsPastEpoch(0), nanoSeconds(0), userTag(0) {}
+    TimeStamp(int64 secondsPastEpoch,int32 nanoSeconds = 0,int32 userTag = 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;
-    int32 getUserTag() const;
-    void setUserTag(int userTag);
-    void put(int64 secondsPastEpoch,int32 nanoSeconds = 0);
+    int64 getSecondsPastEpoch() const {return secondsPastEpoch;}
+    int64 getEpicsSecondsPastEpoch() const {
+        return secondsPastEpoch - posixEpochAtEpicsEpoch;
+    }
+    int32 getNanoSeconds() const  {return nanoSeconds;}
+    int32 getUserTag() const {return userTag;}
+    void setUserTag(int userTag) {this->userTag = userTag;}
+    void put(int64 secondsPastEpoch,int32 nanoSeconds = 0) {
+        this->secondsPastEpoch = secondsPastEpoch;
+        this->nanoSeconds = nanoSeconds;
+        normalize();
+    }
     void put(int64 milliseconds);
     void getCurrent();
     double toSeconds() const ;
@@ -2491,56 +2071,53 @@ public:
     TimeStamp & operator+=(double seconds);
     TimeStamp & operator-=(double seconds);
     int64 getMilliseconds(); // milliseconds since epoch
-};
+ ... +}

where

-
TimeStamp()
+
TimeStamp()
The defauly constuctor. Both seconds and nanoSeconds are set to 0.
-
TimeStamp(int64 secondsPastEpoch,int32 - nanoSeconds = 0)
+
TimeStamp(int64 secondsPastEpoch,int32 nanoSeconds = 0)
A constructor that gives initial values to seconds and nanoseconds.
-
normalize
+
normalize
Adjust seconds and nanoSeconds so that 0<=nanoSeconds<nanoSecPerSec.
-
fromTime_t
+
fromTime_t
Set time from standard C time.
-
toTime_t
+
toTime_t
Convert timeStamp to standard C time.
-
getSecondsPastEpoch
+
getSecondsPastEpoch
Get the number of seconds since the epoch.
-
getEpicsSecondsPastEpoch
+
getEpicsSecondsPastEpoch
Get the number of EPICS seconds since the epoch. EPICS uses Jan 1, 1990 00:00:00 UTC as the epoch.
-
getNanoSeconds
+
getNanoSeconds
Get the number of nanoSeconds. This is always normalized.
-
getUserTag
+
getUserTag
Get the userTag.
-
setUserTag
+
setUserTag
Set the userTag.
-
put(int64 secondsPastEpoch,int32 - nanoSeconds = 0)
+
put(int64 secondsPastEpoch,int32 nanoSeconds = 0)
Set the timeStamp value. If necessary it will be normalized.
-
put(int64 milliseconds)
+
put(int64 milliseconds)
Set the timeStamp with a value the is the number of milliSeconds since the epoch.
-
getCurrent()
+
getCurrent()
Set the timeStamp to the current time.
-
toSeconds()
+
toSeconds()
Convert the timeStamp to a value that is the number of seconds since the epocj
-
operator =
-
operator!=
-
operator<=
-
operator<
-
operator>=
-
operator>
+
operator =
+
operator!=
+
operator<=
+
operator<
+
operator>=
+
operator>
Standard C++ operators.
-
diff
+
diff
diff = a - b
-
getMilliseconds
+
getMilliseconds
Get the number of milliseconds since the epoch.
@@ -2563,14 +2140,14 @@ execute. This is done as follows:

endTime.getCurrent(); double time = TimeStamp::diff(endTime,startTime); -

pvTimeStamp.h

+

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);
+    bool attach(PVFieldPtr const &pvField);
     void detach();
     bool isAttached();
     // following throw logic_error if not attached to PVField
@@ -2581,51 +2158,50 @@ public:
 
 

where

-
PVTimeStamp
+
PVTimeStamp
The default constructor. Attach must be called before get or set can be called.
-
attach
-
Attempts to attach to pvField It returns (false,true) if a - timeStamp structure is found. It looks first at pvField itself and if is - not an appropriate pvData structure but the field name is value it looks - up the parent structure tree.
-
detach
+
attach
+
Attempts to attach to pvField It returns (false,true) if a timeStamp + structure is found. It looks first at pvField itself and if is not an + appropriate pvData structure but the field name is value it looks up the + parent structure tree.
+
detach
Detach from the pvData structure.
-
isAttached
+
isAttached
Is there an attachment to a timeStamp structure?
-
get
+
get
Copies data from the pvData structure to a TimeStamp. An exception is thrown if not attached to a pvData structure.
-
set
+
set
Copies data from TimeStamp to the pvData structure. An exception is thrown if not attached to a pvData structure.
-

alarm

+

alarm

An alarm structure is defined as follows:

structure alarm
-    int32 severity
-    int32 status
-    String message
+ int severity + int status + string message

Note that neither severity or status is defined as an enumerated structure. The reason is performance, i. e. prevent passing the array of choice strings -everywhere. The file alarm.h -provides the choice strings. Thus all code that needs to know about alarms -share the exact same choice strings.

+everywhere. The file alarm.h provides the choice strings. Thus all code that +needs to know about alarms share the exact same choice strings.

-

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

+

Two header files are provided for manipulating alarms:

+
+
alarm.h
+
Defines an alarm independent of pvData, i.e. it is a generally useful + class for manipulating alarms.
+
pvAlarm.h
+
A class that can be attached to an alarm pvData structure. It provides + get and set methods to get/set alarm data as defined by alarm.h
+
-

alarm.h

+

alarm.h

enum AlarmSeverity {
  noAlarm,minorAlarm,majorAlarm,invalidAlarm,undefinedAlarm
 };
@@ -2642,10 +2218,10 @@ public:
     static StringArray getSeverityNames();
 };
 
-
-enum AlarmStatus {
-    noStatus,deviceStatus,driverStatus,recordStatus,
-    dbStatus,confStatus,undefinedStatus,clientStatus
+class AlarmStatusFunc {
+public:
+    static AlarmStatus getStatus(int value);
+    static StringArray getStatusNames();
 };
 
 class Alarm {
@@ -2662,134 +2238,135 @@ public:
 
 

Alarm Severity defines the possible alarm severities:

-
getSeverity
+
getSeverity
Get the alarm severity corresponding to the integer value.
-
getSeverityNames
+
getSeverityNames
Get the array of severity choices.

Alarm Status defines the possible choices for alarm status:

-
getStatus
+
getStatus
Get the alarm status corresponding to the integer value.
-
getStatusNames
+
getStatusNames
Get the array of status choices.

Alarm has the methods:

-
Alarm
+
Alarm
The constructor. It sets the severity to no alarm and the message to "".
-
getMessage
+
getMessage
Get the message.
-
setMessage
+
setMessage
Set the message.
-
getSeverity
+
getSeverity
Get the severity.
-
setSeverity
+
setSeverity
Set the severity.
-
getStatus
+
getStatus
Get the status.
-
setStatus
+
setStatus
Set the status.
-

pvAlarm.h

+

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);
+    bool attach(PVFieldPtr const &pvField);
     void detach();
     bool isAttached();
     // each of the following throws logic_error is not attached to PVField
     // set returns false if field is immutable
-    void get(Alarm &) const;
+    void get(Alarm & alarm) const;
     bool set(Alarm const & alarm); 
 };

where

-
PVAlarm
+
PVAlarm
The default constructor. Attach must be called before get or set can be called.
-
attach
-
Attempts to attach to pvField It returns (false,true) if - it found an appropriate pvData structure. It looks first a pvField itself - and if is not an appropriate pvData structure but the field name is value - it looks to see if the parent structure has an appropriate sub - structure.
-
detach
+
attach
+
Attempts to attach to pvField It returns (false,true) if it found an + appropriate pvData structure. It looks first a pvField itself and if is + not an appropriate pvData structure but the field name is value it looks + to see if the parent structure has an appropriate sub structure.
+
detach
Just detaches from the pvData structure.
-
isAttached
+
isAttached
Is there an attachment to an alarm structure?
-
get
+
get
Copies data from the pvData structure to an Alarm. An exception is thrown if not attached to a pvData structure.
-
set
+
set
Copies data from Alarm to the pvData structure. An exception is thrown if not attached to a pvData structure.
-

control

+

control

Control information is represented by the following structure

structure control
-    structure limit
-        double low
-        double high
+ double limitLow + double limitHigh + double minStep
-

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

+

Two header files are provided for manipulating control:

+
+
control.h
+
Defines control independent of pvData, i.e. it is a generally useful + class for manipulating control.
+
pvControl.h
+
A class that can be attached to an control pvData structure. It + provides get and set methods to get/set control data as defined by + control.h
+
-

control.h

+

control.h

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

where

-
Control
+
Control
The default constructure.
-
getLow
+
getLow
Get the low limit.
-
getHigh
+
getHigh
Get the high limit.
-
setLow
+
setLow
Set the low limit.
-
setHigh
+
setHigh
Set the high limit.
+
setMinStep
+
Set the minimum step size.
+
getMinStep
+
Get he minimum step size.
-

pvControl.h

+

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);
+    bool attach(PVFieldPtr const &pvField);
     void detach();
     bool isAttached();
     // each of the following throws logic_error is not attached to PVField
@@ -2800,50 +2377,48 @@ public:
 
 

where

-
PVControl
+
PVControl
The default constructor. Attach must be called before get or set can be called.
-
attach
-
Attempts to attach to pvField It returns (false,true) if - it found an appropriate pvData structure. It looks first a pvField itself - and if is not an appropriate pvData structure but the field name is value - it looks to see if the parent structure has an appropriate sub - structure.
-
detach
+
attach
+
Attempts to attach to pvField It returns (false,true) if it found an + appropriate pvData structure. It looks first a pvField itself and if is + not an appropriate pvData structure but the field name is value it looks + to see if the parent structure has an appropriate sub structure.
+
detach
Just detaches from the pvData structure.
-
isAttached
+
isAttached
Is there an attachment to a control structure?
-
get
+
get
Copies data from the pvData structure to a Control. An exception is thrown if not attached to a pvData structure.
-
set
+
set
Copies data from Control to the pvData structure. An exception is thrown if not attached to a pvData structure.
-

display

+

display

Display information is represented by the following structure

structure display
-    structure limit
-        double low
-        double high
+    double limitLow
+    double limitHigh
     string description
     string format
     string units
-

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

+

Two header files are provided for manipulating display:

+
+
display.h
+
Defines display independent of pvData, i.e. it is a generally useful + class for manipulating display.
+
pvDisplay.h
+
A class that can be attached to an display pvData structure. It + provides get and set methods to get/set display data as defined by + display.h
+
-

display.h

+

display.h

class Display {
 public:
     Display();
@@ -2862,38 +2437,38 @@ public:
 
 

where

-
Control
+
Control
The default constructure.
-
getLow
+
getLow
Get the low limit.
-
getHigh
+
getHigh
Get the high limit.
-
setLow
+
setLow
Set the low limit.
-
setHigh
+
setHigh
Set the high limit.
-
getDescription
+
getDescription
Get the description.
-
setDescription
+
setDescription
Set the description.
-
getFormat
+
getFormat
Get the format.
-
setFormat
+
setFormat
Set the format.
-
getUnits
+
getUnits
Get the units.
-
setUnits
+
setUnits
Set the units.
-

pvDisplay.h

+

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); 
+    bool attach(PVFieldPtr const&pvField); 
     void detach();
     bool isAttached();
     // each of the following throws logic_error is not attached to PVField
@@ -2904,37 +2479,34 @@ public:
 
 

where

-
PVDisplay
+
PVDisplay
The default constructor. Attach must be called before get or set can be called.
-
attach
-
Attempts to attach to pvField It returns (false,true) if - it found an appropriate pvData structure. It looks first a pvField itself - and if is not an appropriate pvData structure but the field name is value - it looks to see if the parent structure has an appropriate sub - structure.
-
detach
+
attach
+
Attempts to attach to pvField It returns (false,true) if it found an + appropriate pvData structure. It looks first a pvField itself and if is + not an appropriate pvData structure but the field name is value it looks + to see if the parent structure has an appropriate sub structure.
+
detach
Just detaches from the pvData structure.
-
isAttached
+
isAttached
Is there an attachment to a display structure?
-
get
+
get
Copies data from the pvData structure to a Display. An exception is thrown if not attached to a pvData structure.
-
set
+
set
Copies data from Display to the pvData structure. An exception is thrown if not attached to a pvData structure.
-

pvEnumerated

+

pvEnumerated.h

An enumerated structure is a structure that has fields:

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

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

+

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

class PVEnumerated {
 public:
     PVEnumerated();
@@ -2942,7 +2514,7 @@ public:
     //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);
+    bool attach(PVFieldPtr const &pvField);
     void detach();
     bool isAttached();
     // each of the following throws logic_error is not attached to PVField
@@ -2953,48 +2525,117 @@ public:
     bool choicesMutable();
     StringArray getChoices();
     int32 getNumberChoices();
-    bool setChoices(StringArray choices,int32 numberChoices);
+    bool setChoices(StringArray &choices,int32 numberChoices);
 };

where

-
PVEnumerated
+
PVEnumerated
The default constructor. Attach must be called before any get or set method can be called.
-
attach
-
Attempts to attach to pvField It returns (false,true) if - pvField (is not, is) an enumerated structure.
-
detach
+
attach
+
Attempts to attach to pvField It returns (false,true) if pvField (is + not, is) an enumerated structure.
+
detach
Just detaches from the pvData structure.
-
isAttached
+
isAttached
Is there an attachment to an enemerated structure?
-
setIndex
+
setIndex
Set the index field in the pvData structure. An exception is thrown if not attached to a pvData structure.
-
getIndex
+
getIndex
Get the index field in the pvData structure.
-
getChoice
+
getChoice
Get the String value corresponding to the current index field in the pvData structure. An exception is thrown if not attached to a pvData structure.
-
choicesMutable
+
choicesMutable
Can the choices be changed? Note that this is often true. An exception is thrown if not attached to a pvData structure.
-
getChoices
+
getChoices
Get the array of choices. An exception is thrown if not attached to a pvData structure.
-
getNumberChoices
+
getNumberChoices
Get the number of choices. An exception is thrown if not attached to a pvData structure.
-
setChoices
+
setChoices
Change the choices. An exception is thrown if not attached to a pvData structure.
-
-

PVData Factories

-
+

Examples

+ +

Accessing PVData

+ +

Assume that code wants to print two fields from a PVStructure:

+
+
value
+
Must be a PVDouble.
+
timeStamp
+
Just look for field with this name.
+
+ +

The following code uses introspection to get the desired information.

+
void getValueAndTimeStamp(PVStructurePtr pvStructure,StringBuilder buf) {
+   PVFieldPtr valuePV = pvStructure->getSubField(String("value"));
+   if(valuePV.get()==NULL) {
+       buf += "value field not found";
+       return;
+   }
+   buf += "value ";
+   valuePV->toString(&buf);
+   PVFieldPtr timeStampPV = pvStructure->getSubField(String("timeStamp"));
+   if(timeStampPV.get()==NULL) {
+       buf += "timeStamp field not found";
+       return;
+   }
+   buf += " timeStamp ";
+   timeStampPV->toString(&buf);
+}
+ +

Creating PVData

+ +

Example of creating a scalar field.

+
    PVDataCreatePtr pvDataCreate = getPVDataCreate();
+    PVDoublePtr pvValue = static_pointer_cast<PVDouble>(
+        pvDataCreate->createPVScalar(pvDouble));
+ +

Create a structure with a value and an alarm the hard way

+
    FieldCreatePtr fieldCreate = getFieldCreate();
+    PVDataCreatePtr pvDataCreate = getPVDataCreate();
+    FieldConstPtrArray fields;
+    StringArray names;
+    fields.resize(3);
+    names.resize(3);
+    fields[0] = fieldCreate->createScalar(pvInt);
+    fields[1] = fieldCreate->createScalar(pvInt);
+    fields[2] = fieldCreate->createScalar(pvString);
+    names[0] = "severity";
+    names[0] = "status";
+    names[0] = "message";
+    StructureConstPtr alarmField =  
+        fieldCreate->createStructure(names,fields);
+    fields.resize(2);
+    names.resize(2);
+    fields[0] = fieldCreate->createScalar(pvDouble);
+    fields[1] = alarmField;
+    names[0] = "value";
+    names[0] = "alarm";
+    StructureConstPtr structure =
+        fieldCreate->createStructure(names,fields);
+    PVStructurePtr pv = pvDataCreate->createPVStructure(structure);
+ +

Create an alarm structure the easy way.

+
    StandardPVFieldPtr standardPVField = getStandardPVField();
+    PVStructurePtr pv = standardPVField->scalar(pvDouble,"alarm");
+ +

Create a PVStructure with field name example that has a double value field , +timeStamp, alarm, and display. Do it the easy way.

+
    StandardPVFieldPtr standardPVField = getStandardPVField();
+    PVStructurePtr pvStructure = standardPVField->scalar(
+        pvDouble,"timeStamp,alarm.display");
+ +

pvDataApp/factory

Directory factory has code that implements everything described by the files in directory pv

@@ -3014,64 +2655,63 @@ PVDataCreate and implements getPVDataCreate.

implements getConvert.

Other files implement PVData base classes

-
-

Miscellanous Classes

-
+

pvDataAPP/misc

-

Overview

+

Overview

This package provides utility code:

-
bitSet.h
+
bitSet.h
An implementation of BitSet that can be serialized.
-
byteBuffer.h
+
byteBuffer.h
Used to serialize objects.
-
event.h
-
Signal and wait for an event.
-
exception.h
+
destroyable.h
+
Provides method destroy.
+
epicsException.h
Exception with stack trace.
-
executor.h
+
event.h
+
Signal and wait for an event.
+
executor.h
Provides a thread for executing commands.
-
linkedList.h
-
A double linked list facility that requires the user to allocate a - node. It is more efficient that std::list and does not require the - implementation to allocate storage for the nodes.
-
lock.h
+
lock.h
Support for locking and unlocking.
-
messageQueue.h
+
messageQueue.h
Support for queuing messages to give to requesters.
-
noDefaultMethods.h
+
noDefaultMethods.h
When privately extended prevents compiler from implementing default methods.
-
requester.h
-
Allows messages to be sent to a requester.
-
serialize.h
-
Support for serializing objects.
-
CDRMonitor.h
-
Provides support monitoring memory usage for objects of a class.
-
status.h
-
A way to pass status information to a client.
-
thread.h
-
Provides thread support.
-
timeFunction.h
-
Time how long a function call requires.
-
timer.h
-
An implementation of Timer that does not require an object to be - created for each timer request.
-
queue.h
+
queue.h
A queue implementation that allows the latest queue element to continue to be used when no free element is available.
+
requester.h
+
Allows messages to be sent to a requester.
+
serialize.h
+
Support for serializing objects.
+
serializeHelper.h
+
More support for serializing objects.
+
sharedPtr.h
+
Defines POINTER_DEFINITIONS.
+
status.h
+
A way to pass status information to a client.
+
thread.h
+
Provides thread support.
+
timeFunction.h
+
Time how long a function call requires.
+
timer.h
+
An implementation of Timer that does not require an object to be + created for each timer request.

Note that directory testApp/misc has test code for all the classes in misc. The test code also can be used as examples.

-

BitSet

+

bitSet.h

This is adapted from the java.util.BitSet. bitSet.h is:

-
class BitSet /*: public Serializable*/ {
+
class BitSet : public Serializable {
 public:
+    static BitSet::shared_pointer create(uint32 nbits);
     BitSet();
     BitSet(uint32 nbits);
     virtual ~BitSet();
@@ -3085,6 +2725,7 @@ public:
     int32 nextClearBit(uint32 fromIndex) const;
     bool isEmpty() const;
     uint32 cardinality() const;
+    uint32 size() const;
     BitSet& operator&=(const BitSet& set);
     BitSet& operator|=(const BitSet& set);
     BitSet& operator^=(const BitSet& set);
@@ -3100,114 +2741,181 @@ private:
 
 

where

-
BitSet()
+
BitSet()
Creates a bitSet of initial size 64 bits. All bits initially false.
-
BitSet(uint32 nbits)
+
BitSet(uint32 nbits)
Creates a bitSet with the initial of the specified number of bits. All bits initially false.
-
~BitSet()
+
~BitSet()
Destructor.
-
flip(uint32 bitIndex)
+
flip(uint32 bitIndex)
Flip the specified bit.
-
set(uint32 bitIndex)
+
set(uint32 bitIndex)
Set the specified bit true.
-
clear(uint32 bitIndex)
+
clear(uint32 bitIndex)
Set the specified bit false.
-
set(uint32 bitIndex, bool value)
+
set(uint32 bitIndex, bool value)
Set the specified bit to value.
-
get(uint32 bitIndex)
+
get(uint32 bitIndex)
Return the state of the specified bit.
-
clear()
+
clear()
Set all bits to false.
-
nextSetBit(uint32 fromIndex)
+
nextSetBit(uint32 fromIndex)
Get the index of the next true bit beginning with the specified bit.
-
nextClearBit(uint32 fromIndex)
+
nextClearBit(uint32 fromIndex)
Get the index of the next false bit beginning with the specified bit.
-
isEmpty()
+
isEmpty()
Return (false,true) if (at least one bit true, all bits are false)
-
cardinality()
+
cardinality()
Return the number of true bits.
-
operator&=(const BitSet& set)
+
size()
+
Returns the number of bits of space actually in use.
+
operator&=(const BitSet& set)
Performs a logical and of this target bit set with the argument bit set. This bit set is modified so that each bit in it has the value true if and only if it both initially had the value true and the corresponding bit in the bit set argument also had the value.
-
operator|=(const BitSet& set)
+
operator|=(const BitSet& set)
Performs a logical or of this target bit set with the argument bit set.
-
operator^=(const BitSet& set)
+
operator^=(const BitSet& set)
Performs a logical exclusive or of this target bit set with the argument bit set.
-
operator-=(const BitSet& set)
+
operator-=(const BitSet& set)

Clears all of the bits in this bitSet whose corresponding bit is set in the specified bitSet.

-
operator=(const BitSet &set)
+
operator=(const BitSet &set)
Assignment operator.
-
or_and(const BitSet& set1, const - BitSet& set2)
+
or_and(const BitSet& set1, const BitSet& set2)
Perform AND operation on set1 and set2, and then OR this bitSet with the result.
-
operator==(const BitSet &set)
+
operator==(const BitSet &set)
Does this bitSet have the same values as the argument.
-
operator!=(const BitSet &set)
+
operator!=(const BitSet &set)
Is this bitSet different than the argument.
-
toString(StringBuilder buffer)
+
toString(StringBuilder buffer)
Show the current values of the bitSet.
-
toString(StringBuilder buffer, int - indentLevel)
+
toString(StringBuilder buffer, int indentLevel)
Show the current values of the bitSet.
+
virtual void serialize(ByteBuffer *buffer,SerializableControl *flusher) + const;
+
Serialize the bitSet
+
virtual void deserialize(ByteBuffer *buffer,DeserializableControl + *flusher);
+
Deserialize the bitSet.
-

ByteBuffer

+

byteBuffer.h

A ByteBuffer is used to serialize and deserialize primitive data. File byteBuffer.h is:

class ByteBuffer {
 public:
-    ByteBuffer(int size = 32, int byteOrder = EPICS_BYTE_ORDER);
+    ByteBuffer(std::size_t size, int byteOrder = EPICS_BYTE_ORDER)
     ~ByteBuffer();
-    ByteBuffer* clear();
-    ByteBuffer* flip();
-    ByteBuffer* rewind();
+    void setEndianess(int byteOrder);
+    const char* getBuffer();
+    void clear();
+    void flip();
+    void rewind();
+    std::size_t getPosition();
+    void setPosition(std::size_t pos);
+    std::size_t getLimit();
+    void setLimit(std::size_t limit);
+    std::size_t getRemaining();
+    std::size_t getSize();
+    template<typename T>
+    void put(T value)
+    template<typename T>
+    void put(std::size_t index, T value);
+    template<typename T>
+    T get()
+    template<typename T>
+    T get(std::size_t index)
+    void put(const char* src, std::size_t src_offset, std::size_t count);
+    void get(char* dest, std::size_t dest_offset, std::size_t count);
+    template<typename T>
+    inline void putArray(T* values, std::size_t count)
+    template<typename T>
+    inline void getArray(T* values, std::size_t count)
+    template<typename T>
+    inline bool reverse();
+    inline void align(std::size_t size)
+    void putBoolean(  bool value);
+    void putByte   (  int8 value);
+    void putShort  ( int16 value);
+    void putInt    ( int32 value);
+    void putLong   ( int64 value);
+    void putFloat  ( float value);
+    void putDouble (double value);
+    void putBoolean(std::size_t  index,  bool value);
+    void putByte   (std::size_t  index,  int8 value);
+    void putShort  (std::size_t  index, int16 value);
+    void putInt    (std::size_t  index, int32 value);
+    void putFloat  (std::size_t  index, float value);
+    void putDouble (std::size_t  index, double value);
     bool getBoolean();
-    int8 getByte();
-    int16 getShort();
-    int32 getInt();
-    int64 getLong();
-    float getFloat();
-    double getDouble();
-    void get(char* dst, int offset, int count);
-    ByteBuffer* put(const char* src, int offset, int count);
-    ByteBuffer* putBoolean(bool value);
-    ByteBuffer* putByte(int8 value);
-    ByteBuffer* putShort(int16 value);
-    ByteBuffer* putInt(int32 value);
-    ByteBuffer* putLong(int64 value);
-    ByteBuffer* putFloat(float value);
-    ByteBuffer* putDouble(double value);
-    inline int getSize() const;
-    inline int getArrayOffset() const;
-    inline int getPosition() const;
-    inline int getLimit() const;
-    inline int getRemaining() const;
-    inline int getByteOrder() const;
-    inline const char* getArray() const;
-    // TODO must define arrays
-private:
+    int8 getByte   ();
+    int16 getShort  ();
+    int32 getInt    ();
+    int64 getLong   ();
+    float getFloat  ();
+    double getDouble ();
+    bool getBoolean(std::size_t  index);
+    int8 getByte   (std::size_t  index);
+    int16 getShort  (std::size_t  index);
+    int32 getInt    (std::size_t  index);
+    int64 getLong   (std::size_t  index);
+    float getFloat  (std::size_t  index);
+    double getDouble (std::size_t  index);
+    const char* getArray();
+ ...
 };
-

x

+

destroyable.h

+
class Destroyable  {
+public:
+    POINTER_DEFINITIONS(Destroyable);
+    virtual void destroy() = 0;
+    virtual ~Destroyable() {};
+};
-

Event

+

epicsException.h

+
/*
+ * Throwing exceptions w/ file+line# and, when possibly, a stack trace
+ *
+ * THROW_EXCEPTION1( std::bad_alloc );
+ *
+ * THROW_EXCEPTION2( std::logic_error, "my message" );
+ *
+ * THROW_EXCEPTION( mySpecialException("my message", 42, "hello", ...) );
+ *
+ * Catching exceptions
+ *
+ * catch(std::logic_error& e) {
+ *   fprintf(stderr, "%s happened\n", e.what());
+ *   PRINT_EXCEPTION2(e, stderr);
+ *   cout<<SHOW_EXCEPTION(e);
+ * }
+ *
+ * If the exception was not thrown with the above THROW_EXCEPTION*
+ * the nothing will be printed.
+ */
+ +

event.h

This class provides coordinates activity between threads. One thread can wait for the event and the other signals the event.

-
class Event : private NoDefaultMethods {
+
class Event;
+typedef std::tr1::shared_ptr<Event> EventPtr;
+ 
+class Event {
 public:
-    Event(bool full);
+    POINTER_DEFINITIONS(Event);
+    explicit Event(bool = false);
     ~Event();
     void signal();
     bool wait (); /* blocks until full */
@@ -3215,61 +2923,51 @@ public:
     bool tryWait (); /* false if empty */
 private:
     epicsEventId id;
-};
+};

where

-
Event
+
Event
The constructor. The initial value can be full or empty. The normal first state is empty.
-
signal
+
signal
The event becomes full. The current or next wait will complete.
-
wait
+
wait
Wait until event is full or until timeout. The return value is (false,true) if the wait completed because event (was not, was) full. A false value normally means that that a timeout occured. It is also returned if an error occurs or because the event is being deleted.
-
tryWait
+
tryWait
returns (false,true) if the event is (empty,full)
-

Exception

- -

File epicsException.h describes:

-
class BaseException : public std::exception {
-public:
-    BaseException(const char* message, const char* file,
-        int line, std::exception* cause = 0);
-    virtual ~BaseException();
-    virtual const char* what();
-    void toString(std::string& str, unsigned int depth = 0);
-    static inline void getStackTrace(
-         std::string* trace, unsigned int skip_frames = 0, unsigned int max_frames = 63)
-private:
-     // ...
-}
- -

x

- -

Executor

+

executor.h

An Executor is a thread that can execute commands. The user can request that a single command be executed.

-
class ExecutorNode;
-
+
class Command;
+class Executor;
+typedef std::tr1::shared_ptr<Command> CommandPtr;
+typedef std::tr1::shared_ptr<Executor> ExecutorPtr;
+    
 class Command {
 public:
+    POINTER_DEFINITIONS(Command);
+    virtual ~Command(){}
     virtual void command() = 0;
-};
-
-class Executor : private NoDefaultMethods {
-public:
+private: 
+    CommandPtr next;
+    friend class Executor;
+}; 
+ 
+class Executor :  public Runnable{
+public: 
+    POINTER_DEFINITIONS(Executor);
     Executor(String threadName,ThreadPriority priority);
     ~Executor();
-    ExecutorNode * createNode(Command *command);
-    void execute(ExecutorNode *node);
-private:
-    class ExecutorPvt *pImpl;
+    void execute(CommandPtr const &node);
+    virtual void run();
+ ...
 };

Command is a class that must be implemented by the code that calls execute. @@ -3278,131 +2976,18 @@ execute.

Executor has the methods:

-
Executor
+
Executor
The constructor. A thread name and priority must be specified.
-
~Executor
+
~Executor
The destructor. If any commands remain in the execute list they are not called. All ExecutorNodes that have been created are deleted.
-
createNode
-
Create a ExecutorNode that can be passed to execute.
-
execute
+
execute
Request that command be executed. If it is already on the run list nothing is done.
-

Linked List

- -

LinkedList implements a double linked list that requires a user to allocate -the nodes. It is more efficent that std::list. linkedList.h is a template that -is both a complete description and definition. It uses linkedListVoid for -method definitions. linkedListVoid is not meant for use except via -linkedList.

- -

A node can only be on one list at a time but can be put, at different times, -on different lists as long as they all hold the same type of objects. An -exception is thrown if an attempt is made to put a node on a list if the node -is already on a list.

-
template <typename T>
-class LinkedList;
-
-template <typename T>
-class LinkedListNode : private LinkedListVoidNode {
-public:
-    LinkedListNode(T &object) : LinkedListVoidNode(&object){}
-    ~LinkedListNode() {}
-    T &getObject() { return *static_cast<T *>(LinkedListVoidNode::getObject());}
-    bool isOnList() {return LinkedListVoidNode::isOnList();}
-    friend  class LinkedList<T>;
-};
-
-template <typename T>
-class LinkedList : private LinkedListVoid {
-public:
-    LinkedList() : LinkedListVoid() {}
-    ~LinkedList() {}
-    int getLength();
-    void addTail(LinkedListNode<T> &listNode);
-    void addHead(LinkedListNode<T> &listNode);
-    void insertAfter(LinkedListNode<T> &listNode,LinkedListNode<T> &addNode);
-    void insertBefore(LinkedListNode<T> &listNode,LinkedListNode<T> &addNode);
-    LinkedListNode<T> *removeTail();
-    LinkedListNode<T> *removeHead();
-    void remove(LinkedListNode<T> &listNode);
-    LinkedListNode<T> *getHead();
-    LinkedListNode<T> *getTail();
-    LinkedListNode<T> *getNext(LinkedListNode<T> &listNode);
-    LinkedListNode<T> *getPrev(LinkedListNode<T> &listNode);
-    bool isEmpty();
-};
- -

LinkedListNode has the methods:

-
-
LinkedListNode
-
The constructor. The object must be specified.
-
~LinkedListNode
-
The destructor.
-
getObject
-
Returns the nobject.
-
isOnList
-
returns (false,true) if the node (is not, is) on a list.
-
- -

LinkedList has the methods:

-
-
LinkedList
-
The constructor.
-
~LinkedList
-
The destructor.
-
getLength
-
Get the numbet of nodes currently on the list.
-
addTail
-
Add a node to the end of the list. An exception is thrown if the node - is already on a list.
-
addHead
-
Add a node to the beginning of the list. An exception is thrown if the - node is already on a list.
-
insertAfter
-
Insert addNode after node. An exception is thrown if the addNode is - already on a list or if node is not on this list..
-
insertBefore
-
Insert addNode before node. An exception is thrown if the addNode is - already on a list or if node is not on this list.
-
removeTail
-
Remove and return the last node. Null is returned if the list is - empty.
-
removeHead
-
Remove and return the first node. Null is returned if the list is - empty.
-
remove
-
Remove the specified node or object. An exception is thrown if the node - is not on a list.
-
getHead
-
Get the first list node. Null is returned if the list is empty.
-
getTail
-
Get the last list node. Null is returned if the list is empty.
-
getNext
-
Get the node after node. An exception is thrown if node is not on this - list. Null is returned if the is node is the last node on the list.
-
getPrev
-
Get the node before node. An exception is thrown if node is not on this - list. Null is returned if the is node is the first node on the list.
-
isEmpty
-
Is the list empty.
-
contains
-
Does the list contain the specified object?
-
- -

Lock and Mutex

- -

lock.h is:

-
class Mutex  {
-public:
-    Mutex();
-    ~Mutex();
-    void lock();
-    void unlock();
-};
-
+

lock.h

+
typedef epicsMutex Mutex;
 
 class Lock : private NoDefaultMethods {
 public:
@@ -3411,6 +2996,7 @@ public:
     void lock();
     void unlock();
     bool ownsLock() ;
+ ...
 };

Lock is as easy to use as Java synchronize. To protect some object just @@ -3441,74 +3027,79 @@ once. This can be implemented as follows:

// initialization }
-

Message Queue

+

messageQueue.h

-

Definitions

-
class MessageNode {
+

Definitions

+ +

A messageQueue is for use by code that wants to handle messages without +blocking higher priority threads.

+
class MessageNode;
+class MessageQueue;
+typedef std::tr1::shared_ptr<MessageNode> MessageNodePtr;
+typedef std::vector<MessageNodePtr> MessageNodePtrArray;
+typedef std::tr1::shared_ptr<MessageQueue> MessageQueuePtr;
+
+class MessageNode {
 public:
     String getMessage() const;
     MessageType getMessageType() const;
     void setMessageNull();
 };
 
-class MessageQueue : private NoDefaultMethods {
+class MessageQueue : public Queue<MessageNode> {
 public:
-    MessageQueue(int size);
-    ~MessageQueue();
-    MessageNode *get();
+    POINTER_DEFINITIONS(MessageQueue);
+    static MessageQueuePtr create(int size);
+    MessageQueue(MessageNodePtrArray &nodeArray);
+    virtual ~MessageQueue();
+    MessageNodePtr &get();
     // must call release before next get
     void release();
     // return (false,true) if message (was not, was) put into queue
     bool put(String message,MessageType messageType,bool replaceLast);
-    bool isEmpty() const;
-    bool isFull() const;
+    bool isEmpty() ;
+    bool isFull() ;
     int getClearOverrun();
+ ...
 };
-

MessageQueue

- -

This is for use by code that wants to handle messages without blocking -higher priority threads.

-

A messageNode is a class with two public data members:

-
getMessage
+
getMessage
The message.
-
getMessageType
+
getMessageType
The message type.
-
setMessageNull
+
setMessageNull
Set the message to be a null string.

A messageQueue is an interface with public methods:

-
MessageQueue
+
MessageQueue
The constructor. The queue size must be specified.
-
~MessageQueue
+
~MessageQueue
The destructor.
-
put
+
put
Put a new message into the queue. False is returned if the queue was - full and true otherwise. If replaceLast is true then the last message is + full and true otherwise. If replaceLast is true then the last message is replaced with this message.
-
get
+
get
Get the oldest queue element. If the queue is empty null is returned. Before the next get can be issued release must be called.
-
release
+
release
Release the queue element returned by the last get.
-
isEmpty
+
isEmpty
Is the queue empty?
-
isFull
+
isFull
Is the queue full?
-
getClearOverrun
+
getClearOverrun
Get the number of times put has been called but no free element is available.

Look at miscTest/testMessageQueue.cpp for an example.

-

NoDefaultMethods

+

noDefaultMethods.h

If a class privately extends this class then the compiler can not create any of the following: default constructor, default copy constructror, or default @@ -3527,7 +3118,90 @@ assignment contructor.

NoDefaultMethods & operator=(const NoDefaultMethods &); };
-

Requester

+

queue.h

+ +

This provides a queue which has an immutable capacity. When the queue is +full the user code is expected to keep using the current element until a new +free element becomes avalable.

+
template <typename T>
+class Queue
+{   
+public:
+    POINTER_DEFINITIONS(Queue);
+    typedef std::tr1::shared_ptr<T> queueElementPtr;
+    typedef std::vector<queueElementPtr> queueElementPtrArray;
+    Queue(queueElementPtrArray &);
+    virtual ~Queue();
+    void clear();
+    int capacity();
+    int getNumberFree();
+    int getNumberUsed();
+    queueElementPtr & getFree();
+    void setUsed(queueElementPtr &element);
+    queueElementPtr & getUsed();
+    void releaseUsed(queueElementPtr &element);
+ ...
+};
+ +

testApp/misc/testQueue.cpp provides an example of how to define a queue.

+ +

The queue methods are:

+
+
clear
+
Make the queue empty.
+
getNumberFree
+
Get the number of free elements in the queue.
+
capacity
+
Get the capacity, i.e. the maximun number of elements the queue can + hold.
+
getNumberFree
+
Get the number of free elements.
+
getNumberUsed
+
Get the number of elements used.
+
getFree
+
Get the next free element. Null is returned if no free elements are + available. If a non null value is returned then the element belongs to + the caller until setUsed is called.
+
setUsed
+
Set a queue element used. This must be the element returned by the last + call to getFree.
+
getUsed
+
Get the next used element of null if no more used elements are + available.
+
releaseUsed
+
Set a queue element free. This must be the element returned by the last + call to getUsed.
+
+ +

A queue is created as follows:

+
   class MyClass;
+   typedef MyQueueElement<MyClass> MyElement;
+   typedef MyQueue<MyClass> MyQueue;
+   int numElement = 5;
+   ...
+   MyClass *array[numElements];
+   for(int i=0; i<numElements; i++) {
+        array[i] = new MyClass();
+   }
+   MyQueue *queue = new MyQueue(array,numElements);
+ +

A producer calls getFree and setUsed via code like the following:

+
   MyClass *getFree() {
+       MyElement *element = queue->getFree();
+       if(element==0) return 0;
+       return element->getObject();
+  }
+ +

A consumer calls getUsed and releaseUsed via code like the following:

+
     while(true) {
+         MyElement *element = queue->getUsed();
+         if(element==0) break;
+         MyClass *myClass = element->getObject();
+         // do something with myClass
+         queue->releaseUsed(element);
+     }
+ +

requester.h

A PVField extends Requester. Requester is present so that when database errors are found there is someplace to send a message.

@@ -3535,29 +3209,85 @@ errors are found there is someplace to send a message.

infoMessage,warningMessage,errorMessage,fatalErrorMessage }; -extern StringArray messageTypeName; - +extern String getMessageTypeName(MessageType messageType); +extern const size_t messageTypeCount; class Requester { public: + POINTER_DEFINITIONS(Requester); + virtual ~Requester(){} virtual String getRequesterName() = 0; virtual void message(String message,MessageType messageType) = 0; };

where

-
-
MessageType
+
+
MessageType
Type of message.
-
messageTypeName
+
messageTypeName
An array of strings of the message type names, i.e. String("info"),String("warning"),String("error"),String("fatalError").
-
getRequesterName
+
getRequesterName
Returns the requester name.
-
message
+
message
Gives a message to the requester.
-

Serialize

+

serialize.h

+
    class SerializableControl;
+    class DeserializableControl;
+    class Serializable;
+    class BitSetSerializable;
+    class SerializableArray;
+    class BitSet;
+    class Field;
+
+    class SerializableControl {
+    public:
+        virtual ~SerializableControl(){}
+        virtual void flushSerializeBuffer() =0;
+        virtual void ensureBuffer(std::size_t size) =0;
+        virtual void alignBuffer(std::size_t alignment) =0;
+        virtual void cachedSerialize(
+            std::tr1::shared_ptr<const Field> const & field,
+            ByteBuffer* buffer) = 0;
+    };
+
+    class DeserializableControl {
+    public:
+        virtual ~DeserializableControl(){}
+        virtual void ensureData(std::size_t size) =0;
+        virtual void alignData(std::size_t alignment) =0;
+        virtual std::tr1::shared_ptr<const Field> cachedDeserialize(ByteBuffer* buffer) = 0;
+    };
+
+    class Serializable {
+    public:
+        virtual ~Serializable(){}
+        virtual void serialize(ByteBuffer *buffer,
+            SerializableControl *flusher) const = 0;
+        virtual void deserialize(ByteBuffer *buffer,
+            DeserializableControl *flusher) = 0;
+    };
+
+    class BitSetSerializable {
+    public:
+        virtual ~BitSetSerializable(){}
+        virtual void serialize(ByteBuffer *buffer,
+            SerializableControl *flusher,BitSet *bitSet) const = 0;
+        virtual void deserialize(ByteBuffer *buffer,
+            DeserializableControl *flusher,BitSet *bitSet) = 0;
+    };
+
+
+    class SerializableArray : virtual public Serializable {
+    public:
+        virtual ~SerializableArray(){}
+        virtual void serialize(ByteBuffer *buffer,
+            SerializableControl *flusher, std::size_t offset, std::size_t count) const = 0;
+    };
+ +

serializeHelper.h

This is a helper class for serialization, which is required for sending and receiving pvData over the nerwork.

@@ -3574,96 +3304,31 @@ public: SerializableControl* flusher); static String deserializeString(ByteBuffer* buffer, DeserializableControl* control); -private: -}; - -class SerializableControl { -public: - virtual void flushSerializeBuffer() =0; - virtual void ensureBuffer(int size) =0; -}; -class DeserializableControl { - -public: - virtual void ensureData(int size) =0; -}; -class Serializable { -public: - virtual void serialize(ByteBuffer *buffer, - SerializableControl *flusher) = 0; - virtual void deserialize(ByteBuffer *buffer, - DeserializableControl *flusher) = 0; -}; -class BitSetSerializable { -public: - virtual void serialize(ByteBuffer *buffer, - SerializableControl *flusher,BitSet *bitSet) = 0; - virtual void deserialize(ByteBuffer *buffer, - DeserializableControl *flusher,BitSet *bitSet) = 0; -}; -class SerializableArray : public Serializable { -public: - virtual void serialize(ByteBuffer *buffer, - SerializableControl *flusher, int offset, int count) = 0; + ... };

where

-
writeSize
+
writeSize
Serialize the size.
-
readSize
+
readSize
Deserialize the size.
-
serializeString
+
serializeString
Serialize a String.
-
serializeSubstring
+
serializeSubstring
Serialize a substring.
-
deserializeString
+
deserializeString
Deserialize a string.
-

The following interfaces are called by pvAccess for transporting data over -the network. The abstract and base classes ensure that these methods are -properly implemented.

-
x
+

sharedPtr.h

+
#define POINTER_DEFINITIONS(clazz) \
+    typedef std::tr1::shared_ptr<clazz> shared_pointer; \
+    typedef std::tr1::shared_ptr<const clazz> const_shared_pointer; \
+    typedef std::tr1::weak_ptr<clazz> weak_pointer; \
+    typedef std::tr1::weak_ptr<const clazz> const_weak_pointer;
-

x

- -

CDRMonitor - Monitor and Report -Construction and Destruction

- -

This is a facility that allows a class to report how many objects of that -class have been created and destroyed. This can help find memory leaks.

-
struct CDRCount {
-     size_t cons, dtys;
-     long refs;
-};
-
-class CDRMonitor : private NoDefaultMethods {
-public:
-    static CDRMonitor& get();
-    CDRNode* addNode(CDRNode& next);
-    CDRCount current();
-    CDRNode* first();
-    CDRNode* first();
-    void show(FILE*)
-    void show(std::ostream&) const;
-};
-class CDRNode : private NoDefaultMethods {
-public:
-    CDRNode(const String& name);
-    void construct();
-    void destruct(){Lock x(guard);
-     void incRef();
-    void decRef();
-    CDRNode* next();
-     CDRCount get();
-    void show(FILE*);
-    void show(std::ostream&);
-};
-
-static inline CDRNode* getNode(CDRNodeInstance *inst);
- -

Status

+

status.h

Status provides a way to pass status back to client code:

class Status : public epics::pvData::Serializable {
@@ -3697,31 +3362,31 @@ static inline CDRNode* getNode(CDRNodeInstance *inst);

The Status methods are:

-
StatusType
+
StatusType
An enum for the status type.
-
getType
+
getType
Get the statusType.
-
getMessage
+
getMessage
Get a message explaining the error.
-
getStackDump
+
getStackDump
Get a stack dump.

The StatusCreate methods are:

-
getStatusOK
+
getStatusOK
Get a singleton that returns StatusType.OK and a null message and stackDump.
-
createStatus
+
createStatus
Create a new Status.
-
deserializeStatus
+
deserializeStatus
Use this method instead of Status.deserialize(), since this allows OK status optimization.
-

Thread

+

thread.h

-

ThreadPriority

+

ThreadPriority

enum ThreadPriority {
     lowestPriority,
     lowerPriority,
@@ -3730,15 +3395,9 @@ static inline CDRNode* getNode(CDRNodeInstance *inst);
highPriority, higherPriority, highestPriority -}; - -class ThreadPriorityFunc { -public: - static unsigned int const * const getEpicsPriorities(); - static int getEpicsPriority(ThreadPriority threadPriority); };
-

Thread

+

Thread

class Runnable {
 public:
     virtual void run() = 0;
@@ -3746,15 +3405,15 @@ public:
 
 class Thread;
 
-class Thread :  private NoDefaultMethods {
+class Thread : public epicsThread, private NoDefaultMethods {
 public:
-    Thread(String name,ThreadPriority priority,Runnable *runnableReady);
+    Thread(
+        String name,
+        ThreadPriority priority,
+        Runnable *runnableReady,
+        epicsThreadStackSizeClass stkcls=epicsThreadStackSmall);
     ~Thread();
-    String getName();
-    ThreadPriority getPriority();
-    static void showThreads(StringBuilder buf);
-    static void sleep(double seconds);
-private:
+ ...
 };

Runnable must be implement by code that wants to be run via a thread. It has @@ -3765,27 +3424,18 @@ exception is thrown if run remains active when delete is called.

Thread has the methods:

-
Thread
+
Thread
The constructor. A thread name and priority must be specified. The run methods of runnable is executed. When the run methods returns the thread will no longer be active but the client code must still delete the thread.
-
~Thread
+
~Thread
The destructor. This is called as the result of:
    delete pthread;
-
getName
-
Get the thread name.
-
getPriority
-
Get the thread priority.
-
showThreads
-
Get a String that has the name and priority of all currently allocated - threads.
-
sleep
-
Make the current thread sleep for the specified number of seconds.
-

Time Function Call

+

timeFunction.h

TimeFunction is a facility that measures the average number of seconds a function call requires. When timeCall is called, it calls function in a loop. @@ -3793,78 +3443,96 @@ It starts with a loop of one iteration. If the total elapsed time is less then .1 seconds it increases the number of iterrations by a factor of 10. It keeps repeating until the elapsed time is greater than .1 seconds. It returns the average number of seconds per call.

-
class TimeFunctionRequester {
-public:
+
class TimeFunctionRequester;
+class TimeFunction;
+typedef std::tr1::shared_ptr<TimeFunctionRequester> TimeFunctionRequesterPtr;
+typedef std::tr1::shared_ptr<TimeFunction> TimeFunctionPtr;
+        
+class TimeFunctionRequester {
+public:              
+    POINTER_DEFINITIONS(TimeFunctionRequester);
+    virtual ~TimeFunctionRequester(){}
     virtual void function() = 0;
-};
+};  
 
-class TimeFunction : private NoDefaultMethods {
-public:
-    TimeFunction(TimeFunctionRequester *requester);
-    ~TimeFunction();
+    
+class TimeFunction {
+public:    
+    POINTER_DEFINITIONS(TimeFunction);
+    TimeFunction(TimeFunctionRequesterPtr const & requester);
+    ~TimeFunction(); 
     double timeCall();
-private:
-    TimeFunctionRequester *requester;
-};
+ ... +};

TimeFunctionRequester must be implemented by code that wants to time how long a function takes. It has the single method:

-
function
+
function
This is the function.

TimeFunction has the methods:

-
TimeFunction
+
TimeFunction
Constructor.
-
~TimeFunction
+
~TimeFunction
Destructor.
-
timeCall
+
timeCall
Time how long it takes to execute the function. It starts by calling the function one time. If it takes < 1 seconds to doubles the number of times to call the function. It repeats this until it takes at least one second to call it ntimes.
-

Timer

+

timer.h

This provides a general purpose timer. It allows a user callback to be called after a delay or periodically.

-
class TimerCallback {
+
class TimerCallback;
+class Timer;
+typedef std::tr1::shared_ptr<TimerCallback> TimerCallbackPtr;
+typedef std::tr1::shared_ptr<Timer> TimerPtr;
+
+
+class TimerCallback {
 public:
+    POINTER_DEFINITIONS(TimerCallback);
+    TimerCallback();
+    virtual ~TimerCallback(){}
     virtual void callback() = 0;
     virtual void timerStopped() = 0;
 };
 
-class TimerNode : private NoDefaultMethods {
-public:
-    TimerNode(TimerCallback *timerCallback);
-    ~TimerNode();
-    void cancel();
-    bool isScheduled();
-private:
-};
-
-class Timer : private NoDefaultMethods {
+class Timer : private Runnable {
 public:
+    POINTER_DEFINITIONS(Timer);
     Timer(String threadName, ThreadPriority priority);
-    ~Timer();
-    void scheduleAfterDelay(TimerNode &timerNode,double delay);
-    void schedulePeriodic(TimerNode &timerNode,double delay,double period);
-private:
+    virtual ~Timer();
+    virtual void run();
+    void scheduleAfterDelay(
+        TimerCallbackPtr const &timerCallback,
+        double delay);
+    void schedulePeriodic(
+        TimerCallbackPtr const &timerCallback,
+        double delay,
+        double period));
+    void cancel(TimerCallbackPtr const &timerCallback);
+    bool isScheduled(TimerCallbackPtr const &timerCallback);
+    void toString(StringBuilder builder);
+ ...
 };

TimerCallback must be implemented by the user. It has the following methods:

-
callback
+
callback
This is called when a timer expires. This is called with no locks held. When called a delay timer is no longer on the queue but a periodioc timer is on a queue. Thus the callback for a delay timer can issue a new schedule request but a periodic timer must not. Note the explaination of TimerNode.cancel below.
-
timerStopped
+
timerStopped
Timer.stop was called when a timer request was queued. or if the timer is stopped and a schedule request is made.
@@ -3872,122 +3540,39 @@ private:

In order to schedule a callback client code must allocate a TimerNode It can be used to schedule multiple callbacks. It has the methods:

-
TimerNode
+
TimerNode
The constructor. User code must create a TimeNode in order to call a schedule method.
-
~TimerNode
+
~TimerNode
The destructor. This is called as a result of the client calling:
    delete timerNode;
-
cancel
+
cancel
This is called to cancel a timer request. If a callback has been dequeued but the callback not called when cancel is called then a callback may still happen. New schedule requests can be made after a cancel request has been made.
-
isScheduled
+
isScheduled
Is the timerNode scheduled to be called.

Timer has the methods:

-
Timer
+
Timer
The consttructor.
-
~Timer
+
~Timer
The destructor. The queue is emptied and TimerCallback.timerStopped is called for each element of the queue.
-
scheduleAfterDelay
+
scheduleAfterDelay
A request to schedule a callback after a delay specified in seconds.
-
schedulePeriodic
+
schedulePeriodic
Schedule a periodic callback.
-

Queue

+

pvDataApp/pvMisc

-

This provides a queue which has an immutable capacity. When the queue is -full the user code is expected to keep using the current element until a new -free element becomes avalable.

-
template <typename T>
-class QueueElement : private QueueElementVoid {
-public:
-    T *getObject() { return static_cast<T *>(QueueElementVoid::getObject());}
-protected:
-};
-
-template <typename T>
-class Queue : private QueueVoid {
-public:
-    Queue(T *array[],int number);
-    ~Queue();
-    void clear();
-    int getNumberFree();
-    int capacity();
-    QueueElement<T> *getFree();
-    void setUsed(QueueElement<T> *queueElement);
-    QueueElement<T> *getUsed();
-    void releaseUsed(QueueElement<T> *queueElement);
-};
- -

miscTest/queueTest.cpp provides an example of how to define a queue.

- -

The queue methods are:

-
-
clear
-
Make the queue empty.
-
getNumberFree
-
Get the number of free elements in the queue.
-
capacity
-
Get the capacity, i.e. the maximun number of elements the queue can - hold.
-
getFree
-
Get the next free element. Null is returned if no free elements are - available. If a non null value is returned then the element belongs to - the caller until setUsed is called.
-
setUsed
-
Set a queue element used. This must be the element returned by the last - call to getFree.
-
getUsed
-
Get the next used element of null if no more used elements are - available.
-
releaseUsed
-
Set a queue element free. This must be the element returned by the last - call to getUsed.
-
- -

A queue is created as follows:

-
   class MyClass;
-   typedef MyQueueElement<MyClass> MyElement;
-   typedef MyQueue<MyClass> MyQueue;
-   int numElement = 5;
-   ...
-   MyClass *array[numElements];
-   for(int i=0; i<numElements; i++) {
-        array[i] = new MyClass();
-   }
-   MyQueue *queue = new MyQueue(array,numElements);
- -

A producer calls getFree and setUsed via code like the following:

-
   MyClass *getFree() {
-       MyElement *element = queue->getFree();
-       if(element==0) return 0;
-       return element->getObject();
-  }
- -

A consumer calls getUsed and releaseUsed via code like the following:

-
     while(true) {
-         MyElement *element = queue->getUsed();
-         if(element==0) break;
-         MyClass *myClass = element->getObject();
-         // do something with myClass
-         queue->releaseUsed(element);
-     }
-
- -

pvMisc

-
- -

BitSetUtil

+

bitSetUtil.h

The following is also provided:

class BitSetUtil : private NoDefaultMethods {
@@ -3998,8 +3583,7 @@ public:
 

This provides functions that operate on a BitSet for a PVStructure. It currently has only one method:

-
compress
+
compress
Compress the bits in a BitSet related to a structure.
For each structure:
    @@ -4015,12 +3599,6 @@ currently has only one method:

    Channel Access can call this before sending data. It can then pass entire structures if the structure offset bit is set.
- -

MultiChoice

- -

MultiChoice defines an array of strings and a bit set that selects an -arbitrary set of the choices. This will be implemented if the java version is -accepted.

-
NOT DONE
+
diff --git a/pvDataApp/factory/Convert.cpp b/pvDataApp/factory/Convert.cpp index f721278..ede9921 100644 --- a/pvDataApp/factory/Convert.cpp +++ b/pvDataApp/factory/Convert.cpp @@ -2601,7 +2601,7 @@ void convertToString(StringBuilder buffer,PVField const * pv,int indentLevel) PVScalar const *pvScalar = static_cast(pv); const ScalarConstPtr & pscalar = pvScalar->getScalar(); ScalarType scalarType = pscalar->getScalarType(); - ScalarTypeFunc::toString(buffer,scalarType); + *buffer += pscalar->getID(); *buffer += " "; *buffer += pv->getFieldName(); *buffer += " "; @@ -2698,14 +2698,11 @@ void convertToString(StringBuilder buffer,PVField const * pv,int indentLevel) void convertStructure(StringBuilder buffer,PVStructure const *data,int indentLevel) { + *buffer += data->getStructure()->getID() + " " + data->getFieldName(); String extendsName = data->getExtendsStructureName(); - if(extendsName.length()<=0) { - *buffer += "structure "; - } else { - *buffer += extendsName; - *buffer += " "; + if(extendsName.length()>0) { + *buffer += " extends " + extendsName; } - *buffer += data->getFieldName(); PVFieldPtrArray const & fieldsData = data->getPVFields(); if (fieldsData.size() != 0) { int length = data->getStructure()->getNumberFields(); @@ -2722,10 +2719,7 @@ void convertArray(StringBuilder buffer,PVScalarArray const * xxx,int indentLevel PVScalarArray *pv = const_cast(xxx); ScalarArrayConstPtr array = pv->getScalarArray(); ScalarType type = array->getElementType(); - ScalarTypeFunc::toString(buffer,type); - *buffer += "[] "; - *buffer += pv->getFieldName(); - *buffer += " "; + *buffer += array->getID() + " " + pv->getFieldName() + " "; switch(type) { case pvBoolean: { PVBooleanArray *pvdata = static_cast(pv); @@ -2970,10 +2964,8 @@ void convertArray(StringBuilder buffer,PVScalarArray const * xxx,int indentLevel void convertStructureArray(StringBuilder buffer, PVStructureArray const * xxx,int indentLevel) { - PVStructureArray *pvdata = const_cast(xxx); - *buffer += "structure[] "; - *buffer += pvdata->getFieldName(); - *buffer += " "; + PVStructureArray *pvdata = const_cast(xxx); + *buffer += pvdata->getStructureArray()->getID() + " " + pvdata->getFieldName() + " "; size_t length = pvdata->getLength(); if(length<=0) { return; diff --git a/pvDataApp/factory/FieldCreateFactory.cpp b/pvDataApp/factory/FieldCreateFactory.cpp index 9ac6453..4bc020f 100644 --- a/pvDataApp/factory/FieldCreateFactory.cpp +++ b/pvDataApp/factory/FieldCreateFactory.cpp @@ -68,7 +68,7 @@ Scalar::Scalar(ScalarType scalarType) Scalar::~Scalar(){} void Scalar::toString(StringBuilder buffer,int indentLevel) const{ - ScalarTypeFunc::toString(buffer,scalarType); + *buffer += getID(); } static const String idScalarLUT[] = { @@ -171,8 +171,7 @@ String ScalarArray::getID() const } void ScalarArray::toString(StringBuilder buffer,int indentLevel) const{ - ScalarTypeFunc::toString(buffer,elementType); - *buffer += "[]"; + *buffer += getID(); } void ScalarArray::serialize(ByteBuffer *buffer, SerializableControl *control) const { @@ -195,18 +194,13 @@ StructureArray::~StructureArray() { String StructureArray::getID() const { - // NOTE: structure->getID() can return an empty string return pstructure->getID() + "[]"; } void StructureArray::toString(StringBuilder buffer,int indentLevel) const { - if(indentLevel==0) { - *buffer += "structure[]"; - newLine(buffer,indentLevel + 1); - pstructure->toString(buffer,indentLevel + 1); - return; - } - pstructure->toString(buffer,indentLevel); + *buffer += getID(); + newLine(buffer,indentLevel + 1); + pstructure->toString(buffer,indentLevel + 1); } void StructureArray::serialize(ByteBuffer *buffer, SerializableControl *control) const { @@ -255,7 +249,7 @@ String Structure::getID() const return id; } -FieldConstPtr Structure::getField(String fieldName) const { +FieldConstPtr Structure::getField(String const & fieldName) const { size_t numberFields = fields.size(); for(size_t i=0; igetID() + " " + fieldNames[i]; switch(pfield->getType()) { case scalar: case scalarArray: - pfield->toString(buffer, indentLevel); - *buffer += " "; - *buffer += fieldNames[i]; break; case structure: { Field const *xxx = pfield.get(); Structure const *pstruct = static_cast(xxx); - *buffer += "structure "; - *buffer += fieldNames[i]; pstruct->toStringCommon(buffer,indentLevel + 1); break; } case structureArray: - *buffer += "structure[] " + fieldNames[i]; newLine(buffer,indentLevel +1); pfield->toString(buffer,indentLevel +1); break; @@ -340,13 +328,12 @@ StructureConstPtr FieldCreate::createStructure ( StringArray const & fieldNames,FieldConstPtrArray const & fields) const { StructureConstPtr structure( - new Structure(fieldNames,fields), Field::Deleter()); + new Structure(fieldNames,fields,"structure"), Field::Deleter()); return structure; } StructureConstPtr FieldCreate::createStructure ( - String id, - StringArray const & fieldNames,FieldConstPtrArray const & fields) const + String id, StringArray const & fieldNames,FieldConstPtrArray const & fields) const { StructureConstPtr structure( new Structure(fieldNames,fields,id), Field::Deleter()); diff --git a/pvDataApp/factory/PVArray.cpp b/pvDataApp/factory/PVArray.cpp index 78a2b95..efeef1b 100644 --- a/pvDataApp/factory/PVArray.cpp +++ b/pvDataApp/factory/PVArray.cpp @@ -16,76 +16,82 @@ using std::size_t; namespace epics { namespace pvData { - class PVArrayPvt { - public: - PVArrayPvt() : length(0),capacity(0),capacityMutable(true) - {} - size_t length; - size_t capacity; - bool capacityMutable; - }; +class PVArrayPvt { +public: + PVArrayPvt() : length(0),capacity(0),capacityMutable(true) + {} + size_t length; + size_t capacity; + bool capacityMutable; +}; - PVArray::PVArray(FieldConstPtr const & field) - : PVField(field),pImpl(new PVArrayPvt()) - { } +PVArray::PVArray(FieldConstPtr const & field) +: PVField(field),pImpl(new PVArrayPvt()) +{ } - PVArray::~PVArray() - { - delete pImpl; +PVArray::~PVArray() +{ + delete pImpl; +} + + void PVArray::setImmutable() + { + pImpl->capacityMutable = false; + PVField::setImmutable(); + } + + size_t PVArray::getLength() const {return pImpl->length;} + + size_t PVArray::getCapacity() const {return pImpl->capacity;} + + static String fieldImmutable("field is immutable"); + + void PVArray::setLength(size_t length) { + if(length==pImpl->length) return; + if(PVField::isImmutable()) { + PVField::message(fieldImmutable,errorMessage); + return; } + if(length>pImpl->capacity) this->setCapacity(length); + if(length>pImpl->capacity) length = pImpl->capacity; + pImpl->length = length; + } - size_t PVArray::getLength() const {return pImpl->length;} - - size_t PVArray::getCapacity() const {return pImpl->capacity;} - - static String fieldImmutable("field is immutable"); - - void PVArray::setLength(size_t length) { - if(length==pImpl->length) return; - if(PVField::isImmutable()) { - PVField::message(fieldImmutable,errorMessage); - return; - } - if(length>pImpl->capacity) this->setCapacity(length); - if(length>pImpl->capacity) length = pImpl->capacity; - pImpl->length = length; - } - - void PVArray::setCapacityLength(size_t capacity,size_t length) { - pImpl->capacity = capacity; - pImpl->length = length; - } + void PVArray::setCapacityLength(size_t capacity,size_t length) { + pImpl->capacity = capacity; + pImpl->length = length; + } - bool PVArray::isCapacityMutable() const - { - if(PVField::isImmutable()) { - return false; - } - return pImpl->capacityMutable; - } + bool PVArray::isCapacityMutable() const + { + if(PVField::isImmutable()) { + return false; + } + return pImpl->capacityMutable; + } - void PVArray::setCapacityMutable(bool isMutable) - { - if(isMutable && PVField::isImmutable()) { - PVField::message(fieldImmutable,errorMessage); - return; - } - pImpl->capacityMutable = isMutable; - } + void PVArray::setCapacityMutable(bool isMutable) + { + if(isMutable && PVField::isImmutable()) { + PVField::message(fieldImmutable,errorMessage); + return; + } + pImpl->capacityMutable = isMutable; + } - static String capacityImmutable("capacity is immutable"); + static String capacityImmutable("capacity is immutable"); - void PVArray::setCapacity(size_t capacity) { - if(PVField::isImmutable()) { - PVField::message(fieldImmutable,errorMessage); - return; - } - if(pImpl->capacityMutable==false) { - PVField::message(capacityImmutable,errorMessage); - return; - } - pImpl->capacity = capacity; - } + void PVArray::setCapacity(size_t capacity) { + if(PVField::isImmutable()) { + PVField::message(fieldImmutable,errorMessage); + return; + } + if(pImpl->capacityMutable==false) { + PVField::message(capacityImmutable,errorMessage); + return; + } + pImpl->capacity = capacity; + } }} diff --git a/pvDataApp/factory/PVDataCreateFactory.cpp b/pvDataApp/factory/PVDataCreateFactory.cpp index 9ca8b98..5a746ef 100644 --- a/pvDataApp/factory/PVDataCreateFactory.cpp +++ b/pvDataApp/factory/PVDataCreateFactory.cpp @@ -163,6 +163,7 @@ public: DefaultPVArray(ScalarArrayConstPtr const & scalarArray); virtual ~DefaultPVArray(); virtual void setCapacity(size_t capacity); + virtual void setLength(size_t length); virtual size_t get(size_t offset, size_t length, PVArrayData &data) ; virtual size_t put(size_t offset,size_t length, const_pointer from, size_t fromOffset); @@ -221,15 +222,33 @@ void DefaultPVArray::setCapacity(size_t capacity) return; } size_t length = PVArray::getLength(); - std::vector array(capacity); - size_t num = PVArray::getLength(); - if(num>capacity) num = capacity; + if(length>capacity) length = capacity; + std::vector array; + array.reserve(capacity); + array.resize(length); T * from = get(); - for (size_t i=0; iswap(array); PVArray::setCapacityLength(capacity,length); } +template +void DefaultPVArray::setLength(size_t length) +{ + if(PVArray::getLength()==length) return; + size_t capacity = PVArray::getCapacity(); + if(length>capacity) { + if(!PVArray::isCapacityMutable()) { + std::string message("not capacityMutable"); + PVField::message(message, errorMessage); + return; + } + setCapacity(length); + } + value->resize(length); + PVArray::setCapacityLength(capacity,length); +} + template size_t DefaultPVArray::get(size_t offset, size_t len, PVArrayData &data) { @@ -266,6 +285,7 @@ size_t DefaultPVArray::put(size_t offset,size_t len, if(len<=0) return 0; } length = newlength; + setLength(length); } pvalue = get(); for(size_t i=0;igetFieldName(); - if(parentName.length()>0) { - fieldName = parentName + "." + fieldName; + if(fullFieldName.length()>0) { + fullFieldName = fieldName + '.' + fullFieldName; + } else { + fullFieldName = fieldName; } - parent->message(fieldName,message,messageType); + parent->message(message,messageType,fullFieldName); return; } + message = fullFieldName + " " + message; if(requester) { - String mess = fieldName + " " + message; - requester->message(mess,messageType); + requester->message(message,messageType); } else { printf("%s %s %s\n", getMessageTypeName(messageType).c_str(), @@ -55,7 +56,7 @@ void PVField::message(String fieldName,String message,MessageType messageType) void PVField::message(String message,MessageType messageType) { - PVField::message(fieldName,message,messageType); + PVField::message(message,messageType,""); } String PVField::getFieldName() const @@ -63,18 +64,18 @@ String PVField::getFieldName() const return fieldName; } -void PVField::setRequester(Requester *requester) +void PVField::setRequester(RequesterPtr const &req) { if(parent!=NULL) { throw std::logic_error( "PVField::setRequester only legal for top level structure"); } - if(requester!=NULL) { - if(requester==requester) return; + if(requester.get()!=NULL) { + if(requester.get()==req.get()) return; throw std::logic_error( "PVField::setRequester requester is already present"); } - requester = requester; + requester = req; } size_t PVField::getFieldOffset() const @@ -155,15 +156,15 @@ void PVField::postPut() if(postHandler!=NULL) postHandler->postPut(); } -void PVField::setPostHandler(PostHandler *postHandler) +void PVField::setPostHandler(PostHandlerPtr const &handler) { - if(postHandler!=NULL) { - if(postHandler==postHandler) return; + if(postHandler.get()!=NULL) { + if(postHandler.get()==handler.get()) return; throw std::logic_error( "PVField::setPostHandler a postHandler is already registered"); } - postHandler = postHandler; + postHandler = handler; } void PVField::setParentAndName(PVStructure * xxx,String & name) diff --git a/pvDataApp/factory/PVStructure.cpp b/pvDataApp/factory/PVStructure.cpp index 0186576..1f4c534 100644 --- a/pvDataApp/factory/PVStructure.cpp +++ b/pvDataApp/factory/PVStructure.cpp @@ -82,6 +82,16 @@ PVStructure::~PVStructure() { } +void PVStructure::setImmutable() +{ + size_t numFields = pvFields.size(); + for(size_t i=0; isetImmutable(); + } + PVField::setImmutable(); +} + StructureConstPtr PVStructure::getStructure() const { return structurePtr; diff --git a/pvDataApp/factory/PVStructureArray.cpp b/pvDataApp/factory/PVStructureArray.cpp index 1a0aa16..2935316 100644 --- a/pvDataApp/factory/PVStructureArray.cpp +++ b/pvDataApp/factory/PVStructureArray.cpp @@ -21,21 +21,20 @@ namespace epics { namespace pvData { PVStructureArray::PVStructureArray(StructureArrayConstPtr const & structureArray) : PVArray(structureArray), structureArray(structureArray), - value(std::tr1::shared_ptr > - (new std::vector())) + value(std::tr1::shared_ptr(new PVStructurePtrArray())) { } size_t PVStructureArray::append(size_t number) { - size_t currentLength = getCapacity(); + size_t currentLength = getLength(); size_t newLength = currentLength + number; setCapacity(newLength); + setLength(newLength); StructureConstPtr structure = structureArray->getStructure(); PVStructurePtrArray *to = value.get(); for(size_t i=currentLength; icreatePVStructure(structure)); - (*to)[i].swap(pvStructure); + (*to)[i] =getPVDataCreate()->createPVStructure(structure); } return newLength; } @@ -89,15 +88,30 @@ void PVStructureArray::setCapacity(size_t capacity) { return; } size_t length = getCapacity(); - PVStructurePtrArray array(capacity); - size_t num = PVArray::getLength(); - if(num>capacity) num = capacity; + if(length>capacity) length = capacity; + PVStructurePtrArray array; + array.reserve(capacity); + array.resize(length); PVStructurePtr * from = get(); - for (size_t i=0; iswap(array); setCapacityLength(capacity,length); } +void PVStructureArray::setLength(size_t length) { + if(PVArray::getLength()==length) return; + size_t capacity = PVArray::getCapacity(); + if(length>capacity) { + if(!PVArray::isCapacityMutable()) { + std::string message("not capacityMutable"); + PVField::message(message, errorMessage); + return; + } + setCapacity(length); + } + value->resize(length); + PVArray::setCapacityLength(capacity,length); +} StructureArrayConstPtr PVStructureArray::getStructureArray() const { diff --git a/pvDataApp/factory/StandardField.cpp b/pvDataApp/factory/StandardField.cpp index 3e25a02..a45b534 100644 --- a/pvDataApp/factory/StandardField.cpp +++ b/pvDataApp/factory/StandardField.cpp @@ -51,7 +51,7 @@ static void createAlarm() { fields[0] = fieldCreate->createScalar(pvInt); fields[1] = fieldCreate->createScalar(pvInt); fields[2] = fieldCreate->createScalar(pvString); - alarmField = fieldCreate->createStructure(names,fields); + alarmField = fieldCreate->createStructure("alarm_t",names,fields); } static void createTimeStamp() { @@ -64,7 +64,7 @@ static void createTimeStamp() { fields[0] = fieldCreate->createScalar(pvLong); fields[1] = fieldCreate->createScalar(pvInt); fields[2] = fieldCreate->createScalar(pvInt); - timeStampField = fieldCreate->createStructure(names,fields); + timeStampField = fieldCreate->createStructure("timeStamp_t",names,fields); } static void createDisplay() { @@ -81,7 +81,7 @@ static void createDisplay() { fields[2] = fieldCreate->createScalar(pvString); fields[3] = fieldCreate->createScalar(pvString); fields[4] = fieldCreate->createScalar(pvString); - displayField = fieldCreate->createStructure(names,fields); + displayField = fieldCreate->createStructure("display_t",names,fields); } static void createControl() { @@ -94,7 +94,7 @@ static void createControl() { fields[0] = fieldCreate->createScalar(pvDouble); fields[1] = fieldCreate->createScalar(pvDouble); fields[2] = fieldCreate->createScalar(pvDouble); - controlField = fieldCreate->createStructure(names,fields); + controlField = fieldCreate->createStructure("control_t",names,fields); } static void createBooleanAlarm() { @@ -109,7 +109,7 @@ static void createBooleanAlarm() { fields[1] = fieldCreate->createScalar(pvInt); fields[2] = fieldCreate->createScalar(pvInt); fields[3] = fieldCreate->createScalar(pvInt); - booleanAlarmField = fieldCreate->createStructure(names,fields); + booleanAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createByteAlarm() { @@ -136,7 +136,7 @@ static void createByteAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvByte); - byteAlarmField = fieldCreate->createStructure(names,fields); + byteAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createShortAlarm() { @@ -163,7 +163,7 @@ static void createShortAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvShort); - shortAlarmField = fieldCreate->createStructure(names,fields); + shortAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createIntAlarm() { @@ -190,7 +190,7 @@ static void createIntAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvInt); - intAlarmField = fieldCreate->createStructure(names,fields); + intAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createLongAlarm() { @@ -217,7 +217,7 @@ static void createLongAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvLong); - longAlarmField = fieldCreate->createStructure(names,fields); + longAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createUByteAlarm() { @@ -244,7 +244,7 @@ static void createUByteAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvUByte); - ubyteAlarmField = fieldCreate->createStructure(names,fields); + ubyteAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createUShortAlarm() { @@ -271,7 +271,7 @@ static void createUShortAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvUShort); - ushortAlarmField = fieldCreate->createStructure(names,fields); + ushortAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createUIntAlarm() { @@ -298,7 +298,7 @@ static void createUIntAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvUInt); - uintAlarmField = fieldCreate->createStructure(names,fields); + uintAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createULongAlarm() { @@ -325,7 +325,7 @@ static void createULongAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvULong); - ulongAlarmField = fieldCreate->createStructure(names,fields); + ulongAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createFloatAlarm() { @@ -352,7 +352,7 @@ static void createFloatAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvFloat); - floatAlarmField = fieldCreate->createStructure(names,fields); + floatAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createDoubleAlarm() { @@ -379,7 +379,7 @@ static void createDoubleAlarm() { fields[7] = fieldCreate->createScalar(pvInt); fields[8] = fieldCreate->createScalar(pvInt); fields[9] = fieldCreate->createScalar(pvDouble); - doubleAlarmField = fieldCreate->createStructure(names,fields); + doubleAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } static void createEnumeratedAlarm() { @@ -392,10 +392,10 @@ static void createEnumeratedAlarm() { fields[0] = fieldCreate->createScalar(pvBoolean); fields[1] = fieldCreate->createScalar(pvInt); fields[2] = fieldCreate->createScalar(pvInt); - enumeratedAlarmField = fieldCreate->createStructure(names,fields); + enumeratedAlarmField = fieldCreate->createStructure("valueAlarm_t",names,fields); } -static StructureConstPtr createProperties(FieldConstPtr field,String properties) +static StructureConstPtr createProperties(String id,FieldConstPtr field,String properties) { bool gotAlarm = false; bool gotTimeStamp = false; @@ -485,31 +485,31 @@ static StructureConstPtr createProperties(FieldConstPtr field,String properties) names[next] = "valueAlarm"; fields[next++] = valueAlarm; } - return fieldCreate->createStructure(names,fields); + return fieldCreate->createStructure(id,names,fields); } StructureConstPtr StandardField::scalar( - ScalarType type,String properties) + ScalarType type,String properties) { ScalarConstPtr field = fieldCreate->createScalar(type); - return createProperties(field,properties); + return createProperties("scalar_t",field,properties); } StructureConstPtr StandardField::scalarArray( - ScalarType elementType, String properties) + ScalarType elementType, String properties) { ScalarArrayConstPtr field = fieldCreate->createScalarArray(elementType); - return createProperties(field,properties); + return createProperties("scalarArray_t",field,properties); } StructureConstPtr StandardField::structureArray( - StructureConstPtr const & structure,String properties) + StructureConstPtr const & structure,String properties) { StructureArrayConstPtr field = fieldCreate->createStructureArray( structure); - return createProperties(field,properties); + return createProperties("structureArray_t",field,properties); } StructureConstPtr StandardField::enumerated() @@ -521,13 +521,13 @@ StructureConstPtr StandardField::enumerated() names[1] = "choices"; fields[0] = fieldCreate->createScalar(pvInt); fields[1] = fieldCreate->createScalarArray(pvString); - return fieldCreate->createStructure(names,fields); + return fieldCreate->createStructure("enumerated_t",names,fields); } -StructureConstPtr StandardField::enumerated(String properties) +StructureConstPtr StandardField::enumerated(String properties) { StructureConstPtr field = enumerated(); - return createProperties(field,properties); + return createProperties("enumerated_t",field,properties); } StructureConstPtr StandardField::alarm() diff --git a/pvDataApp/factory/StandardPVField.cpp b/pvDataApp/factory/StandardPVField.cpp index 6bccfa0..784e8ce 100644 --- a/pvDataApp/factory/StandardPVField.cpp +++ b/pvDataApp/factory/StandardPVField.cpp @@ -24,63 +24,32 @@ static PVDataCreatePtr pvDataCreate; static String notImplemented("not implemented"); -static void addExtendsStructureName(PVStructure *pvStructure,String properties) -{ - bool gotAlarm = false; - bool gotTimeStamp = false; - bool gotDisplay = false; - bool gotControl = false; - if(properties.find("alarm")!=String::npos) gotAlarm = true; - if(properties.find("timeStamp")!=String::npos) gotTimeStamp = true; - if(properties.find("display")!=String::npos) gotDisplay = true; - if(properties.find("control")!=String::npos) gotControl = true; - if(gotAlarm) { - PVStructure *pv = pvStructure->getStructureField("alarm").get(); - if(pv!=NULL) pv->putExtendsStructureName("alarm"); - } - if(gotTimeStamp) { - PVStructure *pv = pvStructure->getStructureField("timeStamp").get(); - if(pv!=NULL) pv->putExtendsStructureName("timeStamp"); - } - if(gotDisplay) { - PVStructure *pv = pvStructure->getStructureField("display").get(); - if(pv!=NULL) pv->putExtendsStructureName("display"); - } - if(gotControl) { - PVStructure *pv = pvStructure->getStructureField("control").get(); - if(pv!=NULL) pv->putExtendsStructureName(String("control")); - } -} - StandardPVField::StandardPVField(){} StandardPVField::~StandardPVField(){} -PVStructurePtr StandardPVField::scalar(ScalarType type,String properties) +PVStructurePtr StandardPVField::scalar(ScalarType type,String properties) { StructureConstPtr field = standardField->scalar(type,properties); PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field); - addExtendsStructureName(pvStructure.get(),properties); return pvStructure; } -PVStructurePtr StandardPVField::scalarArray(ScalarType elementType, String properties) +PVStructurePtr StandardPVField::scalarArray(ScalarType elementType, String properties) { StructureConstPtr field = standardField->scalarArray(elementType,properties); PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field); - addExtendsStructureName(pvStructure.get(),properties); return pvStructure; } -PVStructurePtr StandardPVField::structureArray(StructureConstPtr structure,String properties) +PVStructurePtr StandardPVField::structureArray(StructureConstPtr const & structure,String properties) { StructureConstPtr field = standardField->structureArray(structure,properties); PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field); - addExtendsStructureName(pvStructure.get(),properties); return pvStructure; } -PVStructurePtr StandardPVField::enumerated(StringArray choices) +PVStructurePtr StandardPVField::enumerated(StringArray const &choices) { StructureConstPtr field = standardField->enumerated(); PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field); @@ -94,11 +63,10 @@ PVStructurePtr StandardPVField::enumerated(StringArray choices) return pvStructure; } -PVStructurePtr StandardPVField::enumerated(StringArray choices,String properties) +PVStructurePtr StandardPVField::enumerated(StringArray const &choices,String properties) { StructureConstPtr field = standardField->enumerated(properties); PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field); - addExtendsStructureName(pvStructure.get(),properties); PVScalarArrayPtr pvScalarArray = pvStructure->getScalarArrayField("value.choices",pvString); if(pvScalarArray.get()==NULL) { throw std::logic_error(String("StandardPVField::enumerated")); diff --git a/pvDataApp/misc/status.cpp b/pvDataApp/misc/status.cpp index d9be74f..bd11b8f 100644 --- a/pvDataApp/misc/status.cpp +++ b/pvDataApp/misc/status.cpp @@ -13,7 +13,7 @@ namespace epics { namespace pvData { const char* Status::StatusTypeName[] = { "OK", "WARNING", "ERROR", "FATAL" }; epics::pvData::String Status::m_emptyString; -Status Status::Ok; +Status Status::OK; //PVDATA_REFCOUNT_MONITOR_DEFINE(status); @@ -60,7 +60,7 @@ epics::pvData::String Status::getStackDump() const return m_stackDump; } -bool Status::isOk() const +bool Status::isOK() const { return (m_statusType == STATUSTYPE_OK); } diff --git a/pvDataApp/misc/status.h b/pvDataApp/misc/status.h index 15bfb78..40d27ee 100644 --- a/pvDataApp/misc/status.h +++ b/pvDataApp/misc/status.h @@ -36,7 +36,7 @@ namespace epics { namespace pvData { static const char* StatusTypeName[]; - static Status Ok; + static Status OK; /** * Creates OK status; STATUSTYPE_OK, empty message and stackDump. @@ -80,7 +80,7 @@ namespace epics { namespace pvData { * @return OK status. * @see #isSuccess() */ - bool isOk() const; + bool isOK() const; /** * Check if operation succeeded. diff --git a/pvDataApp/property/control.h b/pvDataApp/property/control.h index a2b403e..3e0eb2d 100644 --- a/pvDataApp/property/control.h +++ b/pvDataApp/property/control.h @@ -14,11 +14,14 @@ public: //default constructors and destructor are OK double getLow() const {return low;} double getHigh() const {return high;} + double getMinStep() const {return minStep;} void setLow(double value) {low = value;} void setHigh(double value) {high = value;} + void setMinStep(double value) {minStep = value;} private: double low; double high; + double minStep; }; }} diff --git a/pvDataApp/property/pvAlarm.cpp b/pvDataApp/property/pvAlarm.cpp index 202d9ae..49ccb5f 100644 --- a/pvDataApp/property/pvAlarm.cpp +++ b/pvDataApp/property/pvAlarm.cpp @@ -17,7 +17,7 @@ using std::tr1::static_pointer_cast; static String noAlarmFound("No alarm structure found"); static String notAttached("Not attached to an alarm structure"); -bool PVAlarm::attach(PVFieldPtr pvField) +bool PVAlarm::attach(PVFieldPtr const & pvField) { if(pvField->getField()->getType()!=structure) { pvField->message(noAlarmFound,errorMessage); diff --git a/pvDataApp/property/pvAlarm.h b/pvDataApp/property/pvAlarm.h index 7f2b0ee..60e44a8 100644 --- a/pvDataApp/property/pvAlarm.h +++ b/pvDataApp/property/pvAlarm.h @@ -19,7 +19,7 @@ public: //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(PVFieldPtr pvField); + bool attach(PVFieldPtr const & pvField); void detach(); bool isAttached(); // each of the following throws logic_error is not attached to PVField diff --git a/pvDataApp/property/pvControl.cpp b/pvDataApp/property/pvControl.cpp index 430dae5..49bce4b 100644 --- a/pvDataApp/property/pvControl.cpp +++ b/pvDataApp/property/pvControl.cpp @@ -17,7 +17,7 @@ using std::tr1::static_pointer_cast; static String noControlFound("No control structure found"); static String notAttached("Not attached to an control structure"); -bool PVControl::attach(PVFieldPtr pvField) +bool PVControl::attach(PVFieldPtr const & pvField) { if(pvField->getField()->getType()!=structure) { pvField->message(noControlFound,errorMessage); diff --git a/pvDataApp/property/pvControl.h b/pvDataApp/property/pvControl.h index 2ff233d..755e028 100644 --- a/pvDataApp/property/pvControl.h +++ b/pvDataApp/property/pvControl.h @@ -16,7 +16,7 @@ public: //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(PVFieldPtr pvField); + bool attach(PVFieldPtr const & pvField); void detach(); bool isAttached(); // each of the following throws logic_error is not attached to PVField diff --git a/pvDataApp/property/pvDisplay.cpp b/pvDataApp/property/pvDisplay.cpp index b39bc8e..69b20fb 100644 --- a/pvDataApp/property/pvDisplay.cpp +++ b/pvDataApp/property/pvDisplay.cpp @@ -17,7 +17,7 @@ using std::tr1::static_pointer_cast; static String noDisplayFound("No display structure found"); static String notAttached("Not attached to an display structure"); -bool PVDisplay::attach(PVFieldPtr pvField) +bool PVDisplay::attach(PVFieldPtr const & pvField) { if(pvField->getField()->getType()!=structure) { pvField->message(noDisplayFound,errorMessage); diff --git a/pvDataApp/property/pvDisplay.h b/pvDataApp/property/pvDisplay.h index f28ca80..7749ff0 100644 --- a/pvDataApp/property/pvDisplay.h +++ b/pvDataApp/property/pvDisplay.h @@ -17,7 +17,7 @@ public: PVDisplay() {} //default constructors and destructor are OK //An automatic detach is issued if already attached. - bool attach(PVFieldPtr pvField); + bool attach(PVFieldPtr const & pvField); void detach(); bool isAttached(); // each of the following throws logic_error is not attached to PVField diff --git a/pvDataApp/property/pvEnumerated.cpp b/pvDataApp/property/pvEnumerated.cpp index 10f3683..42ac61e 100644 --- a/pvDataApp/property/pvEnumerated.cpp +++ b/pvDataApp/property/pvEnumerated.cpp @@ -17,7 +17,7 @@ using std::tr1::static_pointer_cast; static String notFound("No enumerated structure found"); static String notAttached("Not attached to an enumerated structure"); -bool PVEnumerated::attach(PVFieldPtr pvField) +bool PVEnumerated::attach(PVFieldPtr const & pvField) { if(pvField->getField()->getType()!=structure) { pvField->message(notFound,errorMessage); diff --git a/pvDataApp/property/pvEnumerated.h b/pvDataApp/property/pvEnumerated.h index 95a438b..3096191 100644 --- a/pvDataApp/property/pvEnumerated.h +++ b/pvDataApp/property/pvEnumerated.h @@ -18,7 +18,7 @@ public: //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(PVFieldPtr pvField); + bool attach(PVFieldPtr const & pvField); void detach(); bool isAttached(); // each of the following throws logic_error is not attached to PVField diff --git a/pvDataApp/property/pvTimeStamp.cpp b/pvDataApp/property/pvTimeStamp.cpp index f0a3fab..f59a23b 100644 --- a/pvDataApp/property/pvTimeStamp.cpp +++ b/pvDataApp/property/pvTimeStamp.cpp @@ -17,7 +17,7 @@ using std::tr1::static_pointer_cast; static String noTimeStamp("No timeStamp structure found"); static String notAttached("Not attached to a timeStamp structure"); -bool PVTimeStamp::attach(PVFieldPtr pvField) +bool PVTimeStamp::attach(PVFieldPtr const & pvField) { if(pvField->getField()->getType()!=structure) { pvField->message(noTimeStamp,errorMessage); diff --git a/pvDataApp/property/pvTimeStamp.h b/pvDataApp/property/pvTimeStamp.h index d606546..b13d29b 100644 --- a/pvDataApp/property/pvTimeStamp.h +++ b/pvDataApp/property/pvTimeStamp.h @@ -20,7 +20,7 @@ public: //This class should not be extended //returns (false,true) if pvField(isNot, is valid timeStamp structure - bool attach(PVFieldPtr pvField); + bool attach(PVFieldPtr const & pvField); void detach(); bool isAttached(); // following throw logic_error is not attached to PVField diff --git a/pvDataApp/pv/convert.h b/pvDataApp/pv/convert.h index d34f527..be86184 100644 --- a/pvDataApp/pv/convert.h +++ b/pvDataApp/pv/convert.h @@ -47,15 +47,16 @@ static inline bool operator!=(const StructureArray& a, const StructureArray& b) * numeric types. It is not possible to convert between a scalar * and an array. * Numeric conversions are between types: - * pvByte, pvShort, pvInt, - * pvLong, pvFloat, or pvDouble.

+ * pvByte, pvShort, pvInt, pvLong, + * pvUByte, pvUShort, pvUInt, pvULong, + * pvFloat, or pvDouble.

* *

getString converts any supported type to a String. - * Code that implements a PVField interface can implement + * Code that implements a PVField interface should implement * method toString by calling this method.

* *

fromString converts a String to a scalar. - * fromStringArray converts an array of String + * fromStringArray converts an array of Strings * to a pvArray, which must have a scaler element type. * A scalar field is a numeric field or pvBoolean or pvString.

*

All from methods put data into a PVField, e.g. from means where the PVField gets it's data.

diff --git a/pvDataApp/pv/pvData.h b/pvDataApp/pv/pvData.h index 731abde..6d100d9 100644 --- a/pvDataApp/pv/pvData.h +++ b/pvDataApp/pv/pvData.h @@ -25,6 +25,37 @@ class PVScalarArray; class PVStructure; class PVStructureArray; +/** + * typedef for a pointer to a PVAuxInfo. + */ +typedef std::tr1::shared_ptr PVAuxInfoPtr; + +/** + * typedef for a pointer to a PostHandler. + */ +typedef std::tr1::shared_ptr PostHandlerPtr; + +/** + * typedef for a pointer to a PVField. + */ +typedef std::tr1::shared_ptr PVFieldPtr; +/** + * typedef for a pointer to a array of pointer to PVField. + */ +typedef std::vector PVFieldPtrArray; +typedef std::vector::iterator PVFieldPtrArray_iterator; +typedef std::vector::const_iterator PVFieldPtrArray_const__iterator; + +/** + * typedef for a pointer to a PVScalar. + */ +typedef std::tr1::shared_ptr PVScalarPtr; + +/** + * typedef for a pointer to a PVScalarArray. + */ +typedef std::tr1::shared_ptr PVScalarArrayPtr; + /** * typedef for a pointer to a PVStructure. */ @@ -35,32 +66,11 @@ typedef std::tr1::shared_ptr PVStructurePtr; typedef std::vector PVStructurePtrArray; typedef std::vector::iterator PVStructurePtrArray_iterator; typedef std::vector::const_iterator PVStructurePtrArray_const__iterator; -/** - * typedef for a pointer to a PVField. - */ -typedef std::tr1::shared_ptr PVFieldPtr; -/** - * typedef for a pointer to a PVScalar. - */ -typedef std::tr1::shared_ptr PVScalarPtr; -/** - * typedef for a pointer to a PVScalarArray. - */ -typedef std::tr1::shared_ptr PVScalarArrayPtr; + /** * typedef for a pointer to a PVStructureArray. */ typedef std::tr1::shared_ptr PVStructureArrayPtr; -/** - * typedef for a pointer to a array of pointer to PVField. - */ -typedef std::vector PVFieldPtrArray; -typedef std::vector::iterator PVFieldPtrArray_iterator; -typedef std::vector::const_iterator PVFieldPtrArray_const__iterator; -/** - * typedef for a pointer to a PVAuxInfo. - */ -typedef std::tr1::shared_ptr PVAuxInfoPtr; /** * This class provides auxillary information about a PVField. @@ -125,8 +135,11 @@ private: /** * This class is implemented by code that calls setPostHander */ -class PostHandler { +class PostHandler : + public std::tr1::enable_shared_from_this +{ public: + POINTER_DEFINITIONS(PostHandler); /** * Destructor */ @@ -167,7 +180,7 @@ public: * At most one requester can be registered. * @param prequester The requester. */ - virtual void setRequester(Requester *prequester); + virtual void setRequester(RequesterPtr const &prequester); /** * Get offset of the PVField field within top level structure. * Every field within the PVStructure has a unique offset. @@ -233,7 +246,7 @@ public: * At most one handler can be set. * @param postHandler The handler. */ - void setPostHandler(PostHandler *postHandler); + void setPostHandler(PostHandlerPtr const &postHandler); /** * Is this field equal to another field. * @param pv other field @@ -253,11 +266,15 @@ public: */ virtual void toString(StringBuilder buf,int indentLevel) ; protected: + PVField::shared_pointer getPtrSelf() + { + return shared_from_this(); + } PVField(FieldConstPtr field); void setParentAndName(PVStructure *parent, String & fieldName); void replaceField(FieldConstPtr &field); private: - void message(String fieldName,String message,MessageType messageType); + void message(String message,MessageType messageType,String fullFieldName); static void computeOffset(const PVField *pvField); static void computeOffset(const PVField *pvField,std::size_t offset); PVAuxInfoPtr pvAuxInfo; @@ -267,8 +284,8 @@ private: size_t fieldOffset; size_t nextFieldOffset; bool immutable; - Requester *requester; - PostHandler *postHandler; + RequesterPtr requester; + PostHandlerPtr postHandler; std::tr1::shared_ptr convert; friend class PVDataCreate; friend class PVStructure; @@ -378,6 +395,11 @@ public: * Destructor */ virtual ~PVArray(); + /** + * Set the field to be immutable, i. e. it can no longer be modified. + * This is permanent, i.e. once done the field can onot be made mutable. + */ + virtual void setImmutable(); /** * Get the array length. * @return The length. @@ -387,7 +409,7 @@ public: * Set the array length. * @param The length. */ - void setLength(std::size_t length); + virtual void setLength(std::size_t length); /** * Get the array capacity. * @return The capacity. @@ -491,7 +513,16 @@ public: * Destructor */ virtual ~PVStructureArray() {} + /** + * Set the array capacity. + * @param capacity The length. + */ virtual void setCapacity(size_t capacity); + /** + * Set the array length. + * @param length The length. + */ + virtual void setLength(std::size_t length); /** * Get the introspection interface * @return The interface. @@ -571,6 +602,11 @@ public: virtual ~PVStructure(); typedef PVStructure & reference; typedef const PVStructure & const_reference; + /** + * Set the field to be immutable, i. e. it can no longer be modified. + * This is permanent, i.e. once done the field can onot be made mutable. + */ + virtual void setImmutable(); /** * Get the introspection interface * @return The interface. diff --git a/pvDataApp/pv/pvIntrospect.h b/pvDataApp/pv/pvIntrospect.h index 6097295..a770fc7 100644 --- a/pvDataApp/pv/pvIntrospect.h +++ b/pvDataApp/pv/pvIntrospect.h @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -398,7 +397,7 @@ public: * @return The introspection interface. * This will hold a null pointer if the field is not in the structure. */ - FieldConstPtr getField(String fieldName) const; + FieldConstPtr getField(String const &fieldName) const; /** * Get the field for the specified fieldName. * @param fieldName The index of the field to get; @@ -411,7 +410,7 @@ public: * @return The introspection interface. * This will be -1 if the field is not in the structure. */ - std::size_t getFieldIndex(String fieldName) const; + std::size_t getFieldIndex(String const &fieldName) const; /** * Get the fields in the structure. * @return The array of fields. diff --git a/pvDataApp/pv/pvType.h b/pvDataApp/pv/pvType.h index 50f4ff2..30322bf 100644 --- a/pvDataApp/pv/pvType.h +++ b/pvDataApp/pv/pvType.h @@ -16,6 +16,8 @@ #include #include +#include + namespace epics { namespace pvData { /** @@ -70,160 +72,359 @@ typedef std::string String; * A boolean array. */ typedef std::vector BooleanArray; -/* get is same is UInt */ +typedef std::tr1::shared_ptr BooleanArrayPtr; +/* get is same is ubyte*/ typedef std::vector::iterator BooleanArray_iterator; typedef std::vector::const_iterator BooleanArray_const_iterator; + /** * A byte array. */ typedef std::vector ByteArray; +typedef std::tr1::shared_ptr ByteArrayPtr; inline int8 * get(ByteArray &value) { return &value[0]; } -inline const int8 * get(const ByteArray &value) +inline int8 const * get(ByteArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline int8 * get(ByteArrayPtr &value) +{ + return get(*value.get()); +} +inline int8 const * get(ByteArrayPtr const &value) +{ + return get(*value.get()); +} +inline ByteArray & getVector(ByteArrayPtr &value) +{ + return *value.get(); +} +inline ByteArray const & getVector(ByteArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator ByteArray_iterator; typedef std::vector::const_iterator ByteArray_const_iterator; + /** * A short array. */ typedef std::vector ShortArray; +typedef std::tr1::shared_ptr ShortArrayPtr; inline int16 * get(ShortArray &value) { return &value[0]; } -inline const int16 * get(const ShortArray &value) +inline int16 const * get(ShortArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline int16 * get(ShortArrayPtr &value) +{ + return get(*value.get()); +} +inline int16 const * get(ShortArrayPtr const &value) +{ + return get(*value.get()); +} +inline ShortArray & getVector(ShortArrayPtr &value) +{ + return *value.get(); +} +inline ShortArray const & getVector(ShortArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator ShortArray_iterator; typedef std::vector::const_iterator ShortArray_const_iterator; + /** * A int array. */ typedef std::vector IntArray; +typedef std::tr1::shared_ptr IntArrayPtr; inline int32 * get(IntArray &value) { return &value[0]; } -inline const int32 * get(const IntArray &value) +inline int32 const * get(IntArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline int32 * get(IntArrayPtr &value) +{ + return get(*value.get()); +} +inline int32 const * get(IntArrayPtr const &value) +{ + return get(*value.get()); +} +inline IntArray & getVector(IntArrayPtr &value) +{ + return *value.get(); +} +inline IntArray const & getVector(IntArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator IntArray_iterator; typedef std::vector::const_iterator IntArray_const_iterator; + /** * A long array. */ typedef std::vector LongArray; +typedef std::tr1::shared_ptr LongArrayPtr; inline int64 * get(LongArray &value) { return &value[0]; } -inline const int64 * get(const LongArray &value) +inline int64 const * get(LongArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline int64 * get(LongArrayPtr &value) +{ + return get(*value.get()); +} +inline int64 const * get(LongArrayPtr const &value) +{ + return get(*value.get()); +} +inline LongArray & getVector(LongArrayPtr &value) +{ + return *value.get(); +} +inline LongArray const & getVector(LongArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator LongArray_iterator; typedef std::vector::const_iterator LongArray_const_iterator; + /** * An unsigned byte array. */ typedef std::vector UByteArray; +typedef std::tr1::shared_ptr UByteArrayPtr; inline uint8 * get(UByteArray &value) { return &value[0]; } -inline const uint8 * get(const UByteArray &value) +inline uint8 const * get(UByteArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline uint8 * get(UByteArrayPtr &value) +{ + return get(*value.get()); +} +inline uint8 const * get(UByteArrayPtr const &value) +{ + return get(*value.get()); +} +inline UByteArray & getVector(UByteArrayPtr &value) +{ + return *value.get(); +} +inline UByteArray const & getVector(UByteArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator UByteArray_iterator; typedef std::vector::const_iterator UByteArray_const_iterator; + /** * An unsigned short array. */ typedef std::vector UShortArray; +typedef std::tr1::shared_ptr UShortArrayPtr; inline uint16 * get(UShortArray &value) { return &value[0]; } -inline const uint16 * get(const UShortArray &value) +inline uint16 const * get(UShortArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline uint16 * get(UShortArrayPtr &value) +{ + return get(*value.get()); +} +inline uint16 const * get(UShortArrayPtr const &value) +{ + return get(*value.get()); +} +inline UShortArray & getVector(UShortArrayPtr &value) +{ + return *value.get(); +} +inline UShortArray const & getVector(UShortArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator UShortArray_iterator; typedef std::vector::const_iterator UShortArray_const_iterator; + /** * An unsigned int array. */ typedef std::vector UIntArray; +typedef std::tr1::shared_ptr UIntArrayPtr; inline uint32 * get(UIntArray &value) { return &value[0]; } -inline const uint32 * get(const UIntArray &value) +inline uint32 const * get(UIntArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline uint32 * get(UIntArrayPtr &value) +{ + return get(*value.get()); +} +inline uint32 const * get(UIntArrayPtr const &value) +{ + return get(*value.get()); +} +inline UIntArray & getVector(UIntArrayPtr &value) +{ + return *value.get(); +} +inline UIntArray const & getVector(UIntArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator UIntArray_iterator; typedef std::vector::const_iterator UIntArray_const_iterator; + /** * An unsigned long array. */ typedef std::vector ULongArray; +typedef std::tr1::shared_ptr ULongArrayPtr; inline uint64 * get(ULongArray &value) { return &value[0]; } -inline const uint64 * get(const ULongArray &value) +inline uint64 const * get(ULongArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline uint64 * get(ULongArrayPtr &value) +{ + return get(*value.get()); +} +inline uint64 const * get(ULongArrayPtr const &value) +{ + return get(*value.get()); +} +inline ULongArray & getVector(ULongArrayPtr &value) +{ + return *value.get(); +} +inline ULongArray const & getVector(ULongArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator ULongArray_iterator; typedef std::vector::const_iterator ULongArray_const_iterator; + /** * A float array. */ typedef std::vector FloatArray; +typedef std::tr1::shared_ptr FloatArrayPtr; inline float * get(FloatArray &value) { return &value[0]; } -inline const float * get(const FloatArray &value) +inline float const * get(FloatArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline float * get(FloatArrayPtr &value) +{ + return get(*value.get()); +} +inline float const * get(FloatArrayPtr const &value) +{ + return get(*value.get()); +} +inline FloatArray & getVector(FloatArrayPtr &value) +{ + return *value.get(); +} +inline FloatArray const & getVector(FloatArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator FloatArray_iterator; typedef std::vector::const_iterator FloatArray_const_iterator; + /** * A double array. */ typedef std::vector DoubleArray; +typedef std::tr1::shared_ptr DoubleArrayPtr; inline double * get(DoubleArray &value) { return &value[0]; } -inline const double * get(const DoubleArray &value) +inline double const * get(DoubleArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline double * get(DoubleArrayPtr &value) +{ + return get(*value.get()); +} +inline double const * get(DoubleArrayPtr const &value) +{ + return get(*value.get()); +} +inline DoubleArray & getVector(DoubleArrayPtr &value) +{ + return *value.get(); +} +inline DoubleArray const & getVector(DoubleArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator DoubleArray_iterator; typedef std::vector::const_iterator DoubleArray_const_iterator; + /** * A string array. */ typedef std::vector StringArray; +typedef std::tr1::shared_ptr StringArrayPtr; inline String * get(StringArray &value) { return &value[0]; } -inline const String * get(const StringArray &value) +inline String const * get(StringArray const &value) { - return static_cast(&value[0]); + return static_cast(&value[0]); +} +inline String * get(StringArrayPtr &value) +{ + return get(*value.get()); +} +inline String const * get(StringArrayPtr const &value) +{ + return get(*value.get()); +} +inline StringArray & getVector(StringArrayPtr &value) +{ + return *value.get(); +} +inline StringArray const & getVector(StringArrayPtr const &value) +{ + return *value.get(); } typedef std::vector::iterator StringArray_iterator; typedef std::vector::const_iterator StringArray_const_iterator; diff --git a/pvDataApp/pv/standardField.h b/pvDataApp/pv/standardField.h index 193bf27..045fbba 100644 --- a/pvDataApp/pv/standardField.h +++ b/pvDataApp/pv/standardField.h @@ -20,9 +20,11 @@ namespace epics { namespace pvData { * The property field is a comma separated string of property names of the following: * alarm, timeStamp, display, control, and valueAlarm. * An example is "alarm,timeStamp,valueAlarm". - * The method with properties creates a structure with fields named fieldName and each of the property names.s + * The method with properties creates a structure with fields named fieldName + * and each of the property names. * Each property field is a structure defining the property. - * The details about each property is given in the section named "Property". For example the call: + * The details about each property is given in the section named "Property". + * For example the call: * {@code StructureConstPtr example = standardField->scalar( String("value"), @@ -33,12 +35,13 @@ namespace epics { namespace pvData { structure example double value structure alarm - structure severity - int index - string[] choices - structure timeStamp - long secondsPastEpoch - int nanoSeconds + int severity + int status + string message + structure timeStamp + long secondsPastEpoch + int nanoSeconds + int userTag * } * In addition there are methods that create each of the property structures, * i.e. the methods named: alarm, .... enumeratedAlarm." diff --git a/pvDataApp/pv/standardPVField.h b/pvDataApp/pv/standardPVField.h index 13083e1..d3bd19b 100644 --- a/pvDataApp/pv/standardPVField.h +++ b/pvDataApp/pv/standardPVField.h @@ -34,9 +34,9 @@ public: ~StandardPVField(); PVStructurePtr scalar(ScalarType type,String properties); PVStructurePtr scalarArray(ScalarType elementType, String properties); - PVStructurePtr structureArray(StructureConstPtr structure,String properties); - PVStructurePtr enumerated(StringArray choices); - PVStructurePtr enumerated(StringArray choices, String properties); + PVStructurePtr structureArray(StructureConstPtr const &structure,String properties); + PVStructurePtr enumerated(StringArray const &choices); + PVStructurePtr enumerated(StringArray const &choices, String properties); private: StandardPVField(); }; diff --git a/test/plate.sh b/test/plate.sh deleted file mode 100755 index 4c931ca..0000000 --- a/test/plate.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Make things golden... - -for ff in *Diff -do - [ -s "$ff" ] || continue - - cp "${ff%Diff}" "${ff%Diff}Gold" -done diff --git a/test/testAll.sh b/test/testAll.sh deleted file mode 100755 index c7ec374..0000000 --- a/test/testAll.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -./testBaseException.sh || exit $? -./testPVType.sh || exit $? -./testThread.sh || exit $? -./testBitSet.sh || exit $? -./testByteBuffer.sh || exit $? -./testIntrospect.sh || exit $? -./testPVData.sh || exit $? -./testPVStructureArray.sh || exit $? -./testPVAppend.sh || exit $? -./testPVAuxInfo.sh || exit $? -./testTimeStamp.sh || exit $? -./testTimer.sh || exit $? -./testQueue.sh || exit $? -./testMessageQueue.sh || exit $? -./testSerialization.sh || exit $? -./testProperty.sh || exit $? diff --git a/test/testBaseException b/test/testBaseException deleted file mode 100644 index 215bdea..0000000 --- a/test/testBaseException +++ /dev/null @@ -1,45 +0,0 @@ - - -There is a logic_error - -On line 68 of ../testBaseException.cpp -../bin/linux-x86_64/testBaseException[0x401abb] -../bin/linux-x86_64/testBaseException[0x4014b4] -/lib64/libc.so.6(__libc_start_main+0xed)[0x300ea2169d] -../bin/linux-x86_64/testBaseException[0x40150d] -To translate run 'addr2line -e execname 0xXXXXXXX ...' - Note: Must be compiled with debug symbols - - -There is another logic_error - -On line 75 of ../testBaseException.cpp -../bin/linux-x86_64/testBaseException() [0x401c79] -../bin/linux-x86_64/testBaseException() [0x4014b4] -/lib64/libc.so.6(__libc_start_main+0xed) [0x300ea2169d] -../bin/linux-x86_64/testBaseException() [0x40150d] - -testBaseException... - -all is OK -On line 48 of ../testBaseException.cpp -../bin/linux-x86_64/testBaseException() [0x401859] -../bin/linux-x86_64/testBaseException() [0x4014bc] -/lib64/libc.so.6(__libc_start_main+0xed) [0x300ea2169d] -../bin/linux-x86_64/testBaseException() [0x40150d] - - - - - -exception 2 -On line 57 of ../testBaseException.cpp -../bin/linux-x86_64/testBaseException() [0x40162c] -../bin/linux-x86_64/testBaseException() [0x401a10] -../bin/linux-x86_64/testBaseException() [0x4014bc] -/lib64/libc.so.6(__libc_start_main+0xed) [0x300ea2169d] -../bin/linux-x86_64/testBaseException() [0x40150d] - - - -PASSED diff --git a/test/testBaseException.sh b/test/testBaseException.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testBaseException.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testBaseExceptionDiff b/test/testBaseExceptionDiff deleted file mode 100644 index b23e11a..0000000 --- a/test/testBaseExceptionDiff +++ /dev/null @@ -1,74 +0,0 @@ ---- testBaseExceptionGold 2012-01-21 13:09:44.864000461 -0500 -+++ testBaseException 2012-07-19 16:06:11.418991443 -0400 -@@ -1,37 +1,45 @@ -+ -+ -+There is a logic_error -+ -+On line 68 of ../testBaseException.cpp -+../bin/linux-x86_64/testBaseException[0x401abb] -+../bin/linux-x86_64/testBaseException[0x4014b4] -+/lib64/libc.so.6(__libc_start_main+0xed)[0x300ea2169d] -+../bin/linux-x86_64/testBaseException[0x40150d] -+To translate run 'addr2line -e execname 0xXXXXXXX ...' -+ Note: Must be compiled with debug symbols -+ -+ -+There is another logic_error -+ -+On line 75 of ../testBaseException.cpp -+../bin/linux-x86_64/testBaseException() [0x401c79] -+../bin/linux-x86_64/testBaseException() [0x4014b4] -+/lib64/libc.so.6(__libc_start_main+0xed) [0x300ea2169d] -+../bin/linux-x86_64/testBaseException() [0x40150d] -+ - testBaseException... - - all is OK -- at ../testBaseException.cpp:48 -- ../bin/linux-x86/testBaseException -- ../bin/linux-x86/testBaseException -- /lib/libc.so.6: __libc_start_main()+0xe6 -- ../bin/linux-x86/testBaseException -+On line 48 of ../testBaseException.cpp -+../bin/linux-x86_64/testBaseException() [0x401859] -+../bin/linux-x86_64/testBaseException() [0x4014bc] -+/lib64/libc.so.6(__libc_start_main+0xed) [0x300ea2169d] -+../bin/linux-x86_64/testBaseException() [0x40150d] -+ - - - - - exception 2 -- at ../testBaseException.cpp:57 -- ../bin/linux-x86/testBaseException -- ../bin/linux-x86/testBaseException -- ../bin/linux-x86/testBaseException -- /lib/libc.so.6: __libc_start_main()+0xe6 -- ../bin/linux-x86/testBaseException --exception 1 -- at ../testBaseException.cpp:40 -- ../bin/linux-x86/testBaseException -- ../bin/linux-x86/testBaseException -- ../bin/linux-x86/testBaseException -- ../bin/linux-x86/testBaseException -- /lib/libc.so.6: __libc_start_main()+0xe6 -- ../bin/linux-x86/testBaseException --the root cause -- at ../testBaseException.cpp:31 -- ../bin/linux-x86/testBaseException -- ../bin/linux-x86/testBaseException -- ../bin/linux-x86/testBaseException -- /lib/libc.so.6: __libc_start_main()+0xe6 -- ../bin/linux-x86/testBaseException -+On line 57 of ../testBaseException.cpp -+../bin/linux-x86_64/testBaseException() [0x40162c] -+../bin/linux-x86_64/testBaseException() [0x401a10] -+../bin/linux-x86_64/testBaseException() [0x4014bc] -+/lib64/libc.so.6(__libc_start_main+0xed) [0x300ea2169d] -+../bin/linux-x86_64/testBaseException() [0x40150d] -+ - - - PASSED diff --git a/test/testBaseExceptionGold b/test/testBaseExceptionGold deleted file mode 100644 index 3c7ad61..0000000 --- a/test/testBaseExceptionGold +++ /dev/null @@ -1,37 +0,0 @@ -testBaseException... - -all is OK - at ../testBaseException.cpp:48 - ../bin/linux-x86/testBaseException - ../bin/linux-x86/testBaseException - /lib/libc.so.6: __libc_start_main()+0xe6 - ../bin/linux-x86/testBaseException - - - - -exception 2 - at ../testBaseException.cpp:57 - ../bin/linux-x86/testBaseException - ../bin/linux-x86/testBaseException - ../bin/linux-x86/testBaseException - /lib/libc.so.6: __libc_start_main()+0xe6 - ../bin/linux-x86/testBaseException -exception 1 - at ../testBaseException.cpp:40 - ../bin/linux-x86/testBaseException - ../bin/linux-x86/testBaseException - ../bin/linux-x86/testBaseException - ../bin/linux-x86/testBaseException - /lib/libc.so.6: __libc_start_main()+0xe6 - ../bin/linux-x86/testBaseException -the root cause - at ../testBaseException.cpp:31 - ../bin/linux-x86/testBaseException - ../bin/linux-x86/testBaseException - ../bin/linux-x86/testBaseException - /lib/libc.so.6: __libc_start_main()+0xe6 - ../bin/linux-x86/testBaseException - - -PASSED diff --git a/test/testBitSet b/test/testBitSet deleted file mode 100644 index 2589bb5..0000000 --- a/test/testBitSet +++ /dev/null @@ -1,2 +0,0 @@ -testGetSetClearFlip... PASSED -testOperators... PASSED diff --git a/test/testBitSet.sh b/test/testBitSet.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testBitSet.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testBitSetDiff b/test/testBitSetDiff deleted file mode 100644 index 1ff0734..0000000 --- a/test/testBitSetDiff +++ /dev/null @@ -1,6 +0,0 @@ ---- testBitSetGold 2012-01-21 13:09:45.106001921 -0500 -+++ testBitSet 2012-07-19 16:06:14.839021851 -0400 -@@ -1,3 +1,2 @@ - testGetSetClearFlip... PASSED - testOperators... PASSED --bitSet: totalConstruct 4 totalDestruct 4 diff --git a/test/testBitSetGold b/test/testBitSetGold deleted file mode 100644 index b7bdd44..0000000 --- a/test/testBitSetGold +++ /dev/null @@ -1,3 +0,0 @@ -testGetSetClearFlip... PASSED -testOperators... PASSED -bitSet: totalConstruct 4 totalDestruct 4 diff --git a/test/testByteBuffer b/test/testByteBuffer deleted file mode 100644 index f0be63d..0000000 --- a/test/testByteBuffer +++ /dev/null @@ -1,5 +0,0 @@ -Basic operation tests... - First 10 characters of destination: >> cdefgh << -!!! PASSED -Testing inverse endianness... -!!! PASSED diff --git a/test/testByteBuffer.sh b/test/testByteBuffer.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testByteBuffer.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testByteBufferDiff b/test/testByteBufferDiff deleted file mode 100644 index e69de29..0000000 diff --git a/test/testByteBufferGold b/test/testByteBufferGold deleted file mode 100644 index f0be63d..0000000 --- a/test/testByteBufferGold +++ /dev/null @@ -1,5 +0,0 @@ -Basic operation tests... - First 10 characters of destination: >> cdefgh << -!!! PASSED -Testing inverse endianness... -!!! PASSED diff --git a/test/testIntrospect b/test/testIntrospect deleted file mode 100644 index 42b0ad2..0000000 --- a/test/testIntrospect +++ /dev/null @@ -1,84 +0,0 @@ - -testScalar -boolean -byte -short -int -long -float -double -string - -testScalarArray -boolean[] -byte[] -short[] -int[] -long[] -float[] -double[] -string[] - -testSimpleStructure -structure - double value - structure alarm - int severity - int status - string message - structure timeStamp - long secondsPastEpoch - int nanoSeconds - int userTag - structure display - double limitLow - double limitHigh - string description - string format - string units - structure control - double limitLow - double limitHigh - double minStep - structure valueAlarm - boolean active - double lowAlarmLimit - double lowWarningLimit - double highWarningLimit - double highAlarmLimit - int lowAlarmSeverity - int lowWarningSeverity - int highWarningSeverity - int highAlarmSeverity - double hystersis - -testStructureArray -structure - structure[] value - structure - structure voltage - double value - structure alarm - int severity - int status - string message - structure power - double value - structure alarm - int severity - int status - string message - structure current - double value - structure alarm - int severity - int status - string message - structure alarm - int severity - int status - string message - structure timeStamp - long secondsPastEpoch - int nanoSeconds - int userTag diff --git a/test/testIntrospect.sh b/test/testIntrospect.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testIntrospect.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testIntrospectDiff b/test/testIntrospectDiff deleted file mode 100644 index 1500651..0000000 --- a/test/testIntrospectDiff +++ /dev/null @@ -1,85 +0,0 @@ ---- testIntrospectGold 2012-07-19 16:05:15.355492987 -0400 -+++ testIntrospect 2012-07-19 16:06:14.880022214 -0400 -@@ -1,26 +1,26 @@ - - testScalar --boolean boolean --byte byte --short short --int int --long long --float float --double double --string string -+boolean -+byte -+short -+int -+long -+float -+double -+string - - testScalarArray --boolean[] boolean --byte[] byte --short[] short --int[] int --long[] long --float[] float --double[] double --string[] string -+boolean[] -+byte[] -+short[] -+int[] -+long[] -+float[] -+double[] -+string[] - - testSimpleStructure --structure value -+structure - double value - structure alarm - int severity -@@ -31,16 +31,14 @@ - int nanoSeconds - int userTag - structure display -+ double limitLow -+ double limitHigh - string description - string format - string units -- structure limit -- double low -- double high - structure control -- structure limit -- double low -- double high -+ double limitLow -+ double limitHigh - double minStep - structure valueAlarm - boolean active -@@ -55,9 +53,9 @@ - double hystersis - - testStructureArray --structure value -+structure - structure[] value -- structure powerSupply -+ structure - structure voltage - double value - structure alarm -@@ -84,5 +82,3 @@ - long secondsPastEpoch - int nanoSeconds - int userTag --pvField: totalConstruct 49 totalDestruct 49 --field: totalConstruct 122 totalDestruct 122 diff --git a/test/testIntrospectGold b/test/testIntrospectGold deleted file mode 100644 index bcd8d12..0000000 --- a/test/testIntrospectGold +++ /dev/null @@ -1,88 +0,0 @@ - -testScalar -boolean boolean -byte byte -short short -int int -long long -float float -double double -string string - -testScalarArray -boolean[] boolean -byte[] byte -short[] short -int[] int -long[] long -float[] float -double[] double -string[] string - -testSimpleStructure -structure value - double value - structure alarm - int severity - int status - string message - structure timeStamp - long secondsPastEpoch - int nanoSeconds - int userTag - structure display - string description - string format - string units - structure limit - double low - double high - structure control - structure limit - double low - double high - double minStep - structure valueAlarm - boolean active - double lowAlarmLimit - double lowWarningLimit - double highWarningLimit - double highAlarmLimit - int lowAlarmSeverity - int lowWarningSeverity - int highWarningSeverity - int highAlarmSeverity - double hystersis - -testStructureArray -structure value - structure[] value - structure powerSupply - structure voltage - double value - structure alarm - int severity - int status - string message - structure power - double value - structure alarm - int severity - int status - string message - structure current - double value - structure alarm - int severity - int status - string message - structure alarm - int severity - int status - string message - structure timeStamp - long secondsPastEpoch - int nanoSeconds - int userTag -pvField: totalConstruct 49 totalDestruct 49 -field: totalConstruct 122 totalDestruct 122 diff --git a/test/testMessageQueue b/test/testMessageQueue deleted file mode 100644 index 622297d..0000000 --- a/test/testMessageQueue +++ /dev/null @@ -1,2 +0,0 @@ -message 1 messageType info -message 4 messageType info diff --git a/test/testMessageQueue.sh b/test/testMessageQueue.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testMessageQueue.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testMessageQueueAux b/test/testMessageQueueAux deleted file mode 100644 index e69de29..0000000 diff --git a/test/testMessageQueueDiff b/test/testMessageQueueDiff deleted file mode 100644 index 53e7159..0000000 --- a/test/testMessageQueueDiff +++ /dev/null @@ -1,8 +0,0 @@ ---- testMessageQueueGold 2012-01-21 13:09:45.486004216 -0500 -+++ testMessageQueue 2012-07-19 16:06:21.688082743 -0400 -@@ -1,5 +1,2 @@ - message 1 messageType info - message 4 messageType info --queue: totalConstruct 1 totalDestruct 1 --queueElement: totalConstruct 3 totalDestruct 3 --messageQueue: totalConstruct 1 totalDestruct 1 diff --git a/test/testMessageQueueGold b/test/testMessageQueueGold deleted file mode 100644 index ff56a18..0000000 --- a/test/testMessageQueueGold +++ /dev/null @@ -1,5 +0,0 @@ -message 1 messageType info -message 4 messageType info -queue: totalConstruct 1 totalDestruct 1 -queueElement: totalConstruct 3 totalDestruct 3 -messageQueue: totalConstruct 1 totalDestruct 1 diff --git a/test/testPVAppend b/test/testPVAppend deleted file mode 100644 index 1432a78..0000000 --- a/test/testPVAppend +++ /dev/null @@ -1,34 +0,0 @@ - -testAppendSimple -structure - string fieldlist value,timeStamp - string extra junk - -testAppendMore -structure - structure child1 - string value bla - structure child2 - string value blabla - -testAppends -structure - structure child1 - string Joe Good Guy - string Mary Good Girl - structure child2 - string Bill Bad Guy - string Jane Bad Girl -structure - structure child1 - string Joe Good Guy - string Mary Good Girl - structure child2 - string Joe Bad Guy - string Jane Bad Girl -structure - structure child1 - string Joe Good Guy - string Mary Good Girl - structure child2 - string Jane Bad Girl diff --git a/test/testPVAppend.sh b/test/testPVAppend.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testPVAppend.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testPVAppendDiff b/test/testPVAppendDiff deleted file mode 100644 index 5a171dc..0000000 --- a/test/testPVAppendDiff +++ /dev/null @@ -1,48 +0,0 @@ ---- testPVAppendGold 2012-01-21 13:09:44.859000430 -0500 -+++ testPVAppend 2012-07-19 16:06:14.969023006 -0400 -@@ -1,32 +1,34 @@ --structure request -- string fieldList value,timeStamp --structure request -- string fieldList value,timeStamp -+ -+testAppendSimple -+structure -+ string fieldlist value,timeStamp - string extra junk --structure parent -+ -+testAppendMore -+structure - structure child1 - string value bla - structure child2 -- string value bla --structure parent -+ string value blabla -+ -+testAppends -+structure - structure child1 - string Joe Good Guy - string Mary Good Girl - structure child2 - string Bill Bad Guy - string Jane Bad Girl --structure parent -+structure - structure child1 - string Joe Good Guy - string Mary Good Girl - structure child2 - string Joe Bad Guy - string Jane Bad Girl --structure parent -+structure - structure child1 - string Joe Good Guy - string Mary Good Girl - structure child2 - string Jane Bad Girl --pvField: totalConstruct 15 totalDestruct 15 --field: totalConstruct 110 totalDestruct 110 diff --git a/test/testPVAppendGold b/test/testPVAppendGold deleted file mode 100644 index 26ef748..0000000 --- a/test/testPVAppendGold +++ /dev/null @@ -1,32 +0,0 @@ -structure request - string fieldList value,timeStamp -structure request - string fieldList value,timeStamp - string extra junk -structure parent - structure child1 - string value bla - structure child2 - string value bla -structure parent - structure child1 - string Joe Good Guy - string Mary Good Girl - structure child2 - string Bill Bad Guy - string Jane Bad Girl -structure parent - structure child1 - string Joe Good Guy - string Mary Good Girl - structure child2 - string Joe Bad Guy - string Jane Bad Girl -structure parent - structure child1 - string Joe Good Guy - string Mary Good Girl - structure child2 - string Jane Bad Girl -pvField: totalConstruct 15 totalDestruct 15 -field: totalConstruct 110 totalDestruct 110 diff --git a/test/testPVAuxInfo b/test/testPVAuxInfo deleted file mode 100644 index 1dd8074..0000000 --- a/test/testPVAuxInfo +++ /dev/null @@ -1,45 +0,0 @@ - -testPVAuxInfo -structure - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 0 - string description - string format - string units - auxInfo - string factoryName - double 3 - structure control - double limitLow 0 - double limitHigh 0 - double minStep 0 - offset 0 next 20 number 20 -value offset 1 next 2 number 1 -alarm offset 2 next 6 number 4 -severity offset 3 next 4 number 1 -status offset 4 next 5 number 1 -message offset 5 next 6 number 1 -timeStamp offset 6 next 10 number 4 -secondsPastEpoch offset 7 next 8 number 1 -nanoSeconds offset 8 next 9 number 1 -userTag offset 9 next 10 number 1 -display offset 10 next 16 number 6 -limitLow offset 11 next 12 number 1 -limitHigh offset 12 next 13 number 1 -description offset 13 next 14 number 1 -format offset 14 next 15 number 1 -units offset 15 next 16 number 1 -control offset 16 next 20 number 4 -limitLow offset 17 next 18 number 1 -limitHigh offset 18 next 19 number 1 -minStep offset 19 next 20 number 1 diff --git a/test/testPVAuxInfo.sh b/test/testPVAuxInfo.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testPVAuxInfo.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testPVAuxInfoDiff b/test/testPVAuxInfoDiff deleted file mode 100644 index da0704f..0000000 --- a/test/testPVAuxInfoDiff +++ /dev/null @@ -1,76 +0,0 @@ ---- testPVAuxInfoGold 2012-01-21 13:09:44.897000654 -0500 -+++ testPVAuxInfo 2012-07-19 16:06:14.993023219 -0400 -@@ -1,31 +1,29 @@ - - testPVAuxInfo --structure value -+structure - double value 0 -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -- display display -+ structure display -+ double limitLow 0 -+ double limitHigh 0 - string description - string format - string units -- structure limit -- double low 0 -- double high 0 -- auxInfo -- string factory factoryName -- double junk 3 -- control control -- structure limit -- double low 0 -- double high 0 -+ auxInfo -+ string factoryName -+ double 3 -+ structure control -+ double limitLow 0 -+ double limitHigh 0 - double minStep 0 --value offset 0 next 22 number 22 -+ offset 0 next 20 number 20 - value offset 1 next 2 number 1 - alarm offset 2 next 6 number 4 - severity offset 3 next 4 number 1 -@@ -35,18 +33,13 @@ - secondsPastEpoch offset 7 next 8 number 1 - nanoSeconds offset 8 next 9 number 1 - userTag offset 9 next 10 number 1 --display offset 10 next 17 number 7 --description offset 11 next 12 number 1 --format offset 12 next 13 number 1 --units offset 13 next 14 number 1 --limit offset 14 next 17 number 3 --low offset 15 next 16 number 1 --high offset 16 next 17 number 1 --control offset 17 next 22 number 5 --limit offset 18 next 21 number 3 --low offset 19 next 20 number 1 --high offset 20 next 21 number 1 --minStep offset 21 next 22 number 1 --pvAuxInfo: totalConstruct 1 totalDestruct 1 --pvField: totalConstruct 24 totalDestruct 24 --field: totalConstruct 99 totalDestruct 99 -+display offset 10 next 16 number 6 -+limitLow offset 11 next 12 number 1 -+limitHigh offset 12 next 13 number 1 -+description offset 13 next 14 number 1 -+format offset 14 next 15 number 1 -+units offset 15 next 16 number 1 -+control offset 16 next 20 number 4 -+limitLow offset 17 next 18 number 1 -+limitHigh offset 18 next 19 number 1 -+minStep offset 19 next 20 number 1 diff --git a/test/testPVAuxInfoGold b/test/testPVAuxInfoGold deleted file mode 100644 index 59a41da..0000000 --- a/test/testPVAuxInfoGold +++ /dev/null @@ -1,52 +0,0 @@ - -testPVAuxInfo -structure value - double value 0 - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 - display display - string description - string format - string units - structure limit - double low 0 - double high 0 - auxInfo - string factory factoryName - double junk 3 - control control - structure limit - double low 0 - double high 0 - double minStep 0 -value offset 0 next 22 number 22 -value offset 1 next 2 number 1 -alarm offset 2 next 6 number 4 -severity offset 3 next 4 number 1 -status offset 4 next 5 number 1 -message offset 5 next 6 number 1 -timeStamp offset 6 next 10 number 4 -secondsPastEpoch offset 7 next 8 number 1 -nanoSeconds offset 8 next 9 number 1 -userTag offset 9 next 10 number 1 -display offset 10 next 17 number 7 -description offset 11 next 12 number 1 -format offset 12 next 13 number 1 -units offset 13 next 14 number 1 -limit offset 14 next 17 number 3 -low offset 15 next 16 number 1 -high offset 16 next 17 number 1 -control offset 17 next 22 number 5 -limit offset 18 next 21 number 3 -low offset 19 next 20 number 1 -high offset 20 next 21 number 1 -minStep offset 21 next 22 number 1 -pvAuxInfo: totalConstruct 1 totalDestruct 1 -pvField: totalConstruct 24 totalDestruct 24 -field: totalConstruct 99 totalDestruct 99 diff --git a/test/testPVData b/test/testPVData deleted file mode 100644 index 9848d53..0000000 --- a/test/testPVData +++ /dev/null @@ -1,456 +0,0 @@ -structure - string request value,timeStamp -structure - structure value - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 - structure valueAlarm - boolean active false - double lowAlarmLimit 0 - double lowWarningLimit 0 - double highWarningLimit 0 - double highAlarmLimit 0 - int lowAlarmSeverity 0 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 0 - double hystersis 0 - string extra - -testScalar -boolean true -byte 10 -short 10 -int 10 -long 10 -ubyte 10 -ushort 10 -uint 10 -ulong 10 -float 10 -double 10 -string 10 -structure - boolean value true - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure valueAlarm - boolean active true - int falseSeverity 0 - int trueSeverity 2 - int changeStateSeverity 1 -structure - byte value 127 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - byte lowAlarmLimit 1 - byte lowWarningLimit 0 - byte highWarningLimit 0 - byte highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - byte hystersis 0 -structure - short value 32767 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - short lowAlarmLimit 1 - short lowWarningLimit 0 - short highWarningLimit 0 - short highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - short hystersis 0 -structure - int value -2147483648 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - int lowAlarmLimit 1 - int lowWarningLimit 0 - int highWarningLimit 0 - int highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - int hystersis 0 -structure - long value -9223372032559808513 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - long lowAlarmLimit 1 - long lowWarningLimit 0 - long highWarningLimit 0 - long highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - long hystersis 0 -structure - ubyte value 255 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - ubyte lowAlarmLimit 1 - ubyte lowWarningLimit 0 - ubyte highWarningLimit 0 - ubyte highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - ubyte hystersis 0 -structure - ushort value 65535 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - ushort lowAlarmLimit 1 - ushort lowWarningLimit 0 - ushort highWarningLimit 0 - ushort highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - ushort hystersis 0 -structure - uint value 2147483648 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - uint lowAlarmLimit 1 - uint lowWarningLimit 0 - uint highWarningLimit 0 - uint highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - uint hystersis 0 -structure - ulong value 9223372041149743103 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - ulong lowAlarmLimit 1 - ulong lowWarningLimit 0 - ulong highWarningLimit 0 - ulong highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - ulong hystersis 0 -structure - float value 1.123e+08 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - float lowAlarmLimit 1 - float lowWarningLimit 0 - float highWarningLimit 0 - float highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - float hystersis 0 -structure - double value 1.123e+35 - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits - structure control - double limitLow 1 - double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true - double lowAlarmLimit 1 - double lowWarningLimit 0 - double highWarningLimit 0 - double highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - double hystersis 0 -structure - string value this is a string - structure alarm - int severity 2 - int status 0 - string message messageForAlarm - structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - -testScalarArray -structure - boolean[] value [true,false,true] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure - byte[] value [0,1,2] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure - short[] value [0,1,2] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure - int[] value [0,1,2] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure - long[] value [0,1,2] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure - float[] value [0,1,2] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure - double[] value [0,1,2] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure - string[] value [0,1,2] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 diff --git a/test/testPVData.sh b/test/testPVData.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testPVData.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testPVDataDiff b/test/testPVDataDiff deleted file mode 100644 index 6590fdb..0000000 --- a/test/testPVDataDiff +++ /dev/null @@ -1,533 +0,0 @@ ---- testPVDataGold 2012-01-21 13:09:44.840000316 -0500 -+++ testPVData 2012-07-19 16:06:14.905022437 -0400 -@@ -1,13 +1,13 @@ --structure request -- string fieldList value,timeStamp --structure top -+structure -+ string request value,timeStamp -+structure - structure value - double value 0 -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -@@ -25,50 +25,52 @@ - string extra - - testScalar --boolean boolean true --byte byte 10 --short short 10 --int int 10 --long long 10 --float float 10 --double double 10 --string string 10 --structure boolean -+boolean true -+byte 10 -+short 10 -+int 10 -+long 10 -+ubyte 10 -+ushort 10 -+uint 10 -+ulong 10 -+float 10 -+double 10 -+string 10 -+structure - boolean value true -- alarm alarm -+ structure alarm - int severity 2 - int status 0 - string message messageForAlarm -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure valueAlarm -- boolean active false -+ boolean active true - int falseSeverity 0 -- int trueSeverity 0 -- int changeStateSeverity 0 --structure byte -+ int trueSeverity 2 -+ int changeStateSeverity 1 -+structure - byte value 127 -- alarm alarm -+ structure alarm - int severity 2 - int status 0 - string message messageForAlarm -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 -- display display -+ structure display -+ double limitLow 0 -+ double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits -- structure limit -- double low 0 -- double high 10 -- control control -- structure limit -- double low 1 -- double high 9 -+ structure control -+ double limitLow 1 -+ double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true -@@ -81,27 +83,25 @@ - int highWarningSeverity 0 - int highAlarmSeverity 2 - byte hystersis 0 --structure short -+structure - short value 32767 -- alarm alarm -+ structure alarm - int severity 2 - int status 0 - string message messageForAlarm -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 -- display display -+ structure display -+ double limitLow 0 -+ double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits -- structure limit -- double low 0 -- double high 10 -- control control -- structure limit -- double low 1 -- double high 9 -+ structure control -+ double limitLow 1 -+ double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true -@@ -114,27 +114,25 @@ - int highWarningSeverity 0 - int highAlarmSeverity 2 - short hystersis 0 --structure int -+structure - int value -2147483648 -- alarm alarm -+ structure alarm - int severity 2 - int status 0 - string message messageForAlarm -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 -- display display -+ structure display -+ double limitLow 0 -+ double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits -- structure limit -- double low 0 -- double high 10 -- control control -- structure limit -- double low 1 -- double high 9 -+ structure control -+ double limitLow 1 -+ double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true -@@ -147,27 +145,25 @@ - int highWarningSeverity 0 - int highAlarmSeverity 2 - int hystersis 0 --structure long -+structure - long value -9223372032559808513 -- alarm alarm -+ structure alarm - int severity 2 - int status 0 - string message messageForAlarm -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 -- display display -+ structure display -+ double limitLow 0 -+ double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits -- structure limit -- double low 0 -- double high 10 -- control control -- structure limit -- double low 1 -- double high 9 -+ structure control -+ double limitLow 1 -+ double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true -@@ -180,27 +176,149 @@ - int highWarningSeverity 0 - int highAlarmSeverity 2 - long hystersis 0 --structure float -+structure -+ ubyte value 255 -+ structure alarm -+ int severity 2 -+ int status 0 -+ string message messageForAlarm -+ structure timeStamp -+ long secondsPastEpoch 123456789 -+ int nanoSeconds 1000000 -+ int userTag 0 -+ structure display -+ double limitLow 0 -+ double limitHigh 10 -+ string description this is a description -+ string format f10.2 -+ string units SomeUnits -+ structure control -+ double limitLow 1 -+ double limitHigh 9 -+ double minStep 0 -+ structure valueAlarm -+ boolean active true -+ ubyte lowAlarmLimit 1 -+ ubyte lowWarningLimit 0 -+ ubyte highWarningLimit 0 -+ ubyte highAlarmLimit 9 -+ int lowAlarmSeverity 2 -+ int lowWarningSeverity 0 -+ int highWarningSeverity 0 -+ int highAlarmSeverity 2 -+ ubyte hystersis 0 -+structure -+ ushort value 65535 -+ structure alarm -+ int severity 2 -+ int status 0 -+ string message messageForAlarm -+ structure timeStamp -+ long secondsPastEpoch 123456789 -+ int nanoSeconds 1000000 -+ int userTag 0 -+ structure display -+ double limitLow 0 -+ double limitHigh 10 -+ string description this is a description -+ string format f10.2 -+ string units SomeUnits -+ structure control -+ double limitLow 1 -+ double limitHigh 9 -+ double minStep 0 -+ structure valueAlarm -+ boolean active true -+ ushort lowAlarmLimit 1 -+ ushort lowWarningLimit 0 -+ ushort highWarningLimit 0 -+ ushort highAlarmLimit 9 -+ int lowAlarmSeverity 2 -+ int lowWarningSeverity 0 -+ int highWarningSeverity 0 -+ int highAlarmSeverity 2 -+ ushort hystersis 0 -+structure -+ uint value 2147483648 -+ structure alarm -+ int severity 2 -+ int status 0 -+ string message messageForAlarm -+ structure timeStamp -+ long secondsPastEpoch 123456789 -+ int nanoSeconds 1000000 -+ int userTag 0 -+ structure display -+ double limitLow 0 -+ double limitHigh 10 -+ string description this is a description -+ string format f10.2 -+ string units SomeUnits -+ structure control -+ double limitLow 1 -+ double limitHigh 9 -+ double minStep 0 -+ structure valueAlarm -+ boolean active true -+ uint lowAlarmLimit 1 -+ uint lowWarningLimit 0 -+ uint highWarningLimit 0 -+ uint highAlarmLimit 9 -+ int lowAlarmSeverity 2 -+ int lowWarningSeverity 0 -+ int highWarningSeverity 0 -+ int highAlarmSeverity 2 -+ uint hystersis 0 -+structure -+ ulong value 9223372041149743103 -+ structure alarm -+ int severity 2 -+ int status 0 -+ string message messageForAlarm -+ structure timeStamp -+ long secondsPastEpoch 123456789 -+ int nanoSeconds 1000000 -+ int userTag 0 -+ structure display -+ double limitLow 0 -+ double limitHigh 10 -+ string description this is a description -+ string format f10.2 -+ string units SomeUnits -+ structure control -+ double limitLow 1 -+ double limitHigh 9 -+ double minStep 0 -+ structure valueAlarm -+ boolean active true -+ ulong lowAlarmLimit 1 -+ ulong lowWarningLimit 0 -+ ulong highWarningLimit 0 -+ ulong highAlarmLimit 9 -+ int lowAlarmSeverity 2 -+ int lowWarningSeverity 0 -+ int highWarningSeverity 0 -+ int highAlarmSeverity 2 -+ ulong hystersis 0 -+structure - float value 1.123e+08 -- alarm alarm -+ structure alarm - int severity 2 - int status 0 - string message messageForAlarm -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 -- display display -+ structure display -+ double limitLow 0 -+ double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits -- structure limit -- double low 0 -- double high 10 -- control control -- structure limit -- double low 1 -- double high 9 -+ structure control -+ double limitLow 1 -+ double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true -@@ -213,27 +331,25 @@ - int highWarningSeverity 0 - int highAlarmSeverity 2 - float hystersis 0 --structure double -+structure - double value 1.123e+35 -- alarm alarm -+ structure alarm - int severity 2 - int status 0 - string message messageForAlarm -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 -- display display -+ structure display -+ double limitLow 0 -+ double limitHigh 10 - string description this is a description - string format f10.2 - string units SomeUnits -- structure limit -- double low 0 -- double high 10 -- control control -- structure limit -- double low 1 -- double high 9 -+ structure control -+ double limitLow 1 -+ double limitHigh 9 - double minStep 0 - structure valueAlarm - boolean active true -@@ -246,97 +362,95 @@ - int highWarningSeverity 0 - int highAlarmSeverity 2 - double hystersis 0 --structure string -+structure - string value this is a string -- alarm alarm -+ structure alarm - int severity 2 - int status 0 - string message messageForAlarm -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - - testScalarArray --structure boolean -+structure - boolean[] value [true,false,true] -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --structure byte -+structure - byte[] value [0,1,2] -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --structure short -+structure - short[] value [0,1,2] -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --structure int -+structure - int[] value [0,1,2] -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --structure long -+structure - long[] value [0,1,2] -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --structure float -+structure - float[] value [0,1,2] -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --structure double -+structure - double[] value [0,1,2] -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --structure string -+structure - string[] value [0,1,2] -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --pvField: totalConstruct 336 totalDestruct 336 --field: totalConstruct 141 totalDestruct 141 diff --git a/test/testPVDataGold b/test/testPVDataGold deleted file mode 100644 index 9ec4cd6..0000000 --- a/test/testPVDataGold +++ /dev/null @@ -1,342 +0,0 @@ -structure request - string fieldList value,timeStamp -structure top - structure value - double value 0 - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 - structure valueAlarm - boolean active false - double lowAlarmLimit 0 - double lowWarningLimit 0 - double highWarningLimit 0 - double highAlarmLimit 0 - int lowAlarmSeverity 0 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 0 - double hystersis 0 - string extra - -testScalar -boolean boolean true -byte byte 10 -short short 10 -int int 10 -long long 10 -float float 10 -double double 10 -string string 10 -structure boolean - boolean value true - alarm alarm - int severity 2 - int status 0 - string message messageForAlarm - timeStamp timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - structure valueAlarm - boolean active false - int falseSeverity 0 - int trueSeverity 0 - int changeStateSeverity 0 -structure byte - byte value 127 - alarm alarm - int severity 2 - int status 0 - string message messageForAlarm - timeStamp timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - display display - string description this is a description - string format f10.2 - string units SomeUnits - structure limit - double low 0 - double high 10 - control control - structure limit - double low 1 - double high 9 - double minStep 0 - structure valueAlarm - boolean active true - byte lowAlarmLimit 1 - byte lowWarningLimit 0 - byte highWarningLimit 0 - byte highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - byte hystersis 0 -structure short - short value 32767 - alarm alarm - int severity 2 - int status 0 - string message messageForAlarm - timeStamp timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - display display - string description this is a description - string format f10.2 - string units SomeUnits - structure limit - double low 0 - double high 10 - control control - structure limit - double low 1 - double high 9 - double minStep 0 - structure valueAlarm - boolean active true - short lowAlarmLimit 1 - short lowWarningLimit 0 - short highWarningLimit 0 - short highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - short hystersis 0 -structure int - int value -2147483648 - alarm alarm - int severity 2 - int status 0 - string message messageForAlarm - timeStamp timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - display display - string description this is a description - string format f10.2 - string units SomeUnits - structure limit - double low 0 - double high 10 - control control - structure limit - double low 1 - double high 9 - double minStep 0 - structure valueAlarm - boolean active true - int lowAlarmLimit 1 - int lowWarningLimit 0 - int highWarningLimit 0 - int highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - int hystersis 0 -structure long - long value -9223372032559808513 - alarm alarm - int severity 2 - int status 0 - string message messageForAlarm - timeStamp timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - display display - string description this is a description - string format f10.2 - string units SomeUnits - structure limit - double low 0 - double high 10 - control control - structure limit - double low 1 - double high 9 - double minStep 0 - structure valueAlarm - boolean active true - long lowAlarmLimit 1 - long lowWarningLimit 0 - long highWarningLimit 0 - long highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - long hystersis 0 -structure float - float value 1.123e+08 - alarm alarm - int severity 2 - int status 0 - string message messageForAlarm - timeStamp timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - display display - string description this is a description - string format f10.2 - string units SomeUnits - structure limit - double low 0 - double high 10 - control control - structure limit - double low 1 - double high 9 - double minStep 0 - structure valueAlarm - boolean active true - float lowAlarmLimit 1 - float lowWarningLimit 0 - float highWarningLimit 0 - float highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - float hystersis 0 -structure double - double value 1.123e+35 - alarm alarm - int severity 2 - int status 0 - string message messageForAlarm - timeStamp timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - display display - string description this is a description - string format f10.2 - string units SomeUnits - structure limit - double low 0 - double high 10 - control control - structure limit - double low 1 - double high 9 - double minStep 0 - structure valueAlarm - boolean active true - double lowAlarmLimit 1 - double lowWarningLimit 0 - double highWarningLimit 0 - double highAlarmLimit 9 - int lowAlarmSeverity 2 - int lowWarningSeverity 0 - int highWarningSeverity 0 - int highAlarmSeverity 2 - double hystersis 0 -structure string - string value this is a string - alarm alarm - int severity 2 - int status 0 - string message messageForAlarm - timeStamp timeStamp - long secondsPastEpoch 123456789 - int nanoSeconds 1000000 - int userTag 0 - -testScalarArray -structure boolean - boolean[] value [true,false,true] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure byte - byte[] value [0,1,2] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure short - short[] value [0,1,2] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure int - int[] value [0,1,2] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure long - long[] value [0,1,2] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure float - float[] value [0,1,2] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure double - double[] value [0,1,2] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -structure string - string[] value [0,1,2] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -pvField: totalConstruct 336 totalDestruct 336 -field: totalConstruct 141 totalDestruct 141 diff --git a/test/testPVStructureArray b/test/testPVStructureArray deleted file mode 100644 index 4d0d54a..0000000 --- a/test/testPVStructureArray +++ /dev/null @@ -1,290 +0,0 @@ -pvAlarmStructure -structure[] - structure - int severity 0 - int status 0 - string message - structure - int severity 0 - int status 0 - string message -copy -structure[] - structure - int severity 0 - int status 0 - string message - structure - int severity 0 - int status 0 - string message -after append 5 -structure - structure[] value - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -after remove(0,2) -structure - structure[] value - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -after remove 2,1structure - structure[] value - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -after compressstructure - structure[] value - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 diff --git a/test/testPVStructureArray.sh b/test/testPVStructureArray.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testPVStructureArray.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testPVStructureArrayDiff b/test/testPVStructureArrayDiff deleted file mode 100644 index 0d741ba..0000000 --- a/test/testPVStructureArrayDiff +++ /dev/null @@ -1,217 +0,0 @@ ---- testPVStructureArrayGold 2012-01-21 13:09:45.250002792 -0500 -+++ testPVStructureArray 2012-07-19 16:06:14.944022783 -0400 -@@ -1,7 +1,27 @@ -+pvAlarmStructure -+structure[] -+ structure -+ int severity 0 -+ int status 0 -+ string message -+ structure -+ int severity 0 -+ int status 0 -+ string message -+copy -+structure[] -+ structure -+ int severity 0 -+ int status 0 -+ string message -+ structure -+ int severity 0 -+ int status 0 -+ string message - after append 5 --structure powerSupply -+structure - structure[] value -- structure powerSupply -+ structure - structure voltage - double value 0 - structure alarm -@@ -20,7 +40,7 @@ - int severity 0 - int status 0 - string message -- structure powerSupply -+ structure - structure voltage - double value 0 - structure alarm -@@ -39,7 +59,75 @@ - int severity 0 - int status 0 - string message -- structure powerSupply -+ structure -+ structure voltage -+ double value 0 -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure power -+ double value 0 -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure current -+ double value 0 -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure -+ structure voltage -+ double value 0 -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure power -+ double value 0 -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure current -+ double value 0 -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure -+ structure voltage -+ double value 0 -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure power -+ double value 0 -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure current -+ double value 0 -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure alarm -+ int severity 0 -+ int status 0 -+ string message -+ structure timeStamp -+ long secondsPastEpoch 0 -+ int nanoSeconds 0 -+ int userTag 0 -+after remove(0,2) -+structure -+ structure[] value -+ structure - structure voltage - double value 0 - structure alarm -@@ -58,7 +146,7 @@ - int severity 0 - int status 0 - string message -- structure powerSupply -+ structure - structure voltage - double value 0 - structure alarm -@@ -77,7 +165,7 @@ - int severity 0 - int status 0 - string message -- structure powerSupply -+ structure - structure voltage - double value 0 - structure alarm -@@ -96,19 +184,17 @@ - int severity 0 - int status 0 - string message -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --after remove 0,1,3structure powerSupply -+after remove 2,1structure - structure[] value -- null -- null -- structure powerSupply -+ structure - structure voltage - double value 0 - structure alarm -@@ -127,8 +213,7 @@ - int severity 0 - int status 0 - string message -- null -- structure powerSupply -+ structure - structure voltage - double value 0 - structure alarm -@@ -147,17 +232,17 @@ - int severity 0 - int status 0 - string message -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --after compressstructure powerSupply -+after compressstructure - structure[] value -- structure powerSupply -+ structure - structure voltage - double value 0 - structure alarm -@@ -176,7 +261,7 @@ - int severity 0 - int status 0 - string message -- structure powerSupply -+ structure - structure voltage - double value 0 - structure alarm -@@ -195,13 +280,11 @@ - int severity 0 - int status 0 - string message -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --pvField: totalConstruct 105 totalDestruct 105 --field: totalConstruct 104 totalDestruct 104 diff --git a/test/testPVStructureArrayGold b/test/testPVStructureArrayGold deleted file mode 100644 index d4e0734..0000000 --- a/test/testPVStructureArrayGold +++ /dev/null @@ -1,207 +0,0 @@ -after append 5 -structure powerSupply - structure[] value - structure powerSupply - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure powerSupply - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure powerSupply - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure powerSupply - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure powerSupply - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -after remove 0,1,3structure powerSupply - structure[] value - null - null - structure powerSupply - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - null - structure powerSupply - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -after compressstructure powerSupply - structure[] value - structure powerSupply - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure powerSupply - structure voltage - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure power - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure current - double value 0 - structure alarm - int severity 0 - int status 0 - string message - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -pvField: totalConstruct 105 totalDestruct 105 -field: totalConstruct 104 totalDestruct 104 diff --git a/test/testPVType b/test/testPVType deleted file mode 100644 index 51db51c..0000000 --- a/test/testPVType +++ /dev/null @@ -1,4 +0,0 @@ -int8 max 127 min -128 -int8 max 32767 min -32768 -int8 max 2147483647 min -2147483648 -int8 max 9223372036854775807 min -9223372036854775808 diff --git a/test/testPVType.sh b/test/testPVType.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testPVType.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testPVTypeDiff b/test/testPVTypeDiff deleted file mode 100644 index e69de29..0000000 diff --git a/test/testPVTypeGold b/test/testPVTypeGold deleted file mode 100644 index 51db51c..0000000 --- a/test/testPVTypeGold +++ /dev/null @@ -1,4 +0,0 @@ -int8 max 127 min -128 -int8 max 32767 min -32768 -int8 max 2147483647 min -2147483648 -int8 max 9223372036854775807 min -9223372036854775808 diff --git a/test/testProperty b/test/testProperty deleted file mode 100644 index 7f61741..0000000 --- a/test/testProperty +++ /dev/null @@ -1,76 +0,0 @@ -structure - double value 0 - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 - structure display - double limitLow 0 - double limitHigh 0 - string description - string format - string units - structure control - double limitLow 0 - double limitHigh 0 - double minStep 0 -structure - structure value - int index 0 - string[] choices [1,2,3,4] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -testAlarm - message testMessage severity MAJOR status CLIENT -testTimeStamp -testControl - low 1.000000 high 10.000000 -testDisplay - low -10.000000 high -1.000000 -testEnumerated -index 0 choice 1 choices 1 2 3 4 -index 2 choice 3 -doubleRecord -structure - double value 0 - structure alarm - int severity 2 - int status 7 - string message testMessage - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 32 - structure display - double limitLow -10 - double limitHigh -1 - string description testDescription - string format %f10.0 - string units volts - structure control - double limitLow 1 - double limitHigh 10 - double minStep 0 -enumeratedRecord -structure - structure value - int index 2 - string[] choices [1,2,3,4] - structure alarm - int severity 0 - int status 0 - string message - structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 diff --git a/test/testProperty.sh b/test/testProperty.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testProperty.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testPropertyAux b/test/testPropertyAux deleted file mode 100644 index 6e30b31..0000000 --- a/test/testPropertyAux +++ /dev/null @@ -1 +0,0 @@ -2012.07.19 16:06:21 736405214 nanoSeconds isDst true userTag 32 diff --git a/test/testPropertyDiff b/test/testPropertyDiff deleted file mode 100644 index 684e5a5..0000000 --- a/test/testPropertyDiff +++ /dev/null @@ -1,109 +0,0 @@ ---- testPropertyGold 2012-01-21 13:09:45.080001766 -0500 -+++ testProperty 2012-07-19 16:06:21.736083171 -0400 -@@ -1,34 +1,32 @@ --structure value -+structure - double value 0 -- alarm alarm -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -- display display -+ structure display -+ double limitLow 0 -+ double limitHigh 0 - string description - string format - string units -- structure limit -- double low 0 -- double high 0 -- control control -- structure limit -- double low 0 -- double high 0 -+ structure control -+ double limitLow 0 -+ double limitHigh 0 - double minStep 0 --structure value -+structure - structure value - int index 0 -- string[] choices [0,1,2,3] -- alarm alarm -+ string[] choices [1,2,3,4] -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -@@ -40,43 +38,39 @@ - testDisplay - low -10.000000 high -1.000000 - testEnumerated --index 0 choice 0 choices 0 1 2 3 --index 2 choice 2 -+index 0 choice 1 choices 1 2 3 4 -+index 2 choice 3 - doubleRecord --structure value -+structure - double value 0 -- alarm alarm -+ structure alarm - int severity 2 - int status 7 - string message testMessage -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 32 -- display display -+ structure display -+ double limitLow -10 -+ double limitHigh -1 - string description testDescription - string format %f10.0 - string units volts -- structure limit -- double low -10 -- double high -1 -- control control -- structure limit -- double low 1 -- double high 10 -+ structure control -+ double limitLow 1 -+ double limitHigh 10 - double minStep 0 - enumeratedRecord --structure value -+structure - structure value - int index 2 -- string[] choices [0,1,2,3] -- alarm alarm -+ string[] choices [1,2,3,4] -+ structure alarm - int severity 0 - int status 0 - string message -- timeStamp timeStamp -+ structure timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 --pvField: totalConstruct 34 totalDestruct 34 --field: totalConstruct 101 totalDestruct 101 diff --git a/test/testPropertyGold b/test/testPropertyGold deleted file mode 100644 index 986ff7d..0000000 --- a/test/testPropertyGold +++ /dev/null @@ -1,82 +0,0 @@ -structure value - double value 0 - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 - display display - string description - string format - string units - structure limit - double low 0 - double high 0 - control control - structure limit - double low 0 - double high 0 - double minStep 0 -structure value - structure value - int index 0 - string[] choices [0,1,2,3] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -testAlarm - message testMessage severity MAJOR status CLIENT -testTimeStamp -testControl - low 1.000000 high 10.000000 -testDisplay - low -10.000000 high -1.000000 -testEnumerated -index 0 choice 0 choices 0 1 2 3 -index 2 choice 2 -doubleRecord -structure value - double value 0 - alarm alarm - int severity 2 - int status 7 - string message testMessage - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 32 - display display - string description testDescription - string format %f10.0 - string units volts - structure limit - double low -10 - double high -1 - control control - structure limit - double low 1 - double high 10 - double minStep 0 -enumeratedRecord -structure value - structure value - int index 2 - string[] choices [0,1,2,3] - alarm alarm - int severity 0 - int status 0 - string message - timeStamp timeStamp - long secondsPastEpoch 0 - int nanoSeconds 0 - int userTag 0 -pvField: totalConstruct 34 totalDestruct 34 -field: totalConstruct 101 totalDestruct 101 diff --git a/test/testQueue b/test/testQueue deleted file mode 100644 index e69de29..0000000 diff --git a/test/testQueue.sh b/test/testQueue.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testQueue.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testQueueAux b/test/testQueueAux deleted file mode 100644 index 6c26d17..0000000 --- a/test/testQueueAux +++ /dev/null @@ -1,20 +0,0 @@ -source a 0 b 0 -source a 1 b 10 -source a 2 b 20 -source a 3 b 30 -source a 4 b 40 - sink a 0 b 0 - sink a 1 b 10 - sink a 2 b 20 - sink a 3 b 30 - sink a 4 b 40 -source a 0 b 0 - sink a 0 b 0 -source a 1 b 10 - sink a 1 b 10 -source a 2 b 20 - sink a 2 b 20 -source a 3 b 30 - sink a 3 b 30 -source a 4 b 40 - sink a 4 b 40 diff --git a/test/testQueueDiff b/test/testQueueDiff deleted file mode 100644 index 079950c..0000000 --- a/test/testQueueDiff +++ /dev/null @@ -1,6 +0,0 @@ ---- testQueueGold 2012-01-21 13:09:45.310003152 -0500 -+++ testQueue 2012-07-19 16:06:21.666082550 -0400 -@@ -1,3 +0,0 @@ --event: totalConstruct 4 totalDestruct 4 --queue: totalConstruct 1 totalDestruct 1 --queueElement: totalConstruct 5 totalDestruct 5 diff --git a/test/testQueueGold b/test/testQueueGold deleted file mode 100644 index 64cff31..0000000 --- a/test/testQueueGold +++ /dev/null @@ -1,3 +0,0 @@ -event: totalConstruct 4 totalDestruct 4 -queue: totalConstruct 1 totalDestruct 1 -queueElement: totalConstruct 5 totalDestruct 5 diff --git a/test/testSerialization.sh b/test/testSerialization.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testSerialization.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testSerializationGold b/test/testSerializationGold deleted file mode 100644 index 22d7bd9..0000000 --- a/test/testSerializationGold +++ /dev/null @@ -1,39 +0,0 @@ -Testing scalar equals... -!!! PASSED - -Testing scalars... - PVBoolean - PVByte - PVShort - PVInt - PVLong - PVFloat - PVDouble - PVString -!!! PASSED - -Testing arrays... - PVBooleanArray - PVByteArray - PVShortArray - PVIntArray - PVLongArray - PVFloatArray - PVDoubleArray - PVStringArray -!!! PASSED - -Testing scalar non-initialized... -!!! PASSED - -Testing array non-initialized... -!!! PASSED - -Testing structure... - Simple structure serialization - Complex structure serialization -!!! PASSED - -Done. -pvField totalConstruct 158 totalDestruct 158 -field totalConstruct 68 totalDestruct 68 diff --git a/test/testThread b/test/testThread deleted file mode 100644 index 6afd85e..0000000 --- a/test/testThread +++ /dev/null @@ -1,5 +0,0 @@ -Action waiting -main true -Action is false -Action true -Action is true diff --git a/test/testThread.sh b/test/testThread.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testThread.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testThreadAux b/test/testThreadAux deleted file mode 100644 index 4723f15..0000000 --- a/test/testThreadAux +++ /dev/null @@ -1 +0,0 @@ -time per call 0.782178 microseconds diff --git a/test/testThreadDiff b/test/testThreadDiff deleted file mode 100644 index b9196e6..0000000 --- a/test/testThreadDiff +++ /dev/null @@ -1,14 +0,0 @@ ---- testThreadGold 2012-01-21 13:09:45.300003093 -0500 -+++ testThread 2012-07-19 16:06:14.786021379 -0400 -@@ -1,9 +1,5 @@ - Action waiting --main1 true -+main true - Action is false --Action1 true -+Action true - Action is true --executor: totalConstruct 2 totalDestruct 2 --LinkedList: totalConstruct 4 totalDestruct 4 --LinkedListNode: totalConstruct 12 totalDestruct 12 --event: totalConstruct 8 totalDestruct 8 diff --git a/test/testThreadGold b/test/testThreadGold deleted file mode 100644 index 19de205..0000000 --- a/test/testThreadGold +++ /dev/null @@ -1,9 +0,0 @@ -Action waiting -main1 true -Action is false -Action1 true -Action is true -executor: totalConstruct 2 totalDestruct 2 -LinkedList: totalConstruct 4 totalDestruct 4 -LinkedListNode: totalConstruct 12 totalDestruct 12 -event: totalConstruct 8 totalDestruct 8 diff --git a/test/testTimeStamp b/test/testTimeStamp deleted file mode 100644 index 6bde499..0000000 --- a/test/testTimeStamp +++ /dev/null @@ -1,6 +0,0 @@ -diff 0.000000e+00 -diff 1.000000e+00 -diff -1.000000e+00 -diff -1.000000e+00 -diff -1.000000e-09 -diff 1.000000e-01 diff --git a/test/testTimeStamp.sh b/test/testTimeStamp.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testTimeStamp.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testTimeStampAux b/test/testTimeStampAux deleted file mode 100644 index af1506b..0000000 --- a/test/testTimeStampAux +++ /dev/null @@ -1,5 +0,0 @@ -current 1342728375 15960253 milliSec 1342728375015 -2012.07.19 16:06:15 15960253 nanoSeconds isDst true -fromTime_t -current 1342728375 0 milliSec 1342728375000 -2012.07.19 16:06:15 0 nanoSeconds isDst true diff --git a/test/testTimeStampDiff b/test/testTimeStampDiff deleted file mode 100644 index e69de29..0000000 diff --git a/test/testTimeStampGold b/test/testTimeStampGold deleted file mode 100644 index 6bde499..0000000 --- a/test/testTimeStampGold +++ /dev/null @@ -1,6 +0,0 @@ -diff 0.000000e+00 -diff 1.000000e+00 -diff -1.000000e+00 -diff -1.000000e+00 -diff -1.000000e-09 -diff 1.000000e-01 diff --git a/test/testTimer b/test/testTimer deleted file mode 100644 index e69de29..0000000 diff --git a/test/testTimer.sh b/test/testTimer.sh deleted file mode 100755 index 5d1254b..0000000 --- a/test/testTimer.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -SELF="`basename "$0"`" -TEST="${SELF%.sh}" - -if [ -z "$EPICS_HOST_ARCH" ]; then - echo "Please set EPICS_HOST_ARCH and run again" - exit 1 -fi - -rm -f $TEST ${TEST}Diff ${TEST}Aux - -if ../bin/${EPICS_HOST_ARCH}/$TEST $TEST ${TEST}Aux 2>&1 >/dev/null -then - printf "" # OK -else - printf "$TEST Failed to complete\n" -fi - -if [ -e $TEST -a -e ${TEST}Gold ] -then - diff -u ${TEST}Gold $TEST >> ${TEST}Diff - if [ -s "${TEST}Diff" ] - then - printf "$TEST Does not match expectations\n" - cat ${TEST}Diff - printf "\n\n" - else - printf "$TEST OK\n" - fi -else - printf "$TEST OK\n" -fi diff --git a/test/testTimerAux b/test/testTimerAux deleted file mode 100644 index 921aa2f..0000000 --- a/test/testTimerAux +++ /dev/null @@ -1,60 +0,0 @@ -one requested 0.400000 actual 0.400149 delta 0.000149 -two requested 0.200000 actual 0.200165 delta 0.000165 -three requested 0.100000 actual 0.100116 delta 0.000116 -one requested 0.400000 actual 0.400270 delta 0.000270 -two requested 0.200000 actual 0.200209 delta 0.000209 -three requested 0.100000 actual 0.100178 delta 0.000178 -one requested 0.400000 actual 0.400172 delta 0.000172 -two requested 0.200000 actual 0.200164 delta 0.000164 -three requested 0.100000 actual 0.100166 delta 0.000166 -one requested 0.400000 actual 0.400177 delta 0.000177 -three requested 0.100000 actual 0.100253 delta 0.000253 -one requested 0.400000 actual 0.400172 delta 0.000172 -three requested 0.100000 actual 0.100201 delta 0.000201 -one requested 0.400000 actual 0.400179 delta 0.000179 -three requested 0.100000 actual 0.100178 delta 0.000178 -one requested 0.100000 actual 0.100165 delta 0.000165 -two requested 0.200000 actual 0.200220 delta 0.000220 -three requested 0.400000 actual 0.400203 delta 0.000203 -one requested 0.100000 actual 0.100206 delta 0.000206 -two requested 0.200000 actual 0.200234 delta 0.000234 -three requested 0.400000 actual 0.400251 delta 0.000251 -one requested 0.100000 actual 0.100189 delta 0.000189 -two requested 0.200000 actual 0.200400 delta 0.000400 -three requested 0.400000 actual 0.400426 delta 0.000426 -one requested 0.100000 actual 0.100227 delta 0.000227 -three requested 0.400000 actual 0.400281 delta 0.000281 -one requested 0.100000 actual 0.100177 delta 0.000177 -three requested 0.400000 actual 0.400293 delta 0.000293 -one requested 0.100000 actual 0.100196 delta 0.000196 -three requested 0.400000 actual 0.400236 delta 0.000236 -one requested 0.100000 actual 0.100193 delta 0.000193 -two requested 0.400000 actual 0.400186 delta 0.000186 -three requested 0.200000 actual 0.200206 delta 0.000206 -one requested 0.100000 actual 0.100202 delta 0.000202 -two requested 0.400000 actual 0.400232 delta 0.000232 -three requested 0.200000 actual 0.200198 delta 0.000198 -one requested 0.100000 actual 0.100199 delta 0.000199 -two requested 0.400000 actual 0.400216 delta 0.000216 -three requested 0.200000 actual 0.200235 delta 0.000235 -one requested 0.100000 actual 0.100231 delta 0.000231 -three requested 0.200000 actual 0.200250 delta 0.000250 -one requested 0.100000 actual 0.100201 delta 0.000201 -three requested 0.200000 actual 0.200195 delta 0.000195 -one requested 0.100000 actual 0.100198 delta 0.000198 -three requested 0.200000 actual 0.200232 delta 0.000232 -one requested 0.000000 actual 0.000059 delta 0.000059 -two requested 0.000000 actual 0.000127 delta 0.000127 -three requested 0.000000 actual 0.000194 delta 0.000194 -one requested 0.000000 actual 0.000043 delta 0.000043 -two requested 0.000000 actual 0.000106 delta 0.000106 -three requested 0.000000 actual 0.000171 delta 0.000171 -one requested 0.000000 actual 0.000036 delta 0.000036 -two requested 0.000000 actual 0.000098 delta 0.000098 -three requested 0.000000 actual 0.000161 delta 0.000161 -one requested 0.000000 actual 0.000056 delta 0.000056 -three requested 0.000000 actual 0.000120 delta 0.000120 -one requested 0.000000 actual 0.000037 delta 0.000037 -three requested 0.000000 actual 0.000099 delta 0.000099 -one requested 0.000000 actual 0.000038 delta 0.000038 -three requested 0.000000 actual 0.000099 delta 0.000099 diff --git a/test/testTimerDiff b/test/testTimerDiff deleted file mode 100644 index d68067e..0000000 --- a/test/testTimerDiff +++ /dev/null @@ -1,8 +0,0 @@ ---- testTimerGold 2012-01-21 13:09:44.818000181 -0500 -+++ testTimer 2012-07-19 16:06:15.023023486 -0400 -@@ -1,5 +0,0 @@ --timerNode: totalConstruct 6 totalDestruct 6 --timer: totalConstruct 3 totalDestruct 3 --LinkedList: totalConstruct 3 totalDestruct 3 --LinkedListNode: totalConstruct 9 totalDestruct 9 --event: totalConstruct 12 totalDestruct 12 diff --git a/test/testTimerGold b/test/testTimerGold deleted file mode 100644 index 27df488..0000000 --- a/test/testTimerGold +++ /dev/null @@ -1,5 +0,0 @@ -timerNode: totalConstruct 6 totalDestruct 6 -timer: totalConstruct 3 totalDestruct 3 -LinkedList: totalConstruct 3 totalDestruct 3 -LinkedListNode: totalConstruct 9 totalDestruct 9 -event: totalConstruct 12 totalDestruct 12 diff --git a/test/testtestPVAuxInfoDiff b/test/testtestPVAuxInfoDiff deleted file mode 100644 index e69de29..0000000 diff --git a/testApp/pv/Makefile b/testApp/pv/Makefile index e0936b6..7893a3e 100644 --- a/testApp/pv/Makefile +++ b/testApp/pv/Makefile @@ -18,6 +18,14 @@ PROD_HOST += testPVAuxInfo testPVAuxInfo_SRCS += testPVAuxInfo.cpp testPVAuxInfo_LIBS += pvData Com +PROD_HOST += testStandardField +testStandardField_SRCS += testStandardField.cpp +testStandardField_LIBS += pvData Com + +PROD_HOST += testStandardPVField +testStandardPVField_SRCS += testStandardPVField.cpp +testStandardPVField_LIBS += pvData Com + PROD_HOST += testPVData testPVData_SRCS += testPVData.cpp testPVData_LIBS += pvData Com diff --git a/testApp/pv/testPVData.cpp b/testApp/pv/testPVData.cpp index 7b96ca7..e619cdf 100644 --- a/testApp/pv/testPVData.cpp +++ b/testApp/pv/testPVData.cpp @@ -351,6 +351,8 @@ static void testScalarArrayCommon(FILE * fd,String fieldName,ScalarType stype) builder.clear(); pvStructure->toString(&builder); fprintf(fd,"%s\n",builder.c_str()); + PVFieldPtr pvField = pvStructure->getSubField("alarm.status"); + pvField->message("this is a test",infoMessage); } static void testScalarArray(FILE * fd) { diff --git a/testApp/pv/testPVScalarArray.cpp b/testApp/pv/testPVScalarArray.cpp index c87e8aa..dd660b8 100644 --- a/testApp/pv/testPVScalarArray.cpp +++ b/testApp/pv/testPVScalarArray.cpp @@ -25,12 +25,12 @@ using namespace epics::pvData; using std::tr1::static_pointer_cast; -static FieldCreatePtr fieldCreate; -static PVDataCreatePtr pvDataCreate; -static StandardFieldPtr standardField; -static StandardPVFieldPtr standardPVField; -static ConvertPtr convert; -static String builder(""); +static FieldCreatePtr fieldCreate = getFieldCreate(); +static PVDataCreatePtr pvDataCreate = getPVDataCreate(); +static StandardFieldPtr standardField = getStandardField(); +static StandardPVFieldPtr standardPVField = getStandardPVField(); +static ConvertPtr convert = getConvert(); +static String builder; static String alarmTimeStamp("alarm,timeStamp"); static String alarmTimeStampValueAlarm("alarm,timeStamp,valueAlarm"); static String allProperties("alarm,timeStamp,display,control,valueAlarm"); @@ -312,6 +312,31 @@ static void stringArray() fprintf(fd,"]\n"); } +static void shareArray() +{ + PVScalarArrayPtr pvScalarArray = pvDataCreate->createPVScalarArray(pvDouble);; + PVDoubleArrayPtr pvDoubleArray = static_pointer_cast(pvScalarArray); + DoubleArray value; + value.reserve(length); + for(size_t i = 0; iput(0,length,value,0); + PVDoubleArrayPtr pvShareArray = static_pointer_cast( + pvDataCreate->createPVScalarArray(pvDouble)); + pvShareArray->shareData( + pvDoubleArray->getSharedVector(), + pvDoubleArray->getCapacity(), + pvDoubleArray->getLength()); + printf("pvDoubleArray->get() %p pvShareArray->get() %p\n",pvDoubleArray->get(),pvShareArray->get()); + printf("pvDoubleArray->getVector() %p pvShareArray->getVector() %p\n", + &(pvDoubleArray->getVector()),&(pvShareArray->getVector())); + printf("pvDoubleArray->getSharedVector() %p pvShareArray->getSharedVector() %p\n", + &(pvDoubleArray->getSharedVector()),&(pvShareArray->getSharedVector())); + assert(pvDoubleArray->get()==pvShareArray->get()); + builder.clear(); + pvShareArray->toString(&builder); + fprintf(fd,"pvShare\n%s\n",builder.c_str()); +} + int main(int argc,char *argv[]) { char *fileName = 0; @@ -320,11 +345,6 @@ int main(int argc,char *argv[]) if(fileName!=0 && fileName[0]!=0) { fd = fopen(fileName,"w+"); } - fieldCreate = getFieldCreate(); - pvDataCreate = getPVDataCreate(); - standardField = getStandardField(); - standardPVField = getStandardPVField(); - convert = getConvert(); byteArray(); ubyteArray(); longArray(); @@ -332,6 +352,7 @@ int main(int argc,char *argv[]) floatArray(); doubleArray(); stringArray(); + shareArray(); return(0); } diff --git a/testApp/pv/testPVStructureArray.cpp b/testApp/pv/testPVStructureArray.cpp index cff40d6..32989c1 100644 --- a/testApp/pv/testPVStructureArray.cpp +++ b/testApp/pv/testPVStructureArray.cpp @@ -78,7 +78,6 @@ void testPowerSupplyArray(FILE * fd) { powerSupplyArrayStruct->getStructureArrayField(String("value")); assert(powerSupplyArray.get()!=NULL); int offset = powerSupplyArray->append(5); - powerSupplyArray->setLength(offset); buffer.clear(); powerSupplyArrayStruct->toString(&buffer); fprintf(fd,"after append 5\n%s\n",buffer.c_str()); diff --git a/testApp/pv/testStandardField.cpp b/testApp/pv/testStandardField.cpp new file mode 100644 index 0000000..ab46c72 --- /dev/null +++ b/testApp/pv/testStandardField.cpp @@ -0,0 +1,68 @@ +/* testStandardField.cpp */ +/** + * Copyright - See the COPYRIGHT that is included with this distribution. + * EPICS pvDataCPP is distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. + */ +/* Author: Marty Kraimer Date: 2012.08 */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +using namespace epics::pvData; +using std::tr1::static_pointer_cast; + +static FieldCreatePtr fieldCreate = getFieldCreate(); +static StandardFieldPtr standardField = getStandardField(); +static String builder(""); + +static void print(String name) +{ + printf("\n%s\n%s\n",name.c_str(),builder.c_str()); +} + +int main(int argc,char *argv[]) +{ + StructureConstPtr doubleValue = standardField->scalar(pvDouble, + "alarm,timeStamp,display,control,valueAlarm"); + builder.clear(); + doubleValue->toString(&builder); + print("doubleValue"); + StructureConstPtr stringArrayValue = standardField->scalarArray(pvString, + "alarm,timeStamp"); + builder.clear(); + stringArrayValue->toString(&builder); + print("stringArrayValue"); + StructureConstPtr enumeratedValue = standardField->enumerated( + "alarm,timeStamp,valueAlarm"); + builder.clear(); + enumeratedValue->toString(&builder); + print("enumeratedValue"); + FieldConstPtrArray fields; + fields.reserve(2); + fields.push_back(fieldCreate->createScalar(pvDouble)); + fields.push_back(fieldCreate->createScalarArray(pvDouble)); + StringArray fieldNames; + fieldNames.reserve(2); + fieldNames.push_back("scalarValue"); + fieldNames.push_back("arrayValue"); + StructureConstPtr structure = fieldCreate->createStructure(fieldNames, fields); + StructureConstPtr structureArrayValue = standardField->structureArray(structure, "alarm,timeStamp"); + builder.clear(); + structureArrayValue->toString(&builder); + print("structureArrayValue"); + return(0); +} + diff --git a/testApp/pv/testStandardPVField.cpp b/testApp/pv/testStandardPVField.cpp new file mode 100644 index 0000000..d77fc73 --- /dev/null +++ b/testApp/pv/testStandardPVField.cpp @@ -0,0 +1,84 @@ +/* testStandardPVField.cpp */ +/** + * Copyright - See the COPYRIGHT that is included with this distribution. + * EPICS pvDataCPP is distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. + */ +/* Author: Marty Kraimer Date: 2012.08 */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace epics::pvData; +using std::tr1::static_pointer_cast; + +static PVDataCreatePtr pvDataCreate = getPVDataCreate(); +static StandardFieldPtr standardField = getStandardField(); +static StandardPVFieldPtr standardPVField = getStandardPVField(); +static String builder(""); + +static void print(String name) +{ + printf("\n%s\n%s\n",name.c_str(),builder.c_str()); +} + +int main(int argc,char *argv[]) +{ + PVStructurePtr pvStructure = standardPVField->scalar(pvDouble, + "alarm,timeStamp,display,control,valueAlarm"); + PVDoublePtr pvValue = pvStructure->getDoubleField("value"); + pvValue->put(10.0); + PVIntPtr pvSeverity = pvStructure->getIntField("alarm.severity"); + pvSeverity->put(2); + PVStringPtr pvMessage = pvStructure->getStringField("alarm.message"); + pvMessage->put("test message"); + builder.clear(); + pvStructure->toString(&builder); + print("scalarTest"); + pvStructure = standardPVField->scalar(pvBoolean,"alarm,timeStamp,valueAlarm"); + builder.clear(); + pvStructure->toString(&builder); + print("booleanTest"); + StringArray choices; + choices.reserve(3); + choices.push_back("one"); + choices.push_back("two"); + choices.push_back("three"); + pvStructure = standardPVField->enumerated(choices, "alarm,timeStamp,valueAlarm"); + builder.clear(); + pvStructure->toString(&builder); + print("enumeratedTest"); + pvStructure = standardPVField->scalarArray(pvBoolean,"alarm,timeStamp"); + builder.clear(); + pvStructure->toString(&builder); + print("scalarArrayTest"); + StructureConstPtr structure = standardField->scalar(pvDouble, "alarm,timeStamp"); + pvStructure = standardPVField->structureArray(structure,"alarm,timeStamp"); + size_t num = 2; + PVStructurePtrArray pvStructures; + pvStructures.reserve(num); + for(size_t i=0; icreatePVStructure(structure)); + } + PVStructureArrayPtr pvStructureArray = pvStructure->getStructureArrayField("value"); + pvStructureArray->put(0, num, pvStructures, 0); + builder.clear(); + pvStructure->toString(&builder); + print("structureArrayTest"); + return(0); +} +