8#include "daq/slc/nsm/NSMVHandler.h"
10#include "daq/slc/nsm/NSMCallback.h"
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) {
23 }
else if (var.getType() == NSMVar::FLOAT) {
24 if (var.getLength() == 0) {
28 }
else if (var.getType() == NSMVar::TEXT) {
34bool NSMVHandlerInt::handleGet(
NSMVar& var)
37 if (handleGetInt(val)) {
44bool NSMVHandlerInt::handleSet(
const NSMVar& var)
46 if (var.getType() == NSMVar::INT&& var.getLength() == 0) {
47 if (handleSetInt(var.getInt())) {
55bool NSMVHandlerFloat::handleGet(
NSMVar& var)
58 if (handleGetFloat(val)) {
65bool NSMVHandlerFloat::handleSet(
const NSMVar& var)
67 if (var.getType() == NSMVar::FLOAT && var.getLength() == 0) {
68 if (handleSetFloat(var.getFloat())) {
69 m_var = var.getFloat();
76bool NSMVHandlerText::handleGet(
NSMVar& var)
79 if (handleGetText(val)) {
86bool NSMVHandlerText::handleSet(
const NSMVar& var)
88 if (var.getType() == NSMVar::TEXT && var.getLength() > 0) {
89 if (handleSetText(var.getText())) {
90 m_var = var.getText();
97bool NSMVHandlerIntArray::handleGetIntArray(std::vector<int>& val)
99 const int* pv = (
const int*)m_var.get();
100 val = std::vector<int>();
101 for (
int i = 0; i < m_var.getLength(); i++) {
102 val.push_back(pv[i]);
107bool NSMVHandlerIntArray::handleGet(
NSMVar& var)
109 std::vector<int> val;
110 if (handleGetIntArray(val)) {
117bool NSMVHandlerIntArray::handleSet(
const NSMVar& var)
119 if (var.getType() == NSMVar::INT&& var.getLength() > 0) {
120 const int* pv = (
const int*)var.get();
121 std::vector<int> val;
122 for (
int i = 0; i < var.getLength(); i++) {
123 val.push_back(pv[i]);
125 if (handleSetIntArray(val)) {
133bool NSMVHandlerFloatArray::handleGetFloatArray(std::vector<float>& val)
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]);
143bool NSMVHandlerFloatArray::handleGet(
NSMVar& var)
145 std::vector<float> val;
146 if (handleGetFloatArray(val)) {
153bool NSMVHandlerFloatArray::handleSet(
const NSMVar& var)
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]);
161 if (handleSetFloatArray(val)) {
169bool NSMVHandlerRef::handleGet(
NSMVar& var)
172 m_callback.get(m_refname, var);
176bool NSMVHandlerRef::handleSet(
const NSMVar& var)
180 m_callback.set(m_refname, var);
Abstract base class for different kinds of events.