Newer
Older

Graziano Scalamera
committed
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
/*----- PROTECTED REGION ID(Alarm.cpp) ENABLED START -----*/
static const char *RcsId = "$Id: $";
//=============================================================================
//
// file : Alarm.cpp
//
// description : C++ source for the Alarm class and its commands.
// The class is derived from Device. It represents the
// CORBA servant object which will be accessed from the
// network. All commands which can be executed on the
// Alarm are implemented in this file.
//
// project : alarm
//
// 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/>.
//
// $Author: $
//
// $Revision: $
// $Date: $
//
// $HeadURL: $
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <tango.h>
#include <Alarm.h>
#include <AlarmClass.h>
#include <ctype.h> //for tolower
#include "alarm-thread.h"
#include "alarm_grammar.h"
#include "update-thread.h"
//#define _DUMP_TREE_XML
#ifdef _DUMP_TREE_XML
#if BOOST_VERSION < 103600
#include <boost/spirit/iterator/fixed_size_queue.hpp>
#include <boost/spirit/core.hpp>
#include <boost/spirit/tree/ast.hpp>
#include <boost/spirit/tree/tree_to_xml.hpp>
using namespace boost::spirit;
#else
#include <boost/spirit/include/classic_fixed_size_queue.hpp>
#include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_ast.hpp>
#include <boost/spirit/include/classic_tree_to_xml.hpp>
using namespace boost::spirit::classic;
#endif
#include <iostream>
#include <stack>
#include <functional>
#include <string>
#include <cassert>
#endif //_DUMP_TREE_XML
#include <sstream>
std::map<parser_id, std::string> rule_names; //only for log messages
int Alarm_ns::Alarm::instanceCounter = 0;
#ifndef ALARM_BUILDTIME
#define ALARM_BUILDTIME __DATE__ " " __TIME__ " boost=" BOOST_LIB_VERSION
#endif
const char version_string[] = "$Build: @buildID@ " ALARM_BUILDTIME " $";
static const char __FILE__rev[] = __FILE__ " $Revision: 1.29 $";
/*----- PROTECTED REGION END -----*/ // Alarm.cpp
/**
* Alarm class description:
* Elettra alarm device server
*/
//================================================================
// The following table gives the correspondence
// between command and method names.
//

Graziano Scalamera
committed
// Command name | Method name

Graziano Scalamera
committed
//================================================================

Graziano Scalamera
committed
// State | Inherited (no method)
// Status | Inherited (no method)
// Ack | ack
// Load | load
// Remove | remove
// SearchAlarm | search_alarm
// StopAudible | stop_audible
// Silence | silence
// Modify | modify
// Shelve | shelve
// Enable | enable
// Disable | disable
// ResetStatistics | reset_statistics

Graziano Scalamera
committed
//================================================================
//================================================================

Graziano Scalamera
committed
// Attributes managed are:

Graziano Scalamera
committed
//================================================================

Graziano Scalamera
committed
// audibleAlarm | Tango::DevBoolean Scalar
// StatisticsResetTime | Tango::DevDouble Scalar
// alarm | Tango::DevString Spectrum ( max = 1024)
// normalAlarms | Tango::DevString Spectrum ( max = 10000)
// unacknowledgedAlarms | Tango::DevString Spectrum ( max = 10000)
// acknowledgedAlarms | Tango::DevString Spectrum ( max = 10000)
// unacknowledgedNormalAlarms | Tango::DevString Spectrum ( max = 10000)
// shelvedAlarms | Tango::DevString Spectrum ( max = 10000)
// outOfServiceAlarms | Tango::DevString Spectrum ( max = 10000)
// silencedAlarms | Tango::DevString Spectrum ( max = 10000)
// listAlarms | Tango::DevString Spectrum ( max = 10000)
// frequencyAlarms | Tango::DevDouble Spectrum ( max = 10000)

Graziano Scalamera
committed
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
//================================================================
namespace Alarm_ns
{
/*----- PROTECTED REGION ID(Alarm::namespace_starting) ENABLED START -----*/
// static initializations
/*----- PROTECTED REGION END -----*/ // Alarm::namespace_starting
//--------------------------------------------------------
/**
* Method : Alarm::Alarm()
* Description : Constructors for a Tango device
* implementing the classAlarm
*/
//--------------------------------------------------------
Alarm::Alarm(Tango::DeviceClass *cl, string &s)
: TANGO_BASE_CLASS(cl, s.c_str())
{
/*----- PROTECTED REGION ID(Alarm::constructor_1) ENABLED START -----*/
init_device();
/*----- PROTECTED REGION END -----*/ // Alarm::constructor_1
}
//--------------------------------------------------------
Alarm::Alarm(Tango::DeviceClass *cl, const char *s)
: TANGO_BASE_CLASS(cl, s)
{
/*----- PROTECTED REGION ID(Alarm::constructor_2) ENABLED START -----*/
init_device();
/*----- PROTECTED REGION END -----*/ // Alarm::constructor_2
}
//--------------------------------------------------------
Alarm::Alarm(Tango::DeviceClass *cl, const char *s, const char *d)
: TANGO_BASE_CLASS(cl, s, d)
{
/*----- PROTECTED REGION ID(Alarm::constructor_3) ENABLED START -----*/
init_device();
/*----- PROTECTED REGION END -----*/ // Alarm::constructor_3
}
//--------------------------------------------------------
/**
* Method : Alarm::delete_device()
* Description : will be called at device destruction or at init command
*/
//--------------------------------------------------------
void Alarm::delete_device()
{
DEBUG_STREAM << "Alarm::delete_device() " << device_name << endl;
/*----- PROTECTED REGION ID(Alarm::delete_device) ENABLED START -----*/
// Delete device allocated objects
// Delete device's allocated object
/*
* unsubscribe events and release memory
*/
bool starting = Tango::Util::instance()->is_svr_starting();
bool shutting_down = Tango::Util::instance()->is_svr_shutting_down();
bool restarting = Tango::Util::instance()->is_device_restarting(device_name);
DEBUG_STREAM << __func__ << " starting="<<(int)starting << " shutting_down="<<(int)shutting_down<<" restarting="<<(int)restarting;

Graziano Scalamera
committed
abortflag = true;
DEBUG_STREAM << "Alarm::delete_device(): after abortflag=true..." << endl;
try {
Loading full blame...