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

Interface for in-line creating of NTAttribute extended as required by NTNDArray. More...

#include "ntndarrayAttribute.h"

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

Public Member Functions

 POINTER_DEFINITIONS (NTNDArrayAttributeBuilder)
 
shared_pointer addTags ()
 
shared_pointer addDescriptor ()
 
shared_pointer addAlarm ()
 
shared_pointer addTimeStamp ()
 
epics::pvData::StructureConstPtr createStructure ()
 
epics::pvData::PVStructurePtr createPVStructure ()
 
NTNDArrayAttributePtr create ()
 
shared_pointer add (std::string const &name, epics::pvData::FieldConstPtr const &field)
 

Protected Member Functions

 NTNDArrayAttributeBuilder ()
 
void reset ()
 

Protected Attributes

bool tags
 
bool descriptor
 
bool alarm
 
bool timeStamp
 
epics::pvData::StringArray extraFieldNames
 
epics::pvData::FieldConstPtrArray extraFields
 

Friends

class ::epics::nt::NTNDArrayAttribute
 

Detailed Description

Interface for in-line creating of NTAttribute extended as required by NTNDArray.

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
dgh

Definition at line 38 of file ntndarrayAttribute.h.

Constructor & Destructor Documentation

epics::nt::detail::NTNDArrayAttributeBuilder::NTNDArrayAttributeBuilder ( )
protected

Definition at line 91 of file ntndarrayAttribute.cpp.

Member Function Documentation

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

Definition at line 106 of file ntndarrayAttribute.cpp.

107 {
108  extraFields.push_back(field); extraFieldNames.push_back(name);
109  return shared_from_this();
110 }
epics::pvData::FieldConstPtrArray extraFields
NTNDArrayAttributeBuilder::shared_pointer epics::nt::detail::NTNDArrayAttributeBuilder::addAlarm ( )

Adds alarm field to the NTNDArrayAttribute.

Returns
this instance of NTNDArrayAttributeBuilder.

Definition at line 69 of file ntndarrayAttribute.cpp.

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

Adds descriptor field to the NTNDArrayAttribute.

Returns
this instance of NTNDArrayAttributeBuilder.

Definition at line 63 of file ntndarrayAttribute.cpp.

64 {
65  descriptor = true;
66  return shared_from_this();
67 }
NTNDArrayAttributeBuilder::shared_pointer epics::nt::detail::NTNDArrayAttributeBuilder::addTags ( )

Adds tags field to the NTNDArrayAttribute.

Returns
this instance of NTNDArrayAttributeBuilder.

Definition at line 57 of file ntndarrayAttribute.cpp.

58 {
59  tags = true;
60  return shared_from_this();
61 }
NTNDArrayAttributeBuilder::shared_pointer epics::nt::detail::NTNDArrayAttributeBuilder::addTimeStamp ( )

Adds timeStamp field to the NTNDArrayAttribute.

Returns
this instance of NTNDArrayAttributeBuilder.

Definition at line 75 of file ntndarrayAttribute.cpp.

76 {
77  timeStamp = true;
78  return shared_from_this();
79 }
NTNDArrayAttributePtr epics::nt::detail::NTNDArrayAttributeBuilder::create ( )

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

Returns
a new instance of a NTNDArrayAttribute.

Definition at line 86 of file ntndarrayAttribute.cpp.

87 {
88  return NTNDArrayAttributePtr(new NTNDArrayAttribute(createPVStructure()));
89 }
epics::pvData::PVStructurePtr createPVStructure()
std::tr1::shared_ptr< NTNDArrayAttribute > NTNDArrayAttributePtr
PVStructurePtr epics::nt::detail::NTNDArrayAttributeBuilder::createPVStructure ( )

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

Returns
a new instance of a PVStructure.

Definition at line 81 of file ntndarrayAttribute.cpp.

82 {
83  return getPVDataCreate()->createPVStructure(createStructure());
84 }
epics::pvData::StructureConstPtr createStructure()
FORCE_INLINE const PVDataCreatePtr & getPVDataCreate()
Definition: pvData.h:1648
StructureConstPtr epics::nt::detail::NTNDArrayAttributeBuilder::createStructure ( )

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

Returns
a new instance of a Structure.

Definition at line 23 of file ntndarrayAttribute.cpp.

24 {
25  FieldBuilderPtr builder =
26  getFieldCreate()->createFieldBuilder()->
28  add("name", pvString)->
29  add("value", getFieldCreate()->createVariantUnion());
30 
31  if (tags)
32  builder->addArray("tags", pvString);
33 
34  builder->add("descriptor", pvString);
35 
36  builder->add("sourceType", pvInt);
37 
38  builder->add("source", pvString);
39 
40  if (alarm)
41  builder->add("alarm", ntField->createAlarm());
42 
43  if (timeStamp)
44  builder->add("timeStamp", ntField->createTimeStamp());
45 
46  size_t extraCount = extraFieldNames.size();
47  for (size_t i = 0; i< extraCount; i++)
48  builder->add(extraFieldNames[i], extraFields[i]);
49 
50 
51  StructureConstPtr s = builder->createStructure();
52 
53  reset();
54  return s;
55 }
int i
Definition: scan.c:967
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
shared_pointer add(std::string const &name, epics::pvData::FieldConstPtr const &field)
static const std::string URI
std::tr1::shared_ptr< FieldBuilder > FieldBuilderPtr
FORCE_INLINE const FieldCreatePtr & getFieldCreate()
epics::pvData::FieldConstPtrArray extraFields
epics::nt::detail::NTNDArrayAttributeBuilder::POINTER_DEFINITIONS ( NTNDArrayAttributeBuilder  )
void epics::nt::detail::NTNDArrayAttributeBuilder::reset ( )
protected

Friends And Related Function Documentation

friend class ::epics::nt::NTNDArrayAttribute
friend

Definition at line 111 of file ntndarrayAttribute.h.

Member Data Documentation

bool epics::nt::detail::NTNDArrayAttributeBuilder::alarm
protected

Definition at line 104 of file ntndarrayAttribute.h.

bool epics::nt::detail::NTNDArrayAttributeBuilder::descriptor
protected

Definition at line 103 of file ntndarrayAttribute.h.

epics::pvData::StringArray epics::nt::detail::NTNDArrayAttributeBuilder::extraFieldNames
protected

Definition at line 108 of file ntndarrayAttribute.h.

epics::pvData::FieldConstPtrArray epics::nt::detail::NTNDArrayAttributeBuilder::extraFields
protected

Definition at line 109 of file ntndarrayAttribute.h.

bool epics::nt::detail::NTNDArrayAttributeBuilder::tags
protected

Definition at line 102 of file ntndarrayAttribute.h.

bool epics::nt::detail::NTNDArrayAttributeBuilder::timeStamp
protected

Definition at line 105 of file ntndarrayAttribute.h.


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