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

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

#include "ntnameValue.h"

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

Public Member Functions

 POINTER_DEFINITIONS (NTNameValueBuilder)
 
shared_pointer value (epics::pvData::ScalarType scalarType)
 
shared_pointer addDescriptor ()
 
shared_pointer addAlarm ()
 
shared_pointer addTimeStamp ()
 
epics::pvData::StructureConstPtr createStructure ()
 
epics::pvData::PVStructurePtr createPVStructure ()
 
NTNameValuePtr create ()
 
shared_pointer add (std::string const &name, epics::pvData::FieldConstPtr const &field)
 

Friends

class ::epics::nt::NTNameValue
 

Detailed Description

Interface for in-line creating of NTNameValue.

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 40 of file ntnameValue.h.

Member Function Documentation

NTNameValueBuilder::shared_pointer epics::nt::detail::NTNameValueBuilder::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 NTTableBuilder.

Definition at line 105 of file ntnameValue.cpp.

106 {
107  extraFields.push_back(field); extraFieldNames.push_back(name);
108  return shared_from_this();
109 }
NTNameValueBuilder::shared_pointer epics::nt::detail::NTNameValueBuilder::addAlarm ( )

Adds alarm field to the NTNameValue.

Returns
this instance of NTTableBuilder.

Definition at line 68 of file ntnameValue.cpp.

69 {
70  alarm = true;
71  return shared_from_this();
72 }
NTNameValueBuilder::shared_pointer epics::nt::detail::NTNameValueBuilder::addDescriptor ( )

Adds descriptor field to the NTNameValue.

Returns
this instance of NTTableBuilder.

Definition at line 62 of file ntnameValue.cpp.

63 {
64  descriptor = true;
65  return shared_from_this();
66 }
NTNameValueBuilder::shared_pointer epics::nt::detail::NTNameValueBuilder::addTimeStamp ( )

Adds timeStamp field to the NTNameValue.

Returns
this instance of NTTableBuilder.

Definition at line 74 of file ntnameValue.cpp.

75 {
76  timeStamp = true;
77  return shared_from_this();
78 }
NTNameValuePtr epics::nt::detail::NTNameValueBuilder::create ( )

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

Returns
a new instance of NTNameValue

Definition at line 85 of file ntnameValue.cpp.

86 {
87  return NTNameValuePtr(new NTNameValue(createPVStructure()));
88 }
std::tr1::shared_ptr< NTNameValue > NTNameValuePtr
Definition: ntnameValue.h:28
epics::pvData::PVStructurePtr createPVStructure()
Definition: ntnameValue.cpp:80
PVStructurePtr epics::nt::detail::NTNameValueBuilder::createPVStructure ( )

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

Returns
a new instance of PVStructure

Definition at line 80 of file ntnameValue.cpp.

81 {
82  return getPVDataCreate()->createPVStructure(createStructure());
83 }
epics::pvData::StructureConstPtr createStructure()
Definition: ntnameValue.cpp:32
FORCE_INLINE const PVDataCreatePtr & getPVDataCreate()
Definition: pvData.h:1648
StructureConstPtr epics::nt::detail::NTNameValueBuilder::createStructure ( )

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

Returns
a new instance of Structure.

Definition at line 32 of file ntnameValue.cpp.

33 {
34  if (!valueTypeSet)
35  throw std::runtime_error("value type not set");
36 
37  FieldBuilderPtr builder =
38  getFieldCreate()->createFieldBuilder()->
39  setId(NTNameValue::URI)->
40  addArray("name", pvString)->
41  addArray("value", valueType);
42 
43  if (descriptor)
44  builder->add("descriptor", pvString);
45 
46  if (alarm)
47  builder->add("alarm", ntField->createAlarm());
48 
49  if (timeStamp)
50  builder->add("timeStamp", ntField->createTimeStamp());
51 
52  size_t extraCount = extraFieldNames.size();
53  for (size_t i = 0; i< extraCount; i++)
54  builder->add(extraFieldNames[i], extraFields[i]);
55 
56  StructureConstPtr s = builder->createStructure();
57 
58  reset();
59  return s;
60 }
int i
Definition: scan.c:967
static const std::string URI
Definition: ntnameValue.h:133
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
std::tr1::shared_ptr< FieldBuilder > FieldBuilderPtr
FORCE_INLINE const FieldCreatePtr & getFieldCreate()
epics::nt::detail::NTNameValueBuilder::POINTER_DEFINITIONS ( NTNameValueBuilder  )
NTNameValueBuilder::shared_pointer epics::nt::detail::NTNameValueBuilder::value ( epics::pvData::ScalarType  scalarType)

Sets the value array Scalar type.

Parameters
scalarTypethe value field element ScalarType
Returns
this instance of NTTableBuilder.

Definition at line 22 of file ntnameValue.cpp.

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

Friends And Related Function Documentation

friend class ::epics::nt::NTNameValue
friend

Definition at line 116 of file ntnameValue.h.


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