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

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

#include "nthistogram.h"

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

Public Member Functions

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

Friends

class ::epics::nt::NTHistogram
 

Detailed Description

Interface for in-line creating of NTHistogram.

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 nthistogram.h.

Member Function Documentation

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

Definition at line 107 of file nthistogram.cpp.

108 {
109  extraFields.push_back(field); extraFieldNames.push_back(name);
110  return shared_from_this();
111 }
NTHistogramBuilder::shared_pointer epics::nt::detail::NTHistogramBuilder::addAlarm ( )

Adds alarm field to the NTHistogram.

Returns
this instance of NTHistogramBuilder.

Definition at line 69 of file nthistogram.cpp.

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

Adds descriptor field to the NTHistogram.

Returns
this instance of NTHistogramBuilder.

Definition at line 63 of file nthistogram.cpp.

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

Adds timeStamp field to the NTHistogram.

Returns
this instance of NTHistogramBuilder.

Definition at line 75 of file nthistogram.cpp.

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

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

Returns
a new instance of NTHistogram.

Definition at line 87 of file nthistogram.cpp.

88 {
89  return NTHistogramPtr(new NTHistogram(createPVStructure()));
90 }
std::tr1::shared_ptr< NTHistogram > NTHistogramPtr
Definition: nthistogram.h:26
epics::pvData::PVStructurePtr createPVStructure()
Definition: nthistogram.cpp:82
PVStructurePtr epics::nt::detail::NTHistogramBuilder::createPVStructure ( )

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

Returns
a new instance of PVStructure.

Definition at line 82 of file nthistogram.cpp.

83 {
84  return getPVDataCreate()->createPVStructure(createStructure());
85 }
epics::pvData::StructureConstPtr createStructure()
Definition: nthistogram.cpp:32
FORCE_INLINE const PVDataCreatePtr & getPVDataCreate()
Definition: pvData.h:1648
StructureConstPtr epics::nt::detail::NTHistogramBuilder::createStructure ( )

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

Returns
a new instance of Structure.

Definition at line 32 of file nthistogram.cpp.

33 {
34  if (!valueTypeSet)
35  throw std::runtime_error("value array element type not set");
36 
37  FieldBuilderPtr builder =
38  getFieldCreate()->createFieldBuilder()->
39  setId(NTHistogram::URI)->
40  addArray("ranges", pvDouble)->
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 
57  StructureConstPtr s = builder->createStructure();
58 
59  reset();
60  return s;
61 }
static const std::string URI
Definition: nthistogram.h:133
int i
Definition: scan.c:967
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::NTHistogramBuilder::POINTER_DEFINITIONS ( NTHistogramBuilder  )
NTHistogramBuilder::shared_pointer epics::nt::detail::NTHistogramBuilder::value ( epics::pvData::ScalarType  scalarType)

Sets the scalar type of the value field array.

Parameters
scalarTypethe scalar type of the value field array.
Returns
this instance of NTHistogramBuilder.

Definition at line 22 of file nthistogram.cpp.

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

Friends And Related Function Documentation

friend class ::epics::nt::NTHistogram
friend

Definition at line 114 of file nthistogram.h.


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