Belle II Software development
NSMVHandlerFloatArray Class Reference
Inheritance diagram for NSMVHandlerFloatArray:
NSMVHandler

Public Member Functions

 NSMVHandlerFloatArray (const std::string &name, bool useget, bool useset, const std::vector< float > &val=std::vector< float >())
 
 NSMVHandlerFloatArray (const std::string &node, const std::string &name, bool useget, bool useset, const std::vector< float > &val=std::vector< float >())
 
bool handleGet (NSMVar &var) override
 
bool handleSet (const NSMVar &var) override
 
virtual bool handleGetFloatArray (std::vector< float > &val)
 
virtual bool handleSetFloatArray (const std::vector< float > &val)
 
const std::string & getNode () const
 
const std::string & getName () const
 
bool useGet () const
 
bool useSet () const
 
void setUseGet (bool use)
 
void setUseSet (bool use)
 
int getTimeStamp () const
 
int getId () const
 
void setNode (const std::string &node)
 
void setId (int id)
 
void set (const NSMVar &var)
 
void set (int val)
 
void set (float val)
 
void set (const std::string &val)
 
void set (const std::vector< int > &val)
 
void set (const std::vector< float > &val)
 
const NSMVarget () const
 
NSMVarget ()
 
NSMVar::Type getType () const
 
const char * getTypeLabel () const
 
bool isDumped () const
 
void setDumped (bool isdump)
 

Static Public Member Functions

static NSMVHandlercreate (const NSMVar &var)
 

Protected Attributes

int m_id
 
int m_timestamp
 
std::string m_node
 
std::string m_name
 
bool m_useget
 
bool m_useset
 
NSMVar m_var
 
bool m_isdump
 

Detailed Description

Definition at line 226 of file NSMVHandler.h.

Constructor & Destructor Documentation

◆ NSMVHandlerFloatArray() [1/2]

NSMVHandlerFloatArray ( const std::string &  name,
bool  useget,
bool  useset,
const std::vector< float > &  val = std::vector<float>() 
)
inline

Definition at line 229 of file NSMVHandler.h.

232 : NSMVHandler("", name, useset, useget)
233 {
234 m_var = val;
235 }

◆ NSMVHandlerFloatArray() [2/2]

NSMVHandlerFloatArray ( const std::string &  node,
const std::string &  name,
bool  useget,
bool  useset,
const std::vector< float > &  val = std::vector<float>() 
)
inline

Definition at line 236 of file NSMVHandler.h.

239 : NSMVHandler(node, name, useset, useget)
240 {
241 m_var = val;
242 }

◆ ~NSMVHandlerFloatArray()

virtual ~NSMVHandlerFloatArray ( )
inlinevirtual

Definition at line 243 of file NSMVHandler.h.

243{}

Member Function Documentation

◆ create()

NSMVHandler * create ( const NSMVar var)
staticinherited

Definition at line 14 of file NSMVHandler.cc.

15{
16 const std::string node = var.getNode();
17 const std::string name = var.getName();
18 if (var.getType() == NSMVar::INT) {
19 if (var.getLength() == 0) {
20 return new NSMVHandlerInt(node, name, false, true);
21 }
22 return new NSMVHandlerIntArray(node, name, false, true);
23 } else if (var.getType() == NSMVar::FLOAT) {
24 if (var.getLength() == 0) {
25 return new NSMVHandlerFloat(node, name, false, true);
26 }
27 return new NSMVHandlerFloatArray(node, name, false, true);
28 } else if (var.getType() == NSMVar::TEXT) {
29 return new NSMVHandlerText(node, name, false, true);
30 }
31 return NULL;
32}

◆ get() [1/2]

NSMVar & get ( )
inlineinherited

Definition at line 68 of file NSMVHandler.h.

68{ return m_var; }

◆ get() [2/2]

const NSMVar & get ( ) const
inlineinherited

Definition at line 67 of file NSMVHandler.h.

67{ return m_var; }

◆ getId()

int getId ( ) const
inlineinherited

Definition at line 58 of file NSMVHandler.h.

58{ return m_id; }

◆ getName()

const std::string & getName ( ) const
inlineinherited

Definition at line 52 of file NSMVHandler.h.

52{ return m_name; }

◆ getNode()

const std::string & getNode ( ) const
inlineinherited

Definition at line 51 of file NSMVHandler.h.

51{ return m_node; }

◆ getTimeStamp()

int getTimeStamp ( ) const
inlineinherited

Definition at line 57 of file NSMVHandler.h.

57{ return m_timestamp; }

◆ getType()

NSMVar::Type getType ( ) const
inlineinherited

Definition at line 69 of file NSMVHandler.h.

69{ return m_var.getType(); }

◆ getTypeLabel()

const char * getTypeLabel ( ) const
inlineinherited

Definition at line 70 of file NSMVHandler.h.

70{ return m_var.getTypeLabel(); }

◆ handleGet()

bool handleGet ( NSMVar var)
overridevirtual

Reimplemented from NSMVHandler.

Definition at line 143 of file NSMVHandler.cc.

144{
145 std::vector<float> val;
146 if (handleGetFloatArray(val)) {
147 var = val;
148 return true;
149 }
150 return false;
151}

◆ handleGetFloatArray()

bool handleGetFloatArray ( std::vector< float > &  val)
virtual

Definition at line 133 of file NSMVHandler.cc.

134{
135 const float* pv = (const float*)m_var.get();
136 val = std::vector<float>();
137 for (int i = 0; i < m_var.getLength(); i++) {
138 val.push_back(pv[i]);
139 }
140 return true;
141}

◆ handleSet()

bool handleSet ( const NSMVar var)
overridevirtual

Reimplemented from NSMVHandler.

Definition at line 153 of file NSMVHandler.cc.

154{
155 if (var.getType() == NSMVar::FLOAT && var.getLength() > 0) {
156 const float* pv = (const float*)var.get();
157 std::vector<float> val;
158 for (int i = 0; i < var.getLength(); i++) {
159 val.push_back(pv[i]);
160 }
161 if (handleSetFloatArray(val)) {
162 m_var = val;
163 return true;
164 }
165 }
166 return false;
167}

◆ handleSetFloatArray()

virtual bool handleSetFloatArray ( const std::vector< float > &  val)
inlinevirtual

Definition at line 251 of file NSMVHandler.h.

252 {
253 m_var = val;
254 return true;
255 }

◆ isDumped()

bool isDumped ( ) const
inlineinherited

Definition at line 71 of file NSMVHandler.h.

71{ return m_isdump; }

◆ set() [1/6]

void set ( const NSMVar var)
inlineinherited

Definition at line 61 of file NSMVHandler.h.

61{ m_var = var; }

◆ set() [2/6]

void set ( const std::string &  val)
inlineinherited

Definition at line 64 of file NSMVHandler.h.

64{ m_var = val; }

◆ set() [3/6]

void set ( const std::vector< float > &  val)
inlineinherited

Definition at line 66 of file NSMVHandler.h.

66{ m_var = val; }

◆ set() [4/6]

void set ( const std::vector< int > &  val)
inlineinherited

Definition at line 65 of file NSMVHandler.h.

65{ m_var = val; }

◆ set() [5/6]

void set ( float  val)
inlineinherited

Definition at line 63 of file NSMVHandler.h.

63{ m_var = val; }

◆ set() [6/6]

void set ( int  val)
inlineinherited

Definition at line 62 of file NSMVHandler.h.

62{ m_var = val; }

◆ setDumped()

void setDumped ( bool  isdump)
inlineinherited

Definition at line 72 of file NSMVHandler.h.

72{ m_isdump = isdump; }

◆ setId()

void setId ( int  id)
inlineinherited

Definition at line 60 of file NSMVHandler.h.

60{ m_id = id; }

◆ setNode()

void setNode ( const std::string &  node)
inlineinherited

Definition at line 59 of file NSMVHandler.h.

59{ m_node = node; }

◆ setUseGet()

void setUseGet ( bool  use)
inlineinherited

Definition at line 55 of file NSMVHandler.h.

55{ m_useget = use; }

◆ setUseSet()

void setUseSet ( bool  use)
inlineinherited

Definition at line 56 of file NSMVHandler.h.

56{ m_useset = use; }

◆ useGet()

bool useGet ( ) const
inlineinherited

Definition at line 53 of file NSMVHandler.h.

53{ return m_useget; }

◆ useSet()

bool useSet ( ) const
inlineinherited

Definition at line 54 of file NSMVHandler.h.

54{ return m_useset; }

Member Data Documentation

◆ m_id

int m_id
protectedinherited

Definition at line 75 of file NSMVHandler.h.

◆ m_isdump

bool m_isdump
protectedinherited

Definition at line 82 of file NSMVHandler.h.

◆ m_name

std::string m_name
protectedinherited

Definition at line 78 of file NSMVHandler.h.

◆ m_node

std::string m_node
protectedinherited

Definition at line 77 of file NSMVHandler.h.

◆ m_timestamp

int m_timestamp
protectedinherited

Definition at line 76 of file NSMVHandler.h.

◆ m_useget

bool m_useget
protectedinherited

Definition at line 79 of file NSMVHandler.h.

◆ m_useset

bool m_useset
protectedinherited

Definition at line 80 of file NSMVHandler.h.

◆ m_var

NSMVar m_var
protectedinherited

Definition at line 81 of file NSMVHandler.h.


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