This is Unofficial EPICS BASE Doxygen Site
epics::nt::detail::NTScalarArrayBuilder Class Reference

Interface for in-line creating of NTScalarArray. More...

#include "ntscalarArray.h"

+ Inheritance diagram for epics::nt::detail::NTScalarArrayBuilder:
+ Collaboration diagram for epics::nt::detail::NTScalarArrayBuilder:

Public Member Functions

 POINTER_DEFINITIONS (NTScalarArrayBuilder)
 
shared_pointer value (epics::pvData::ScalarType elementType)
 
shared_pointer arrayValue (epics::pvData::ScalarType elementType)
 
shared_pointer addDescriptor ()
 
shared_pointer addAlarm ()
 
shared_pointer addTimeStamp ()
 
shared_pointer addDisplay ()
 
shared_pointer addControl ()
 
epics::pvData::StructureConstPtr createStructure ()
 
epics::pvData::PVStructurePtr createPVStructure ()
 
NTScalarArrayPtr create ()
 
shared_pointer add (std::string const &name, epics::pvData::FieldConstPtr const &field)
 

Friends

class ::epics::nt::NTScalarArray
 

Detailed Description

Interface for in-line creating of NTScalarArray.

One instance can be used to create multiple instances. An instance of this object must not be used concurrently (an object has a state).

Author
mse

Definition at line 41 of file ntscalarArray.h.

Member Function Documentation

NTScalarArrayBuilder::shared_pointer epics::nt::detail::NTScalarArrayBuilder::add ( std::string const &  name,
epics::pvData::FieldConstPtr const &  field 
)

Adds extra Field to the type.

Parameters
namethe name of the field.
fieldthe field to be added.
Returns
this instance of NTScalarArrayBuilder.

Definition at line 133 of file ntscalarArray.cpp.

134 {
135  extraFields.push_back(field); extraFieldNames.push_back(name);
136  return shared_from_this();
137 }
NTScalarArrayBuilder::shared_pointer epics::nt::detail::NTScalarArrayBuilder::addAlarm ( )

Adds alarm field to the NTScalarArray.

Returns
this instance of NTScalarArrayBuilder.

Definition at line 84 of file ntscalarArray.cpp.

85 {
86  alarm = true;
87  return shared_from_this();
88 }
NTScalarArrayBuilder::shared_pointer epics::nt::detail::NTScalarArrayBuilder::addControl ( )

Adds control field to the NTScalarArray.

Returns
this instance of NTScalarArrayBuilder.

Definition at line 102 of file ntscalarArray.cpp.

103 {
104  control = true;
105  return shared_from_this();
106 }
NTScalarArrayBuilder::shared_pointer epics::nt::detail::NTScalarArrayBuilder::addDescriptor ( )

Adds descriptor field to the NTScalarArray.

Returns
this instance of NTScalarArrayBuilder.

Definition at line 78 of file ntscalarArray.cpp.

79 {
80  descriptor = true;
81  return shared_from_this();
82 }
NTScalarArrayBuilder::shared_pointer epics::nt::detail::NTScalarArrayBuilder::addDisplay ( )

Adds display field to the NTScalarArray.

Returns
this instance of NTScalarArrayBuilder.

Definition at line 96 of file ntscalarArray.cpp.

97 {
98  display = true;
99  return shared_from_this();
100 }
NTScalarArrayBuilder::shared_pointer epics::nt::detail::NTScalarArrayBuilder::addTimeStamp ( )

Adds timeStamp field to the NTScalarArray.

Returns
this instance of NTScalarArrayBuilder.

Definition at line 90 of file ntscalarArray.cpp.

91 {
92  timeStamp = true;
93  return shared_from_this();
94 }
NTScalarArrayBuilder::shared_pointer epics::nt::detail::NTScalarArrayBuilder::arrayValue ( epics::pvData::ScalarType  elementType)

Sets the value type of the NTScalarArray.

Parameters
elementTypethe value field element ScalarType.
Returns
this instance of NTScalarArrayBuilder.
Deprecated:
use value instead.

Definition at line 32 of file ntscalarArray.cpp.

35 {
36  valueType = elementType;
37  valueTypeSet = true;
38 
39  return shared_from_this();
40 }
NTScalarArrayPtr epics::nt::detail::NTScalarArrayBuilder::create ( )

Creates a NTScalarArray instance. This resets this instance state and allows new instance to be created.

Returns
a new instance of NTScalarArray.

Definition at line 113 of file ntscalarArray.cpp.

114 {
115  return NTScalarArrayPtr(new NTScalarArray(createPVStructure()));
116 }
epics::pvData::PVStructurePtr createPVStructure()
std::tr1::shared_ptr< NTScalarArray > NTScalarArrayPtr
Definition: ntscalarArray.h:29
PVStructurePtr epics::nt::detail::NTScalarArrayBuilder::createPVStructure ( )

Creates a PVStructure that represents NTScalarArray. This resets this instance state and allows new instance to be created.

Returns
a new instance of PVStructure.

Definition at line 108 of file ntscalarArray.cpp.

109 {
110  return getPVDataCreate()->createPVStructure(createStructure());
111 }
epics::pvData::StructureConstPtr createStructure()
FORCE_INLINE const PVDataCreatePtr & getPVDataCreate()
Definition: pvData.h:1648
StructureConstPtr epics::nt::detail::NTScalarArrayBuilder::createStructure ( )

Creates a Structure that represents NTScalarArray. This resets this instance state and allows new instance to be created.

Returns
a new instance of Structure.

Definition at line 42 of file ntscalarArray.cpp.

43 {
44  if (!valueTypeSet)
45  throw std::runtime_error("value array element type not set");
46 
47  FieldBuilderPtr builder =
48  getFieldCreate()->createFieldBuilder()->
49  setId(NTScalarArray::URI)->
50  addArray("value", valueType);
51 
52  if (descriptor)
53  builder->add("descriptor", pvString);
54 
55  if (alarm)
56  builder->add("alarm", ntField->createAlarm());
57 
58  if (timeStamp)
59  builder->add("timeStamp", ntField->createTimeStamp());
60 
61  if (display)
62  builder->add("display", ntField->createDisplay());
63 
64  if (control)
65  builder->add("control", ntField->createControl());
66 
67  size_t extraCount = extraFieldNames.size();
68  for (size_t i = 0; i< extraCount; i++)
69  builder->add(extraFieldNames[i], extraFields[i]);
70 
71 
72  StructureConstPtr s = builder->createStructure();
73 
74  reset();
75  return s;
76 }
int i
Definition: scan.c:967
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
std::tr1::shared_ptr< FieldBuilder > FieldBuilderPtr
static const std::string URI
FORCE_INLINE const FieldCreatePtr & getFieldCreate()
epics::nt::detail::NTScalarArrayBuilder::POINTER_DEFINITIONS ( NTScalarArrayBuilder  )
NTScalarArrayBuilder::shared_pointer epics::nt::detail::NTScalarArrayBuilder::value ( epics::pvData::ScalarType  elementType)

Sets the value type of the NTScalarArray.

Parameters
elementTypethe value field element ScalarType.
Returns
this instance of NTScalarArrayBuilder.

Definition at line 22 of file ntscalarArray.cpp.

25 {
26  valueType = elementType;
27  valueTypeSet = true;
28 
29  return shared_from_this();
30 }

Friends And Related Function Documentation

friend class ::epics::nt::NTScalarArray
friend

Definition at line 139 of file ntscalarArray.h.


The documentation for this class was generated from the following files: