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;
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.
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.This consists of two components:
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 @@ - - - -
- -This product is made available subject to acceptance of the EPICS open source -license.
-Since the last version of this document the following changes have -been made to the proposed interface definitionsi for PVValueArray:
-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.
-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: -
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: -
-PVScalarArrayPtr createPVScalarArray(const PVScalarArray &, size_t offset, size_t length); -- This will share the raw data array but allow a new window. -
The following compares the definitions of the following: PVField, -PVScalar and extensions, PVArray and extensions. -PVStructureArray is not discussed. -
-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<<. -
-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();
-}
-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);
-
-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);
-
--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; -... -}; - -
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: -
The proposed version is like the pvDataCPP version except for dumpValue -and the stream interators.
-
-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);
-}
-
-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() {}
- ...
-};
-
-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() {}
- ...
-};
-
-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() {}
- ...
-};
-
-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: -
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/
-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);
-}
-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
-
-
-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
-
-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;
-
-
-
-
-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.
- --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:
-
-class PVScalar : public PVField {
-public:
- POINTER_DEFINITIONS(PVScalar);
- virtual ~PVScalar();
-
- typedef PVScalar &reference;
- typedef const PVScalar& const_reference;
-
- const ScalarConstPtr getScalar() const;
-...
-};
-
-where
--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
-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;
- ...
-};
-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
-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
-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.
-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: -
The following subsections are organized as follows: -
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. -
-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.
-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.
-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; -- -
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; -- -
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 --
These are member types defined by std::tr1::shared_ptr. -These are not used by any of the client methods.
- -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
--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. -
-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} []"? -
--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, ...]
-
--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. -
- --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.
- - - -
- 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.
- -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(); -- -
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 -- -
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;
-}
-
-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.
-Brief Summary -
-push_back(x) Add an element after the last element -pop_back(x) Remove the last element. --
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 -... -- -
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>= --
-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 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 -- -
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. -
-void make_unique(); -bool unique() const; --
-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 --
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 -- - -
Not yet documented
- -Not yet documented
- -Not yet documented
- - -This product is made available subject to acceptance of the
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:
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:This document discusses the following:
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();
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:
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:
Directory pvDataApp/pv has the following header files:
+Directory src/pv has the following header files:
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.TBD +
TBD
typedef uint8_t boolean;
+ 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.
@@ -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.
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.
-uint32 val = pv->getAs@@ -2026,9 +2123,9 @@ pv->putFrom<pvInt>(val);(); +uint32 val = pv->getAs<pvInt>();
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;
};
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:
where
TBD +
TBD
where
@@ -2365,10 +2461,10 @@ public:The interface for an array of unions is:
-template&ly;>
-class epicsShareClass PVValueArray&ly;PVUnionPtr> : public detail::PVVectorStorage&ly;PVUnionPtr,PVArray>
+template<>
+class epicsShareClass PVValueArray<PVUnionPtr> : public detail::PVVectorStorage<PVUnionPtr,PVArray>
{
- typedef detail::PVVectorStorage&ly;PVUnionPtr,PVArray> 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> svector;
- typedef ::epics::pvData::shared_vector&ly;const PVUnionPtr> 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>();
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:
An exception is thrown if:
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.Two header files are provided for manipulating time stamps:
@@ -3015,7 +3112,7 @@ public:where
where
where
where
@@ -3477,7 +3574,7 @@ public: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
-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);
Clears all of the bits in this bitSet whose corresponding bit is set - in the specified bitSet.
--
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:
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(size_t c);
@@ -4425,7 +4514,7 @@ shared_vector(size_t c);
is the sole owner of the data array.
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:
Timer has the methods:
TBD Michael will explain.
-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:
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.
This consists of two components: +
This consists of two components:
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:
+
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.
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 copyMonitorPluginManager has the methods:
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.
-
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 displayA 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 @@ - - - - - -This product is made available subject to acceptance of the EPICS open source -license.
-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.
-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. -
-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);
-}
-
-
-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);
-}
-
-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.
-The old get and put are replaced by two new and simpler methods: -
-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. -
-The C++ class definitions are similar to the Java definitions with two main exceptions: -
-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();
-
-
-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();
-
-
-
-