This is Unofficial EPICS BASE Doxygen Site
PVDataCreateFactory.cpp
Go to the documentation of this file.
1 /*PVDataCreateFactory.cpp*/
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  */
10 #include <cstddef>
11 #include <cstdlib>
12 #include <string>
13 #include <cstdio>
14 
15 #include <epicsMutex.h>
16 #include <epicsThread.h>
17 
18 #define epicsExportSharedSymbols
19 #include <pv/lock.h>
20 #include <pv/pvIntrospect.h>
21 #include <pv/pvData.h>
22 #include <pv/factory.h>
23 #include <pv/serializeHelper.h>
24 #include <pv/reftrack.h>
25 
27 using std::size_t;
28 using std::string;
29 using std::min;
30 
31 namespace epics { namespace pvData {
32 
33 
34 template<> const ScalarType PVBoolean::typeCode = pvBoolean;
35 template<> const ScalarType PVByte::typeCode = pvByte;
36 template<> const ScalarType PVShort::typeCode = pvShort;
37 template<> const ScalarType PVInt::typeCode = pvInt;
38 template<> const ScalarType PVLong::typeCode = pvLong;
39 template<> const ScalarType PVUByte::typeCode = pvUByte;
40 template<> const ScalarType PVUShort::typeCode = pvUShort;
41 template<> const ScalarType PVUInt::typeCode = pvUInt;
42 template<> const ScalarType PVULong::typeCode = pvULong;
43 template<> const ScalarType PVFloat::typeCode = pvFloat;
44 template<> const ScalarType PVDouble::typeCode = pvDouble;
46 
48 template<> const ScalarType PVByteArray::typeCode = pvByte;
49 template<> const ScalarType PVShortArray::typeCode = pvShort;
50 template<> const ScalarType PVIntArray::typeCode = pvInt;
51 template<> const ScalarType PVLongArray::typeCode = pvLong;
52 template<> const ScalarType PVUByteArray::typeCode = pvUByte;
54 template<> const ScalarType PVUIntArray::typeCode = pvUInt;
55 template<> const ScalarType PVULongArray::typeCode = pvULong;
56 template<> const ScalarType PVFloatArray::typeCode = pvFloat;
59 
60 
61 template<typename T>
63 
64 template<typename T>
65 std::ostream& PVScalarValue<T>::dumpValue(std::ostream& o) const
66 {
67  return o << get();
68 }
69 
70 template<typename T>
72 {
73  value = get();
74 }
75 
76 template<typename T>
78 {
79  put(value);
80 }
81 
82 template<typename T>
84 {
85  if(isImmutable())
86  throw std::invalid_argument("destination is immutable");
87  copyUnchecked(scalar);
88 }
89 
90 template<typename T>
92 {
93  assign(from);
94 }
95 
96 template<typename T>
98 {
99  if(this==&from)
100  return;
101  T result;
102  from.getAs((void*)&result, typeCode);
103  put(result);
104 }
105 
106 template<typename T>
108  SerializableControl *pflusher) const {
109  pflusher->ensureBuffer(sizeof(T));
110  pbuffer->put(storage.value);
111 }
112 
113 template<>
115  SerializableControl *pflusher) const {
116  SerializeHelper::serializeString(storage.value, pbuffer, pflusher);
117 }
118 
119 template<typename T>
121  DeserializableControl *pflusher)
122 {
123  pflusher->ensureData(sizeof(T));
124  storage.value = pbuffer->GET(T);
125 }
126 
127 template<>
129  DeserializableControl *pflusher)
130 {
131  storage.value = SerializeHelper::deserializeString(pbuffer, pflusher);
132  // TODO: check for violations of maxLength?
133 }
134 
135 PVString::PVString(ScalarConstPtr const & scalar)
136  : PVScalarValue<std::string>(scalar)
137 {
139  if (boundedString.get())
140  storage.maxLength = boundedString->getMaximumLength();
141  else
142  storage.maxLength = 0;
143 }
144 
145 std::ostream& PVString::dumpValue(std::ostream& o) const
146 {
147  // we escape, but do not quote, for scalar string
148  o<<escape(get());
149  return o;
150 }
151 
152 /* mixing overrides (virtual functions) and overloads (different argument lists) is fun...
153  * we override all overloads to avoid the "hides overloaded virtual function" warning from clang.
154  * In this case we don't need/want to, so just delegate to the base class.
155  */
157  SerializableControl *pflusher) const
158 {PVScalarValue<std::string>::serialize(pbuffer, pflusher);}
159 
161  SerializableControl *pflusher, size_t offset, size_t count) const
162 {
163  // check bounds
164  const size_t length = storage.value.length();
165  /*if (offset < 0) offset = 0;
166  else*/ if (offset > length) offset = length;
167  //if (count < 0) count = length;
168 
169  const size_t maxCount = length - offset;
170  if (count > maxCount)
171  count = maxCount;
172 
173  // write
174  SerializeHelper::serializeSubstring(storage.value, offset, count, pbuffer, pflusher);
175 }
176 
177 void PVArray::checkLength(size_t len) const
178 {
179  Array::ArraySizeType type = getArray()->getArraySizeType();
180  if (type != Array::variable)
181  {
182  size_t size = getArray()->getMaximumCapacity();
183  if (type == Array::fixed && len != size)
184  throw std::invalid_argument("invalid length for a fixed size array");
185  else if (type == Array::bounded && len > size)
186  throw std::invalid_argument("new array capacity too large for a bounded size array");
187  }
188 }
189 
190 template<typename T>
192  :base_t(scalarArray)
193  ,value()
194 
195 {}
196 
198  :base_t(structureArray)
199  ,structureArray(structureArray)
200 
201 {}
202 
204  :base_t(unionArray)
205  ,unionArray(unionArray)
206 {}
207 
208 template<typename T>
210 
211 template<typename T>
213 {
214  return std::tr1::static_pointer_cast<const Array>(this->getField());
215 }
216 
217 template<typename T>
218 std::ostream& PVValueArray<T>::dumpValue(std::ostream& o) const
219 {
220  const_svector v(this->view());
221  typename const_svector::const_iterator it(v.begin()),
222  end(v.end());
223  o << '[';
224  if(it!=end) {
225  o << print_cast(*it++);
226  for(; it!=end; ++it)
227  o << ',' << print_cast(*it);
228 
229  }
230  return o << ']';
231 }
232 
233 template<>
234 std::ostream& PVValueArray<std::string>::dumpValue(std::ostream& o, size_t index) const
235 {
236  return o << '"' << escape(this->view().at(index)) << '"';
237 }
238 
239 template<>
240 std::ostream& PVValueArray<std::string>::dumpValue(std::ostream& o) const
241 {
242  const_svector v(this->view());
244  end(v.end());
245  o << '[';
246  if(it!=end) {
247  o << '"' << escape(*it++) << '"';
248  for(; it!=end; ++it)
249  o << ", \"" << escape(*it) << '"';
250 
251  }
252  return o << ']';
253 }
254 
255 template<typename T>
256 std::ostream& PVValueArray<T>::dumpValue(std::ostream& o, size_t index) const
257 {
258  return o << print_cast(this->view().at(index));
259 }
260 
261 template<typename T>
262 void PVValueArray<T>::setCapacity(size_t capacity)
263 {
264  if(this->isCapacityMutable()) {
265  this->checkLength(capacity);
266  value.reserve(capacity);
267  }
268  else
269  THROW_EXCEPTION2(std::logic_error, "capacity immutable");
270 }
271 
272 template<typename T>
273 void PVValueArray<T>::setLength(size_t length)
274 {
275  if(this->isImmutable())
276  THROW_EXCEPTION2(std::logic_error, "immutable");
277 
278  if (length == value.size())
279  return;
280 
281  this->checkLength(length);
282 
283  if (length < value.size())
284  value.slice(0, length);
285  else
286  value.resize(length);
287 }
288 
289 template<typename T>
291 {
292  this->checkLength(next.size());
293 
294  value = next;
295  this->postPut();
296 }
297 
298 template<typename T>
300 {
301  if (this->isImmutable())
302  THROW_EXCEPTION2(std::logic_error, "immutable");
303 
304  // no checkLength call here
305 
306  value.swap(other);
307 }
308 
309 
310 template<typename T>
312  SerializableControl *pflusher) const {
313  serialize(pbuffer, pflusher, 0, this->getLength());
314 }
315 
316 template<typename T>
318  DeserializableControl *pcontrol) {
319 
320  size_t size = this->getArray()->getArraySizeType() == Array::fixed ?
321  this->getArray()->getMaximumCapacity() :
322  SerializeHelper::readSize(pbuffer, pcontrol);
323 
324  svector nextvalue(thaw(value));
325  nextvalue.resize(size); // TODO: avoid copy of stuff we will then overwrite
326 
327  T* cur = nextvalue.data();
328 
329  // try to avoid deserializing from the buffer
330  // this is only possible if we do not need to do endian-swapping
331  if (!pbuffer->reverse<T>())
332  if (pcontrol->directDeserialize(pbuffer, (char*)cur, size, sizeof(T)))
333  {
334  // inform about the change?
336  return;
337  }
338 
339  // retrieve value from the buffer
340  size_t remaining = size;
341  while(remaining) {
342  const size_t have_bytes = pbuffer->getRemaining();
343 
344  // correctly rounds down in an element is partially received
345  const size_t available = have_bytes/sizeof(T);
346 
347  if(available == 0) {
348  // get at least one element
349  pcontrol->ensureData(sizeof(T));
350  continue;
351  }
352 
353  const size_t n2read = std::min(remaining, available);
354 
355  pbuffer->getArray(cur, n2read);
356  cur += n2read;
357  remaining -= n2read;
358  }
359  value = freeze(nextvalue);
360  // TODO !!!
361  // inform about the change?
363 }
364 
365 template<typename T>
367  SerializableControl *pflusher, size_t offset, size_t count) const
368 {
369  //TODO: avoid incrementing the ref counter...
370  const_svector temp(value);
371  temp.slice(offset, count);
372  count = temp.size();
373 
374  ArrayConstPtr array = this->getArray();
375  if (array->getArraySizeType() != Array::fixed)
376  SerializeHelper::writeSize(count, pbuffer, pflusher);
377  else if (count != array->getMaximumCapacity())
378  throw std::length_error("fixed array cannot be partially serialized");
379 
380  const T* cur = temp.data();
381 
382  // try to avoid copying into the buffer
383  // this is only possible if we do not need to do endian-swapping
384  if (!pbuffer->reverse<T>())
385  if (pflusher->directSerialize(pbuffer, (const char*)cur, count, sizeof(T)))
386  return;
387 
388  while(count) {
389  const size_t empty = pbuffer->getRemaining();
390  const size_t space_for = empty/sizeof(T);
391 
392  if(space_for==0) {
393  pflusher->flushSerializeBuffer();
394  // Can we be certain that more space is now free???
395  // If not then we spinnnnnnnnn
396  continue;
397  }
398 
399  const size_t n2send = std::min(count, space_for);
400 
401  pbuffer->putArray(cur, n2send);
402  cur += n2send;
403  count -= n2send;
404  }
405 }
406 
407 // specializations for string
408 
409 template<>
411  DeserializableControl *pcontrol) {
412 
413  size_t size = this->getArray()->getArraySizeType() == Array::fixed ?
414  this->getArray()->getMaximumCapacity() :
415  SerializeHelper::readSize(pbuffer, pcontrol);
416 
417  svector nextvalue(thaw(value));
418 
419  // Decide if we must re-allocate
420  if(size > nextvalue.size() || !nextvalue.unique())
421  nextvalue.resize(size);
422  else if(size < nextvalue.size())
423  nextvalue.slice(0, size);
424 
425 
426  string * pvalue = nextvalue.data();
427  for(size_t i = 0; i<size; i++) {
428  pvalue[i] = SerializeHelper::deserializeString(pbuffer,
429  pcontrol);
430  }
431  value = freeze(nextvalue);
432  // inform about the change?
433  postPut();
434 }
435 
436 template<>
438  SerializableControl *pflusher, size_t offset, size_t count) const {
439 
440  const_svector temp(value);
441  temp.slice(offset, count);
442 
443  // TODO if fixed count == getArray()->getMaximumCapacity()
444  if (this->getArray()->getArraySizeType() != Array::fixed)
445  SerializeHelper::writeSize(temp.size(), pbuffer, pflusher);
446 
447  const string * pvalue = temp.data();
448  for(size_t i = 0; i<temp.size(); i++) {
449  SerializeHelper::serializeString(pvalue[i], pbuffer, pflusher);
450  }
451 }
452 
453 template<typename T>
455 {
456  out = static_shared_vector_cast<const void>(this->view());
457 }
458 
459 template<typename T>
461 {
462  this->replace(shared_vector_convert<const T>(in));
463 }
464 
465 // Factory
466 
467 PVDataCreate::PVDataCreate()
468 : fieldCreate(getFieldCreate())
469 { }
470 
472 {
473  switch(field->getType()) {
474  case scalar: {
475  ScalarConstPtr xx = static_pointer_cast<const Scalar>(field);
476  return createPVScalar(xx);
477  }
478  case scalarArray: {
480  return createPVScalarArray(xx);
481  }
482  case structure: {
484  return createPVStructure(xx);
485  }
486  case structureArray: {
488  return createPVStructureArray(xx);
489  }
490  case union_: {
491  UnionConstPtr xx = static_pointer_cast<const Union>(field);
492  return createPVUnion(xx);
493  }
494  case unionArray: {
496  return createPVUnionArray(xx);
497  }
498  }
499  throw std::logic_error("PVDataCreate::createPVField should never get here");
500 }
501 
503 {
504  switch(fieldToClone->getField()->getType()) {
505  case scalar:
506  {
507  PVScalarPtr pvScalar = static_pointer_cast<PVScalar>(fieldToClone);
508  return createPVScalar(pvScalar);
509  }
510  case scalarArray:
511  {
512  PVScalarArrayPtr pvScalarArray
513  = static_pointer_cast<PVScalarArray>(fieldToClone);
514  return createPVScalarArray(pvScalarArray);
515  }
516  case structure:
517  {
518  PVStructurePtr pvStructure
519  = static_pointer_cast<PVStructure>(fieldToClone);
520  StringArray const & fieldNames = pvStructure->getStructure()->getFieldNames();
521  PVFieldPtrArray const & pvFieldPtrArray = pvStructure->getPVFields();
522  return createPVStructure(fieldNames,pvFieldPtrArray);
523  }
524  case structureArray:
525  {
527  = static_pointer_cast<PVStructureArray>(fieldToClone);
528  StructureArrayConstPtr structureArray = from->getStructureArray();
529  PVStructureArrayPtr to = createPVStructureArray(
530  structureArray);
531  to->copyUnchecked(*from);
532  return to;
533  }
534  case union_:
535  {
536  PVUnionPtr pvUnion
537  = static_pointer_cast<PVUnion>(fieldToClone);
538  return createPVUnion(pvUnion);
539  }
540  case unionArray:
541  {
542  PVUnionArrayPtr from
543  = static_pointer_cast<PVUnionArray>(fieldToClone);
544  UnionArrayConstPtr unionArray = from->getUnionArray();
545  PVUnionArrayPtr to = createPVUnionArray(unionArray);
546  to->copyUnchecked(*from);
547  return to;
548  }
549  }
550  throw std::logic_error("PVDataCreate::createPVField should never get here");
551 }
552 
554 {
555  ScalarType scalarType = scalar->getScalarType();
556  switch(scalarType) {
557  case pvBoolean:
558  return PVScalarPtr(new PVBoolean(scalar));
559  case pvByte:
560  return PVScalarPtr(new PVByte(scalar));
561  case pvShort:
562  return PVScalarPtr(new PVShort(scalar));
563  case pvInt:
564  return PVScalarPtr(new PVInt(scalar));
565  case pvLong:
566  return PVScalarPtr(new PVLong(scalar));
567  case pvUByte:
568  return PVScalarPtr(new PVUByte(scalar));
569  case pvUShort:
570  return PVScalarPtr(new PVUShort(scalar));
571  case pvUInt:
572  return PVScalarPtr(new PVUInt(scalar));
573  case pvULong:
574  return PVScalarPtr(new PVULong(scalar));
575  case pvFloat:
576  return PVScalarPtr(new PVFloat(scalar));
577  case pvDouble:
578  return PVScalarPtr(new PVDouble(scalar));
579  case pvString:
580  return PVScalarPtr(new PVString(scalar));
581  }
582  throw std::logic_error("PVDataCreate::createPVScalar should never get here");
583 }
584 
586 {
587  ScalarConstPtr scalar = fieldCreate->createScalar(scalarType);
588  return createPVScalar(scalar);
589 }
590 
591 
593 {
594  ScalarType scalarType = scalarToClone->getScalar()->getScalarType();
595  PVScalarPtr pvScalar = createPVScalar(scalarType);
596  pvScalar->copyUnchecked(*scalarToClone);
597  return pvScalar;
598 }
599 
602 {
603  switch(scalarArray->getElementType()) {
604  case pvBoolean:
605  return PVScalarArrayPtr(new PVBooleanArray(scalarArray));
606  case pvByte:
607  return PVScalarArrayPtr(new PVByteArray(scalarArray));
608  case pvShort:
609  return PVScalarArrayPtr(new PVShortArray(scalarArray));
610  case pvInt:
611  return PVScalarArrayPtr(new PVIntArray(scalarArray));
612  case pvLong:
613  return PVScalarArrayPtr(new PVLongArray(scalarArray));
614  case pvUByte:
615  return PVScalarArrayPtr(new PVUByteArray(scalarArray));
616  case pvUShort:
617  return PVScalarArrayPtr(new PVUShortArray(scalarArray));
618  case pvUInt:
619  return PVScalarArrayPtr(new PVUIntArray(scalarArray));
620  case pvULong:
621  return PVScalarArrayPtr(new PVULongArray(scalarArray));
622  case pvFloat:
623  return PVScalarArrayPtr(new PVFloatArray(scalarArray));
624  case pvDouble:
625  return PVScalarArrayPtr(new PVDoubleArray(scalarArray));
626  case pvString:
627  return PVScalarArrayPtr(new PVStringArray(scalarArray));
628  }
629  throw std::logic_error("PVDataCreate::createPVScalarArray should never get here");
630 
631 }
632 
634  ScalarType elementType)
635 {
636  ScalarArrayConstPtr scalarArray = fieldCreate->createScalarArray(elementType);
637  return createPVScalarArray(scalarArray);
638 }
639 
641  PVScalarArrayPtr const & arrayToClone)
642 {
643  PVScalarArrayPtr pvArray = createPVScalarArray(
644  arrayToClone->getScalarArray()->getElementType());
645  pvArray->assign(*arrayToClone.get());
646  return pvArray;
647 }
648 
651 {
652  return PVStructureArrayPtr(new PVStructureArray(structureArray));
653 }
654 
657 {
658  return PVStructurePtr(new PVStructure(structure));
659 }
660 
663 {
664  return PVUnionArrayPtr(new PVUnionArray(unionArray));
665 }
666 
668  UnionConstPtr const & punion)
669 {
670  return PVUnionPtr(new PVUnion(punion));
671 }
672 
674 {
675  return PVUnionPtr(new PVUnion(fieldCreate->createVariantUnion()));
676 }
677 
679 {
680  return PVUnionArrayPtr(new PVUnionArray(fieldCreate->createVariantUnionArray()));
681 }
682 
684  StringArray const & fieldNames,PVFieldPtrArray const & pvFields)
685 {
686  size_t num = fieldNames.size();
687  FieldConstPtrArray fields(num);
688  for (size_t i=0;i<num;i++) fields[i] = pvFields[i]->getField();
689  StructureConstPtr structure = fieldCreate->createStructure(fieldNames,fields);
690  PVStructurePtr pvStructure(new PVStructure(structure,pvFields));
691  return pvStructure;
692 }
693 
695 {
696  FieldConstPtrArray field;
697  if(!structToClone) {
698  // is this correct?!
699  FieldConstPtrArray fields(0);
700  StringArray fieldNames(0);
701  StructureConstPtr structure = fieldCreate->createStructure(fieldNames,fields);
702  return PVStructurePtr(new PVStructure(structure));
703  }
704  StructureConstPtr structure = structToClone->getStructure();
705  PVStructurePtr pvStructure(new PVStructure(structure));
706  pvStructure->copyUnchecked(*structToClone);
707  return pvStructure;
708 }
709 
711 {
712  PVUnionPtr punion(new PVUnion(unionToClone->getUnion()));
713  // set cloned value
714  punion->set(unionToClone->getSelectedIndex(), createPVField(unionToClone->get()));
715  return punion;
716 }
717 
718 namespace detail {
721  pvfield_factory() :pvDataCreate(new PVDataCreate()) {
723  }
724 };
725 }
726 
727 static detail::pvfield_factory* pvfield_factory_s;
728 static epicsThreadOnceId pvfield_factory_once = EPICS_THREAD_ONCE_INIT;
729 
730 static void pvfield_factory_init(void*)
731 {
732  try {
733  pvfield_factory_s = new detail::pvfield_factory;
734  }catch(std::exception& e){
735  std::cerr<<"Error initializing getFieldCreate() : "<<e.what()<<"\n";
736  }
737 }
738 
740 {
741  epicsThreadOnce(&pvfield_factory_once, &pvfield_factory_init, 0);
742  if(!pvfield_factory_s->pvDataCreate)
743  throw std::logic_error("getPVDataCreate() not initialized");
744  return pvfield_factory_s->pvDataCreate;
745 }
746 
747 // explicitly instanciate to ensure that windows
748 // builds emit exported symbols for inline'd methods
749 template class PVScalarValue<boolean>;
750 template class PVScalarValue<int8>;
751 template class PVScalarValue<uint8>;
752 template class PVScalarValue<int16>;
753 template class PVScalarValue<uint16>;
754 template class PVScalarValue<int32>;
755 template class PVScalarValue<uint32>;
756 template class PVScalarValue<int64>;
757 template class PVScalarValue<uint64>;
758 template class PVScalarValue<float>;
759 template class PVScalarValue<double>;
760 template class PVScalarValue<std::string>;
761 template class PVValueArray<boolean>;
762 template class PVValueArray<int8>;
763 template class PVValueArray<uint8>;
764 template class PVValueArray<int16>;
765 template class PVValueArray<uint16>;
766 template class PVValueArray<int32>;
767 template class PVValueArray<uint32>;
768 template class PVValueArray<int64>;
769 template class PVValueArray<uint64>;
770 template class PVValueArray<float>;
771 template class PVValueArray<double>;
772 template class PVValueArray<std::string>;
773 
774 }} // namespace epics::pvData
775 
776 namespace std{
777  std::ostream& operator<<(std::ostream& o, const epics::pvData::PVField *ptr)
778  {
779  if(ptr) return o << *ptr;
780  return o << "nullptr";
781  }
782 }
virtual void serialize(ByteBuffer *pbuffer, SerializableControl *pflusher) const OVERRIDE FINAL
PVScalarValue< int32 > PVInt
Definition: pvData.h:496
epics::pvData::BitSetPtr empty
Definition: pvAccess.cpp:135
This class implements introspection object for Scalar.
Definition: pvIntrospect.h:397
void resize(size_t i)
Grow or shrink array.
Definition: sharedVector.h:457
Definition: link.h:174
virtual const_svector view() const OVERRIDE FINAL
Fetch a read-only view of the current array data.
Definition: pvData.h:1209
PVScalar is the base class for each scalar field.
Definition: pvData.h:272
virtual void _getAsVoid(epics::pvData::shared_vector< const void > &out) const OVERRIDE FINAL
PVUnionArrayPtr createPVVariantUnionArray()
This class implements introspection object for a union.
Definition: pvIntrospect.h:866
pvac::PutEvent result
Definition: clientSync.cpp:117
Data class for a unionArray.
Definition: pvData.h:1335
std::tr1::shared_ptr< detail::SharedPut > put
virtual bool directSerialize(ByteBuffer *existingBuffer, const char *toSerialize, std::size_t elementCount, std::size_t elementSize)=0
PVValueArray< int16 > PVShortArray
Definition: pvData.h:1436
pointer data() const
Return Base pointer.
Definition: sharedVector.h:616
#define THROW_EXCEPTION2(TYPE, MSG)
static std::string deserializeString(ByteBuffer *buffer, DeserializableControl *control)
virtual void setLength(size_t length) OVERRIDE FINAL
PVValueArray< uint8 > PVUByteArray
Definition: pvData.h:1445
int i
Definition: scan.c:967
#define min(x, y)
Definition: flexdef.h:78
virtual void deserialize(ByteBuffer *pbuffer, DeserializableControl *pflusher) OVERRIDE FINAL
PVValueArray< uint16 > PVUShortArray
Definition: pvData.h:1448
virtual void setCapacity(size_t capacity) OVERRIDE FINAL
virtual void serialize(ByteBuffer *pbuffer, SerializableControl *pflusher) const OVERRIDE
virtual void serialize(ByteBuffer *pbuffer, SerializableControl *pflusher) const OVERRIDE FINAL
const FieldConstPtr & getField() const
Definition: pvData.h:208
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:788
std::tr1::shared_ptr< const Array > ArrayConstPtr
Definition: pvIntrospect.h:154
void checkLength(size_t length) const
virtual void copy(const PVScalar &from) OVERRIDE FINAL
PVValueArray< double > PVDoubleArray
Definition: pvData.h:1460
pvd::StructureConstPtr type
Definition: memory.hpp:41
TODO only here because of the Lockable.
Definition: ntaggregate.cpp:16
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
static size_t num_instances
Definition: pvData.h:241
std::tr1::shared_ptr< const StructureArray > StructureArrayConstPtr
Definition: pvIntrospect.h:166
static void writeSize(std::size_t s, ByteBuffer *buffer, SerializableControl *flusher)
PVValueArray< PVStructurePtr > PVStructureArray
Definition: pvData.h:99
static std::size_t readSize(ByteBuffer *buffer, DeserializableControl *control)
PVValueArray< int32 > PVIntArray
Definition: pvData.h:1439
Callback class for deserialization.
Definition: serialize.h:89
This is a singleton class for creating data instances.
Definition: pvData.h:1474
PVField is the base class for each PVData field.
Definition: pvData.h:152
PVScalarValue< uint32 > PVUInt
Definition: pvData.h:500
PVValueArray< uint64 > PVULongArray
Definition: pvData.h:1454
std::ostream & operator<<(std::ostream &o, const Field &f)
PVScalarValue< boolean > PVBoolean
Definition: pvData.h:493
PVFieldPtr createPVField(FieldConstPtr const &field)
PVValueArray(ScalarArrayConstPtr const &scalar)
std::tr1::shared_ptr< const Scalar > ScalarConstPtr
Definition: pvIntrospect.h:150
void putArray(const T *values, std::size_t count)
Definition: byteBuffer.h:801
std::tr1::shared_ptr< PVDataCreate > PVDataCreatePtr
Definition: pvData.h:124
PVScalarValue< uint64 > PVULong
Definition: pvData.h:501
PVStructurePtr createPVStructure(StructureConstPtr const &structure)
PVUnionArrayPtr createPVUnionArray(UnionArrayConstPtr const &unionArray)
PVString is special case, since it implements SerializableArray.
Definition: pvData.h:521
virtual void replace(const const_svector &next) OVERRIDE FINAL
PVValueArray< float > PVFloatArray
Definition: pvData.h:1457
std::tr1::shared_ptr< PVUnion > PVUnionPtr
Definition: pvData.h:107
virtual void operator<<=(typename storage_t::arg_type value)
#define EPICS_THREAD_ONCE_INIT
Definition: epicsThread.h:109
virtual void _putFromVoid(const epics::pvData::shared_vector< const void > &in) OVERRIDE FINAL
std::tr1::shared_ptr< const Union > UnionConstPtr
Definition: pvIntrospect.h:170
This class implements introspection object for a structure.
Definition: pvIntrospect.h:697
PVValueArray< int8 > PVByteArray
Definition: pvData.h:1433
PVValueArray< boolean > PVBooleanArray
Definition: pvData.h:1430
std::tr1::shared_ptr< PVStructureArray > PVStructureArrayPtr
Definition: pvData.h:100
void getArray(T *values, std::size_t count)
Definition: byteBuffer.h:817
template class for all extensions of PVArray.
Definition: pvData.h:55
APIs for the epicsMutex mutual exclusion semaphore.
LIBCOM_API void epicsStdCall epicsThreadOnce(epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg)
virtual void copyUnchecked(const PVScalar &from) OVERRIDE FINAL
std::tr1::shared_ptr< PVAT > createPVScalarArray()
Definition: pvData.h:1590
PVValueArray< uint32 > PVUIntArray
Definition: pvData.h:1451
PVValueArray< PVUnionPtr > PVUnionArray
Definition: pvData.h:119
virtual std::ostream & dumpValue(std::ostream &o) const OVERRIDE FINAL
std::tr1::shared_ptr< const BoundedString > BoundedStringConstPtr
Definition: pvIntrospect.h:178
This class implements introspection object for Array.
Definition: pvIntrospect.h:462
Base class for a scalarArray.
Definition: pvData.h:618
virtual ArrayConstPtr getArray() const OVERRIDE FINAL
This class implements a Bytebuffer that is like the java.nio.ByteBuffer.
Definition: byteBuffer.h:233
std::tr1::shared_ptr< PVScalar > PVScalarPtr
Definition: pvData.h:77
PVScalarValue< uint8 > PVUByte
Definition: pvData.h:498
std::tr1::shared_ptr< PVUnionArray > PVUnionArrayPtr
Definition: pvData.h:120
bool unique() const
Data is not shared?
Definition: sharedVector.h:216
meta::decorate_const< const T >::type * const_iterator
Definition: sharedVector.h:300
PVUnion has a single subfield.
Definition: pvData.h:940
std::vector< FieldConstPtr > FieldConstPtrArray
Definition: pvIntrospect.h:146
virtual void swap(const_svector &other) OVERRIDE FINAL
This class implements introspection object for BoundedString.
Definition: pvIntrospect.h:437
static void serializeString(const std::string &value, ByteBuffer *buffer, SerializableControl *flusher)
This class implements introspection object for a unionArray.
Definition: pvIntrospect.h:652
std::vector< PVFieldPtr > PVFieldPtrArray
Definition: pvData.h:70
Data interface for a structure,.
Definition: pvData.h:712
std::size_t getRemaining() const
Definition: byteBuffer.h:391
std::tr1::shared_ptr< const Field > FieldConstPtr
Definition: pvIntrospect.h:137
PVUnionPtr createPVUnion(UnionConstPtr const &punion)
size_t size() const
Number of elements visible through this vector.
Definition: sharedVector.h:220
static const PVDataCreatePtr & getPVDataCreate()
FORCE_INLINE const FieldCreatePtr & getFieldCreate()
void registerRefCounter(const char *name, const size_t *counter)
Definition: reftrack.cpp:59
PVScalarValue< int64 > PVLong
Definition: pvData.h:497
std::tr1::shared_ptr< const ScalarArray > ScalarArrayConstPtr
Definition: pvIntrospect.h:158
This class implements introspection object for scalar array.
Definition: pvIntrospect.h:497
This class implements introspection object for a structureArray.
Definition: pvIntrospect.h:607
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
char * pbuffer
Definition: errlog.c:85
std::tr1::shared_ptr< PVT > createPVScalar()
Definition: pvData.h:1521
Data class for a structureArray.
Definition: pvData.h:1236
friend class PVStructure
Definition: pvData.h:261
bool isImmutable() const
Definition: pvData.h:198
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
std::vector< std::string > StringArray
Definition: pvType.h:110
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
PVValueArray< std::string > PVStringArray
Definition: pvData.h:1463
bool isCapacityMutable() const
Definition: PVArray.cpp:33
virtual std::ostream & dumpValue(std::ostream &o) const OVERRIDE FINAL
virtual void ensureBuffer(std::size_t size)=0
virtual size_t getLength() const OVERRIDE FINAL
Definition: pvData.h:1203
Callback class for serialization.
Definition: serialize.h:34
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:808
const StructureConstPtr & getStructure() const
Definition: pvData.h:731
void slice(size_t offset, size_t length=(size_t)-1)
Reduce the view of this shared_vector.
Definition: sharedVector.h:244
PVScalarValue< int16 > PVShort
Definition: pvData.h:495
PVValueArray< int64 > PVLongArray
Definition: pvData.h:1442
PVScalarValue< int8 > PVByte
Definition: pvData.h:494
virtual bool directDeserialize(ByteBuffer *existingBuffer, char *deserializeTo, std::size_t elementCount, std::size_t elementSize)=0
virtual void assign(const PVScalar &scalar) OVERRIDE FINAL
static void serializeSubstring(const std::string &value, std::size_t offset, std::size_t count, ByteBuffer *buffer, SerializableControl *flusher)
virtual void ensureData(std::size_t size)=0
C++ and C descriptions for a thread.
std::tr1::shared_ptr< PVScalarArray > PVScalarArrayPtr
Definition: pvData.h:82
virtual std::ostream & dumpValue(std::ostream &o) const OVERRIDE
EPICS_ALWAYS_INLINE bool reverse() const
Definition: byteBuffer.h:493
PVStructureArrayPtr createPVStructureArray(StructureArrayConstPtr const &structureArray)
PVScalarValue< double > PVDouble
Definition: pvData.h:503
PVScalarValue< float > PVFloat
Definition: pvData.h:502
T getAs() const
Definition: pvData.h:302
PVScalarValue< uint16 > PVUShort
Definition: pvData.h:499
virtual void operator>>=(T &value) const
static const ScalarType typeCode
Definition: pvData.h:1188
std::tr1::shared_ptr< const UnionArray > UnionArrayConstPtr
Definition: pvIntrospect.h:174