1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
// NOLINTBEGIN(*)
/*----- PROTECTED REGION ID(TestCppTango1022::DynAttrUtils.cpp) ENABLED START -----*/
/* clang-format on */
//=============================================================================
//
// file : TestCppTango1022DynAttrUtils.cpp
//
// description : Dynamic attributes utilities file for the TestCppTango1022 class
//
//
//
// This file is part of Tango device class.
//
// Tango is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tango is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Tango. If not, see <http://www.gnu.org/licenses/>.
//
//
// Copyright (C): 2022
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// France
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include "TestCppTango1022.h"
#include "TestCppTango1022Class.h"
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // TestCppTango1022::DynAttrUtils.cpp
//================================================================
// Attributes managed is:
//================================================================
// DoubleAttr | Tango::DevDouble Scalar
//================================================================
// For compatibility reason, this file (TestCppTango1022DynAttrUtils)
// manage also the dynamic command utilities.
//================================================================
// The following table gives the correspondence
// between command and method names.
//
// Command name | Method name
//================================================================
//================================================================
namespace TestCppTango1022_ns
{
//=============================================================
// Add/Remove dynamic attribute methods
//=============================================================
//--------------------------------------------------------
/**
* Add a DoubleAttr dynamic attribute.
*
* parameter attname: attribute name to be created and added.
*/
//--------------------------------------------------------
void TestCppTango1022::add_DoubleAttr_dynamic_attribute(std::string attname)
{
// Attribute : DoubleAttr
DoubleAttrAttrib *doubleattr = new DoubleAttrAttrib(attname);
Tango::UserDefaultAttrProp doubleattr_prop;
// description not set for DoubleAttr
// label not set for DoubleAttr
// unit not set for DoubleAttr
// standard_unit not set for DoubleAttr
// display_unit not set for DoubleAttr
// format not set for DoubleAttr
// max_value not set for DoubleAttr
// min_value not set for DoubleAttr
// max_alarm not set for DoubleAttr
// min_alarm not set for DoubleAttr
// max_warning not set for DoubleAttr
// min_warning not set for DoubleAttr
// delta_t not set for DoubleAttr
// delta_val not set for DoubleAttr
/*----- PROTECTED REGION ID(TestCppTango1022::att_DoubleAttr_dynamic_attribute) ENABLED START -----*/
/* clang-format on */
// Add your own code
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // TestCppTango1022::att_DoubleAttr_dynamic_attribute
doubleattr->set_default_properties(doubleattr_prop);
// Not Polled
doubleattr->set_disp_level(Tango::OPERATOR);
// Not Memorized
DoubleAttr_data.insert(make_pair(attname, 0.0));
add_attribute(doubleattr);
}
//--------------------------------------------------------
/**
* remove a DoubleAttr dynamic attribute.
*
* parameter attname: attribute name to be removed.
*/
//--------------------------------------------------------
void TestCppTango1022::remove_DoubleAttr_dynamic_attribute(std::string attname)
{
remove_attribute(attname, true, Tango::Util::instance()->use_db());
std::map<std::string,Tango::DevDouble>::iterator ite;
if ((ite=DoubleAttr_data.find(attname))!=DoubleAttr_data.end())
{
/*----- PROTECTED REGION ID(TestCppTango1022::remove_DoubleAttr_dynamic_attribute) ENABLED START -----*/
/* clang-format on */
// Add your own code
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // TestCppTango1022::remove_DoubleAttr_dynamic_attribute
DoubleAttr_data.erase(ite);
}
}
//============================================================
// Tool methods to get pointer on attribute data buffer
//============================================================
//--------------------------------------------------------
/**
* Return a pointer on DoubleAttr data.
*
* parameter attname: the specified attribute name.
*/
//--------------------------------------------------------
Tango::DevDouble *TestCppTango1022::get_DoubleAttr_data_ptr(std::string &name)
{
std::map<std::string,Tango::DevDouble>::iterator ite;
if ((ite=DoubleAttr_data.find(name))==DoubleAttr_data.end())
{
TangoSys_OMemStream tms;
tms << "Dynamic attribute " << name << " has not been created";
Tango::Except::throw_exception(
(const char *)"ATTRIBUTE_NOT_FOUND",
tms.str().c_str(),
(const char *)"TestCppTango1022::get_DoubleAttr_data_ptr()");
}
return &(ite->second);
}
//=============================================================
// Add/Remove dynamic command methods
//=============================================================
} // namespace
// NOLINTEND(*)
|