diff --git a/.hgtags b/.hgtags index 1c3718d..6d497b9 100644 --- a/.hgtags +++ b/.hgtags @@ -11,3 +11,6 @@ d70c5ad29163306f50979a95b5aebbe9a93cfe76 2.0-BETA 58092712d092ee521d1e1c8fa596a67f7d113ee9 3.0.2 40b681ffc5cd609320e3f8ffc8eb6aa3bfdfbf19 before_merge_changesAfter3_0_2 260f35b9c6cad113f242c83c89be9cdac802f610 3.1.0 +1348c22b125861ecb9da95b23f20314b167ee155 4.0.0 +1348c22b125861ecb9da95b23f20314b167ee155 4.0.0 +9c62aaa83b9db6ad69740a6bb46d6529e0e60b78 4.0.0 diff --git a/LICENSE b/LICENSE index 1f555ec..3f43ff2 100644 --- a/LICENSE +++ b/LICENSE @@ -2,7 +2,7 @@ Copyright (c) 2008 Martin R. Kraimer Copyright (c) 2006 The University of Chicago, as Operator of Argonne National Laboratory. -Copyright (c) 2006 Deutsches Elektronen-Synchroton, +Copyright (c) 2006 Deutsches Elektronen-Synchrotron, Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY. Copyright (c) 2007 Control System Laboratory, (COSYLAB) Ljubljana Slovenia diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 59bf2d2..70a2f0f 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -34,8 +34,8 @@ For example:

is replaced by

  PVDoublePtr pvValue;
-  cout << pvValue=>dumpValue(cout) << endl
-  cout << pvValue->getField()->dump(cout) << endl;
+  cout << *pvValue << endl
+  cout << *pvValue->getField() << endl;
 

union is a new basic type.

There are two new basic types: union_t and unionArray.

@@ -55,4 +55,4 @@ only on pvData, i. e. it no longer has any knowledge of PVRecord.

This is for is for use by code that implements pvAccess monitors. This is prototype and is subject to debate.

Release 3.0.2

-

This was the starting point for RELEASE_NOTES

\ No newline at end of file +

This was the starting point for RELEASE_NOTES

diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 5a66e64..760892c 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -53,8 +53,8 @@ For example: is replaced by PVDoublePtr pvValue; - cout << pvValue=>dumpValue(cout) << endl - cout << pvValue->getField()->dump(cout) << endl; + cout << *pvValue << endl + cout << *pvValue->getField() << endl; union is a new basic type. diff --git a/documentation/copyandmonitor.html b/documentation/copyandmonitor.html index bf3afd2..3b25eb1 100644 --- a/documentation/copyandmonitor.html +++ b/documentation/copyandmonitor.html @@ -52,7 +52,7 @@ provides a language independent overview of copy and monitor.

NOTE:pvRequest.html must be updated since it is based on an earlier version of pvCopy that -had knowlege of PVRecord. The C++ version was implemented in pvDatabaseCPP +had knowledge of PVRecord. The C++ version was implemented in pvDatabaseCPP and the Java version on pvIOCJava. At present only the C++ version of the new API for pvCopy is implemented.

@@ -65,13 +65,13 @@ At present only the C++ version of the new API for pvCopy is implemented. Given an ascii string createRequest creates a PVStructure that provides a pvData representation of the information from the ascii string. It is this structure that can be passed to the channel create methods.
- The information in a pvRequest selects an arbitrarary subset of the + The information in a pvRequest selects an arbitrary subset of the fields in a top level structure that resides in the server. In addition options can be specified. Both global and field specific options can be specified.
pvCopy
-
This is a faculity used by channel providers. +
This is a facility used by channel providers. It provides client specific code that manages a copy of an arbitrary subset of the fields in a top level structure that resides in the provider. It also allows provider access to options specified @@ -185,7 +185,7 @@ where This is the method for creating a PVCopy instance.
pvMaster
-
the top level sructure managed by the server.
+
the top level structure managed by the server.
pvRequest
selects the set of subfields desired and options for each field.
@@ -241,12 +241,12 @@ where
updateCopyFromBitSet
For each set bit in bitSet set the field in copyPVStructure to the value - of the corrseponding field in pvMaster. + of the corresponding field in pvMaster.
updateMaster
For each set bit in bitSet set the field in pvMaster to the value - of the corrseponding field in copyPVStructure. + of the corresponding field in copyPVStructure.
getOptions
@@ -266,7 +266,7 @@ where

This consists of two components:

monitor
-
Used by code that implements pvAccess montors.
+
Used by code that implements pvAccess monitors.
monitorPlugin
Code that provides special semantics for monitors.
@@ -346,7 +346,7 @@ Note that each client has it's own queue that is not shared with other client.
start
Start monitoring. - This will result in a an inital monitor that has the current value + This will result in a an initial monitor that has the current value of all fields.
stop
@@ -356,11 +356,11 @@ Note that each client has it's own queue that is not shared with other client.
poll
Called to get a monitor element. - If no new elemants are available then a null pointer is returned. + If no new elements are available then a null pointer is returned.
release
- Release the monotor element. + Release the monitor element. The caller owns the monitor element between the calls to poll and release.
@@ -488,7 +488,7 @@ It has methods:

MonitorPluginManager is a singleton. The first call to get will create the single instance. - Further calls will rerurn the single instance. + Further calls will return the single instance.
addPlugin
@@ -496,18 +496,18 @@ It has methods:

findPlugin
- Find a plugin. A NULL shared pointer is reurned if it has not been added. + Find a plugin. A NULL shared pointer is returned if it has not been added.
showNames
- Show the names of all puugins that have been added. + Show the names of all plugins that have been added.

NOTE: Should the method causeMonitor have arguments pvField and pvTop -be defined so that they can not be modfied. -This would be posssible if the following was defined: +be defined so that they can not be modified. +This would be possible if the following was defined:

 typedef std::tr1::shared_ptr<const PVField> PVFieldConstPtr;
 typedef std::tr1::shared_ptr<const PVStructure> PVStructureConstPtr;
@@ -519,7 +519,7 @@ virtual bool causeMonitor(
         PVStructureConstPtr const &pvTop,
         MonitorElementPtr const &monitorElement) = 0;
 
-But just adding these definitions is not sufficent. +But just adding these definitions is not sufficient. In addition all methods defined in pvDataCPP must be checked. In particular many of the methods in Convert must have their arguments modified. @@ -545,15 +545,15 @@ structure powerSupply structure power double value structure alarm - struvture display + structure display structure voltage double value structure alarm - struvture display + structure display structure current double value structure alarm - struvture display + structure display

A pvAccess client wants to create a monitor on the powerSupply as follows: The client wants a top level structure that looks like: @@ -578,7 +578,7 @@ client wants. It can be attached to any field via the following options: [plugin=onChange,raiseMonitor=value] This plugin will trigger a monitor for the field only if the field changes -value. In addition value equals false means do not raise a monotor +value. In addition value equals false means do not raise a monitor for changes to this field. But if a change to another field does cause a monitor the change to this field will be passed to the client. diff --git a/documentation/examples.zip b/documentation/examples.zip index 1f27dd5..dcefb77 100644 Binary files a/documentation/examples.zip and b/documentation/examples.zip differ diff --git a/documentation/pvArray.html b/documentation/pvArray.html deleted file mode 100644 index 9f7c031..0000000 --- a/documentation/pvArray.html +++ /dev/null @@ -1,1842 +0,0 @@ - - - - - - EPICS pvArray - - - - - - - - -

-

EPICS Array

- - -

EPICS v4 Working Group, Working Draft, 28-Jun-2013

- -
-
Latest version:
-
pvArray.html -
-
This version:
-
none
-
Previous version:
-
None
-
Editors:
-
Marty Kraimer, BNL
- Michael Davidsaver, BNL
-
- - -
-
- - -
-

Table of Contents

-
-
- - -

Changes

-

Since the last version of this document the following changes have -been made to the proposed interface definitionsi for PVValueArray:

-
-
put(const svector &from)
-
This has been removed. shareData can be used instead.
-
get
-
The get methods has been replaced by two methods. - One allows write access to array elements and the other does not. -
-
-

The stream operator++ methods were changed so that they only appear -in PVField. All the complexity should be hidden in the implementation -and, perhaps like Java, in the convert facility.

-

A few minor changes were made because of mistakes in documenting -existing API descriptions.

-

Introduction

-

This is the documentation for pvData.h as defined by pvDataCPP-md. -When complete it will be merged into pvDataCPP.html. -This document proposes an implementation of the PVXXX interfaces that are -different than the existing pvDataCPP-md interfaces. -See the next section for a comparison of the four interface descriptions. -The main reason for proposing a different definition is the primary -purpose for pvData: -

pvData (Process Variable Data) defines and implements an efficent -way to store, access, and communicate memory resident data structures.
-This statement appears as the first sentence of pvDataJava.html. -A few sentances later the document makes clear that communication -includes network communication. -Thus pvData provides an interface for network accessible structured data. -If the interfaces for C++ and Java are similar then -someone who understands the interface in one of the languages -and knows both languages will quickly understand the interface of the other language. -With only a few exceptions the naming and other conventions do -not follow the C++ standard library conventions. -The pvData.h API is similar to the definition for Java. -The differences are mainly related to language differences. -Some differences are: -
-
shared pointers
-
Java has a garbage collector. In C++ the implementation manages - memory. An important tool is std::tr1::shared_ptr.
-
PVArray
-
The Java garbage collector allows raw data arrays, e. g. int[], - to be shared. For C++ a shared_vector holds the raw data. -
-
ostream replaces toString
-
In Java every object has method toString(). - For C++ stream operator<< replaces toString
-
shared_vector
-
This is similar to std::vector but uses a shared_ptr to wrap the raw - data and also supports a window into the raw data. It does follow the - naming and other conventions for C++ standard library containers. - Code that wants to use features of the C++ standard library - like iterators and algorithms can get the shared_vector. -
-
-

There is one big difference from the existing Java API: -The method PVValueArray::get. -As an example the Java definition for PVDoubleArray is currently: -

-    int get(int offset, int length, DoubleArrayData data);
-
-This document assumes this will be replaced by: -
-    double[] get();
-
-

The existing version allowed the data source to provide the array in chunks. -The new version assumes that the data source always provides contiguous storage -for the entire raw array. If this is accepted it simplifies a lot of code. -

-

Three topics not discussed in this document are: -

-
pvDataCreate
-
There should be a new method something like: -
-PVScalarArrayPtr createPVScalarArray(const PVScalarArray &, size_t offset, size_t length);
-      
- This will share the raw data array but allow a new window. -
-
convert
-
This will be changed to do conversions itself instead of calling - methods like getAs. It will again support methods toXXXArray and fromXXXArray. - Templates should be used to minimize the code required.
-
PVStructureArray
-
This should also be able to use shared_vector to hold elements.
-
-

-

PVXXX: pvDataJava, pvDataCPP, pvDataCPP-md, and proposed interface

-

The following compares the definitions of the following: PVField, -PVScalar and extensions, PVArray and extensions. -PVStructureArray is not discussed. -

-

PVField

-

This is the base for all the PVXXX iterfaces. -It provides basic methods for allowing network transfer and for -traversing structured data. -The pvDataJava and pvDataCPP definitions are similar. -pvDataCPP-md added method getFullName. -The proposed interface is like the existing pvDataCPP except that -the dumpValue method is replaced by the stream operator<<. -

-

Java

-
interface PVField extends Requester, Serializable {
-    std::string getFieldName();
-    void setRequester(Requester requester);
-    int getFieldOffset();
-    int getNextFieldOffset();
-    int getNumberFields();
-    PVAuxInfo getPVAuxInfo();
-    boolean isImmutable();
-    void setImmutable();
-    Field getField();
-    PVStructure getParent();
-    void renameField(std::string newName);
-    void postPut(); // calls PVRecordField.postPut if this is a field of a record
-    void setPostHandler(PostHandler postHandler);
-    void toString(StringBuilder buf);
-    void toString(StringBuilder buf,int indentLevel);
-    std::string toString();
-}
-

pvDataCPP

-
class PVField
-: virtual public Serializable,
-  public std::tr1::enable_shared_from_this<PVField>
-{
-public:
-   POINTER_DEFINITIONS(PVField);
-   virtual ~PVField();
-   virtual void message(std::string message,MessageType messageType);
-   std::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(std::string const &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);
-   virtual std::ostream& dumpValue(std::ostream& o) const =0;
- ...
-}
-
-std::ostream& operator<<(std::ostream& o, const PVFieldPtr & f);
-
-

pvDataCPP-md

-
class PVField
-: virtual public Serializable,
-  public std::tr1::enable_shared_from_this<PVField>
-{
-public:
-   POINTER_DEFINITIONS(PVField);
-   virtual ~PVField();
-   virtual void message(std::string message,MessageType messageType);
-   std::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(std::string const &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);
-   std::ostream& dumpValue(std::ostream& o) const;
-   // not in pvDataCPP
-   std::string getFullName() const;
- ...
-}
-
-std::ostream& operator<<(std::ostream& o, const PVFieldPtr & f);
-
-

proposed

-
-class PVField
-: virtual public Serializable,
-  public std::tr1::enable_shared_from_this
-{
-public:
-    POINTER_DEFINITIONS(PVField);
-    virtual ~PVField();
-    virtual void message(std::string message,MessageType messageType);
-    const std::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;
-    void setImmutable();
-    const FieldConstPtr & getField() const;
-    PVStructure * getParent() const;
-    void replacePVField(const PVFieldPtr&  newPVField);
-    void renameField(std::string const & newName);
-    void postPut();
-    void setPostHandler(PostHandlerPtr const &postHandler);
-    virtual bool equals(PVField &pv);
-    void toString(StringBuilder buf) ;
-    void toString(StringBuilder buf,int indentLevel);
-    std::ostream& operator<<(std::ostream& o) const;
-...
-};
-
-
-

PVScalar

-

The Java and pvDataCPP versions differ in that Java has an interface definition -for each scalar type, i. e. PVBoolean, ..., PVString, -and the CPP versions provide a template PVValue for the implementation.

-

-pvDataCPP-md differs from pvDataCPP in that it implements three additional -methods: -

-
getAs
-
This is used to implement the Convert::toXXX methods. - This belongs in the Convert implementation not in PVScalar.
-
putFrom
-
This is used to implement the Convert::fromXXX scalar methods. - This belongs in the Convert implementation not in PVScalar.
-
assign
-
This does the same thing as the Convert::fromXXX methods except - that it does not go through Convert. - This belongs in the Convert implementation not in PVScalar.
-
-

-

The proposed version is like the pvDataCPP version except for dumpValue -and the stream interators.

-

pvDataJava

-
-interface PVScalar extends PVField {
-    Scalar getScalar();
-}
-
-interface PVBoolean extends PVScalar {
-    boolean get();
-    void put(boolean value);
-}
-
-interface PVByte extends PVScalar {
-    byte get();
-    void put(byte value);
-}
-...
-interface PVDouble extends PVScalar {
-    double get();
-    void put(double value);
-}
-interface PVString extends PVScalar, SerializableArray {
-    std::string get();
-    void put(std::string value);
-}
-
-

pvDataCPP

-
class PVScalar : public PVField {
-public:
-    POINTER_DEFINITIONS(PVScalar);
-    virtual ~PVScalar();
-    typedef PVScalar &reference;
-    typedef const PVScalar& const_reference;
-    const ScalarConstPtr getScalar() const ;
- ...
-}
-
-template<typename T>
-class PVScalarValue : public PVScalar {
-public:
-    POINTER_DEFINITIONS(PVScalarValue);
-    typedef T value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-    virtual ~PVScalarValue() {}
-    virtual T get() const = 0;
-    virtual void put(T value) = 0;
-    std::ostream& dumpValue(std::ostream& o) const
-    void operator>>=(T& value) const;
-    void operator<<=(T value);
- ...
-}
-
-typedef PVScalarValue PVBoolean;
-typedef PVScalarValue PVByte;
-...typedef PVScalarValue PVDouble;
-typedef std::tr1::shared_ptr PVBooleanPtr;
-typedef std::tr1::shared_ptr PVBytePtr;
-...
-typedef std::tr1::shared_ptr PVDoublePtr;
-
-
-// PVString is special case, since it implements SerializableArray
-class PVString : public PVScalarValue<std::string>, SerializableArray {
-public:
-    virtual ~PVString() {}
- ...
-};
- -

pvDataCPP-md

-
class PVScalar : public PVField {
-public:
-    POINTER_DEFINITIONS(PVScalar);
-    virtual ~PVScalar();
-    typedef PVScalar &reference;
-    typedef const PVScalar& const_reference;
-    const ScalarConstPtr getScalar() const ;
-
-    // not in pvDataCPP
-    template<ScalarType ID>
-    inline typename ScalarTypeTraits<ID>::type getAs() const;
-
-    virtual void getAs(void *, ScalarType) const = 0;
-    template<ScalarType ID>
-    inline void putFrom(typename ScalarTypeTraits<ID>::type val)
-
-    virtual void putFrom(const void *, ScalarType) = 0;
-    virtual void assign(const PVScalar&) = 0;
-
- ...
-}
-
-template<typename T>
-class PVScalarValue : public PVScalar {
-public:
-    POINTER_DEFINITIONS(PVScalarValue);
-    typedef T value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-    virtual ~PVScalarValue() {}
-    virtual T get() const = 0;
-    virtual void put(T value) = 0;
-    std::ostream& dumpValue(std::ostream& o) const
-    void operator>>=(T& value) const;
-    void operator<<=(T value);
-
-    // not in pvDataCPP
-    static const ScalarType typeCode;
- ...
-}
-
-typedef PVScalarValue PVBoolean;
-typedef PVScalarValue PVByte;
-...typedef PVScalarValue PVDouble;
-typedef std::tr1::shared_ptr PVBooleanPtr;
-typedef std::tr1::shared_ptr PVBytePtr;
-...
-typedef std::tr1::shared_ptr PVDoublePtr;
-
-
-// PVString is special case, since it implements SerializableArray
-class PVString : public PVScalarValue<std::string>, SerializableArray {
-public:
-    virtual ~PVString() {}
- ...
-};
-

proposed

-
-class PVScalar : public PVField {
-public:
-    POINTER_DEFINITIONS(PVScalar);
-    virtual ~PVScalar();
-
-    typedef PVScalar &reference;
-    typedef const PVScalar& const_reference;
-
-    const ScalarConstPtr getScalar() const;
-...
-};
-
-template<typename T>
-class PVScalarValue : public PVScalar {
-public:
-    POINTER_DEFINITIONS(PVScalarValue);
-    typedef T value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-
-    virtual ~PVScalarValue() {}
-    virtual T get() const = 0;
-    virtual void put(T value) = 0;
-
-    void operator>>=(T& value) const;
-    void operator<<=(T value);
-...
-};
-typedef PVScalarValue<uint8> PVBoolean;
-typedef PVScalarValue<int8> PVByte;
-typedef PVScalarValue<double> PVDouble;
-...
-typedef std::tr1::shared_ptr<PVBoolean> PVBooleanPtr;
-typedef std::tr1::shared_ptr<PVByte> PVBytePtr;
-...
-typedef std::tr1::shared_ptr<PVDouble> PVDoublePtr;
-
-// PVString is special case, since it implements SerializableArray
-class PVString : public PVScalarValue<std::string>, SerializableArray {
-public:
-    virtual ~PVString() {}
- ...
-};
-
-

PVArray

-

The Java and pvDataCPP versions differ in that Java has an interface definition -for each scalarArray type, i. e. PVBooleanArray, ..., PVStringArray, -and the CPP versions provide a template PVValueArray for the implementation.

-

-pvDataCPP-md differs from pvDataCPP in that it implements additional -methods: -

-
getAs
-
This is used to implement the Convert::toXXXArray methods. - This belongs in the Convert implementation not in PVArray.
-
putFrom
-
This is used to implement the Convert::fromXXXArray scalar methods. - This belongs in the Convert implementation not in PVArray.
-
assign
-
This does the same thing as the Convert::fromXXXArray methods except - that it does not go through Convert. - This belongs in the Convert implementation not in PVArray.
-
copyOut
-
This is used to copy data to a raw array.
-
copyIn
-
This is used to copy data in from a raw array. -
-

-

The proposed version is differs from pvJava, pvDataCPP, and pvCPP-md. -It is like the Java version if the Java get method is simplified as discussed above. -For example PVDoubleArray::get becomes: -

-    double[] get();
-
-The corresponding C++ version becomes: -
-    const svector & get();
-    const const_svector & get() const;
-
-

-

The remaining difference is that dumpValue is replaced by the stream operator<<.

-

The main difference from the pvDataJava version is that PVValueArray "wraps" shared_vector. -Thus shared_vector takes the place of the raw arrays in Java. -This allows the C++ interface to be more similar to Java.

-

The main difference from the pvDataCPP-md version is that it does not implement -the extra methods and allows -the client access to the shared_vector. -The client is then able to perform C++ specific things to the data. -BUT it also means that if the client modifies the shared_vector -the client is also responsible for ensuring that the -immutable and capacity related features of PVField and PVArray are -respected and the postPut is properly handled. -

-

Note that two get methods exist. -One allows write access to the raw data and the other doesn't/

-

pvDataJava

-
interface PVArray extends PVField, SerializableArray {
-    int getLength();
-    void setLength(int length);
-    int getCapacity();
-    void setCapacity(int length);
-    boolean isCapacityMutable();
-    void setCapacityMutable(boolean isMutable);
-}
-
-interface PVScalarArray extends PVArray {
-    ScalarArray getScalarArray();
-}
-

For each scalar type an associated array data interface is defined. Each has -a get and put method. For example:

-
public class DoubleArrayData {
-    public double[] data;
-    public int offset;
-}
-
-interface PVDoubleArray extends PVArray {
-    int get(int offset, int len, DoubleArrayData data);
-    int put(int offset,int len, double[] from, int fromOffset);
-    void shareData(double[] from);
-}
-

pvDataCPP

-
class PVArray : public PVField, public SerializableArray {
-public:
-    POINTER_DEFINITIONS(PVArray);
-    virtual ~PVArray();
-    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(std::size_t capacity) = 0;
-    virtual std::ostream& dumpValue(std::ostream& o, std::size_t index) const = 0;
-
- ...
-};
-
-
-template<typename T>
-class PVArrayData {
-private:
-    std::vector<T> init;
-public:
-    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)
-    {}
-};
-
-class PVScalarArray : public PVArray {
-public:
-    POINTER_DEFINITIONS(PVScalarArray);
-    virtual ~PVScalarArray();
-    typedef PVScalarArray &reference;
-    typedef const PVScalarArray& const_reference;
-    const ScalarArrayConstPtr getScalarArray() const ;
- ...
-}
-
-template<typename T>
-class PVValueArray : public PVScalarArray {
-public:
-    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 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;
-    std::ostream& dumpValue(std::ostream& o) const;
-    std::ostream& dumpValue(std::ostream& o, size_t index) const;
-
-...
-};
-
-/**
- * Definitions for the various scalarArray types.
- */
-typedef PVArrayData<uint8> BooleanArrayData;
-typedef PVValueArray<uint8> PVBooleanArray;
-typedef std::tr1::shared_ptr<PVBooleanArray> PVBooleanArrayPtr;
-...
-typedef PVArrayData<std::string> StringArrayData;
-typedef PVValueArray<std::string> PVStringArray;
-typedef std::tr1::shared_ptr<PVStringArray> PVStringArrayPtr;i
-
- -

pvDataCPP-md

-
class PVArray : public PVField, public SerializableArray {
-public:
-    POINTER_DEFINITIONS(PVArray);
-    virtual ~PVArray();
-    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(std::size_t capacity) = 0;
-    virtual std::ostream& dumpValue(std::ostream& o, std::size_t index) const = 0;
- ...
-};
-
-std::ostream& operator<<(format::array_at_internal const& manip, const PVArray& array);
-
-template<typename T>
-class PVArrayData {
-private:
-    std::vector<T> init;
-public:
-    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)
-    {}
-};
-
-class PVScalarArray : public PVArray {
-public:
-    POINTER_DEFINITIONS(PVScalarArray);
-    virtual ~PVScalarArray();
-    typedef PVScalarArray &reference;
-    typedef const PVScalarArray& const_reference;
-    const ScalarArrayConstPtr getScalarArray() const ;
-
-    // in pvDataCPP but not in pvDataCPP=md
-    //virtual std::ostream& dumpValue(std::ostream& o, size_t index) const = 0;
-
-    // not in pvDataCPP
-    template<ScalarType ID>
-    virtual void
-    getAs(shared_vector<typename ScalarTypeTraits<ID>::type>& out) const;
-
-    virtual void
-    getAs(ScalarType, shared_vector<void>& out) const = 0;
-
-    template<ScalarType ID>
-    inline size_t copyOut(typename ScalarTypeTraits<ID>::type* inp, size_t len) const;
-
-    virtual size_t copyOut(ScalarType id, void* ptr, size_t olen) const = 0;
-
-    template<ScalarType ID>
-    inline void putFrom(const shared_vector<typename ScalarTypeTraits<ID>::type>& inp);
-
-    virtual void putFrom(ScalarType, const shared_vector<void>&) = 0;
-
-    template<ScalarType ID>
-    inline void copyIn(const typename ScalarTypeTraits<ID>::type* inp, size_t len);
-
-    virtual void copyIn(ScalarType, const void*, size_t) = 0;
-
-    virtual void assign(PVScalarArray& pv) = 0;
-    
- ...
-}
-
-template<typename T>
-class PVValueArray : public detail::PVVectorStorage {
-    typedef detail::PVVectorStorage base_t;
-public:
-    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 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;
-    std::ostream& dumpValue(std::ostream& o) const;
-    std::ostream& dumpValue(std::ostream& o, size_t index) const;
-
-    /// not in pvDataCPP
-    static const ScalarType typeCode;
-    typedef ::epics::pvData::shared_vector<T> svector;
-    typedef ::epics::pvData::shared_vector<const T> const_svector;
-
-     virtual void
-    getAs(ScalarType id, ::epics::pvData::shared_vector<void>& out) const;
-    virtual size_t copyOut(ScalarType id, void* ptr, size_t olen) const;
-    virtual void
-    putFrom(ScalarType id, const ::epics::pvData::shared_vector<void>& inp);
-    virtual void copyIn(ScalarType id, const void* ptr, size_t len);
-    virtual void assign(PVScalarArray& pv);
-
-
-protected:
-    PVValueArray(ScalarArrayConstPtr const & scalar)
-    : PVScalarArray(scalar) {}
-    friend class PVDataCreate;
-};
-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<std::string> StringArrayData;
-typedef PVValueArray<std::string> PVStringArray;
-typedef std::tr1::shared_ptr<PVStringArray> PVStringArrayPtr;i
-
-

proposed

-
class PVArray : public PVField, public SerializableArray {
-public:
-    POINTER_DEFINITIONS(PVArray);
-    virtual ~PVArray();
-    virtual std::size_t getLength() const = 0;
-    virtual void setLength(std::size_t length) = 0;
-    bool isCapacityMutable() const;
-    void setCapacityMutable(bool isMutable);
-    virtual std::size_t getCapacity() const = 0;
-    virtual void setCapacity(std::size_t capacity) = 0;
- ...
-};
-
-
-class PVScalarArray : public PVArray {
-public:
-    POINTER_DEFINITIONS(PVScalarArray);
-    typedef PVScalarArray &reference;
-    typedef const PVScalarArray& const_reference;
-
-    virtual ~PVScalarArray();
-    const ScalarArrayConstPtr getScalarArray() const;
- ...
-};
-
-template<typename T>
-class PVValueArray : public PVScalarArray
-{
-public:
-    POINTER_DEFINITIONS(PVValueArray);
-    typedef T  value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-    typedef PVValueArray & reference;
-    typedef const PVValueArray & const_reference;
-
-    typedef shared_vector<T> svector;
-    typedef shared_vector<const T> const_svector;
-
-    virtual ~PVValueArray() {}
-    const svector & get() ;
-    const const_svector &get() const;
-    size_t put(size_t offset,size_t length, const_pointer from, size_t fromOffset);
-
-    void shareData(const svector &from);
-
-...
-};
-
-typedef PVValueArray<uint8> PVBooleanArray;
-typedef std::tr1::shared_ptr<PVBooleanArray> PVBooleanArrayPtr;
-...
-typedef PVValueArray<std::string> PVStringArray;
-typedef std::tr1::shared_ptr<PVStringArray> PVStringArrayPtr;
-
- - - -

pvDataApp/pv

-

pvData.h

-

This provides the interface for network accessible data. -Although templates are used to minimize the amount of code, -the interface is not meant to be extended. -Only the types defined by pvIntrospect are implemented.

- -

PVField

-
-class PVField
-: virtual public Serializable,
-  public std::tr1::enable_shared_from_this
-{
-public:
-    POINTER_DEFINITIONS(PVField);
-    virtual ~PVField();
-    virtual void message(std::string message,MessageType messageType);
-    const std::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;
-    void setImmutable();
-    const FieldConstPtr & getField() const;
-    PVStructure * getParent() const;
-    void replacePVField(const PVFieldPtr&  newPVField);
-    void renameField(std::string const & newName);
-    void postPut();
-    void setPostHandler(PostHandlerPtr const &postHandler);
-    virtual bool equals(PVField &pv);
-    void toString(StringBuilder buf) ;
-    void toString(StringBuilder buf,int indentLevel);
-    std::ostream& operator<<(std::ostream& o) const;
-...
-};
-
-std::ostream& operator<<(std::ostream& o, const PVFieldPtr & f);
-std::ostream& operator<<(std::ostream& o, const PVFieldPtr & f, size_t index);
-
-

The public methods for PVField are:

-
-
~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.
-
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
-
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
-
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
-
Get the total number of fields in this field. This is nextFieldOffset - - fieldOffset.
-
getPVAuxInfo
-
Get the PVAuxInfo for this field. PVAuxInfo is described below.
-
isImmutable
-
Is the field immutable?
-
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
-
Get the reflection interface for the data.
-
getParent
-
Get the interface for the parent or null if this is the top level - PVStructure.
-
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
-
Set the postHandler for the record. Only a single handler can be - registered.
-
operator<<
-
Stream output -
-

PVScalar

-
-class PVScalar : public PVField {
-public:
-    POINTER_DEFINITIONS(PVScalar);
-    virtual ~PVScalar();
-
-    typedef PVScalar &reference;
-    typedef const PVScalar& const_reference;
-
-    const ScalarConstPtr getScalar() const;
-...
-};
-
-

where

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

PVScalarValue

-
-template
-class PVScalarValue : public PVScalar {
-public:
-    POINTER_DEFINITIONS(PVScalarValue);
-    typedef T value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-
-    virtual ~PVScalarValue() {}
-    virtual T get() const = 0;
-    virtual void put(T value) = 0;
-    void operator>>=(T& value) const;
-    void operator<<=(T value);
-...
-};
-typedef PVScalarValue<uint8> PVBoolean;
-typedef PVScalarValue<int8> PVByte;
-typedef PVScalarValue<int16> PVShort;
-typedef PVScalarValue<int32> PVInt;
-typedef PVScalarValue<int64> PVLong;
-typedef PVScalarValue<uint8> PVUByte;
-typedef PVScalarValue<uint16> PVUShort;
-typedef PVScalarValue<uint32> PVUInt;
-typedef PVScalarValue<uint64> PVULong;
-typedef PVScalarValue<float> PVFloat;
-typedef PVScalarValue<double> PVDouble;
-typedef std::tr1::shared_ptr<PVBoolean> PVBooleanPtr;
-typedef std::tr1::shared_ptr<PVByte> PVBytePtr;
-typedef std::tr1::shared_ptr<PVShort> PVShortPtr;
-typedef std::tr1::shared_ptr<PVInt> PVIntPtr;
-typedef std::tr1::shared_ptr<PVLong> PVLongPtr;
-typedef std::tr1::shared_ptr<PVUByte> PVUBytePtr;
-typedef std::tr1::shared_ptr<PVUShort> PVUShortPtr;
-typedef std::tr1::shared_ptr<PVUInt> PVUIntPtr;
-typedef std::tr1::shared_ptr<PVULong> PVULongPtr;
-typedef std::tr1::shared_ptr<PVFloat> PVFloatPtr;
-typedef std::tr1::shared_ptr<PVDouble> PVDoublePtr;
-
-// PVString is special case, since it implements SerializableArray
-class PVString : public PVScalarValue<std::string>, SerializableArray {
-public:
-    virtual ~PVString() {}
- ...
-};
-
- -

where

-
-
get
-
Get the value stored in the object.
-
put
-
Change the value stored in the object.
-
operator<<
-
operator>>
-
Methods for stream I/O.
-
- - -

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();
-    virtual std::size_t getLength() const = 0;
-    virtual void setLength(std::size_t length) = 0;
-    bool isCapacityMutable() const;
-    void setCapacityMutable(bool isMutable);
-    virtual std::size_t getCapacity() const = 0;
-    virtual void setCapacity(std::size_t capacity) = 0;
- ...
-};
-
-
getLength
-
Get the current length. This is less than or equal to the capacity.
-
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.
-
isCapacityMutable
-
Is the capacity mutable
-
setCapacityMutable
-
Specify if the capacity can be changed.
-
getCapacity
-
Get the capacity, i.e. this is the size of the underlying data - array.
-
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.
-
- - -

PVScalarArray

- -

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:
-    POINTER_DEFINITIONS(PVScalarArray);
-    typedef PVScalarArray &reference;
-    typedef const PVScalarArray& const_reference;
-
-    virtual ~PVScalarArray();
-    const ScalarArrayConstPtr getScalarArray() const;
- ...
-};
-
- -

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:
-    POINTER_DEFINITIONS(PVValueArray);
-    typedef T  value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-    typedef PVValueArray & reference;
-    typedef const PVValueArray & const_reference;
-
-    typedef shared_vector<T> svector;
-    typedef shared_vector<const T> const_svector;
-
-    virtual ~PVValueArray() {}
-    const svector & get() ;
-    const const_svector &get() const;
-    size_t put(size_t offset,size_t length, const_pointer from, size_t fromOffset);
-
-    void shareData(const svector &from);
-...
-};
-
-typedef PVValueArray<uint8> PVBooleanArray;
-typedef std::tr1::shared_ptr<PVBooleanArray> PVBooleanArrayPtr;
-
-typedef PVValueArray<int8> PVByteArray;
-typedef std::tr1::shared_ptr<PVByteArray> PVByteArrayPtr;
-
-typedef PVValueArray<int16> PVShortArray;
-typedef std::tr1::shared_ptr<PVShortArray> PVShortArrayPtr;
-
-typedef PVValueArray<int32> PVIntArray;
-typedef std::tr1::shared_ptr<PVIntArray> PVIntArrayPtr;
-
-typedef PVValueArray<int64> PVLongArray;
-typedef std::tr1::shared_ptr<PVLongArray> PVLongArrayPtr;
-
-typedef PVValueArray<uint8> PVUByteArray;
-typedef std::tr1::shared_ptr<PVUByteArray> PVUByteArrayPtr;
-
-typedef PVValueArray<uint16> PVUShortArray;
-typedef std::tr1::shared_ptr<PVUShortArray> PVUShortArrayPtr;
-
-typedef PVValueArray<uint32> PVUIntArray;
-typedef std::tr1::shared_ptr<PVUIntArray> PVUIntArrayPtr;
-
-typedef PVValueArray<uint64> PVULongArray;
-typedef std::tr1::shared_ptr<PVULongArray> PVULongArrayPtr;
-
-typedef PVValueArray<float> PVFloatArray;
-typedef std::tr1::shared_ptr<PVFloatArray> PVFloatArrayPtr;
-
-typedef PVValueArray<double> PVDoubleArray;
-typedef std::tr1::shared_ptr<PVDoubleArray> PVDoubleArrayPtr;
-
-typedef PVValueArray<std::string> PVStringArray;
-typedef std::tr1::shared_ptr<PVStringArray> PVStringArrayPtr;
-
- -

where

-
-
get
-
Get the shared_vector that holds the data. - Code that calls this is able to modify the array elements - but should be very careful if it does. - For example it must call postPut after modifying the array elements. - It must also respect isImmutable(). -
-
size_t put(size_t offset,size_t length, const_pointer from, size_t fromOffset);
-
put
-
This is the recommended method for modifying the array elements. - It may change the capacity if len asks for more elements - than the cureent capacity allows. - It does not change the current length. -
-
shareData
-
Share data with an existing shared_vector. - Note that if capacity is ever changed then data will no - longer be shared. - This method can also be called to force the PVValueArray to have a new - raw array. This is usefull for implementing Copy On Write. -
-
- -

shared_vector

-

Status

-

I think that all public components of sharedVector.h -are now documented, but not all have a description or example. -Thus the documentation needs more work. -

-

When NOTE EXISTING appears it means that there is a question about -the existing shared_vector implementation.

-

Introduction

-

A shared_vector is a container as defined by the C++ standard library. -It is like std::vector but provides two additional features -1) shared raw array and 2) a window into the raw array.

-

To support these two features a shared_vector keeps the following -private data: -

-
m_sdata
-
This is a std::tr1::shared_ptr for the actual data array. -
-
m_offset
-
This is the offset of the first element seen by the window.
-
m_count
-
This is the size, i. e. total number of elements, seen by the window.
-
m_total
-
This is the number of elements between offset and the end of the array referenced - by m_sdata.
-
-Note that only m_sdata is shared. Thus each shared_vector has it's own window.

-

The following subsections are organized as follows: -

-
shared_vector example
-
The example code is based on a shared_vector<int32> - This subsection show the C++ definitions that are assumed by - the example code. - The source that contains the example code will be part - of this project but not yet.
-
std::vector compatible subsections
-
The types and methods that have the same names as std::vector.
-
share_vector specific
-
The methods that are not part of std::vector.
-

-

The subsections that are compatible with std::vector are organized -and start with a brief summary modeled after Section 31.3(STL Containers) in:
-"The C++ Programming Language, C++11, Fourth Edition", Bjarne Stroustrup,2013
-The subsection names are the same names that Stroustrup uses. -Each subsection starts with a brief summary that is similar to -the summary Stroustrup has at the beginnining of each subsection.

-

The comparison is always with std::vector. -In addition it shows what is defined by by std::vector but not by -shared_vector.

-

Someone who already understand the C++ STL can understand shared_vector -by just looking at the brief summarys. -For others the brief summary is followed by tutorial information. -

-

shared_vector example

-

The examples all assume that the following has been defined:

-
-typedef shared_vector<int32> Int32Array;
-...
-static void dumpArray(std::string const &message,Int32Array const& int32Array);
-
-

The following: -

-Int32Array int32Array(5);
-dumpArray("example",int32Array);
-
-creates a shared vector that holds an array of five elements where each element is a -32 bit signed integer. -The call to dumpArray displays the message and the array elements on standard out: -
-example 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-
-

-

exampleSharedVector is a main program that has the code for the -examples shown below.

-

Member Types

-

Brief Summary -

-value_type              Type of element
-size_type               Unsigned type of subscripts, element counts, etc.
-difference_type         Signed type of difference between iterators
-iterator                Behaves like value_type*
-const_iterator          Behaves like const value_type*
-reverse_iterator        Behaves like value_type*
-const_reverse_iterator  Behaves like const value_type*
-reference               value_types&
-const_reference         const_value_type&
-pointer                 Behaves like value_type *
-const_pointer           Behaves like const value_type*
-//not part of std::vector
-element_type            same as value_type
-shared_pointer_type     std::tr1::shared_ptr<value_type>
-// defined by std::vector but not by shared_vector
-allocator_type
-
-

-

-The typedefs are compatible with the STL container member types. -These define types for various types of variables that belong to a container -or are used to access a container.

-

value_type, reference, and const_reference

-

These three typedefs define the same types as the equivalent types for -an element of the shared_vector. -

-Int32Array::value_type value;
-//is the same as
-int32 value;
-
-Int32Array::reference rvalue = value;
-//is the same as
-int32 & rvalue = value;
-
-Int32Array::const_reference rvalue = value;
-//is the same as
-const int32 & rvalue = value;
-
-

-

pointer and const_pointer

-

The following is an example of code that uses the -pointer typedef:

-
-Int32Array int32Array(5);
-Int32Array::pointer pint32Array = int32Array.data();
-size_t len = int32Array.size();
-for(size_t i=0; i<len; ++i) pint32Array[i] = i;
-
-

A const_pointer is like a pointer except that only read access to the array elements -is allowed.

-

NOTE: data The above code is better implemented as:

-
-Int32Array int32Array(5);
-size_t len = int32Array.size();
-for(size_t i=0; i<len; ++i) int32Array[i] = i;
-
- -

difference_type

-

This is used to get the number of elements between two elements. -For example:

-
-Int32Array::difference_type pdiff = int32Array[3] - int32Array[1];
-// pdiff will have the value 2
-
-

element_type and shared_pointer_type

-

These are member types defined by std::tr1::shared_ptr. -These are not used by any of the client methods.

- -

Constructors, Destructor, and Assignments

-

Brief Summary -

-C c();         Default constructor; c is empty.
-C c(n);        c is initialized with n elementis with the value value_type{};
-               offset is 0; size is n;
-C c(n,e);      Initialize c with n copies of e.
-               offset is 0; size is n;
-
-C c(c);        Copy an existing shared_vector of the same type.
-               offset and taken same as v.
-               shared_ptr is copied; not the raw array
-C operator=(c) Assignment constructor.
-               shared_ptr is copied; not the raw array
-C c(c,o,n);    Copy an existing std::tr1::shared_ptr<value_type>
-               offset is o; size is c;
-C c(r,o,n);    Use an existing raw pointer.
-               default deleter use "delete[]" to delete.
-               offset is o; size is c;
-C c(r,d,o,n);  Use an existing raw pointer and deleter d;
-               offset is o; size is c;
-
-not implemented
-~C()           The C++ default destructor is used.
-C++11 specific
-&& constructor move constructor
-{} constructor uniform initializer constructor
-
-where -
-
C
-
The class name, e. g. shared_vector<int32>
-
c
-
shared_vector instance
-
n
-
size, i. e. the number of elements
-
o
-
offset
-
e
-
element instance
-
r
-
raw pointer, e. g. int32 *
-
d
-
a deleter, i. e. object that destroys the raw array.
-
-

-

Construct by creating new raw array

-
-shared_vector();
-shared_vector(size_t n);
-shared_vector(size_t n, value_type e);
-
-

The first three constructors all create a new shared_vector -by also creating a new raw array, -The difference is the size of the array, i.e. how many elements it contains, -and how the elements are initalized. -

-
-
shared_vector()
-
The array is empty, i.e. it has no elements.
-
shared_vector(size_t n)
-
The array has n elements. Each element is initialized -by the default constructor for the element type. -For numeric elements, like int32, this means 0.
-
shared_vector(size_t n, value_type e)
-
The array has n elements. -Each element has the initial value e. -
-
-

The following: -

-    cout << "***exampleConstructors***" << endl;
-    Int32Array emptyArray();
-    Int32Array zeroArray(16);
-    int32 value = 1;
-    Int32Array oneArray(8, value);
-    dumpArray("emptyArray",emptyArray);
-    dumpArray("zeroArray",zeroArray);
-    dumpArray("oneArray",oneArray);
-
-produces -
-***exampleConstructors***
-emptyArray 1
-zeroArray {16}[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]
-oneArray {8}[1, 1, 1, 1, 1, 1, 1, 1]
-
-

NOTE EXISTING: Why did emptyArray disply the above. -Should it be "emptyArray {0} []"? -

-

Construct by sharing raw array from a shared_vector

-
-shared_vector(const shared_vector& o);
-shared_vector_base& operator=(const shared_vector_base& o);
-
-

These create a vector by coping the contents of an existing shared_vector -of the same type into the newly created vector. -Note that the complete raw array is not copied but just the std::tr1:: shared_ptr -that holds the array.

-

The following: -

-    cout << "***exampleCopyConstructors***" << endl;
-    size_t max = 16;
-    Int32Array int32Array(max);
-    for(size_t i=0; i<max; ++i) int32Array[i] = i+1;
-    Int32Array xxx(int32Array);    //copy constructor
-    Int32Array yyy = int32Array;   //copy assignment
-    cout << "dataPtr int32Array " << int32Array.dataPtr();
-    cout << " xxx " << xxx.dataPtr();
-    cout << " yyy " << yyy.dataPtr() << endl;
-    dumpArray("int32Array",emptyArray);
-    dumpArray("xxx",emptyArray);
-    dumpArray("yyy",emptyArray);
-
-produces -
-***exampleConstructors***
-dataPtr int32Array 0x136ea90 xxx 0x136ea90 yyy 0x136ea90
-int32Array {16}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...]
-xxx {16}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...]
-yyy {16}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...]
-
-

Construct by wrapping an existing raw array

-
-shared_vector(A v, size_t o, size_t c)
-shared_vector(A d, B b, size_t o, size_t c)
-
-

NOTE EXISTING: Are these constructors necessary? -If code wants to wrap an existing raw array then -a std::tr1::shared_ptr can first be created -and the constructor in the next section can be called.

-

These "wrap" an existing raw pointer. -They allows access to a sub-array starting at offset o> -and has size c -The second provides a destructor and the first has a default deleter.

-

The default deleter does the following: -When the shared_vector is deleted, i. e. when no code references it, -the statement "delete[] a;" is executed.

-

An example of wrapping a raw array without using these constructors is:

-
-class Int32ArrayDeleter
-{
-//Note that this an example that does nothing.
-//But it could have private data
-public:
-     Int32ArrayDeleter() {}
-     virtual ~Int32ArrayDeleter() {}
-     void operator()(int32* a){
-         // MUST HANDLE DELETION
-         // default is "delete[] a;"
-     }
-};
-...
-int32 *pother; // something managed by other code
-size_t capacity; // size of array managed by other code
-
-Int32Array int32Array(pother,int32array_deleter,0,capacity);
-
-

This is used to wrap arrays that are managed by other -code. This should only be used if You understand the other code -and know what your deleter has to do. -An example, exampleShareRawArray, gives a more complete example. -

- -

Create a shared_vector from an existing shared_ptr

-
-shared_vector(const std::tr1::shared_ptr<E1>& d, size_t o, size_t c)
-
-

This creates a vector from an existing smart pointer. -Thus the vector will share reference counting with the existing smart -pointer. This is useful for creating "windows" into the array -that the smart pointer references.

- - - -

Create a shared_vector from an existing shared_vector

-
- template<typename E1>
-    shared_vector(const shared_vector<E1>& o) :base_t(o) {}
-
-

NOTE EXISTING: I do not understand how this works or what it does.

-

This create a vector by coping the contents of an existing shared_vector -of the same or a different but related type -into the newly created vector. -This constructor creates a new raw array and copies the elements from -the existing array to the new array.

- -

Size and Capacity

-

Brief Summary -

-size()      Return the number of elements in the window
-empty()     Is the window empty? this means shared_ptr is empty
-max_size()  The maximum possible number of elements.
-capacity()  The number of possible elements without re-allocating raw array.
-reserve(n)  Reserve at least n elements in raw array; May cause reallocation.
-resize(n)   Change size to n; May cause reallocation
-clear()     shared_ptr is reset, Window will be empty.
-
-not implemented
-resize(n,v)
-shrink_to_fit()
-

-

Details -

-size_t size() const;
-bool empty() const;
-size_t max_size() const;
-size_t capacity() const;
-void reserve(size_t n);
-void resize(size_t n);
-void clear();
-
-

-
-
size
-
The current number of elements in the window.
-
empty
-
(true,false) if size is (0,>0)
-
max_size
-
Maximum possible number of elements. -NOTE EXISTING; Should be ((size_t)-1)/sizeof(T) -
-
capacity
-
The maximum size the window can be without reallocating raw array
-
reserve
-
Set the maximum number of element that the window can see. - If the caller is the only user of the window and the number - of elements specified does not cause the number of elements to change - then this method just returns. - In all other cases a new raw array is allocated.

-
resize
-
Change the window size: may cause a reallocation of the raw array.
-
clear
-
If the shared_vector is not already empty the shared_ptr will - be reset. The new size will be 0.
-
-

The following: -

-static void exampleSizeEtc()
-{
-    cout << "***exampleSizeEtc***" << endl;
-    size_t max = 16;
-    Int32Array int32Array(max);
-    size_t capacity = int32Array.capacity();
-    size_t size = int32Array.size();
-    bool empty = int32Array.empty();
-    size_t max_size = int32Array.max_size();
-    cout<< "capacity" << capacity;
-    cout<< " size " << size;
-    cout<< " empty " << (empty ? true : false) ;
-    cout<< " max_size " << max_size << endl;
-}
-
-
-produces: -
-***exampleSizeEtc***
-capacity16 size 16 empty 0 max_size 18446744073709551615
-
-

-

Iterators

-

Brief Summary -

-begin()      First element
-end()        One past last element
-cbegin()     Constant first element
-cend()       Constant last element
-rbegin()     First element of reverse sequence
-rend()       One past last element of reverse sequence
-crbegin()    Constant first element of reverse sequence
-crend()      Constant last element of reverse sequence
-

-

-shared_vector supports both iterators and reverse iterators as defined by the STL. -For both constant iterators are also defined. -A constant iterator does not allow an array elemnent to be modified.

-

The following is an example of a constant iterator.

-
-int32 sum = 0;
-for(Int32Array::const_iterator iter=int32Array.begin(); iter<int32Array.end(); ++iter )
-{
-     sum += *iter;
-}
-
-

The following is an example of a non constant iterator.

-
-int32 value = 0;
-for(Int32Array::iterator iter=int32Array.begin(); iter<int32Array.end(); ++iter )
-{
-     *iter += ++value;
-}
-
-

Element Access

-

Brief Summary -

-operator[i]    random element access 
-data()         return the raw array
-
-implemented by std::vector but not implemented
-front()
-back()
-at()
-

-

Note that: -

-Int32Array::pointer pint32= int32Array.data();
-
-is guaranteed to be the same as -
-int32 * pint32 = int32Array.data();
-
-

-

NOTE EXISTING: data() should be defined to return a const_pointer. -It is currently defined to return a plain pointer.

-

Stack Operations

-

Brief Summary -

-push_back(x)     Add an element after the last element
-pop_back(x)      Remove the last element.
-

-

List operations

-

shared_vector does not support the standard list operations like: -

-implemented by std::vector but not by shared_vector
-
-insert(p,x)   Add x before p
-...
-
-

-

Other Operations

-

Brief Summary -

-operator==       Do all elements of both containers compare equal.
-operator!=       Does any element not compare equal.
-operator<<       ostream operator
-swap(c2)         Swap the contents of two shared_vectors of the same type.
-swap(c1,c2)      Swap the contents of two shared_vectors of the same type.
-
-not implemented
-operator<
-operator<=
-operator>
-operator>=
-

-

operators equals, not equals, and ostream

-
-template<typename A, typename B>
-bool operator==(const epics::pvData::shared_vector<A>& a,
-                const epics::pvData::shared_vector<B>& b);
-
-template<typename A, typename B>
-bool operator!=(const epics::pvData::shared_vector<A>& a,
-                const epics::pvData::shared_vector<B>& b);
-
-template<typename E>
-std::ostream& operator<<(
-    std::ostream& strm, const epics::pvData::shared_vector<E>& arr);
-
-
-

swap

-

Swap the contents of two shared_vectors. The following code: -

-    cout << "***exampleSwap***" << endl;
-    Int32Array first(8);
-    Int32Array second(16);
-    cout << " before swap  size ";
-    cout<< "first " << first.size() << " second " << second.size() << endl;
-    first.swap(second);
-    cout << " after swap   size ";
-    cout<< "first " << first.size() << " second " << second.size() << endl;
-    swap(first,second);
-    cout << " swap again   size ";
-    cout<< "first " << first.size() << " second " << second.size() << endl;
-
-produces: -
-***exampleSwap***
- before swap  size first 8 second 16
- after swap   size first 16 second 8
- swap again   size first 8 second 16
-

- -

shared_vector specific operations

-

Brief Summary -

-void make_unique()         Make caller the only user of std::tr1::shared_ptr
-bool unique()              Is the caller the only user of std::tr1::shared_ptr
-void slice(offset,length)  Change window offset andsize
-
-// following should only be used for debugging
-const std::tr1::shared_ptr<E>&
-       dataPtr()           Return const  shared_ptr
-size_t dataOffset()        Return offset.
-size_t dataCount()         Return count which is also the size
-size_t dataTotal()         Return total number of elements between
-                           offset and end of the raw array
-
-// following converts from type FROM to type TO
-shared_vector static_shared_vector_cast(const shared_vector<FROM>& src);
-
-// following casts from const Type to Type
-shared_vector
-const_shared_vector_cast(const shared_vector<const TYPE>& src)
-

-

NOTE EXISTING: The C++ standard library considers a slice to be every nth element -of some part of an array, i. e., slice has arguments (offset,length,stride). -shared_vector only has offset and length. -Perhaps it should have another name like rewindow. -

make_unique and unique

-
-void make_unique();
-bool unique() const;
-
-
-
make_unique
-
Makes sure that caller is the only user of this standard_vector. - If the caller is not already the only user a new raw array is allocated.
-
unique
-
- Returns (true,false) if there is only one user of the shared_vector. -
-
-

slice

-
-void slice(size_t offset, size_t length=(size_t)-1);
-
-

This modifies the "window" into the raw array starting at offset and of -the specified length. The offset and length are forced to be -within the raw array. -Note that this method never reallocates the underlying raw array. -

-

The following code: -

-static void exampleSlice()
-{
-    cout << "***exampleSlice***" << endl;
-    size_t max = 16;
-    Int32Array int32Array(max);
-    int32 value = 0;
-    for(Int32Array::iterator iter = int32Array.begin(); iter!=int32Array.end(); ++iter)
-    {
-        *iter = ++value;
-    }
-    dumpArray("int32Array",int32Array);
-    size_t offset = 0;
-    size_t length = 8;
-    Int32Array window1(int32Array);
-    window1.slice(offset,length);
-    dumpArray("window1",window1);
-    offset = 8;
-    length = 8;
-    Int32Array window2(int32Array);
-    window2.slice(offset,length);
-    dumpArray("window2",window2);
-    offset = 2;
-    length = 4;
-    Int32Array window3(window2);
-    window3.slice(offset,length);
-    dumpArray("window3",window3);
-}
-
-produces the following output: -
-***exampleSlice***
-int32Array 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-window1 1 2 3 4 5 6 7 8
-window2 9 10 11 12 13 14 15 16
-window3 11 12 13 14
-
-

dataPtr, dataOffset, dataCount, and dataTotal

-
-
dataPtr
-
Returns the shared_ptr that holds the raw array. -
-
dataOffset
-
Offset in the data array of first element
-
dataCount
-
Number of visible elements. - Same as size. -
-
dataTotal
-
Total number of elements between m_offset and the end of data. - Same as capacity. -
-
-

The following: -

-static void exampleDataEtc()
-{
-    cout << "***exampleDataEtc***" << endl;
-    size_t max = 16;
-    Int32Array int32Array(max);
-    long use_count = int32Array.dataPtr().use_count();
-    long offset = int32Array.dataOffset();
-    long count = int32Array.dataCount();
-    long total = int32Array.dataTotal();
-    cout << "use_count " << use_count;
-    cout << " offset " << offset;
-    cout << " count " << count;
-    cout << " total " <<  total << endl;
-}
-
-produces: -
-***exampleDataEtc***
-use_count 1 offset 0 count 16 total 16
-
-

- -

static_shared_vector_cast

-

Not yet documented

- -

const_shared_vector_cast

-

Not yet documented

- -

specialization for untyped pointers

-

Not yet documented

- - -
- - diff --git a/documentation/pvDataCPP.html b/documentation/pvDataCPP.html index 1d80ff6..c430a2c 100644 --- a/documentation/pvDataCPP.html +++ b/documentation/pvDataCPP.html @@ -37,7 +37,7 @@

EPICS pvDataCPP

-

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

+

EPICS v4 Working Group, Working Draft, 08-Oct-2014

Latest version:
@@ -56,6 +56,7 @@
Marty Kraimer, BNL
Michael Davidsaver, BNL
Matej Sekoranja, CosyLab
+
David Hickin, Diamond Light Source

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

Status of this Document

-

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

This is the 08-Oct-2014 version of the C++ implementation of pvData.

RELEASE_NOTES.md provides changes since the last release. @@ -97,7 +98,7 @@ TODO.md describes things to do before the next release.

pvData is one of a set of related projects. It describes and implements 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 project pvAccess, which is +reader should also become familiar with project pvAccess, which is located via the same sourceforge site as this project.

The Java and C++ implementation of pvData implement the same data model but @@ -107,7 +108,7 @@ differ in implementation because of the differences between Java and C++.

first two chapters:

Introduction
-
A brief descripton of pvData.
+
A brief description of pvData.
PVData Meta Language
A language used to describe data.
@@ -120,17 +121,17 @@ href="./html/index.html">doxygenDoc

This document discusses the following:

-
pvDataAPP/pv
+
src/pv
This subdirectory contains all the public interfaces that describe pvData. The section from Namespace and Memory Management through Conversion discuss these interfaces.
-
pvDataApp/property
+
src/property
This section has support for managing "standard" fields.
-
pvDataApp/misc
+
src/misc
This section has support for facilities required by implementation code.
-
copy and monitor
+
src/copy and src/monitor
These sections provide pvData support for implementing pvAccess providers.
@@ -140,7 +141,7 @@ data interfaces. The first time reader may not understand them but hopefully wil idea of how pvData works. After reading the rest of this document the examples will be much easier to understand.

-

The documentation directory for this project has a file examples.zip. +

The documentation directory for this project has a file examples.zip. It has the code for the examples. After it is unzipped:

@@ -149,10 +150,12 @@ cp ExampleRELEASE.local RELEASE.local
 #edit RELEASE.local
 cd ..
 make
+
+Now you are ready to run the examples: +
 bin/linux-x86_64/introspectMain 
 bin/linux-x86_64/dataMain
 
-

The examples assume that the following statements have been issued:

 using std::cout;
@@ -166,17 +169,17 @@ StandardPVFieldPtr standardPVField = getStandardPVField();
 
fieldCreate
This creates instances of introspection objects. - It also provides fieldBuilder, which provides an easier way to create introspection objects. + It also provides fieldBuilder, which provides an easier way to create introspection objects.
pvDataCreate
This creates instances of data objects.
standardField
-
This provides support for introspection obects for standard fields, +
This provides support for introspection objects for standard fields, Standard fields are alarm, timeStamp, display, enumerated structure, and value alarm.
standardPVField
-
This provides support for data obects for standard fields, +
This provides support for data objects for standard fields,
@@ -213,7 +216,7 @@ It uses only createField. topfields.push_back(timeStamp); StructureConstPtr doubleScalar = fieldCreate->createStructure(topnames,topfields); - cout << doubleScalar->dump(cout) << endl; + cout << *doubleScalar << endl;

Using FieldBuilder the same can be done via:

@@ -227,13 +230,13 @@ It uses only createField.
             add("userTag", pvInt)->
             endNested()->
         createStructure();
-    cout << doubleScalarHard->dump(cout) << endl;
+    cout << *doubleScalarHard << endl;
 

The easiest way to produce the structure is:

     StructureConstPtr stringArrayEasy =
          getStandardField()->scalarArray(pvString,"alarm,timeStamp");
-    cout << stringArrayEasy->dump(cout) << "\n\n";
+    cout << *stringArrayEasy << "\n\n";
 
These three ways produce:
@@ -245,7 +248,7 @@ structure
         int nanoseconds
         int userTag
 
-hardway
+hard way
 structure
     double value
     time_t timeStamp
@@ -254,7 +257,7 @@ structure
         int userTag
 
 easy way
-uri:ev4:nt/2014/pwd:NTScalarArray
+epics:nt/NTScalarArray:1.0
     string[] value
     alarm_t alarm
         int severity
@@ -270,11 +273,11 @@ via standardField:

     StructureConstPtr stringArrayEasy =
         standardField->scalarArray(pvString,"alarm,timeStamp");
-    cout <<stringArrayEasy->dump(cout) << endl;
+    cout << *stringArrayEasy << endl;
 
It produces :
-uri:ev4:nt/2014/pwd:NTScalarArray
+epics:nt/NTScalarArray:1.0
     string[] value
     alarm_t alarm
         int severity
@@ -287,7 +290,7 @@ uri:ev4:nt/2014/pwd:NTScalarArray
 0x607188
 

enumerated structure

-

An enumerated structure is a structure with two sub-fields: +

An enumerated structure is a structure with two subfields: index, which is an int, and choices, which is an array of string. The following examples create a structure which has a field names value, which is an enumerated structure and additional fields. @@ -302,7 +305,7 @@ A hard way to create an structure with an enumerated value field and a time stam StructureConstPtr ntEnumHard = fieldCreate->createFieldBuilder()-> - setId("uri:ev4:nt/2014/pwd/NTEnum")-> + setId("epics:nt/NTEnum:1.0")-> add("value", enum_t)-> addNestedStructure("timeStamp")-> setId("time_t")-> @@ -311,11 +314,11 @@ A hard way to create an structure with an enumerated value field and a time stam add("userTag", pvInt)-> endNested()-> createStructure(); - cout <<ntEnumHard->dump(cout) << endl; + cout << *ntEnumHard << endl;

It produces:
-uri:ev4:nt/2014/pwd/NTEnum
+epics:nt/NTEnum:1.0
     enum_t value
         int index
         string[] choices
@@ -328,11 +331,11 @@ uri:ev4:nt/2014/pwd/NTEnum
 fields: alarm and timeStamp:

     StructureConstPtr ntEnumEasy = getStandardField()->enumerated("alarm,timeStamp");
-    cout <<ntEnumEsay->dump(cout) << endl;
+    cout << *ntEnumEasy << endl;
 
It produces:
-uri:ev4:nt/2014/pwd:NTEnum
+epics:nt/NTEnum
     enum_t value
         int index
         string[] choices
@@ -356,10 +359,10 @@ uri:ev4:nt/2014/pwd:NTEnum
         add("intValue", pvInt)->
         add("timeStamp",standardField->timeStamp())->
         createUnion();
-    cout <<ntunion->dump(cout) << endl;
+    cout << *ntunion << endl;
 
     StructureConstPtr unionValue = standardField->regUnion(punion,"alarm,timeStamp");
-    cout <<unionValue->dump(cout) << endl;
+    cout << *unionValue << endl;
 
It produces:
@@ -372,7 +375,7 @@ union
         int userTag
 
 structure with value field being a union
-uri:ev4:nt/2014/pwd:NTUnion
+epics:nt/NTUnion:1.0
     union value
         double doubleValue
         int intValue
@@ -395,7 +398,7 @@ uri:ev4:nt/2014/pwd:NTUnion
 
     UnionArrayConstPtr unionArray = fieldCreate->createUnionArray(
         fieldCreate->createVariantUnion());
-    cout << unionArray->dump(cout) << "\n\n";
+    cout << *unionArray << "\n\n";
 

Produces

@@ -423,7 +426,7 @@ any
            add("alarm",standardField->alarm()) ->
            endNested()->
         createStructure();
-    std::cout << powerSupply->dumpValue(cout) <<std::endl;
+    std::cout << *powerSupply <<std::endl;
 
It produces:
@@ -464,13 +467,13 @@ structure
     PVDoublePtr pvdouble =
         doubleValue->getSubField<PVDouble>("value");
     pvdouble->put(1e5);
-    cout << doubleValue->dumpValue(cout) << endl;
+    cout << *doubleValue << endl;
     double value = doubleValue->getSubField<PVDouble>("value")->get();
     cout << "from get " << value << "\n\n";
 
This produces:
-uri:ev4:nt/2014/pwd:NTScalar 
+epics:nt/NTScalar:1.0
     double value 100000
     alarm_t alarm
         int severity 0
@@ -494,7 +497,7 @@ from get 100000
     for(size_t i=0; i< len; ++i) xxx[i] = i;
     shared_vector<const double> data(freeze(xxx));
     pvDoubleArray->replace(data);
-    cout << doubleArrayValue->dumpValue(cout) << endl;
+    cout << *doubleArrayValue << endl;
     
     shared_vector<const double>  getData = pvDoubleArray->view();
     cout << "via getData";
@@ -503,7 +506,7 @@ from get 100000
 
This produces:
-uri:ev4:nt/2014/pwd:NTScalarArray 
+epics:nt/NTScalarArray:1.0
     double[] value [0,1,2,3,4,5,6,7,8,9]
     alarm_t alarm
         int severity 0
@@ -520,11 +523,11 @@ via getData 0 1 2 3 4 5 6 7 8 9
 
     PVStructurePtr pvntenum = pvDataCreate->createPVStructure(
          standardField->enumerated("alarm,timeStamp"));
-    cout << pvntenum->dumpValue(cout) << "\n\n";
+    cout << *pvntenum << "\n\n";
 
This produces:
-uri:ev4:nt/2014/pwd:NTEnum 
+epics:nt/NTEnum:1.0
     enum_t value
         int index 0
         string[] choices []
@@ -558,7 +561,7 @@ uri:ev4:nt/2014/pwd:NTEnum
            endNested()->
         createStructure();
     PVStructurePtr pvpowerSupply = pvDataCreate->createPVStructure(powerSupply);
-    cout << pvpowerSupply->dumpValue(cout) << endl;
+    cout << *pvpowerSupply << endl;
 
This produces:
@@ -604,13 +607,13 @@ structure
     PVStructurePtr pvTimeStamp =
         pvStructure->getSubField<PVUnion>("value")->select<PVStructure>(2);
     pvTimeStamp->getSubField<PVLong>("secondsPastEpoch")->put(1000);
-    cout << pvStructure->dumpValue(cout) << "\n";
+    cout << *pvStructure) << "\n";
     pvStructure->getSubField<PVUnion>("value")->select<PVDouble>(0)->put(1e5);
-    cout << pvStructure->dumpValue(cout) << "\n\n";
+    cout << *pvStructure << "\n\n";
 
This produces:
-uri:ev4:nt/2014/pwd:NTUnion
+epics:nt/NTUnion:1.0
     union value
         time_t
             long secondsPastEpoch 1000
@@ -625,7 +628,7 @@ uri:ev4:nt/2014/pwd:NTUnion
         int nanoseconds 0
         int userTag 0
 0x60a2c8
-uri:ev4:nt/2014/pwd:NTUnion
+epics:nt/NTUnion:1.0
     union value
         double  100000
     alarm_t alarm
@@ -639,7 +642,7 @@ uri:ev4:nt/2014/pwd:NTUnion
 0x60a2c8
 
-

varient union example

+

variant union example

     PVStructurePtr pvStructure = pvDataCreate->createPVStructure(
         standardField->variantUnion("alarm,timeStamp"));
@@ -647,17 +650,17 @@ uri:ev4:nt/2014/pwd:NTUnion
         pvDataCreate->createPVStructure(standardField->timeStamp());
     pvStructure->getSubField<PVUnion>("value")->set(pvTimeStamp);
     pvTimeStamp->getSubField<PVLong>("secondsPastEpoch")->put(1000);
-    cout << pvStructure->dumpValue(cout) << "\n";
+    cout << *pvStructure << "\n";
     pvStructure->getSubField<PVUnion>("value")->set(
         pvDataCreate->createPVScalar(pvDouble));
     PVDoublePtr pvValue = static_pointer_cast<PVDouble>(
         pvStructure->getSubField<PVUnion>("value")->get());
     pvValue->put(1e5);
-    cout << pvStructure->dumpValue(cout) << "\n\n";
+    cout << *pvStructure << "\n\n";
 
This produces:
-uri:ev4:nt/2014/pwd:NTUnion
+epics:nt/NTUnion:1.0
     any value
         time_t
             long secondsPastEpoch 1000
@@ -672,7 +675,7 @@ uri:ev4:nt/2014/pwd:NTUnion
         int nanoseconds 0
         int userTag 0
 0x60a2c8
-uri:ev4:nt/2014/pwd:NTUnion
+epics:nt/NTUnion:1.0
     any value
         double  100000
     alarm_t alarm
@@ -712,27 +715,27 @@ uri:ev4:nt/2014/pwd:NTUnion
                 createUnion(),
             "alarm,timeStamp"));
     cout << "introspection\n";
-    cout <<pvStructure->getStructure()->dump(cout) << endl;
+    cout << *pvStructure->getStructure() << endl;
     cout << "data\n";
-    cout << pvStructure->dumpValue(cout) << "\n";
+    cout << *pvStructure << "\n";
     PVUnionPtr pvUnion = pvStructure->getSubField<PVUnion>("value");;
     pvUnion->select("doubleValue");
     PVDoublePtr pvDouble = pvUnion->get<PVDouble>();
     pvDouble->put(1.55);
     cout << "select valueDouble\n";
-    cout << pvStructure->dumpValue(cout) << "\n";
+    cout << *pvStructure << "\n";
     cout << "value = " << pvDouble->get() << "\n";
     pvUnion->select("structValue");
     pvDouble = pvUnion->get<PVStructure>()->getSubField<PVDouble>("doubleValue");
     pvDouble->put(1.65);
     cout << "select structValue\n";
-    cout << pvStructure->dumpValue(cout) << "\n";
+    cout << *pvStructure << "\n";
     cout << "value = " << pvDouble->get() << "\n";
 
This produces:
 introspection
-uri:ev4:nt/2014/pwd:NTUnion
+epics:nt/NTUnion:1.0
     union value
         double doubleValue
         double[] doubleArrayValue
@@ -768,7 +771,7 @@ uri:ev4:nt/2014/pwd:NTUnion
         int userTag
 0x60a2c8
 data
-uri:ev4:nt/2014/pwd:NTUnion
+epics:nt/NTUnion:1.0
     union value
         (none)
     alarm_t alarm
@@ -781,7 +784,7 @@ uri:ev4:nt/2014/pwd:NTUnion
         int userTag 0
 0x60a2c8
 select valueDouble
-uri:ev4:nt/2014/pwd:NTUnion
+epics:nt/NTUnion:1.0
     union value
         double  1.55
     alarm_t alarm
@@ -795,7 +798,7 @@ uri:ev4:nt/2014/pwd:NTUnion
 0x60a2c8
 value = 1.55
 select structValue
-uri:ev4:nt/2014/pwd:NTUnion
+epics:nt/NTUnion:1.0
     union value
         structure
             double doubleValue 1.65
@@ -821,10 +824,10 @@ value = 1.65
      // ...
 }}
-

Memory Managemment

+

Memory Management

Many pvDataCPP introspection and data objects are designed to be shared. They are -made availiable via std::tr1::shared_ptr. +made available via std::tr1::shared_ptr. The following naming convention is used in typedefs:

@@ -838,23 +841,23 @@ typedef PVScalarValue<boolean> PVBoolean; typedef std::tr1::shared_ptr<PVBoolean> PVBooleanPtr;
-

pvDataApp/pv

+

src/pv

-

Directory pvDataApp/pv has header files that completely describe pvData. -The implementation is provided in directory pvDataApp/factory. +

Directory src/pv has header files that completely describe pvData. +The implementation is provided in directory src/factory. Test programs appears in testApp/pv.

NOTES:

interface
-
The documention uses the word interface. +
The documentation uses the word interface. This is an analogy with how Java defines interface. 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, +
Naming Conventions
+
The naming conventions for variables, methods, and classes follow the + Java conventions, i. e. class name begin with an upper case letter, variables and methods begin with a lower case letter.
@@ -868,7 +871,7 @@ introspection and data interfaces for pvData.

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:

+

Directory src/pv has the following header files:

pvType.h
C++ definitions for primitive types.
@@ -885,14 +888,14 @@ copying data between fields.

Provides access to introspection interfaces for standard structures like timeStamp, alarm, etc.
standardPVField.h
-
Cteates data interfaces for standard data structures like timeStamp, +
Creates data interfaces for standard data structures like timeStamp, alarm, etc.

pvType.h

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

@@ -919,8 +922,8 @@ inline std::string const * get(StringArray const &value); inline std::string * get(StringArrayPtr &value); inline std::string const * get(StringArrayPtr const &value); } -inline StringArray & getVector(StringArrayPtr &value); -inline StringArray const & getVector(StringArrayPtr const &value); +inline StringArray & getVector(StringArrayPtr &value); +inline StringArray const & getVector(StringArrayPtr const &value); typedef std::vector<std::string>::iterator StringArray_iterator; typedef std::vector<std::string>::const_iterator StringArray_const_iterator;
@@ -938,30 +941,28 @@ typedef std::vector<std::string>::const_iterator StringArray_const_iterato in a future implementation they should be changes via "#ifdef" preprocessor statements.
std::string
-
pvData requires that a string be an immutable string that is transfered +
pvData requires that a string be an immutable string that is transferred 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. - Note that string is treated like a primitive type.
+ Note that std::string is treated like a primitive type.
StringArray definitions
typedefs are provided for an array of std::strings, which is a std::vector<std::string>. This is used by introspection.
-

TBD +

TBD

boolean
Question for Michael. Why isn't the definition of boolean just
 typedef uint8_t boolean;
     
+
printer.h
Not documented. Is this needed? Nothing currently uses it.
-

pvIntrospect.h

@@ -971,10 +972,10 @@ than showing the entire file, it will be described in parts.

The primary purpose 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 name is a unique name in the local network. -This is also refered to as the channel name. +This is also referred to as the channel name.

-

Given a pvname , it is possible to introspect the types of the associated data +

Given a pvname, it is possible to introspect the types of the associated data 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 pvname, the client library can obtain the reflection information without obtaining any @@ -1035,8 +1036,8 @@ std::ostream& operator<<(std::ostream& o, const ScalarType& sc structure introspection interface.

union_t
This is like a structure that has a single subfield. - The type for the subfield can either be any type, which is called a varient union, - of can be one od a specified set of types. + The type for the subfield can either be any type, which is called a variant union, + of can be one of a specified set of types. In the data interfaces the type can be changed dynamically. '
unionArray
@@ -1120,15 +1121,15 @@ following:

Has fields that can be any of the supported types.
StructureArray
The field holds an array of structures. Each element has the same - Structure interspection interface. A pvAccess client can only get/put + Structure introspection interface. A pvAccess client can only get/put entire PVStructure elements NOT subfields of array elements.
Union
- This has two flavors: a varient union or a union of a fixed set + This has two flavors: a variant union or a union of a fixed set of types. A PVUnion will have a single subfield. - If the union introspection interface is a varient union then + If the union introspection interface is a variant union then the single field can be of any type and has the name any. - If the union is not a varient type then the type can be one of + If the union is not a variant type then the type can be one of a fixed set of types and a name associated with the type. The union introspection interface has a field array and a string array that has the fixed set of types and associated names. @@ -1136,7 +1137,7 @@ following:

UnionArray
This is an array of unions. A PVUnionArray is an array - of PVUnions. Each element has the same interspection interface + of PVUnions. Each element has the same introspection interface but the subfield of each element can have a different type.
FieldBuilder
@@ -1197,12 +1198,29 @@ public: ... }; +class BoundedString : public Scalar{ +public: + POINTER_DEFINITIONS(BoundedString); + virtual ~BoundedString(); + typedef BoundedString& reference; + typedef const BoundedString& const_reference; + + std::size_t getMaximumLength() const; + virtual std::string getID() const; + virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const; +... +}; + class epicsShareClass Array : public Field{ public: POINTER_DEFINITIONS(Array); virtual ~Array(); typedef Array& reference; typedef const Array& const_reference; + enum ArraySizeType { variable, fixed, bounded }; + + virtual ArraySizeType getArraySizeType() const = 0; + virtual std::size_t getMaximumCapacity() const = 0; ... }; @@ -1215,6 +1233,8 @@ public: ScalarArray(ScalarType scalarType); ScalarType getElementType() const {return elementType;} + virtual ArraySizeType getArraySizeType() const; + virtual std::size_t getMaximumCapacity() const; virtual std::string getID() const; virtual std::ostream& dump(std::ostream& o) const; virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const; @@ -1222,6 +1242,36 @@ public: ... }; +class epicsShareClass BoundedScalarArray : public ScalarArray{ +public: + POINTER_DEFINITIONS(BoundedScalarArray); + typedef BoundedScalarArray& reference; + typedef const BoundedScalarArray& const_reference; + + BoundedScalarArray(ScalarType scalarType, std::size_t size); + virtual ArraySizeType getArraySizeType() const; + virtual std::size_t getMaximumCapacity() const; + virtual std::string getID() const; + virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const; +... +} + +class epicsShareClass FixedScalarArray : public ScalarArray{ +public: + POINTER_DEFINITIONS(FixedScalarArray); + typedef FixedScalarArray& reference; + typedef const FixedScalarArray& const_reference; + + FixedScalarArray(ScalarType scalarType, std::size_t size); + virtual ArraySizeType getArraySizeType() const {return Array::fixed;} + virtual std::size_t getMaximumCapacity() const {return size;} + virtual std::string getID() const; + virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const; +... +}; + + + class StructureArray : public Field{ public: POINTER_DEFINITIONS(StructureArray); @@ -1229,6 +1279,8 @@ public: typedef const StructureArray& const_reference; StructureConstPtr getStructure() const {return pstructure;} + virtual ArraySizeType getArraySizeType() const; + virtual std::size_t getMaximumCapacity() const; virtual std::string getID() const; virtual std::ostream& dump(std::ostream& o) const; virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const; @@ -1242,6 +1294,8 @@ public: typedef UnionArray& reference; typedef const UnionArray& const_reference; UnionConstPtr getUnion() const {return punion;} + virtual ArraySizeType getArraySizeType() const; + virtual std::size_t getMaximumCapacity() const; virtual std::string getID() const; virtual std::ostream& dump(std::ostream& o) const; virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const; @@ -1369,14 +1423,14 @@ public:
getNumberFields
Get the number of possible field types. Both getFields and getFieldNames will return an array with getNumberFields elements. - A value of 0 is returned for invarient arrays. + A value of 0 is returned for invariant arrays.
getField
-
Given a name ot an index the type is returned. +
Given a name or an index the type is returned. NULL is returned if not found.
getFieldIndex
-
Get the index for name. -1 is returned if not found. +
Get the index for name. -1 is returned if not found.
getFields
Get the array of types.
getFieldNames
@@ -1384,7 +1438,7 @@ public:
getFieldName
Get the name for the specified index.
isVariant
-
returns true if this is varient array and false otherwise. +
returns true if this is variant array and false otherwise.

fieldBuilder and createField

@@ -1394,8 +1448,16 @@ class epicsShareClass FieldBuilder :
 public:
     FieldBuilderPtr setId(std::string const & id);
     FieldBuilderPtr add(std::string const & name, ScalarType scalarType);
+    FieldBuilderPtr addBoundedString(std::string const & name, std::size_t maxLength);
     FieldBuilderPtr add(std::string const & name, FieldConstPtr const & field);
     FieldBuilderPtr addArray(std::string const & name, ScalarType scalarType);
+    FieldBuilderPtr addFixedArray(
+         std::string const & name,
+         ScalarType scalarType,
+         std::size_t size);
+    FieldBuilderPtr addBoundedArray(std::string const &
+         name,ScalarType scalarType,
+         std::size_t bound);
     FieldBuilderPtr addArray(std::string const & name, FieldConstPtr const & element);
     StructureConstPtr createStructure();
     UnionConstPtr createUnion();
@@ -1411,8 +1473,14 @@ public:
     static FieldCreatePtr getFieldCreate();
     FieldBuilderPtr createFieldBuilder() const;
     ScalarConstPtr createScalar(ScalarType scalarType) const;
+    BoundedStringConstPtr createBoundedString(std::size_t maxLength) const;
     ScalarArrayConstPtr createScalarArray(ScalarType elementType) const;
-    StructureArrayConstPtr createStructureArray(StructureConstPtr const & structure) const;
+    ScalarArrayConstPtr createFixedScalarArray(
+        ScalarType elementType, std::size_t size) const
+    ScalarArrayConstPtr createBoundedScalarArray(
+        ScalarType elementType, std::size_t bound) const;
+    StructureArrayConstPtr createStructureArray(
+        StructureConstPtr const & structure) const;
     StructureConstPtr createStructure () const;
     StructureConstPtr createStructure (
         StringArray const & fieldNames,
@@ -1458,9 +1526,22 @@ description of the methods.
       
Add a scalar field.
+
addBoundedString
+
+ Add a scalar field that is a string that has a maximum size. +
addArray
- Add a scalarArray field. + Add an array field. There are two methods: one to create a scalaArray + and one to create scalarArray, unionArray, or structureArray. +
+
addFixedArray
+
+ Add a fixed size scalarArray field. +
+
addBoundedArray
+
+ Add a bounded scalarArray field.
createStructure
@@ -1504,14 +1585,24 @@ description of the methods.
Create an instance of a FieldBuilder.
createScalar
Create a scalar introspection instance.
+
createBoundedString
+
create a scalar introspection instance for a bounded string.
createScalarArray
Create a scalar array introspection instance.
+
createFixedScalarArray
+
Create a scalar array introspection instance.
+
createBoundedScalarArray
+
Create a scalar array introspection instance.
createStructure
Create a structure introspection instance. Three methods are provided. The first creates an empty structure, i. e. a structure with no fields. The other two are similar. The only difference is that one provides an ID and the other does not. The one without will result in ID structure.
+
createStructureArray
+
Ceate a structure array introspection instance. + All elements will have the same introspection interface. +
createUnion
Create a union. There are two methods. Each has arguments for an array of types and an array of names. @@ -1519,13 +1610,13 @@ description of the methods.
createVariantUnion
- Create a varient union. The id will be any. + Create a variant union. The id will be any.
createUnionArray
Create a union array. punion is the introspection interface for each element.
createVariantUnionArray
-
Create a union array where each element is a varient union.
+
Create a union array where each element is a variant union.
createStructureArray
Create a structure array introspection instance.
appendField
@@ -1622,8 +1713,8 @@ public: will be created with the first element being a union with the specified scalar type and name value. The other fields in the structure will be the corresponding property structures. -
varient`Union
-
Create a varient union. A structure +
variant`Union
+
Create a variant union. A structure will be created with the first element being a union with the specified scalar type and name value. The other fields in the structure will be the corresponding property structures.
@@ -1679,7 +1770,7 @@ showing the entire file, it will be described in parts.

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".

+definitions, i.e. typedefs for "std::vector" and "std::tr1::shared_ptr".

 class PVField;
 class PVScalar;
@@ -1687,7 +1778,13 @@ class PVScalarArray;
 class PVStructure;
 class PVStructureArray;
 class PVUnion;
-class PVUnionArray;
+
+template<typename T> class PVScalarValue;
+template<typename T> class PVValueArray;
+
+typedef PVValueArray<PVUnionPtr> PVUnionArray;
+typedef std::tr1::shared_ptr<PVUnionArray> PVUnionArrayPtr;
+
 
 typedef std::tr1::shared_ptr<PostHandler> PostHandlerPtr;
 
@@ -1830,7 +1927,7 @@ std::ostream& operator<<(std::ostream& o, const PVField& f);
       name will be an empty string.
   
getFullName
Fully expand the name of this field using the - names of its parent fields with a dot '.' seperating + names of its parent fields with a dot '.' separating each name.
getFieldOffset
@@ -1909,7 +2006,7 @@ public: which must be one of the ScalarType enums. For example:
-uint32 val = pv->getAs();
+uint32 val = pv->getAs<pvInt>();
 
@@ -2026,9 +2123,9 @@ pv->putFrom<pvInt>(val);

A PVUnion has a single subfield. The Union introspection interface determines the possible field types for the subfield. -If it is a varient union then any type is allowed and the +If it is a variant union then any type is allowed and the subfield name is normally any. -If it is not a varient union that the Union interface determines +If it is not a variant union that the Union interface determines the possible field types and names.

 class PVUnion : public PVField
@@ -2063,13 +2160,14 @@ public:
     virtual void serialize(
         ByteBuffer *pbuffer,SerializableControl *pflusher) const ;
     PVUnion(UnionConstPtr const & punion);
+    virtual std::ostream& dumpValue(std::ostream& o) const;
 };
 
getUnion
Get the introspection interface.
get
-
Get the curent field. A template version does the conversion. +
Get the current field. A template version does the conversion. NULL is returned if no field is selected or if the caller ' asks for the wrong type.
@@ -2133,17 +2231,16 @@ public:
setCapacityMutable
Specify if the capacity can be changed.
setCapacity
-
Set the capaciity.
+
Set the capacity.
dumpValue
ostream method
-

PVScalarArray

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 +template for the various scalar array data classes. There is a class for each possible scalar type, i. e. PVBooleanArray, ..., PVStringArray.

 class PVScalarArray : public PVArray {
@@ -2179,13 +2276,13 @@ public:
      
Assign the given value after conversion. A copy and element-wise conversion is performed unless the element type of the PVScalarArray matches the type of the provided data. - If the types do match then a new refernce to the provided data is kept. + If the types do match then a new reference to the provided data is kept.
assign
Assign the given PVScalarArray's value. A copy and element-wise conversion is performed unless the element type of the PVScalarArray matches the type of the provided data. - If the types do match then a new refernce to the provided data is kept. + If the types do match then a new reference to the provided data is kept.
@@ -2238,15 +2335,17 @@ public: A non-null result is returned if fieldName is a field of the PVStructure. The fieldName can be of the form name.name... - If the field does not exist the a Ptr to a NULL value is returned + If the field does not exist then a Ptr to a NULL value is returned without any error message being generated.
- Note that the template version replaces getBooleanField, etc.
+ Note The template version replaces getBooleanField, etc.
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. +
+ Note The template version replaces getBooleanField, etc.
dumpValue
Method for streams I/O.
@@ -2270,12 +2369,13 @@ public: static const ScalarType typeCode; virtual ~PVValueArray() {} + virtual ArrayConstPtr getArray() const std::ostream& dumpValue(std::ostream& o) const; std::ostream& dumpValue(std::ostream& o, size_t index) const; // inherited from PVVectorStorage const_svector view(); - void swap(const_svector& other); - void replace(const const_svector& next); + void swap(const_svector& other); + void replace(const const_svector& next); svector reuse(); ... }; @@ -2283,6 +2383,8 @@ public:

where

+
getArray
+
Get the introspection interface.
dumpValue
Method for streams I/O.
view
@@ -2297,13 +2399,12 @@ public:
reuse
Remove and return the current array data or an unique copy if shared.
-

TBD +

TBD

Check for completeness
Michael should check that PVScalarArray and PVValueArray have the correct set of methods and that the descriptions are correct.
-

PVStructureArray

@@ -2343,11 +2444,6 @@ public: DeserializableControl *pflusher); virtual std::ostream& dumpValue(std::ostream& o) const; virtual std::ostream& dumpValue(std::ostream& o, std::size_t index) const; - // inherited from PVVectorStorage - const_svector view(); - void swap(const_svector& other); - void replace(const const_svector& next); - svector reuse(); ... }

where

@@ -2365,10 +2461,10 @@ public:

PVUnionArray

The interface for an array of unions is:

-template&ly;&gt;
-class epicsShareClass PVValueArray&ly;PVUnionPtr&gt; : public detail::PVVectorStorage&ly;PVUnionPtr,PVArray&gt;
+template<>
+class epicsShareClass PVValueArray<PVUnionPtr> : public detail::PVVectorStorage<PVUnionPtr,PVArray>
 {
-    typedef detail::PVVectorStorage&ly;PVUnionPtr,PVArray&gt; base_t;
+    typedef detail::PVVectorStorage<PVUnionPtr,PVArray> base_t;
 public:
     POINTER_DEFINITIONS(PVUnionArray);
     typedef PVUnionPtr  value_type;
@@ -2378,8 +2474,8 @@ public:
     typedef const PVUnionArray& const_reference;
 
     //TODO: full namespace can be removed along with local typedef 'shared_vector'
-    typedef ::epics::pvData::shared_vector&ly;PVUnionPtr&gt; svector;
-    typedef ::epics::pvData::shared_vector&ly;const PVUnionPtr&gt; const_svector;
+    typedef ::epics::pvData::shared_vector<PVUnionPtr> svector;
+    typedef ::epics::pvData::shared_vector<const PVUnionPtr> const_svector;
     
     virtual ~PVValueArray() {}
     virtual ArrayConstPtr getArray() const;
@@ -2449,7 +2545,7 @@ public:
     std::tr1::shared_ptr<PVAT> createPVScalarArray();
 
     PVStructureArrayPtr createPVStructureArray(StructureArrayConstPtr const & structureArray);
-    PVStructureArrayPtr createPVStructureArray(StructureConstPtr const ∓ structure);
+    PVStructureArrayPtr createPVStructureArray(StructureConstPtr const & structure);
 
     PVUnionArrayPtr createPVUnionArray(UnionArrayConstPtr const & unionArray);
     PVUnionArrayPtr createPVUnionArray(UnionConstPtr const & punion);
@@ -2481,19 +2577,19 @@ PVDoublePtr pvDouble = getPVDataCreate()->createPVScalar<PVDouble>();
   
createPVStructure
Create an instance of a PVStructure. Three methods are provided. - The first uses an array of field names and an array of PVFields to initialize the sub-fields. + The first uses an array of field names and an array of PVFields to initialize the subfields. The second initializes the subfields by cloning the fields contained in - structToClone. The newly created sub-fields will have the same values as the original. - If structToClone is null then the new structure is initialized to have 0 sub-fields. + structToClone. The newly created subfields will have the same values as the original. + If structToClone is null then the new structure is initialized to have 0 subfields. The third method uses a previously created structure introspection interface.
-
createPVUnion
+
createPVUnion
Create an instance of a PVUnion. Two methods are provided. The first uses a previously created union introspection interface. The second clones an existing PVUnion.
-
createPVVariantUnion
-
Creates an instance of a varient PVUnion. +
createPVVariantUnion
+
Creates an instance of a variant PVUnion. This is a union which has a single field which can be any pvData supported type,
createPVScalarArray
@@ -2740,7 +2836,7 @@ void copy( size_t count);

The last copy is the only one most client need to call. -It either throws an error of the element types do not match or calls the +It either throws an error if the element types do not match or calls the other copy functions. The arguments are:

from
@@ -2763,27 +2859,28 @@ other copy functions. The arguments are:

An exception is thrown if:

-
type mismatch
+
type mismatch
The element types for the source and destination differ.
immutable
-
The destination array is immutable. +
The destination array is immutable.
capacity immutable
-
The destination array needs to have it's capacity extentended +
The destination array needs to have it's capacity extended but the capacity is immutable.
-

pvDataApp/property

+

src/property

Definition of Property

-

Only fields named "value" have properties. A record can have multiple value +

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

+structure hierarchy 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.

@@ -2882,7 +2979,7 @@ general purpose clients.

characteristics for the value field.
history
Provides a history buffer for the value field. Note that currently - PVData does not define history suppoprt.
+ PVData does not define history support.
other
Other standard properties can be defined.
@@ -2950,7 +3047,7 @@ seconds is kept as a 64 bit integer, it allows for a time much greater than the present age of the universe. Since the nanoseconds portion is kept as a 32 bit integer it is subject to overflow if a value that corresponds to a value that 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, +support code always adjust seconds so that the nanoseconds part is normalized, i. e. it has is 0<=nanoseconds<nanoSecPerSec..

Two header files are provided for manipulating time stamps:

@@ -3015,7 +3112,7 @@ public:

where

TimeStamp()
-
The defauly constuctor. Both seconds and nanoseconds are set to 0.
+
The default constructor. Both seconds and nanoseconds are set to 0.
TimeStamp(int64 secondsPastEpoch,int32 nanoseconds = 0)
A constructor that gives initial values to seconds and nanoseconds.
normalize
@@ -3282,7 +3379,7 @@ public:

where

Control
-
The default constructure.
+
The default constructor.
getLow
Get the low limit.
getHigh
@@ -3376,7 +3473,7 @@ public:

where

Control
-
The default constructure.
+
The default constructor.
getLow
Get the low limit.
getHigh
@@ -3463,7 +3560,7 @@ public: bool choicesMutable(); StringArrayPtr const & getChoices(); int32 getNumberChoices(); - bool setChoices(StringArray &choices,int32 numberChoices); + bool setChoices(StringArray &choices); };

where

@@ -3477,7 +3574,7 @@ public:
detach
Just detaches from the pvData structure.
isAttached
-
Is there an attachment to an enemerated structure?
+
Is there an attachment to an enumerated structure?
setIndex
Set the index field in the pvData structure. An exception is thrown if not attached to a pvData structure.
@@ -3502,7 +3599,7 @@ public: -

pvDataApp/factory

+

src/factory

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

@@ -3522,7 +3619,7 @@ implements getConvert.

Other files implement PVData base classes

-

pvDataAPP/misc

+

src/misc

Overview

@@ -3560,13 +3657,13 @@ implements getConvert.

More support for serializing objects.
sharedPtr.h
Defines POINTER_DEFINITIONS.
-
sharedVector.h +
sharedVector.h
Like std::vector except that std::shared_ptr is used for the data array.
status.h
A way to pass status information to a client.
templateMeta.h
-
TBD Michael can You provide an explaination?
+
TBD Michael can You provide an explanation?
thread.h
Provides thread support.
timeFunction.h
@@ -3575,7 +3672,7 @@ implements getConvert.

An implementation of Timer that does not require an object to be created for each timer request.
typeCast.h
-
TBD Michael can You provide an explaination?
+
TBD Michael can You provide an explanation?

Note that directory testApp/misc has test code for all the classes in misc. @@ -3608,7 +3705,6 @@ public: BitSet& operator&=(const BitSet& set); BitSet& operator|=(const BitSet& set); BitSet& operator^=(const BitSet& set); - BitSet& operator-=(const BitSet& set); BitSet& operator=(const BitSet &set); void or_and(const BitSet& set1, const BitSet& set2); bool operator==(const BitSet &set) const; @@ -3667,10 +3763,6 @@ std::ostream& operator<<(std::ostream& o, const BitSet& b);

operator^=(const BitSet& set)
Performs a logical exclusive or of this target bit set with the argument bit 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)
Assignment operator.
or_and(const BitSet& set1, const BitSet& set2)
@@ -3687,7 +3779,6 @@ std::ostream& operator<<(std::ostream& o, const BitSet& b); *flusher);
Deserialize the bitSet.
-

byteBuffer.h

@@ -3815,7 +3906,7 @@ public:
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 + false value normally means that that a timeout occurred. It is also returned if an error occurs or because the event is being deleted.
tryWait
returns (false,true) if the event is (empty,full)
@@ -3922,15 +4013,13 @@ once. This can be implemented as follows:

if(alreadyInitialized) return; // initialization }
-

-

Lock has a private variable: +

Lock has a private variable:

 bool locked;
 
-and improves efficency by checking the local variable before calling the +and improves efficiency by checking the local variable before calling the mutex methods. This is not thread safe if any methods are called by a thread other than the thread that created the Lock. -

It is thread safe if used as follows:

 {
@@ -4038,8 +4127,8 @@ public:
 

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 -assignment contructor.

+of the following: default constructor, default copy constructor, or default +assignment constructor.

/* This is based on Item 6 of
  * Effective C++, Third Edition, Scott Meyers
  */
@@ -4049,7 +4138,7 @@ assignment contructor.

NoDefaultMethods(){}; ~NoDefaultMethods(){} private: - // do not implment + // do not implement NoDefaultMethods(const NoDefaultMethods&); NoDefaultMethods & operator=(const NoDefaultMethods &); };
@@ -4058,7 +4147,7 @@ assignment contructor.

This provides a bounded queue. When the queue is full the user code is expected to keep using the current element until a new -free element becomes avalable.

+free element becomes available.

 template <typename T>
 class Queue
@@ -4089,7 +4178,7 @@ public:
   
getNumberFree
Get the number of free elements in the queue.
capacity
-
Get the capacity, i.e. the maximun number of elements the queue can +
Get the capacity, i.e. the maximum number of elements the queue can hold.
getNumberFree
Get the number of free elements.
@@ -4237,7 +4326,7 @@ public:

serializeHelper.h

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

+receiving pvData over the network.

class SerializeHelper : public NoDefaultMethods {
 public:
     static void writeSize(int s, ByteBuffer* buffer,
@@ -4278,7 +4367,7 @@ public:
 
 

sharedVector.h

-shared_vector is a holder for a contigious piece of memory. +shared_vector is a holder for a contiguous piece of memory. Data is shared, but offset and length are not. This allows one vector to have access to only a subset of a piece of memory.

@@ -4318,7 +4407,7 @@ shared_vector differs from std::vector as follows:

shared_vector has additional constructors from raw pointers and shared_ptr s. The copy constructor and assignment operator allow implicit castings from type 'shared_vector<T>' to 'shared_vector<const T>>'. - To faciliate safe modification the methods unique() and make_unique() are provided + To facilitate safe modification the methods unique() and make_unique() are provided The slice() method selects a sub-set of the shared_vector. The low level accessors dataPtr(), dataOffset(), dataCount(), and dataTotal(). @@ -4400,7 +4489,7 @@ public: where
shared_vector
-
Several flavors of constructor are provided. The most commingly used is: +
Several flavors of constructor are provided. The most commonly used is:
 shared_vector(size_t c);
        
@@ -4425,7 +4514,7 @@ shared_vector(size_t c); is the sole owner of the data array.
begin,...,rend
-
Standard interators.
+
Standard iterators.
front
Return a reference to the first element.
back
@@ -4456,7 +4545,7 @@ shared_vector(size_t c);
slice
Reduce the view of this shared_vector.
dataPtr
-
A readonly shared_ptr to the array.
+
A read-only shared_ptr to the array.
dataOffset
Offset in the data array of first visible element.
dataCount
@@ -4566,7 +4655,7 @@ public:

Runnable must be implement by code that wants to be run via a thread. It has one virtual method: run. Run is the code that is run as a thread. When run -compeletes it can not be restarted. If code wants to delete a thread then it +completes it can not be restarted. If code wants to delete a thread then it MUST arrange that the run returns before the thread can be deleted. An exception is thrown if run remains active when delete is called.

@@ -4588,7 +4677,7 @@ exception is thrown if run remains active when delete is called.

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. 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 +.1 seconds it increases the number of iterations 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;
@@ -4676,9 +4765,9 @@ public:
 
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 + When called a delay timer is no longer on the queue but a periodic 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 + schedule request but a periodic timer must not. Note the explanation of TimerNode.cancel below.
timerStopped
Timer.stop was called when a timer request was queued. or if the timer @@ -4707,7 +4796,7 @@ be used to schedule multiple callbacks. It has the methods:

Timer has the methods:

Timer
-
The consttructor.
+
The constructor.
~Timer
The destructor. The queue is emptied and TimerCallback.timerStopped is called for each element of the queue.
@@ -4720,7 +4809,7 @@ be used to schedule multiple callbacks. It has the methods:

typeCast.h

TBD Michael will explain.

-

pvDataApp/pvMisc

+

src/pvMisc

bitSetUtil.h

@@ -4750,7 +4839,7 @@ currently has only one method:

entire structures if the structure offset bit is set.
-

support for copy and monitor

+

src/copy and src/monitor

copy and monitor are not used in this project. They are intended for use by pvAccess and by pvAccess servers. They are provided with this project because the code depends only on @@ -4763,11 +4852,11 @@ provides a language independent overview of copy and monitor.

NOTE:pvRequest.html must be updated since it is based on an earlier version of pvCopy that -had knowlege of PVRecord. The C++ version was implemented in pvDatabaseCPP +had knowledge of PVRecord. The C++ version was implemented in pvDatabaseCPP and the Java version on pvIOCJava. At present only the C++ version of the new API for pvCopy is implemented.

-

Copy provides: +

Copy provides:

createRequest
@@ -4776,13 +4865,13 @@ At present only the C++ version of the new API for pvCopy is implemented. Given an ascii string createRequest creates a PVStructure that provides a pvData representation of the information from the ascii string. It is this structure that can be passed to the channel create methods.
- The information in a pvRequest selects an arbitrarary subset of the + The information in a pvRequest selects an arbitrary subset of the fields in a top level structure that resides in the server. In addition options can be specified. Both global and field specific options can be specified.
pvCopy
-
This is a faculity used by channel providers. +
This is a facility used by channel providers. It provides client specific code that manages a copy of an arbitrary subset of the fields in a top level structure that resides in the provider. It also allows provider access to options specified @@ -4802,9 +4891,7 @@ Monitor provides: of pvAccess but only pvData.
-

- -

support for copy

+

src/copy

copy provides the ability to create a structure that has a copy of an arbitrary subset of the fields in an existing top level structure. In addition it allows global options and field specific options. @@ -4898,7 +4985,7 @@ where This is the method for creating a PVCopy instance.

pvMaster
-
the top level sructure managed by the server.
+
the top level structure managed by the server.
pvRequest
selects the set of subfields desired and options for each field.
@@ -4954,12 +5041,12 @@ where
updateCopyFromBitSet
For each set bit in bitSet set the field in copyPVStructure to the value - of the corrseponding field in pvMaster. + of the corresponding field in pvMaster.
updateMaster
For each set bit in bitSet set the field in pvMaster to the value - of the corrseponding field in copyPVStructure. + of the corresponding field in copyPVStructure.
getOptions
@@ -4975,15 +5062,14 @@ where -

support for monitor

-

This consists of two components: +

src/monitor

+

This consists of two components:

monitor
-
Used by code that implements pvAccess montors.
+
Used by code that implements pvAccess monitors.
monitorPlugin
Code that provides special semantics for monitors.
-

monitor

 class MonitorElement {
@@ -5010,21 +5096,22 @@ class MonitorRequester : public virtual Requester {
 

monitorElement

MonitorElement holds the data for one element of a monitor queue. It has the fields: +

pvStructurePtr
A top level structure with data values at the time the monitors occurs.
changedBitSet
Shows which fields have changed since the previous monitor.
overrunBitSet
-
Shows which fields have changed more han once since the previous monitor.
+
Shows which fields have changed more than once since the previous monitor.
-

monitorElement queue

A queue of monitor elements must be implemented by any channel provider that implements Channel::createMonitor. For an example implementation look at pvDatabaseCPP. It has the following: +

 typedef Queue<MonitorElement> MonitorElementQueue;
 typedef std::tr1::shared_ptr<MonitorElementQueue> MonitorElementQueuePtr;
@@ -5059,7 +5146,7 @@ Note that each client has it's own queue that is not shared with other client.
    
start
Start monitoring. - This will result in a an inital monitor that has the current value + This will result in a an initial monitor that has the current value of all fields.
stop
@@ -5069,14 +5156,13 @@ Note that each client has it's own queue that is not shared with other client.
poll
Called to get a monitor element. - If no new elemants are available then a null pointer is returned. + If no new elements are available then a null pointer is returned.
release
- Release the monotor element. + Release the monitor element. The caller owns the monitor element between the calls to poll and release.
-

MonitorRequester

This must be implemented by a pvAccess client. @@ -5144,7 +5230,7 @@ It has methods:

Should the value of pvField cause a monitor to be raised. pvField and pvTop are fields in the top level structure being monitored. monitorElement has the top level structure - for the copy. + for the copy
. The implementation should not modify the fields in the structure being monitored. Called with pvTop locked. @@ -5193,7 +5279,7 @@ It has methods:

pairs. name is the subField name and value is the subField value.
Note that a plugin will below to a single client. -
+

MonitorPluginManager

MonitorPluginManager has the methods:

@@ -5201,7 +5287,7 @@ It has methods:

MonitorPluginManager is a singleton. The first call to get will create the single instance. - Further calls will rerurn the single instance. + Further calls will return the single instance.
addPlugin
@@ -5209,18 +5295,19 @@ It has methods:

findPlugin
- Find a plugin. A NULL shared pointer is reurned if it has not been added. + Find a plugin. A NULL shared pointer is returned if it has not been added.
showNames
- Show the names of all puugins that have been added. + Show the names of all plugins that have been added.

NOTE: Should the method causeMonitor have arguments pvField and pvTop -be defined so that they can not be modfied. -This would be posssible if the following was defined: +be defined so that they can not be modified. +This would be possible if the following was defined: +

 typedef std::tr1::shared_ptr<const PVField> PVFieldConstPtr;
 typedef std::tr1::shared_ptr<const PVStructure> PVStructureConstPtr;
@@ -5232,12 +5319,11 @@ virtual bool causeMonitor(
         PVStructureConstPtr const &pvTop,
         MonitorElementPtr const &monitorElement) = 0;
 
-But just adding these definitions is not sufficent. +But just adding these definitions is not sufficient. In addition all methods defined in pvDataCPP must be checked. In particular many of the methods in Convert must have their arguments modified. Big job. -

monitorPlugin example

Example Plugin Overview

This section describes an example plugin that:

@@ -5258,18 +5344,19 @@ structure powerSupply structure power double value structure alarm - struvture display + structure display structure voltage double value structure alarm - struvture display + structure display structure current double value structure alarm - struvture display + structure display

A pvAccess client wants to create a monitor on the powerSupply as follows: The client wants a top level structure that looks like: +

 structure powerSupply
     structure alarm
@@ -5282,20 +5369,19 @@ structure powerSupply
        double value
 
In addition the client wants monitors to occur only when one of the monitored -fields changes value but not just because a put occured. +fields changes value but not just because a put occurred. Also if only the timeStamp changes value then that should not cause a monitor. -

The example monitor plugin implements the semantics the client wants. It can be attached to any field via the following options: +

 [plugin=onChange,raiseMonitor=value]
 
This plugin will trigger a monitor for the field only if the field changes -value. In addition value equals false means do not raise a monotor +value. In addition value equals false means do not raise a monitor for changes to this field. But if a change to another field does cause a monitor the change to this field will be passed to the client. -

Assume that the client has already connected to the channel. The client can then issue the commands:

diff --git a/documentation/pvDataCPPCookbook.txt b/documentation/pvDataCPPCookbook.txt index 6021e09..d408bc3 100644 --- a/documentation/pvDataCPPCookbook.txt +++ b/documentation/pvDataCPPCookbook.txt @@ -28,11 +28,11 @@ StructureConstPtr enum_t = // create a structure (cntd.) StructureConstPtr ntEnum = getFieldCreate()->createFieldBuilder()-> - setId("uri:ev4:nt/2012/pwd/NTEnum")-> + setId("epics:nt/NTEnum:1.0")-> add("value", enum_t)-> addNestedStructure("timeStamp")-> setId("time_t")-> - add("secsPastEpoch", pvLong)-> + add("secondsPastEpoch", pvLong)-> add("nanoseconds", pvInt)-> add("userTag", pvInt)-> endNested()-> diff --git a/documentation/pvDataDiscussion.html b/documentation/pvDataDiscussion.html deleted file mode 100644 index 5f9b13b..0000000 --- a/documentation/pvDataDiscussion.html +++ /dev/null @@ -1,792 +0,0 @@ - - - - - - EPICS pvDataDiscussion - - - - - - - - -
-

EPICS pvDataDiscussion

- - -

EPICS v4 Working Group, Working Draft, 03-Jul-2013

- -
-
Latest version:
-
pvDataDiscussion.html -
-
This version:
-
none
-
Previous version:
-
None
-
Editors:
-
Marty Kraimer, BNL
-
- - -
-
- - -
-

Table of Contents

-
-
- - -

Introduction

-

As pvDataCPP progressed PVField and derived classes accumulated -more and more member functions. -These member functions have nothing to do with the primary primary -purpose for pvData: -

pvData (Process Variable Data) defines and implements an efficent -way to store, access, and communicate memory resident data structures.
-This statement appears as the first sentence of pvDataJava.html. -A few sentances later the document makes it clear that communication -includes efficent network communication. -Thus pvData provides an interface for network accessible structured data. -The problem of adding member functions that have nothing to do with the primary purpose -started with the Java API. -It already had extra methods that solved problems that should have had a different solution. -This document removes the extra methods so that when new problems arise in the future -the solution will not involve adding new member functions to the introspection and data API. -

-

The introspection and data API for pvData should only encapuslate methods that support the primary purpose -stated above. -The interfaces for C++ and Java should be similar so that -someone who understands the interface in one of the languages -and knows both languages will quickly understand the interface of the other language.

-

There is another problem with the existing API. There are methods that allow the "structure" -to change after an pvData object is created. An example is PVField::renameField(std::string newName). -Such methods should not exist.

-

There are methods regarding immutability: setImmutable, isImmutablei, setCapacityMutable, and isCapacityMutable. -Should they exists? For now lets assume no. -

-

One last issue is the interface for array data. This document proposes a simplified -version of what currently exists. It requires that the implementation always provides storage for -the complete raw array. The existing APIs allow the implementation to provide the data in -"chunks". Giving up this requirement simplifies the array interfaces. -The existing C++ implementation of PVValueArray has serious problems. -The shared_vector that is implemented in pvDataCP-md provides the solution to fixing -the problems. This document describes an API that is very similar to the new Java API -except that raw arrays are replaced by shared_vector.

-

This document will first describe changes to the existing Java interfaces -and then the corresponding C++ API.

-

Java API

-

The following shows which methods will be removed from the existing interfaces -and what will be added. -The methods to be removed are in red -and methods to add are in blue -Also the removed methods are at the end with a comment above. -The new methods also have a comment. -

-

Introspection Interfaces

- -
interface Field extends Serializable {
-    std::string getId();
-    Type getType();
-    // following will be removed
-    void toString(StringBuilder buf);
-    void toString(StringBuilder buf,int indentLevel);
-    std::string toString();
-}
-
-
-// new interface
-interface FieldTostd::string {
-    std::string toString(Field field);
-}
-
-interface Scalar extends Field {
-    ScalarType getScalarType();
-}
-
-interface ScalarArray extends Field {
-    ScalarType getElementType();
-}
-
-interface Structure extends Field {
-    Field getField(std::string fieldName);
-    int getFieldIndex(std::string fieldName);
-    Field[] getFields();
-    Field getField(int fieldIndex);
-    std::string[] getFieldNames();
-    std::string getFieldName(int fieldIndex)
-}
-
-interface StructureArray extends Field {
-    Structure getStructure();
-}
-
-interface FieldCreate {
-    Scalar createScalar(ScalarType scalarType);
-    ScalarArray createScalarArray(ScalarType elementType);
-    StructureArray createStructureArray(Structure elementStructure);
-    Structure createStructure(std::string[] fieldNames, Field[] field);
-    Structure createStructure(std::string id,std::string[] fieldNames, Field[] field);
-    Structure createStructure(Structure structToClone);
-    Field deserialize(ByteBuffer buffer, DeserializableControl control);
-    // following will be removed
-    Structure appendField(Structure structure,std::string fieldName, Field field);
-    Structure appendFields(Structure structure,std::string[] fieldNames, Field[] fields);
-}
-
-

Data Interfaces

-
-interface PVField extends Requester, Serializable {
-    std::string getFieldName();
-    void setRequester(Requester requester);
-    int getFieldOffset();
-    int getNextFieldOffset();
-    int getNumberFields();
-    Field getField();
-    PVStructure getParent();
-    void postPut();
-    void setPostHandler(PostHandler postHandler);
-    // following will be removed
-    PVAuxInfo getPVAuxInfo();
-    boolean isImmutable();
-    void setImmutable();
-    void renameField(std::string newName);
-    void toString(StringBuilder buf);
-    void toString(StringBuilder buf,int indentLevel);
-    std::string toString();
-}
-
-
-// The following is a new interface
-interface PVFieldTostd::string {
-    std::string toString(PVField pvField);
-    void setMaxInitialArrayElements(int num);
-    void setMaxFinalArrayElements(int num);
-    int getMaxInitialArrayElements();
-    int getMaxFinalArrayElements();
-}
-    
-interface PVScalar extends PVField{
-    Scalar getScalar();
-}
-
-interface PVDouble extends PVScalar{
-    double get();
-    void put(double value);
-}
-// also PVBoolean, PVByte, PVShort, PVInt, PVLong, PVFloat, and PVString
-
-interface PVArray extends PVField, SerializableArray {
-    int getLength();
-    void setLength(int length);
-    int getCapacity();
-    void setCapacity(int length);
-    // following will be removed
-    boolean isCapacityMutable();
-    void setCapacityMutable(boolean isMutable);
-}
-
-interface PVScalarArray extends PVArray {
-    ScalarArray getScalarArray();
-}
-
-
-//following will be removed
-public class DoubleArrayData {
-    public double[] data;
-    public int offset;
-}
-
-interface PVDoubleArray extends PVArray {
-    // following are new
-    double[] get();
-    void swap(double[] value);
-    //following will be removed
-    int get(int offset, int len, DoubleArrayData data);
-    int put(int offset,int len, double[] from, int fromOffset);
-    void shareData(double[] from);
-}
-
-// also PVBooleanArray, ..., PVStringArray
-
-
-interface PVStructure extends PVField , BitSetSerializable{
-    Structure getStructure();
-    PVField[] getPVFields();
-    PVField getSubField(std::string fieldName);
-    PVField getSubField(int fieldOffset);
-    // The following are convenience methods
-    PVBoolean getBooleanField(std::string fieldName);
-    PVByte getByteField(std::string fieldName);
-    PVShort getShortField(std::string fieldName);
-    PVInt getIntField(std::string fieldName);
-    PVLong getLongField(std::string fieldName);
-    PVFloat getFloatField(std::string fieldName);
-    PVDouble getDoubleField(std::string fieldName);
-    PVString getStringField(std::string fieldName);
-    PVScalarArray getScalarArrayField(std::string fieldName);
-    PVStructureArray getStructureArrayField(std::string fieldName);
-    PVStructure getStructureField(std::string fieldName);
-    PVArray getArrayField(std::string fieldName,ScalarType elementType);
-    // following will be removed
-    void appendPVField(std::string fieldName,PVField pvField);
-    void appendPVFields(std::string[] fieldNames,PVField[] pvFields);
-    void removePVField(std::string fieldName);
-    void replacePVField(PVField oldPVField,PVField newPVField);
-    std::string getExtendsStructureName();
-    boolean putExtendsStructureName(std::string extendsStructureName);
-    public boolean checkValid();
-}
- 
-
-//following will be removed
-public class StructureArrayData {
-    public PVStructure[] data;
-    public int offset;
-}
-
-
-interface PVStructureArray extends PVArray{
-    StructureArray getStructureArray();
-    // following are new
-    PVStructure[] get();
-    void swap(PVStructure[] value);
-    // following will be removed
-    int get(int offset, int length, StructureArrayData data);
-    int put(int offset,int length, PVStructure[] from, int fromOffset);
-    void shareData(PVStructure[] from);
-}
-
-
-public interface PVDataCreate {
-    PVField createPVField(Field field);
-    PVField createPVField(PVField fieldToClone);
-    PVScalar createPVScalar(Scalar scalar);
-    PVScalar createPVScalar(ScalarType fieldType);
-    PVScalar createPVScalar(PVScalar scalarToClone);
-    PVScalarArray createPVScalarArray(ScalarArray array);
-    PVScalarArray createPVScalarArray(ScalarType elementType);
-    PVScalarArray createPVScalarArray(PVScalarArray arrayToClone;
-    PVStructureArray createPVStructureArray(StructureArray structureArray);
-    PVStructure createPVStructure(Structure structure);
-    PVStructure createPVStructure(std::string[] fieldNames,Field[] fields);
-    PVStructure createPVStructure(PVStructure structToClone);
-    // following will be removed
-    PVField[] flattenPVStructure(PVStructure pvStructure);
-}
-
-

PVFieldTostd::string

-

In addition to toString this has methods to limit the number of array element to display. -The existing Java implementation of toString displayed all elements. -For large arrays this is not desirable. -The new methods provide a way for the client to limit the number of elements. -The default might be set to something like display up to 10 elements with 5 fron the beginning and 5 from the end.

-

For C++ this can be a replacement for dumpValue.

-

PVBooleanArray, ..., PVStructureArray

-

The old get and put are replaced by two new and simpler methods: -

-
get
-
Returns the raw array. If the client code modifies the elements in the array then - the client must call postPut. The client also has to realize that if the raw array held by the PVXXXArray changes - then the client is no longer sharing data -
swap
-
This exchanges the old raw data with the new raw data.
-
-

-

-The method setCapacity will always create a new raw array and copy old data from the old to the new array. -This is not true now since the implementation does not create a new array if the old capacity is equal to the requested capacity. -

-

C++ API

-

The C++ class definitions are similar to the Java definitions with two main exceptions: -

-
toString
-
In c++ this is replaced by std::ostream.
-
raw array data
-
Java supports array data like double[] - The C++ replacement is shared_vector<double>, which is implemented - in pvDataCPP-md.
-

Introspection Interfaces

- -
-class Field :
-    virtual public Serializable,
-    public std::tr1::enable_shared_from_this<Field>
-{
-public:
-    POINTER_DEFINITIONS(Field);
-    virtual ~Field();
-    Type getType() const{return m_type;}
-    virtual std::string getID() const = 0;
-    
-    // following will be removed
-    virtual void toString(StringBuilder buf) const{toString(buf,0);}
-    virtual void toString(StringBuilder buf,int indentLevel) const;
-    
- ...
-};
-
-// new function
-std::ostream &toString(Field::const_reference field, std::ostream& o);
-
-
-class Scalar : public Field{
-public:
-    POINTER_DEFINITIONS(Scalar);
-    virtual ~Scalar();
-    typedef Scalar& reference;
-    typedef const Scalar& const_reference;
-
-    ScalarType getScalarType() const {return scalarType;}
-    virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const;
-    virtual void deserialize(ByteBuffer *buffer, DeserializableContol *control);
-    
-    // following will be removed
-    virtual void toString(StringBuilder buf) const{toString(buf,0);}
-    virtual void toString(StringBuilder buf,int indentLevel) const;
-    virtual std::string getID() const;
-    
- ...
-};
-class ScalarArray : public Field{
-public:
-    POINTER_DEFINITIONS(ScalarArray);
-    typedef ScalarArray& reference;
-    typedef const ScalarArray& const_reference;
-
-    ScalarArray(ScalarType scalarType);
-    ScalarType  getElementType() const {return elementType;}
-    virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const;
-    virtual void deserialize(ByteBuffer *buffer, DeserializableControl *control);
-    
-    // following will be removed
-    virtual void toString(StringBuilder buf) const{toString(buf,0);}
-    virtual void toString(StringBuilder buf,int indentLevel) const;
-    virtual std::string getID() const;
-    
- ...
-};
-
-class Structure : public Field {
-public:
-    POINTER_DEFINITIONS(Structure);
-    typedef Structure& reference;
-    typedef const Structure& const_reference;
-
-   std::size_t getNumberFields() const {return numberFields;}
-   FieldConstPtr getField(std::string const & fieldName) const;
-   FieldConstPtr getField(std::size_t index) const;
-   std::size_t getFieldIndex(std::string const &fieldName) const;
-   FieldConstPtrArray const & getFields() const {return fields;}
-   StringArray const & getFieldNames() const;
-   std::string getFieldName(std::size_t fieldIndex);
-   virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const;
-   virtual void deserialize(ByteBuffer *buffer, DeserializableControl *control);
-    
-    // following will be removed
-   void renameField(std::size_t fieldIndex,std::string const &newName);
-   virtual void toString(StringBuilder buf,int indentLevel) const;
-   virtual std::string getID() const;
-   
- ...
-};
-
-class StructureArray : public Field{
-public:
-    POINTER_DEFINITIONS(StructureArray);
-    typedef StructureArray& reference;
-    typedef const StructureArray& const_reference;
-
-    StructureConstPtr  getStructure() const {return pstructure;}
-    virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const;
-    virtual void deserialize(ByteBuffer *buffer, DeserializableControl *control);
-    
-    // following will be removed
-    virtual void toString(StringBuilder buf,int indentLevel=0) const;
-    virtual std::string getID() const;
-    
- ...
-};
-
-class FieldCreate  {
-public:
-    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 (
-        std::string const &id,
-        StringArray const & fieldNames,
-        FieldConstPtrArray const & fields) const;
-    FieldConstPtr deserialize(ByteBuffer* buffer, DeserializableControl* control) const;
-    
-    // following will be removed
-    StructureConstPtr appendField(
-        StructureConstPtr const & structure,
-        std::string const &fieldName, FieldConstPtr const & field) const;
-    StructureConstPtr appendFields(
-        StructureConstPtr const & structure,
-        StringArray const & fieldNames,
-        FieldConstPtrArray const & fields) const;
-    
- ...
-};
-
-extern FieldCreatePtr getFieldCreate();
- 
-

Data Interfaces

-
-class PVField
-: virtual public Serializable,
-  public std::tr1::enable_shared_from_this<PVField>
-{
-public:
-   POINTER_DEFINITIONS(PVField);
-   virtual ~PVField();
-   inline const std::string &getFieldName() const ;
-   virtual void setRequester(RequesterPtr const &prequester);
-   std::size_t getFieldOffset() const;
-   std::size_t getNextFieldOffset() const;
-   std::size_t getNumberFields() const;
-   const FieldConstPtr & getField() const ;
-   PVStructure * getParent() const
-   void postPut() ;
-   void setPostHandler(PostHandlerPtr const &postHandler);
-    // following will be removed
-    
-   virtual void message(std::string message,MessageType messageType);
-   void replacePVField(const PVFieldPtr&  newPVField);
-   std::string getFullName() const;
-   virtual bool equals(PVField &pv);
-   PVAuxInfoPtr & getPVAuxInfo()
-   bool isImmutable() const;
-   virtual void setImmutable();
-   void replacePVField(const PVFieldPtr&  newPVField);
-   void renameField(std::string const &newName);
-   virtual void toString(StringBuilder buf) ;
-   virtual void toString(StringBuilder buf,int indentLevel);
-   std::ostream& dumpValue(std::ostream& o) const;
-   
- ...
-};
-
-
-// The following is a new class
-class PVFieldTostd::string {
-    std::string toString(const PVFieldPtr &pvField);
-    void setMaxInitialArrayElements(size_t num);
-    void setMaxFinalArrayElements(size_t num);
-    size_t getMaxInitialArrayElements();
-    size_t getMaxFinalArrayElements();
-...
-}
-
-class PVScalar : public PVField {
-public:
-    POINTER_DEFINITIONS(PVScalar);
-    virtual ~PVScalar();
-    typedef PVScalar &reference;
-    typedef const PVScalar& const_reference;
-
-    const ScalarConstPtr getScalar() const ;
- ...
-}
-
-
-template<typename T>
-class PVScalarValue : public PVScalar {
-public:
-    POINTER_DEFINITIONS(PVScalarValue);
-    typedef T value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-
-    virtual ~PVScalarValue() {}
-    virtual T get() const = 0;
-    virtual void put(T value) = 0;
-    
-    // following will be removed
-    std::ostream& dumpValue(std::ostream& o)
-    void operator>>=(T& value) const;
-    void operator<<=(T value);
-    
- ...
-}
-
-// PVString is special case, since it implements SerializableArray
-class PVString : public PVScalarValue<std::string>, SerializableArray {
-public:
-    virtual ~PVString() {}
- ...
-}
-class PVArray : public PVField, public SerializableArray {
-public:
-    POINTER_DEFINITIONS(PVArray);
-    virtual ~PVArray();
-    std::size_t getLength() const;
-    virtual void setLength(std::size_t length);
-    std::size_t getCapacity() const;
-    virtual void setCapacity(std::size_t capacity) = 0;
-    
-    // following will be removed
-    virtual void setImmutable();
-    bool isCapacityMutable() const;
-    void setCapacityMutable(bool isMutable);
-    virtual std::ostream& dumpValue(std::ostream& o, std::size_t index) const = 0;
-    
- ...
-};
-
-class PVScalarArray : public PVArray {
-public:
-    POINTER_DEFINITIONS(PVScalarArray);
-    virtual ~PVScalarArray();
-    typedef PVScalarArray &reference;
-    typedef const PVScalarArray& const_reference;
-
-    const ScalarArrayConstPtr getScalarArray() const ;
-    
-    // following will be removed
-    virtual std::ostream& dumpValue(std::ostream& o, size_t index) const = 0;
-    
- ...
-}
-
-
-// following will be removed
-template<typename T>
-class PVArrayData {
-private:
-    std::vector<T> init;
-public:
-    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)
-    {}
-};
-
-
-template<typename T>
-class PVValueArray : public PVScalarArray {
-public:
-    POINTER_DEFINITIONS(PVValueArray);
-    typedef T  value_type;
-    typedef T* pointer;
-    typedef const T* const_pointer;
-    // following are new typeDefs
-    typedef shared_vector<T> svector;
-    typedef shared_vector<const T> const_svector; 
-
-    virtual ~PVValueArray() {}
-    // following are added
-    svector get();
-    void swap(svector& value);
-    
-    // following are removed
-    typedef PVValueArray & reference;
-    typedef const PVValueArray & const_reference;
-    typedef PVArrayData<T> ArrayDataType;
-    typedef std::vector<T> vector;
-    typedef const std::vector<T> const_vector;
-    typedef std::tr1::shared_ptr<vector> shared_vector;
-
-    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;
-    std::ostream& dumpValue(std::ostream& o) const;
-    std::ostream& dumpValue(std::ostream& o, size_t index) const;
-    
-...
-};
-
-typedef PVValueArray<uint8> PVBooleanArray;
-typedef std::tr1::shared_ptr<PVBooleanArray> PVBooleanArrayPtr;
-...
-typedef PVValueArray<std::string> PVStringArray;
-typedef std::tr1::shared_ptr<PVStringArray> PVStringArrayPtr;
-
-class PVStructure : public PVField,public BitSetSerializable {
-public:
-    POINTER_DEFINITIONS(PVStructure);
-    virtual ~PVStructure();
-    typedef PVStructure & reference;
-    typedef const PVStructure & const_reference;
-
-    StructureConstPtr getStructure() const;
-    const PVFieldPtrArray & getPVFields() const;
-    PVFieldPtr getSubField(std::string const &fieldName) const;
-    PVFieldPtr getSubField(std::size_t fieldOffset) const;
-    PVBooleanPtr getBooleanField(std::string const &fieldName) ;
-    PVBytePtr getByteField(std::string const &fieldName) ;
-    PVShortPtr getShortField(std::string const &fieldName) ;
-    PVIntPtr getIntField(std::string const &fieldName) ;
-    PVLongPtr getLongField(std::string const &fieldName) ;
-    PVUBytePtr getUByteField(std::string const &fieldName) ;
-    PVUShortPtr getUShortField(std::string const &fieldName) ;
-    PVUIntPtr getUIntField(std::string const &fieldName) ;
-    PVULongPtr getULongField(std::string const &fieldName) ;
-    PVFloatPtr getFloatField(std::string const &fieldName) ;
-    PVDoublePtr getDoubleField(std::string const &fieldName) ;
-    PVStringPtr getStringField(std::string const &fieldName) ;
-    PVStructurePtr getStructureField(std::string const &fieldName) ;
-    PVScalarArrayPtr getScalarArrayField(
-        std::string const &fieldName,ScalarType elementType) ;
-    PVStructureArrayPtr getStructureArrayField(std::string const &fieldName) ;
-    virtual void serialize(
-        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(StructureConstPtr const & structure);
-    PVStructure(StructureConstPtr const & structure,PVFieldPtrArray const & pvFields);
-    
-    // following are removed
-    void appendPVField(
-        std::string const &fieldName,
-        PVFieldPtr const & pvField);
-    void appendPVFields(
-        StringArray const & fieldNames,
-        PVFieldPtrArray const & pvFields);
-    void removePVField(std::string const &fieldName);
-    virtual void setImmutable();
-    std::string getExtendsStructureName() const;
-    bool putExtendsStructureName(
-        std::string const &extendsStructureName);
-    
-};
-
-
-// following will be removed
-typedef PVArrayData<PVStructurePtr> StructureArrayData;
-
-
-class PVStructureArray : public PVArray
-{
-public:
-    POINTER_DEFINITIONS(PVStructureArray);
-    typedef PVStructurePtr  value_type;
-    typedef PVStructurePtr* pointer;
-    typedef const PVStructurePtr* const_pointer;
-    
-    // following are new typeDefs
-    typedef shared_vector<PVStructurePtr> svector;
-    typedef shared_vector<const PVStructurePtr> const_svector;
-    
-
-    virtual ~PVStructureArray() {}
-    virtual void setCapacity(size_t capacity);
-    virtual void setLength(std::size_t length);
-    virtual StructureArrayConstPtr getStructureArray() const ;
-    virtual void serialize(ByteBuffer *pbuffer,
-        SerializableControl *pflusher) const;
-    virtual void deserialize(ByteBuffer *buffer,
-    virtual void serialize(ByteBuffer *pbuffer,
-        SerializableControl *pflusher, std::size_t offset, std::size_t count) const ;
-    // following are new
-    svector get();
-    void swap(svector & value);
-    
-    // following are removed
-    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 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 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;}
-    
- ...
-};
-
-class PVDataCreate {
-public:
-    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 PVDataCreatePtr getPVDataCreate();
-
- - -
- - diff --git a/src/factory/Convert.cpp b/src/factory/Convert.cpp index ffeff40..ce00129 100644 --- a/src/factory/Convert.cpp +++ b/src/factory/Convert.cpp @@ -50,7 +50,8 @@ void Convert::getString(string *buf,PVField const *pvField,int /*indentLevel*/) { // TODO indextLevel ignored std::ostringstream strm; - strm << pvField->dumpValue(strm) << std::endl; + pvField->dumpValue(strm); + strm << std::endl; // PrinterPlain p; // p.setStream(strm); // p.print(*pvField); diff --git a/src/factory/StandardField.cpp b/src/factory/StandardField.cpp index 7a3711e..d3009fa 100644 --- a/src/factory/StandardField.cpp +++ b/src/factory/StandardField.cpp @@ -503,28 +503,28 @@ StructureConstPtr StandardField::scalar( ScalarType type,string const &properties) { ScalarConstPtr field = fieldCreate->createScalar(type); // scalar_t - return createProperties("ev4:nt:NTScalar:1.0",field,properties); + return createProperties("epics:nt/NTScalar:1.0",field,properties); } StructureConstPtr StandardField::regUnion( UnionConstPtr const &field, string const & properties) { - return createProperties("ev4:nt:NTUnion:1.0",field,properties); + return createProperties("epics:nt/NTUnion:1.0",field,properties); } StructureConstPtr StandardField::variantUnion( string const & properties) { UnionConstPtr field = fieldCreate->createVariantUnion(); - return createProperties("ev4:nt:NTUnion:1.0",field,properties); + return createProperties("epics:nt/NTUnion:1.0",field,properties); } StructureConstPtr StandardField::scalarArray( ScalarType elementType, string const &properties) { ScalarArrayConstPtr field = fieldCreate->createScalarArray(elementType); // scalar_t[] - return createProperties("ev4:nt:NTScalarArray:1.0",field,properties); + return createProperties("epics:nt/NTScalarArray:1.0",field,properties); } @@ -533,7 +533,7 @@ StructureConstPtr StandardField::structureArray( { StructureArrayConstPtr field = fieldCreate->createStructureArray( structure); - return createProperties("ev4:nt:NTStructureArray:1.0",field,properties); + return createProperties("epics:nt/NTStructureArray:1.0",field,properties); } StructureConstPtr StandardField::unionArray( @@ -541,7 +541,7 @@ StructureConstPtr StandardField::unionArray( { UnionArrayConstPtr field = fieldCreate->createUnionArray( punion); - return createProperties("ev4:nt:NTUnionArray:1.0",field,properties); + return createProperties("epics:nt/NTUnionArray:1.0",field,properties); } StructureConstPtr StandardField::enumerated() @@ -560,7 +560,7 @@ StructureConstPtr StandardField::enumerated() StructureConstPtr StandardField::enumerated(string const &properties) { StructureConstPtr field = enumerated(); // enum_t - return createProperties("ev4:nt:NTEnum:1.0",field,properties); + return createProperties("epics:nt/NTEnum:1.0",field,properties); } StructureConstPtr StandardField::alarm() diff --git a/src/misc/parseToPOD.cpp b/src/misc/parseToPOD.cpp index 8180a6f..fa9bc85 100644 --- a/src/misc/parseToPOD.cpp +++ b/src/misc/parseToPOD.cpp @@ -27,7 +27,7 @@ using std::string; #endif #if EPICS_VERSION_INT < VERSION_INT(3,15,0,1) -/* integer conversion primatives added to epicsStdlib.c in 3.15.0.1 */ +/* integer conversion primitives added to epicsStdlib.c in 3.15.0.1 */ #define S_stdlib_noConversion 1 /* No digits to convert */ #define S_stdlib_extraneous 2 /* Extraneous characters */ @@ -249,7 +249,18 @@ epicsParseFloat(const char *str, float *to, char **units) } #endif -#if defined(NEED_LONGLONG) && (defined(__vxworks) || defined (_WIN32)) +// MS Visual Studio 2013 defines strtoll, etc. +#if defined(_WIN32) +# if (_MSC_VER >= 1800) +# define WIN_NEEDS_OLL_FUNC 0 +# else +# define WIN_NEEDS_OLL_FUNC 1 +# endif +#else +# define WIN_NEEDS_OLL_FUNC 0 +#endif + +#if defined(NEED_LONGLONG) && (defined(__vxworks) || WIN_NEEDS_OLL_FUNC) static long long strtoll(const char *ptr, char ** endp, int base) { diff --git a/src/pv/standardField.h b/src/pv/standardField.h index a746234..9dcf7ba 100644 --- a/src/pv/standardField.h +++ b/src/pv/standardField.h @@ -122,7 +122,7 @@ public: */ StructureConstPtr enumerated(); /** Create a structure that has an enumerated structure value field - * The id for the structure is "ev4:nt:NTEnum:1.0". + * The id for the structure is "epics:nt/NTEnum:1.0". * @param properties A comma separated list of properties. * This is some combination of "alarm,timeStamp,display,control,valueAlarm". * @return The const shared pointer to the structure. diff --git a/src/pv/standardPVField.h b/src/pv/standardPVField.h index e267c17..cad6c2e 100644 --- a/src/pv/standardPVField.h +++ b/src/pv/standardPVField.h @@ -84,7 +84,7 @@ public: PVStructurePtr enumerated(StringArray const &choices); /** * Create a structure that has an enumerated structure value field. - * The id for the structure is "ev4:nt:NTEnum:1.0". + * The id for the structure is "epics:nt/NTEnum:1.0". * @param choices This is a StringArray of choices. * @param properties A comma separated list of properties. * @return The const shared pointer to the structure. diff --git a/testApp/copy/testPVCopy.cpp b/testApp/copy/testPVCopy.cpp index fc2fc63..8a7d886 100644 --- a/testApp/copy/testPVCopy.cpp +++ b/testApp/copy/testPVCopy.cpp @@ -214,7 +214,7 @@ static void scalarTest() CreateRequest::shared_pointer createRequest = CreateRequest::create(); pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "value"; testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy); @@ -222,7 +222,7 @@ static void scalarTest() valueNameMaster = "value"; pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "value"; testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy); @@ -230,7 +230,7 @@ static void scalarTest() valueNameMaster = "value"; pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "value"; testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy); @@ -253,7 +253,7 @@ static void arrayTest() valueNameMaster = request = "value"; pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "value"; testPVScalarArray(pvDouble,valueNameMaster,valueNameCopy,pvMaster,pvCopy); @@ -261,7 +261,7 @@ static void arrayTest() valueNameMaster = "value"; pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "value"; testPVScalarArray(pvDouble,valueNameMaster,valueNameCopy,pvMaster,pvCopy); @@ -269,7 +269,7 @@ static void arrayTest() valueNameMaster = "value"; pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "value"; testPVScalarArray(pvDouble,valueNameMaster,valueNameCopy,pvMaster,pvCopy); @@ -320,7 +320,7 @@ static void powerSupplyTest() valueNameMaster = request = "power.value"; pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "power.value"; testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy); @@ -328,7 +328,7 @@ static void powerSupplyTest() valueNameMaster = "power.value"; pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "power.value"; testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy); @@ -336,7 +336,7 @@ static void powerSupplyTest() valueNameMaster = "power.value"; pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "power.value"; testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy); @@ -344,7 +344,7 @@ static void powerSupplyTest() valueNameMaster = "power.value"; pvRequest = createRequest->createRequest(request); if(debug) { cout << "request " << request << endl; } - if(debug) { cout << "pvRequest\n" << pvRequest->dumpValue(cout) << endl; } + if(debug) { cout << "pvRequest\n" << *pvRequest << endl; } pvCopy = PVCopy::create(pvMaster,pvRequest,""); valueNameCopy = "power.value"; testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy);