PVData C++  8.0.3
pvData.h
1 /* pvData.h */
2 /*
3  * Copyright information and license terms for this software can be
4  * found in the file LICENSE that is included with the distribution
5  */
6 /**
7  * @author mrk
8  */
9 #ifndef PVDATA_H
10 #define PVDATA_H
11 
12 #include <string>
13 #include <map>
14 #include <stdexcept>
15 #include <algorithm>
16 #include <iterator>
17 #include <iostream>
18 #include <iomanip>
19 
20 #include <epicsAssert.h>
21 
22 #include <pv/pvIntrospect.h>
23 #include <pv/typeCast.h>
24 #include <pv/anyscalar.h>
25 #include <pv/sharedVector.h>
26 
27 #include <shareLib.h>
28 #include <compilerDependencies.h>
29 
30 #if defined(vxWorks) && !defined(_WRS_VXWORKS_MAJOR)
31 typedef class std::ios std::ios_base;
32 #endif
33 
34 namespace epics { namespace pvData {
35 
36 /** @defgroup pvcontainer Value containers
37  *
38  * The core of the pvDataCPP library are the typed, structured, data containers.
39  */
40 
41 class PostHandler;
42 
43 class PVField;
44 class PVScalar;
45 
46 class PVScalarArray;
47 
48 class PVStructure;
49 
50 class PVUnion;
51 
52 
53 
54 template<typename T> class PVScalarValue;
55 template<typename T> class PVValueArray;
56 
57 
58 /**
59  * typedef for a pointer to a PostHandler.
60  */
62 
63 /**
64  * typedef for a pointer to a PVField.
65  */
67 /**
68  * typedef for a pointer to a array of pointer to PVField.
69  */
71 typedef std::vector<PVFieldPtr>::iterator PVFieldPtrArray_iterator;
72 typedef std::vector<PVFieldPtr>::const_iterator PVFieldPtrArray_const__iterator;
73 
74 /**
75  * typedef for a pointer to a PVScalar.
76  */
78 
79 /**
80  * typedef for a pointer to a PVScalarArray.
81  */
83 
84 /**
85  * typedef for a pointer to a PVStructure.
86  */
88 /**
89  * typedef for a pointer to a array of pointer to PVStructure.
90  */
92 typedef std::vector<PVStructurePtr>::iterator PVStructurePtrArray_iterator;
93 typedef std::vector<PVStructurePtr>::const_iterator PVStructurePtrArray_const__iterator;
94 
95 /**
96  * typedef for a pointer to a PVStructureArray.
97  */
98 
99 typedef PVValueArray<PVStructurePtr> PVStructureArray;
100 typedef std::tr1::shared_ptr<PVStructureArray> PVStructureArrayPtr;
101 typedef std::vector<PVStructureArrayPtr> PVStructureArrayPtrArray;
102 typedef std::tr1::shared_ptr<PVStructureArrayPtrArray> PVStructureArrayPtrArrayPtr;
103 
104 /**
105  * typedef for a pointer to a PVUnion.
106  */
108 /**
109  * typedef for a pointer to a array of pointer to PVUnion.
110  */
112 typedef std::vector<PVUnionPtr>::iterator PVUnionPtrArray_iterator;
113 typedef std::vector<PVUnionPtr>::const_iterator PVUnionPtrArray_const__iterator;
114 
115 /**
116  * typedef for a pointer to a PVUnionArray.
117  */
118 
119 typedef PVValueArray<PVUnionPtr> PVUnionArray;
120 typedef std::tr1::shared_ptr<PVUnionArray> PVUnionArrayPtr;
121 typedef std::vector<PVUnionArrayPtr> PVUnionArrayPtrArray;
122 typedef std::tr1::shared_ptr<PVUnionArrayPtrArray> PVUnionArrayPtrArrayPtr;
123 
124 class PVDataCreate;
125 typedef std::tr1::shared_ptr<PVDataCreate> PVDataCreatePtr;
126 
127 /**
128  * @brief This class is implemented by code that calls setPostHander
129  *
130  */
131 class epicsShareClass PostHandler
132 {
133 public:
135  /**
136  * Destructor
137  */
138  virtual ~PostHandler(){}
139  /**
140  * This is called every time postPut is called for this field.
141  */
142  virtual void postPut() = 0;
143 };
144 
145 /**
146  * @brief PVField is the base class for each PVData field.
147  *
148  * Each PVData field has an interface that extends PVField.
149  *
150  * @ingroup pvcontainer
151  */
152 class epicsShareClass PVField
153 : virtual public Serializable,
155 {
156 public:
158  /**
159  * Destructor
160  */
161  virtual ~PVField();
162  /**
163  * Get the fieldName for this field.
164  * @return The name or empty string if top-level field.
165  */
166  inline const std::string& getFieldName() const {return fieldName;}
167  /**
168  * Fully expand the name of this field using the
169  * names of its parent fields with a dot '.' separating
170  * each name.
171  */
172  std::string getFullName() const;
173  /**
174  * Get offset of the PVField field within top-level structure.
175  * Every field within the PVStructure has a unique offset.
176  * The top-level structure has an offset of 0.
177  * The first field within the structure has offset equal to 1.
178  * The other offsets are determined by recursively traversing each structure of the tree.
179  * @return The offset.
180  */
181  std::size_t getFieldOffset() const;
182  /**
183  * Get the next offset. If the field is a scalar or array field then this is just offset + 1.
184  * If the field is a structure it is the offset of the next field after this structure.
185  * Thus (nextOffset - offset) is always equal to the number of fields within the field.
186  * @return The offset.
187  */
188  std::size_t getNextFieldOffset() const;
189  /**
190  * Get the total number of fields in this field.
191  * This is equal to nextFieldOffset - fieldOffset.
192  */
193  std::size_t getNumberFields() const;
194  /**
195  * Is the field immutable, i.e. does it not allow changes.
196  * @return (false,true) if it (is not, is) immutable.
197  */
198  inline bool isImmutable() const {return immutable;}
199  /**
200  * Set the field to be immutable, i.e. it can no longer be modified.
201  * This is permanent, i.e. once done the field cannot be made mutable.
202  */
203  virtual void setImmutable();
204  /**
205  * Get the <i>Field</i> that describes the field.
206  * @return Field, which is the reflection interface.
207  */
208  inline const FieldConstPtr & getField() const {return field;}
209  /**
210  * Get the parent of this field.
211  * @return The parent interface or null if this is PVRecord
212  */
213  inline PVStructure * getParent() {return parent;}
214  inline const PVStructure * getParent() const {return parent;}
215  /**
216  * postPut. Called when the field is updated by the implementation.
217  */
218  void postPut() ;
219  /**
220  * Set the handler for postPut.
221  * At most one handler can be set.
222  * @param postHandler The handler.
223  */
225  /**
226  * Is this field equal to another field.
227  * @param pv other field
228  * @return (false,true) if (is not,is) equal.
229  */
230  virtual bool equals(PVField &pv);
231  /**
232  * Puts the PVField raw value to the stream.
233  * @param o output stream.
234  * @return The output stream.
235  */
236  virtual std::ostream& dumpValue(std::ostream& o) const = 0;
237 
238  void copy(const PVField& from);
239  void copyUnchecked(const PVField& from);
240 
241  static size_t num_instances; // use atomic::get() or volatile* access
242  enum {isPVField=1};
243 protected:
245  {
246  return shared_from_this();
247  }
248  explicit PVField(FieldConstPtr field);
250 private:
251  static void computeOffset(const PVField *pvField);
252  static void computeOffset(const PVField *pvField,std::size_t offset);
255  const FieldConstPtr field;
258  bool immutable;
260  friend class PVDataCreate;
261  friend class PVStructure;
263 };
264 
265 epicsShareExtern std::ostream& operator<<(std::ostream& o, const PVField& f);
266 
267 /**
268  * @brief PVScalar is the base class for each scalar field.
269  *
270  * @ingroup pvcontainer
271  */
272 class epicsShareClass PVScalar : public PVField {
273  // friend our child class(s) so that it
274  // can call protected methods of other
275  // PVScalar instances.
276  template<typename E> friend class PVScalarValue;
277 public:
279  /**
280  * Destructor
281  */
282  virtual ~PVScalar();
283  typedef PVScalar &reference;
284  typedef const PVScalar& const_reference;
285  /**
286  * Get the Scalar introspection interface for the PVScalar.
287  * @return the interface.
288  */
289  const ScalarConstPtr getScalar() const ;
290 
291  /**
292  * Convert and return the scalar value in the requested type.
293  * Result type is determined from the function template argument
294  * which must be one of the ScalarType enums.
295  * Uses castUnsafe<TO>() for value conversion.
296  @code
297  PVScalar* pv = ...;
298  uint32 val = pv->getAs<pvInt>();
299  @endcode
300  */
301  template<typename T>
302  inline T getAs() const {
303  T result;
304  this->getAs((void*)&result, (ScalarType)ScalarTypeID<T>::value);
305  return result;
306  }
307 protected:
308  virtual void getAs(void *, ScalarType) const = 0;
309 public:
310 
311  virtual void getAs(AnyScalar& v) const =0;
312 
313  /**
314  * Convert and assign the provided value.
315  * The value type is determined from the function template argument
316  * which must be one of the ScalarType enums.
317  * Uses castUnsafe<TO>() for value conversion.
318  @code
319  PVScalar* pv = ...;
320  pv->putFrom<pvInt>((int32)42);
321  @endcode
322  */
323  template<typename T>
324  inline void putFrom(T val) {
325  this->putFrom((const void*)&val, (ScalarType)ScalarTypeID<T>::value);
326  }
327 
328  //! Convert and assign
329  virtual void putFrom(const void *, ScalarType) = 0;
330 
331  inline void putFrom(const AnyScalar& v) {
332  if(v)
333  putFrom(v.unsafe(), v.type());
334  }
335 
336  virtual void assign(const PVScalar&) = 0;
337 
338  virtual void copy(const PVScalar& from) = 0;
339  virtual void copyUnchecked(const PVScalar& from) = 0;
340 
341 protected:
342  explicit PVScalar(ScalarConstPtr const & scalar);
344 };
345 
346 namespace detail {
347 template<typename T>
349  T value;
350  typedef T arg_type;
351  inline void store(T v) {
352  value = v;
353  }
354  ScalarStorageOps() :value(0) {}
355 };
356 template<>
357 struct ScalarStorageOps<std::string> {
358  std::string value;
359  size_t maxLength;
360  typedef const std::string& arg_type;
361  void store(const std::string& val) {
362  if (maxLength > 0 && val.length() > maxLength)
363  throw std::overflow_error("string too long");
364 
365  value = val;
366  }
367 
368  ScalarStorageOps(): value(), maxLength(0) {} // initialized in PVString::PVString
369 };
370 } // namespace detail
371 
372 /**
373  * @brief Class that holds the data for each possible scalar type.
374  *
375  * @ingroup pvcontainer
376  */
377 template<typename T>
378 class epicsShareClass PVScalarValue : public PVScalar {
380 public:
382  typedef T value_type;
383  typedef T* pointer;
384  typedef const T* const_pointer;
385 
386  static const ScalarType typeCode;
387 
388  /**
389  * Destructor
390  */
391  virtual ~PVScalarValue();
392  /**
393  * Get the value.
394  * @return The value.
395  */
396  typename storage_t::arg_type get() const { return storage.value; }
397  /**
398  * Put a new value into the PVScalar.
399  * @param value The value.
400  */
401  inline void put(typename storage_t::arg_type v) {
402  storage.store(v);
403  PVField::postPut();
404  }
405 
406  virtual std::ostream& dumpValue(std::ostream& o) const OVERRIDE;
407 
408  // get operator
409  // double value; doubleField >>= value;
410  // NOTE: virtual is needed for MS C++ compiler to get this operator exported
411  virtual void operator>>=(T& value) const;
412 
413  // put operator
414  // double value = 12.8; doubleField <<= value;
415  // NOTE: virtual is needed for MS C++ compiler to get this operator exported
416  virtual void operator<<=(typename storage_t::arg_type value);
417 
418  template<typename T1>
419  inline T1 getAs() const {
420  T1 result(castUnsafe<T1,T>(get()));
421  return result;
422  }
423 
424  template<typename T1>
425  inline void putFrom(typename detail::ScalarStorageOps<T1>::arg_type val) {
426  put(castUnsafe<T,T1>(val));
427  }
428 
429  inline void putFrom(const AnyScalar& v) {
430  // the template form of putFrom() hides the base class AnyScalar overload
431  PVScalar::putFrom(v);
432  }
433 
434  virtual void assign(const PVScalar& scalar) OVERRIDE FINAL;
435  virtual void copy(const PVScalar& from) OVERRIDE FINAL;
436  virtual void copyUnchecked(const PVScalar& from) OVERRIDE FINAL;
437 
438  virtual void serialize(ByteBuffer *pbuffer,
440  virtual void deserialize(ByteBuffer *pbuffer,
442 
443 protected:
444  explicit PVScalarValue(ScalarConstPtr const & scalar)
445  : PVScalar(scalar), storage() {}
446  virtual void getAs(void * result, ScalarType rtype) const OVERRIDE FINAL
447  {
448  const T src = get();
449  castUnsafeV(1, rtype, result, typeCode, (const void*)&src);
450  }
451 public:
452  virtual void getAs(AnyScalar& v) const OVERRIDE FINAL
453  {
454  v = get();
455  }
456  virtual void putFrom(const void *src, ScalarType stype) OVERRIDE FINAL
457  {
458  T result;
459  castUnsafeV(1, typeCode, (void*)&result, stype, src);
460  put(result);
461  }
462 protected:
463 
464  friend class PVDataCreate;
467 };
468 
469 /**
470  * @brief Some explicit specializations exist
471  */
472 template<> inline
474 {
475  return o << static_cast<int>(get());
476 }
477 
478 template<> inline
480 {
481  return o << static_cast<unsigned int>(get());
482 }
483 
484 template<> inline
486 {
487  return o << std::boolalpha << static_cast<bool>(get());
488 }
489 
490 /*
491  * typedefs for the various possible scalar types.
492  */
493 typedef PVScalarValue<boolean> PVBoolean;
494 typedef PVScalarValue<int8> PVByte;
495 typedef PVScalarValue<int16> PVShort;
496 typedef PVScalarValue<int32> PVInt;
497 typedef PVScalarValue<int64> PVLong;
498 typedef PVScalarValue<uint8> PVUByte;
499 typedef PVScalarValue<uint16> PVUShort;
500 typedef PVScalarValue<uint32> PVUInt;
501 typedef PVScalarValue<uint64> PVULong;
502 typedef PVScalarValue<float> PVFloat;
503 typedef PVScalarValue<double> PVDouble;
504 typedef std::tr1::shared_ptr<PVBoolean> PVBooleanPtr;
505 typedef std::tr1::shared_ptr<PVByte> PVBytePtr;
506 typedef std::tr1::shared_ptr<PVShort> PVShortPtr;
507 typedef std::tr1::shared_ptr<PVInt> PVIntPtr;
508 typedef std::tr1::shared_ptr<PVLong> PVLongPtr;
509 typedef std::tr1::shared_ptr<PVUByte> PVUBytePtr;
510 typedef std::tr1::shared_ptr<PVUShort> PVUShortPtr;
511 typedef std::tr1::shared_ptr<PVUInt> PVUIntPtr;
512 typedef std::tr1::shared_ptr<PVULong> PVULongPtr;
513 typedef std::tr1::shared_ptr<PVFloat> PVFloatPtr;
514 typedef std::tr1::shared_ptr<PVDouble> PVDoublePtr;
515 
516 /**
517  * @brief PVString is special case, since it implements SerializableArray
518  *
519  * @ingroup pvcontainer
520  */
521 class epicsShareClass PVString : public PVScalarValue<std::string>, SerializableArray {
522 public:
523  /**
524  * Destructor
525  */
526  virtual ~PVString() {}
527 
528  virtual std::ostream& dumpValue(std::ostream& o) const OVERRIDE FINAL;
529 
530  virtual void serialize(ByteBuffer *pbuffer,
532  virtual void serialize(ByteBuffer *pbuffer,
534 protected:
535  explicit PVString(ScalarConstPtr const & scalar);
536 
537  friend class PVDataCreate;
539 };
540 typedef std::tr1::shared_ptr<PVString> PVStringPtr;
541 
542 
543 /**
544  * @brief PVArray is the base class for all array types.
545  *
546  * The array types are unionArray, strucrtureArray and scalarArray.
547  * There is a scalarArray type for each scalarType.
548  *
549  * @ingroup pvcontainer
550  */
551 class epicsShareClass PVArray : public PVField, public SerializableArray {
552 public:
554  /**
555  * Destructor
556  */
557  virtual ~PVArray(){};
558  /**
559  * Get the introspection interface
560  * @return The interface.
561  */
562  virtual ArrayConstPtr getArray() const = 0;
563  /**
564  * Set the field to be immutable, i.e. it can no longer be modified.
565  * This is permanent, i.e. once done the field cannot be made mutable.
566  */
567  virtual void setImmutable() OVERRIDE;
568  /**
569  * Get the array length.
570  * @return The length.
571  */
572  virtual std::size_t getLength() const = 0;
573  /**
574  * Set the array length.
575  * @param length The length.
576  */
577  virtual void setLength(std::size_t length) = 0;
578  /**
579  * Get the array capacity.
580  * @return The capacity.
581  */
582  virtual std::size_t getCapacity() const = 0;
583  /**
584  * Can the capacity be changed.
585  * @return (false,true) if (can not, can) be changed.
586  */
587  bool isCapacityMutable() const;
588  /**
589  * Set the mutability of the array capacity.
590  * @return false or true
591  */
592  void setCapacityMutable(bool isMutable);
593  /**
594  * Set the array capacity.
595  * @param capacity The capacity.
596  */
597  virtual void setCapacity(std::size_t capacity) = 0;
598 
599  using PVField::dumpValue;
600  virtual std::ostream& dumpValue(std::ostream& o, std::size_t index) const = 0;
601 
602 protected:
603  explicit PVArray(FieldConstPtr const & field);
604  void checkLength(size_t length) const;
605 private:
606  bool capacityMutable;
607  friend class PVDataCreate;
609 };
610 
611 epicsShareExtern std::ostream& operator<<(format::array_at_internal const& manip, const PVArray& array);
612 
613 /**
614  * @brief Base class for a scalarArray.
615  *
616  * @ingroup pvcontainer
617  */
618 class epicsShareClass PVScalarArray : public PVArray {
619 public:
621  /**
622  * Destructor
623  */
624  virtual ~PVScalarArray();
625  typedef PVScalarArray &reference;
626  typedef const PVScalarArray& const_reference;
627  /**
628  * Get the introspection interface
629  * @return The interface.
630  */
631  const ScalarArrayConstPtr getScalarArray() const ;
632 
633 protected:
634  virtual void _getAsVoid(shared_vector<const void>&) const = 0;
635  virtual void _putFromVoid(const shared_vector<const void>&) = 0;
636 public:
637 
638  /**
639  * Fetch the current value and convert to the requested type.
640  *
641  * A copy is made if the requested type does not match
642  * the element type. If the types do match then
643  * no copy is made.
644  */
645  template<typename T>
646  void
647  getAs(shared_vector<const T>& out) const
648  {
649  shared_vector<const void> temp;
650  _getAsVoid(temp);
651  out = shared_vector_convert<const T>(temp);
652  }
653 
654  /**
655  * Assign the given value after conversion.
656  *
657  * A copy and element-wise conversion is performed unless
658  * the element type of the PVScalarArray matches the
659  * type of the provided data.
660  * If the types do match then a new reference to the provided
661  * data is kept.
662  *
663  * Calls postPut()
664  */
665  template<typename T>
666  inline void putFrom(const shared_vector<const T>& inp)
667  {
668  shared_vector<const void> temp(static_shared_vector_cast<const void>(inp));
670  }
671 
672  /**
673  * Assign the given PVScalarArray's value.
674  *
675  * A copy and element-wise conversion is performed unless
676  * the element type of the PVScalarArray matches the
677  * type of the provided data.
678  * If the types do match then a new reference to the provided
679  * data is kept.
680  */
681  void assign(const PVScalarArray& pv) {
682  if (isImmutable())
683  throw std::invalid_argument("destination is immutable");
684  copyUnchecked(pv);
685  }
686 
687  void copy(const PVScalarArray& from) {
688  assign(from);
689  }
690 
691  void copyUnchecked(const PVScalarArray& from) {
692  if (this==&from)
693  return;
694  shared_vector<const void> temp;
697  }
698 
699 protected:
701 private:
702  friend class PVDataCreate;
704 };
705 
706 
707 /**
708  * @brief Data interface for a structure,
709  *
710  * @ingroup pvcontainer
711  */
712 class epicsShareClass PVStructure : public PVField, public BitSetSerializable
713 {
714 public:
716  /**
717  * Destructor
718  */
719  virtual ~PVStructure();
720  typedef PVStructure & reference;
721  typedef const PVStructure & const_reference;
722  /**
723  * Set the field to be immutable, i.e. it can no longer be modified.
724  * This is permanent, i.e. once done the field cannot be made mutable.
725  */
726  virtual void setImmutable() OVERRIDE FINAL;
727  /**
728  * Get the introspection interface
729  * @return The interface.
730  */
731  inline const StructureConstPtr &getStructure() const { return structurePtr; }
732  /**
733  * Get the array of pointers to the subfields in the structure.
734  * @return The array.
735  */
736  inline const PVFieldPtrArray & getPVFields() const { return pvFields; }
737 
738  /**
739  * Get the subfield with the specified offset.
740  * @param a A sub-field name or index
741  * @return Pointer to the field or NULL if field does not exist.
742  */
743  template<typename A>
745  {
746  return getSubFieldImpl(a, false);
747  }
748 
749  template<typename A>
751  {
752  return getSubFieldImpl(a, false);
753  }
754 
755  /**
756  * Get a subfield with the specified name.
757  * @param a A sub-field name or index
758  * @returns A pointer to the sub-field or null if field does not exist or has a different type
759  * @code
760  * PVIntPtr ptr = pvStruct->getSubField<PVInt>("substruct.leaffield");
761  * @endcode
762  *
763  * A field name is a '.' delimited list of child field names (no whitespace allowed)
764  */
765  template<typename PVD, typename A>
767  {
768  STATIC_ASSERT(PVD::isPVField); // only allow cast from PVField sub-class
769  return std::tr1::dynamic_pointer_cast<PVD>(getSubFieldImpl(a, false));
770  }
771 
772  template<typename PVD, typename A>
773  inline std::tr1::shared_ptr<const PVD> getSubField(A a) const
774  {
775  STATIC_ASSERT(PVD::isPVField); // only allow cast from PVField sub-class
776  return std::tr1::dynamic_pointer_cast<const PVD>(getSubFieldImpl(a, false));
777  }
778 
779  /**
780  * Get the subfield with the specified offset.
781  * @param a A sub-field name or index
782  * @throws std::runtime_error if the requested sub-field doesn't exist, or has a different type
783  * @return Pointer to the field
784  */
785  template<typename A>
787  {
788  return getSubFieldImpl(a, true);
789  }
790 
791  template<typename A>
793  {
794  return getSubFieldImpl(a, true);
795  }
796 
797 private:
798  static void throwBadFieldType(const char *name);
799  static void throwBadFieldType(std::size_t fieldOffset);
800  static FORCE_INLINE void throwBadFieldType(const std::string& name) {
802  }
803 public:
804 
805  template<typename PVD, typename A>
806  inline std::tr1::shared_ptr<PVD> getSubFieldT(A a)
807  {
808  STATIC_ASSERT(PVD::isPVField); // only allow cast from PVField sub-class
810  if(!ret)
812  return ret;
813  }
814 
815  template<typename PVD, typename A>
816  inline std::tr1::shared_ptr<const PVD> getSubFieldT(A a) const
817  {
818  STATIC_ASSERT(PVD::isPVField); // only allow cast from PVField sub-class
819  std::tr1::shared_ptr<const PVD> ret(std::tr1::dynamic_pointer_cast<const PVD>(getSubFieldImpl(a, true)));
820  if(!ret)
822  return ret;
823  }
824 
825  /**
826  * Serialize.
827  * @param pbuffer The byte buffer.
828  * @param pflusher Interface to call when buffer is full.
829  */
830  virtual void serialize(
832  /**
833  * Deserialize
834  * @param pbuffer The byte buffer.
835  * @param pflusher Interface to call when buffer is empty.
836  */
837  virtual void deserialize(
839  /**
840  * Serialize.
841  * @param pbuffer The byte buffer.
842  * @param pflusher Interface to call when buffer is full.
843  * @param pbitSet A bitset the specifies which fields to serialize.
844  */
845  virtual void serialize(ByteBuffer *pbuffer,
847  /**
848  * Deserialize
849  * @param pbuffer The byte buffer.
850  * @param pflusher Interface to call when buffer is empty.
851  * @param pbitSet A bitset the specifies which fields to deserialize.
852  */
853  virtual void deserialize(ByteBuffer *pbuffer,
855  /**
856  * Constructor
857  * @param structure The introspection interface.
858  */
859  explicit PVStructure(StructureConstPtr const & structure);
860  /**
861  * Constructor
862  * @param structure The introspection interface.
863  * @param pvFields The array of fields for the structure.
864  */
866 
867  virtual std::ostream& dumpValue(std::ostream& o) const OVERRIDE FINAL;
868 
869  void copy(const PVStructure& from);
870 
871  void copyUnchecked(const PVStructure& from);
872  void copyUnchecked(const PVStructure& from, const BitSet& maskBitSet, bool inverse = false);
873 
874  struct Formatter {
875  enum mode_t {
876  Auto,
877  Plain,
878  ANSI,
879  };
880  enum format_t {
881  Raw,
882  NT,
883  JSON,
884  };
885  private:
886  const PVStructure& xtop;
887  const BitSet* xshow;
888  const BitSet* xhighlight;
889  mode_t xmode;
890  format_t xfmt;
891  public:
892  explicit Formatter(const PVStructure& top)
893  :xtop(top)
894  ,xshow(0)
895  ,xhighlight(0)
896  ,xmode(Auto)
897  ,xfmt(NT)
898  {}
899 
900  // those fields (and their parents) to be printed. non-NT mode.
901  FORCE_INLINE Formatter& show(const BitSet& set) { xshow = &set; return *this; }
902  // those fields (and not their parents) to be specially highlighted. non-NT mode.
903  FORCE_INLINE Formatter& highlight(const BitSet& set) { xhighlight = &set; return *this; }
904 
905  FORCE_INLINE Formatter& mode(mode_t m) { xmode = m; return *this; }
906 
907  FORCE_INLINE Formatter& format(format_t f) { xfmt = f; return *this; }
908 
910  friend void printRaw(std::ostream& strm, const PVStructure::Formatter& format, const PVStructure& cur);
911  };
912 
913  FORCE_INLINE Formatter stream() const { return Formatter(*this); }
914 
915 private:
916 
917  inline PVFieldPtr getSubFieldImpl(const std::string& name, bool throws) const {
918  return getSubFieldImpl(name.c_str(), throws);
919  }
920  PVFieldPtr getSubFieldImpl(const char *name, bool throws) const;
922 
926  friend class PVDataCreate;
928 };
929 
930 epicsShareFunc
931 std::ostream& operator<<(std::ostream& strm, const PVStructure::Formatter& format);
932 
933 /**
934  * @brief PVUnion has a single subfield.
935  *
936  * The type for the subfield is specified by a union introspection interface.
937  *
938  * @ingroup pvcontainer
939  */
940 class epicsShareClass PVUnion : public PVField
941 {
942 public:
944  /**
945  * Destructor
946  */
947  virtual ~PVUnion();
948  typedef PVUnion & reference;
949  typedef const PVUnion & const_reference;
950 
951  /**
952  * Undefined index.
953  * Default value upon PVUnion construction. Can be set by the user.
954  * Corresponds to @c null value.
955  */
956  static const int32 UNDEFINED_INDEX;
957 
958  /**
959  * Get the introspection interface
960  * @return The interface.
961  */
962  inline const UnionConstPtr& getUnion() const { return unionPtr; }
963 
964  /**
965  * Get the @c PVField value stored in the field.
966  * @return @c PVField value of field, @c null if {@code getSelectedIndex() == UNDEFINED_INDEX}.
967  */
968  inline const PVFieldPtr& get() { return value; }
969  inline PVField::const_shared_pointer get() const { return value; }
970 
971  template<typename PVT>
972  inline std::tr1::shared_ptr<PVT> get() {
973  STATIC_ASSERT(PVT::isPVField); // only allow cast from PVField sub-class
974  return std::tr1::dynamic_pointer_cast<PVT>(get());
975  }
976 
977  template<typename PVT>
978  inline std::tr1::shared_ptr<const PVT> get() const {
979  STATIC_ASSERT(PVT::isPVField); // only allow cast from PVField sub-class
980  return std::tr1::dynamic_pointer_cast<const PVT>(get());
981  }
982 
983  /**
984  * Select field (set index) and get the field at the index.
985  * @param index index of the field to select.
986  * @return corresponding PVField (of undetermined value), @c null if {@code index == UNDEFINED_INDEX}.
987  * @throws std::invalid_argument if index is invalid (out of range).
988  */
990 
991  template<typename PVT>
992  inline std::tr1::shared_ptr<PVT> select(int32 index) {
993  STATIC_ASSERT(PVT::isPVField); // only allow cast from PVField sub-class
995  }
996 
997  /**
998  * Select field (set index) and get the field by given name.
999  * @param fieldName the name of the field to select.
1000  * @return corresponding PVField (of undetermined value).
1001  * @throws std::invalid_argument if field does not exist.
1002  */
1003  PVFieldPtr select(std::string const & fieldName);
1004 
1005  template<typename PVT>
1006  inline std::tr1::shared_ptr<PVT> select(std::string const & fieldName) {
1008  }
1009 
1010  /**
1011  * Get selected field index.
1012  * @return selected field index.
1013  */
1014  inline int32 getSelectedIndex() const { return selector; }
1015 
1016  /**
1017  * Get selected field name.
1018  * @return selected field name, empty string if field does not exist.
1019  */
1020  std::string getSelectedFieldName() const;
1021 
1022  /**
1023  * Set the @c PVField (by reference!) as selected field.
1024  * If a value is not a valid union field an @c std::invalid_argument
1025  * exception is thrown.
1026  * @param value the field to set.
1027  */
1028  inline void set(PVFieldPtr const & value) {
1029  set(selector, value);
1030  }
1031  /**
1032  * Set the @c PVField (by reference!) as field at given index.
1033  * If a value is not a valid union field an @c std::invalid_argument
1034  * exception is thrown.
1035  * Use @c select(int32) to put by value.
1036  * @param index index of a field to put.
1037  * @param value the field to set.
1038  * @see #select(int32)
1039  */
1040  void set(int32 index, PVFieldPtr const & value);
1041 
1042  /**
1043  * Set the @c PVField (by reference!) as field by given name.
1044  * If a value is not a valid union field an @c std::invalid_argument
1045  * exception is thrown.
1046  * Use @c select(std::string const &) to put by value.
1047  * @param fieldName Name of the field to put.
1048  * @param value the field to set.
1049  * @see #select(std::string const &)
1050  */
1051  void set(std::string const & fieldName, PVFieldPtr const & value);
1052 
1053  /**
1054  * Serialize.
1055  * @param pbuffer The byte buffer.
1056  * @param pflusher Interface to call when buffer is full.
1057  */
1058  virtual void serialize(
1060  /**
1061  * Deserialize
1062  * @param pbuffer The byte buffer.
1063  * @param pflusher Interface to call when buffer is empty.
1064  */
1065  virtual void deserialize(
1067  /**
1068  * Constructor
1069  * @param punion The introspection interface.
1070  */
1071  explicit PVUnion(UnionConstPtr const & punion);
1072 
1073  virtual std::ostream& dumpValue(std::ostream& o) const OVERRIDE FINAL;
1074 
1075  void copy(const PVUnion& from);
1076  void copyUnchecked(const PVUnion& from);
1077 
1078 private:
1080 
1081  friend class PVDataCreate;
1082  UnionConstPtr unionPtr; // same as PVField::getField()
1083 
1084  int32 selector;
1085  PVFieldPtr value;
1086  bool variant;
1088 };
1089 
1090 
1091 namespace detail {
1092  // adaptor to allow epics::pvData::shared_vector to hold a reference
1093  // to a shared_ptr<std::vector<> >
1094  template<typename T>
1095  struct shared_ptr_vector_deletor {
1096  typedef std::tr1::shared_ptr<std::vector<T> > shared_vector;
1097  shared_vector vec;
1098  shared_ptr_vector_deletor(const shared_vector& v)
1099  :vec(v) {}
1100  void operator()(T*){vec.reset();}
1101  };
1102 
1103  //! Common code for PV*Array
1104  template<typename T, class Base>
1105  class PVVectorStorage : public Base
1106  {
1107  public:
1108  typedef T value_type;
1109  typedef T* pointer;
1110  typedef const T* const_pointer;
1111 
1112  //TODO: full namespace can be removed along with local typedef 'shared_vector'
1113  typedef ::epics::pvData::shared_vector<T> svector;
1114  typedef ::epics::pvData::shared_vector<const T> const_svector;
1115 
1116 
1117  protected:
1118  template<typename A>
1119  explicit PVVectorStorage(A a) : Base(a) {}
1120  public:
1121  virtual ~PVVectorStorage(){}
1122 
1123  // Primitive array manipulations
1124 
1125  //! Fetch a read-only view of the current array data
1126  virtual const_svector view() const = 0;
1127 
1128  /** Exchange our contents for the provided.
1129  *
1130  @throws std::logic_error for Immutable arrays.
1131  *
1132  * Callers must ensure that postPut() is called
1133  * after the last swap() operation.
1134  *
1135  * Before you call this directly, consider using
1136  * the reuse(), or replace() methods.
1137  */
1138  virtual void swap(const_svector& other) = 0;
1139 
1140  //! Discard current contents and replaced with the provided.
1141  //! Fails for Immutable arrays
1142  //! calls postPut()
1143  virtual void replace(const const_svector& next) = 0;
1144 
1145  // Derived operations
1146 
1147  /** Remove and return the current array data
1148  * or an unique copy if shared.
1149  *
1150  * Does @b not (and should not) call postPut()
1151  *
1152  * The returned shared_vector<T> will
1153  * have unique()==true.
1154  */
1155  inline svector reuse()
1156  {
1157  const_svector result;
1158  this->swap(result);
1159  return thaw(result);
1160  }
1161 
1163  };
1164 } // namespace detail
1165 
1166 /**
1167  * @brief template class for all extensions of PVArray.
1168  *
1169  * The direct extensions are pvBooleanArray, pvByteArray, ..., pvStringArray.
1170  * There are specializations for PVStringArray, PVStructureArray, and PVUnionArray.
1171  *
1172  * @ingroup pvcontainer
1173  */
1174 template<typename T>
1175 class epicsShareClass PVValueArray : public detail::PVVectorStorage<T,PVScalarArray> {
1177 public:
1179  typedef T value_type;
1180  typedef T* pointer;
1181  typedef const T* const_pointer;
1182 
1183  //TODO: full namespace can be removed along with local typedef 'shared_vector'
1184  typedef ::epics::pvData::shared_vector<T> svector;
1185  typedef ::epics::pvData::shared_vector<const T> const_svector;
1186 
1187 
1188  static const ScalarType typeCode;
1189 
1190  /**
1191  * Destructor
1192  */
1193  virtual ~PVValueArray();
1194 
1195  /**
1196  * Get introspection interface.
1197  */
1198  virtual ArrayConstPtr getArray() const OVERRIDE FINAL;
1199 
1200  virtual std::ostream& dumpValue(std::ostream& o) const OVERRIDE FINAL;
1201  virtual std::ostream& dumpValue(std::ostream& o, size_t index) const OVERRIDE FINAL;
1202 
1203  virtual size_t getLength() const OVERRIDE FINAL {return value.size();}
1204  virtual size_t getCapacity() const OVERRIDE FINAL {return value.capacity();}
1205 
1206  virtual void setCapacity(size_t capacity) OVERRIDE FINAL;
1207  virtual void setLength(size_t length) OVERRIDE FINAL;
1208 
1209  virtual const_svector view() const OVERRIDE FINAL {return value;}
1210  virtual void swap(const_svector &other) OVERRIDE FINAL;
1211  virtual void replace(const const_svector& next) OVERRIDE FINAL;
1212 
1213  // from Serializable
1216  virtual void serialize(ByteBuffer *pbuffer,
1218 
1219 protected:
1220  virtual void _getAsVoid(epics::pvData::shared_vector<const void>& out) const OVERRIDE FINAL;
1221  virtual void _putFromVoid(const epics::pvData::shared_vector<const void>& in) OVERRIDE FINAL;
1222 
1223  explicit PVValueArray(ScalarArrayConstPtr const & scalar);
1225  friend class PVDataCreate;
1227 };
1228 
1229 
1230 /**
1231  * @brief Data class for a structureArray
1232  *
1233  * @ingroup pvcontainer
1234  */
1235 template<>
1237 {
1239 public:
1241  typedef PVStructurePtr value_type;
1242  typedef PVStructurePtr* pointer;
1243  typedef const PVStructurePtr* const_pointer;
1244  typedef PVStructureArray &reference;
1245  typedef const PVStructureArray& const_reference;
1246 
1247  //TODO: full namespace can be removed along with local typedef 'shared_vector'
1250  /**
1251  * Destructor
1252  */
1253  virtual ~PVValueArray() {}
1254 
1256  {
1257  return std::tr1::static_pointer_cast<const Array>(structureArray);
1258  }
1259 
1260  virtual size_t getLength() const OVERRIDE FINAL {return value.size();}
1261  virtual size_t getCapacity() const OVERRIDE FINAL {return value.capacity();}
1262 
1263  /**
1264  * Set the array capacity.
1265  * @param capacity The length.
1266  */
1267  virtual void setCapacity(size_t capacity) OVERRIDE FINAL;
1268  /**
1269  * Set the array length.
1270  * @param length The length.
1271  */
1272  virtual void setLength(std::size_t length) OVERRIDE FINAL;
1273 
1274  /**
1275  * Get the introspection interface
1276  * @return The interface.
1277  */
1279  /**
1280  * Append new elements to the end of the array.
1281  * @param number The number of elements to add.
1282  * @return the new length of the array.
1283  */
1285  /**
1286  * Remove elements from the array.
1287  * @param offset The offset of the first element to remove.
1288  * @param number The number of elements to remove.
1289  * @return (false,true) if the elements were removed.
1290  */
1292  /**
1293  * Compress. This removes all null elements from the array.
1294  */
1295  void compress();
1296 
1297  virtual const_svector view() const OVERRIDE FINAL { return value; }
1298  virtual void swap(const_svector &other) OVERRIDE FINAL;
1299  virtual void replace(const const_svector &other) OVERRIDE FINAL {
1300  checkLength(other.size());
1301  value = other;
1302  PVField::postPut();
1303  }
1304 
1305  virtual void serialize(ByteBuffer *pbuffer,
1307  virtual void deserialize(ByteBuffer *buffer,
1309  virtual void serialize(ByteBuffer *pbuffer,
1311 
1312  virtual std::ostream& dumpValue(std::ostream& o) const OVERRIDE FINAL;
1313  virtual std::ostream& dumpValue(std::ostream& o, std::size_t index) const OVERRIDE FINAL;
1314 
1315  void copy(const PVStructureArray& from);
1316  void copyUnchecked(const PVStructureArray& from);
1317 
1318 protected:
1320 private:
1323  friend class PVDataCreate;
1325 };
1326 
1327 
1328 
1329 /**
1330  * @brief Data class for a unionArray
1331  *
1332  * @ingroup pvcontainer
1333  */
1334 template<>
1336 {
1338 public:
1340  typedef PVUnionPtr value_type;
1341  typedef PVUnionPtr* pointer;
1342  typedef const PVUnionPtr* const_pointer;
1343  typedef PVUnionArray &reference;
1344  typedef const PVUnionArray& const_reference;
1345 
1346  //TODO: full namespace can be removed along with local typedef 'shared_vector'
1348  typedef ::epics::pvData::shared_vector<const PVUnionPtr> const_svector;
1349  /**
1350  * Destructor
1351  */
1352  virtual ~PVValueArray() {}
1353 
1355  {
1356  return std::tr1::static_pointer_cast<const Array>(unionArray);
1357  }
1358 
1359  virtual size_t getLength() const OVERRIDE FINAL {return value.size();}
1360  virtual size_t getCapacity() const OVERRIDE FINAL {return value.capacity();}
1361 
1362  /**
1363  * Set the array capacity.
1364  * @param capacity The length.
1365  */
1366  virtual void setCapacity(size_t capacity) OVERRIDE FINAL;
1367  /**
1368  * Set the array length.
1369  * @param length The length.
1370  */
1371  virtual void setLength(std::size_t length) OVERRIDE FINAL;
1372 
1373  /**
1374  * Get the introspection interface
1375  * @return The interface.
1376  */
1378  /**
1379  * Append new elements to the end of the array.
1380  * @param number The number of elements to add.
1381  * @return the new length of the array.
1382  */
1384  /**
1385  * Remove elements from the array.
1386  * @param offset The offset of the first element to remove.
1387  * @param number The number of elements to remove.
1388  * @return (false,true) if the elements were removed.
1389  */
1391  /**
1392  * Compress. This removes all null elements from the array.
1393  */
1394  void compress();
1395 
1396  virtual const_svector view() const OVERRIDE { return value; }
1397  virtual void swap(const_svector &other) OVERRIDE;
1398  virtual void replace(const const_svector &other) OVERRIDE FINAL {
1399  checkLength(other.size());
1400  value = other;
1401  PVField::postPut();
1402  }
1403 
1404  virtual void serialize(ByteBuffer *pbuffer,
1406  virtual void deserialize(ByteBuffer *buffer,
1408  virtual void serialize(ByteBuffer *pbuffer,
1410 
1411  virtual std::ostream& dumpValue(std::ostream& o) const OVERRIDE FINAL;
1412  virtual std::ostream& dumpValue(std::ostream& o, std::size_t index) const OVERRIDE FINAL;
1413 
1414  void copy(const PVUnionArray& from);
1415  void copyUnchecked(const PVUnionArray& from);
1416 
1417 protected:
1418  explicit PVValueArray(UnionArrayConstPtr const & unionArray);
1419 private:
1422  friend class PVDataCreate;
1424 };
1425 
1426 
1427 /**
1428  * Definitions for the various scalarArray types.
1429  */
1431 typedef std::tr1::shared_ptr<PVBooleanArray> PVBooleanArrayPtr;
1432 
1433 typedef PVValueArray<int8> PVByteArray;
1434 typedef std::tr1::shared_ptr<PVByteArray> PVByteArrayPtr;
1435 
1436 typedef PVValueArray<int16> PVShortArray;
1437 typedef std::tr1::shared_ptr<PVShortArray> PVShortArrayPtr;
1438 
1439 typedef PVValueArray<int32> PVIntArray;
1440 typedef std::tr1::shared_ptr<PVIntArray> PVIntArrayPtr;
1441 
1442 typedef PVValueArray<int64> PVLongArray;
1443 typedef std::tr1::shared_ptr<PVLongArray> PVLongArrayPtr;
1444 
1445 typedef PVValueArray<uint8> PVUByteArray;
1446 typedef std::tr1::shared_ptr<PVUByteArray> PVUByteArrayPtr;
1447 
1448 typedef PVValueArray<uint16> PVUShortArray;
1449 typedef std::tr1::shared_ptr<PVUShortArray> PVUShortArrayPtr;
1450 
1451 typedef PVValueArray<uint32> PVUIntArray;
1452 typedef std::tr1::shared_ptr<PVUIntArray> PVUIntArrayPtr;
1453 
1454 typedef PVValueArray<uint64> PVULongArray;
1455 typedef std::tr1::shared_ptr<PVULongArray> PVULongArrayPtr;
1456 
1457 typedef PVValueArray<float> PVFloatArray;
1458 typedef std::tr1::shared_ptr<PVFloatArray> PVFloatArrayPtr;
1459 
1460 typedef PVValueArray<double> PVDoubleArray;
1461 typedef std::tr1::shared_ptr<PVDoubleArray> PVDoubleArrayPtr;
1462 
1463 typedef PVValueArray<std::string> PVStringArray;
1464 typedef std::tr1::shared_ptr<PVStringArray> PVStringArrayPtr;
1465 
1466 namespace detail {
1467 struct pvfield_factory;
1468 }
1469 
1470 /**
1471  * @brief This is a singleton class for creating data instances.
1472  *
1473  */
1474 class epicsShareClass PVDataCreate {
1475  friend struct detail::pvfield_factory;
1476 public:
1477  /**
1478  * get the singleton
1479  * @return The PVDataCreate implementation
1480  */
1481  static const PVDataCreatePtr &getPVDataCreate();
1482 
1483  /**
1484  * Create a PVField using given Field introspection data.
1485  * @param field The introspection data to be used to create PVField.
1486  * @return The PVField implementation.
1487  */
1489  /**
1490  * Create a PVField using given a PVField to clone.
1491  * This method calls the appropriate createPVScalar, createPVArray, or createPVStructure.
1492  * @param fieldToClone The field to clone.
1493  * @return The PVField implementation
1494  */
1496  /**
1497  * Create an implementation of a scalar field reusing the Scalar introspection interface.
1498  * @param scalar The introspection interface.
1499  * @return The PVScalar implementation.
1500  */
1502  /**
1503  * Create an implementation of a scalar field. A Scalar introspection interface is created.
1504  * @param scalarType The scalar type.
1505  * @return The PVScalar implementation.
1506  */
1508  /**
1509  * Create an implementation of a scalar field by cloning an existing PVScalar.
1510  * The new PVScalar will have the same value and auxInfo as the original.
1511  * @param scalarToClone The PVScalar to clone.
1512  * @return The PVScalar implementation.
1513  */
1515  /**
1516  * template version
1517  * @tparam PVT must be a valid PVType
1518  * @return The PVScalar implementation.
1519  */
1520  template<typename PVT>
1522  {
1524  }
1525 
1526  /**
1527  * Create implementation for PVStructure.
1528  * @param structure The introspection interface.
1529  * @return The PVStructure implementation
1530  */
1532  /**
1533  * Create implementation for PVStructure.
1534  * @param fieldNames The field names.
1535  * @param pvFields Array of PVFields
1536  * @return The PVStructure implementation
1537  */
1540  /**
1541  * Create implementation for PVStructure.
1542  * @param structToClone A structure. Each subfield and any auxInfo is cloned and added to the newly created structure.
1543  * @return The PVStructure implementation.
1544  */
1546 
1547  /**
1548  * Create implementation for PVUnion.
1549  * @param punion The introspection interface.
1550  * @return The PVUnion implementation
1551  */
1553  /**
1554  * Create implementation for PVUnion.
1555  * @param unionToClone A union. Each subfield is cloned and added to the newly created union.
1556  * @return The PVUnion implementation.
1557  */
1559  /**
1560  * Create variant union implementation.
1561  * @return The variant PVUnion implementation.
1562  */
1564 
1565  /**
1566  * Create an implementation of an array field reusing the Array introspection interface.
1567  * @param scalarArray The introspection interface.
1568  * @return The PVScalarArray implementation.
1569  */
1571  /**
1572  * Create an implementation for an array field. An Array introspection interface is created.
1573  * @param elementType The element type.
1574  * @return The PVScalarArray implementation.
1575  */
1577  /**
1578  * Create an implementation of an array field by cloning an existing PVArray.
1579  * The new PVArray will have the same value and auxInfo as the original.
1580  * @param scalarArrayToClone The PVScalarArray to clone.
1581  * @return The PVScalarArray implementation.
1582  */
1584  /**
1585  * template version
1586  * @tparam PVT must be a valid pvType
1587  * @return The PVScalarArray implementation.
1588  */
1589  template<typename PVAT>
1591  {
1593  }
1594 
1595  /**
1596  * Create an implementation of an array with structure elements.
1597  * @param structureArray The introspection interface.
1598  * All elements share the same introspection interface.
1599  * @return The PVStructureArray implementation.
1600  */
1602  /**
1603  * Create an implementation of an array with structure elements.
1604  * @param structure The introspection interface that is used to create StructureArrayConstPtr.
1605  * All elements share the same introspection interface.
1606  * @return The PVStructureArray implementation.
1607  */
1609  {
1611  }
1612 
1613  /**
1614  * Create an implementation of an array with union elements.
1615  * @param unionArray The introspection interface.
1616  * All elements share the same introspection interface.
1617  * @return The PVUnionArray implementation.
1618  */
1620  /**
1621  * Create an implementation of an array with union elements.
1622  * @param punion The introspection interface that is used to create UnionArrayConstPtr.
1623  * All elements share the same introspection interface.
1624  * @return The PVUnionArray implementation.
1625  */
1627  {
1629  }
1630  /**
1631  * Create variant union array implementation.
1632  * @return The variant PVUnionArray implementation.
1633  */
1635 
1636 private:
1637  PVDataCreate();
1640 };
1641 
1642 /**
1643  * Get the single class that implements PVDataCreate
1644  * @return The PVDataCreate factory.
1645  *
1646  * @ingroup pvcontainer
1647  */
1648 FORCE_INLINE const PVDataCreatePtr& getPVDataCreate() {
1649  return PVDataCreate::getPVDataCreate();
1650 }
1651 
1652 bool epicsShareExtern operator==(const PVField&, const PVField&);
1653 
1654 static inline bool operator!=(const PVField& a, const PVField& b)
1655 {return !(a==b);}
1656 
1657 }}
1658 
1659 /**
1660  * stream support for pvField
1661  */
1662 namespace std{
1663  epicsShareExtern std::ostream& operator<<(std::ostream& o, const epics::pvData::PVField *ptr);
1664 }
1665 
1666 #endif /* PVDATA_H */
PVValueArray< PVUnionPtr > PVUnionArray
Definition: pvData.h:119
PVValueArray< PVStructurePtr > PVStructureArray
Definition: pvData.h:99
virtual void swap(const_svector &other)=0
std::vector< PVFieldPtr > PVFieldPtrArray
Definition: pvData.h:70
std::vector< PVUnionPtr > PVUnionPtrArray
Definition: pvData.h:111
PVValueArray< boolean > PVBooleanArray
Definition: pvData.h:1430
std::tr1::shared_ptr< PVUnion > PVUnionPtr
Definition: pvData.h:107
PVArray is the base class for all array types.
Definition: pvData.h:551
Data interface for a structure,.
Definition: pvData.h:712
std::tr1::shared_ptr< PVScalar > PVScalarPtr
Definition: pvData.h:77
std::vector< PVStructurePtr > PVStructurePtrArray
Definition: pvData.h:91
#define FINAL
Definition: pvIntrospect.h:51
PVString is special case, since it implements SerializableArray.
Definition: pvData.h:521
#define POINTER_DEFINITIONS(clazz)
Definition: sharedPtr.h:198
Base class for a scalarArray.
Definition: pvData.h:618
std::tr1::shared_ptr< PVScalarArray > PVScalarArrayPtr
Definition: pvData.h:82
virtual void replace(const const_svector &next)=0
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
PVScalar is the base class for each scalar field.
Definition: pvData.h:272
#define FORCE_INLINE
Definition: templateMeta.h:20
This is a singleton class for creating data instances.
Definition: pvData.h:1474
This class is implemented by code that calls setPostHander.
Definition: pvData.h:131
virtual const_svector view() const =0
Fetch a read-only view of the current array data.
PVField is the base class for each PVData field.
Definition: pvData.h:152
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
#define EPICS_NOT_COPYABLE(CLASS)
Disable implicit copyable.
epicsShareFunc bool yajl_parse_helper(std::istream &src, yajl_handle handle)
PVUnion has a single subfield.
Definition: pvData.h:940
Common code for PV*Array.
Definition: pvData.h:1105
FORCE_INLINE const PVDataCreatePtr & getPVDataCreate()
Definition: pvData.h:1648
#define OVERRIDE
Definition: pvIntrospect.h:58
std::ostream & dumpValue(std::ostream &o) const
Definition: pvData.h:485
std::tr1::shared_ptr< PostHandler > PostHandlerPtr
Definition: pvData.h:55