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
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
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
193
194
195
196
197
198
199
200
/*----- 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 "log_thread.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.
//
// Command name | Method name
//================================================================
// State | Inherited (no method)
// Status | Inherited (no method)
// Ack | ack
// Load | load
// Remove | remove
// Configured | configured
// StopNew | stop_new
// Silence | silence
// Modify | modify
//================================================================
//================================================================
// Attributes managed is:
//================================================================
// alarm | Tango::DevString Spectrum ( max = 1024)
//================================================================
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
*/
DEBUG_STREAM << "Alarm::delete_device(): entering..." << endl;
abortflag = true;
DEBUG_STREAM << "Alarm::delete_device(): after abortflag=true..." << endl;
try {
events->unsubscribe();
} catch (string& err) {
ERROR_STREAM << err << endl;
}
DEBUG_STREAM << "Alarm::delete_device(): events unsubscribed!" << endl;
events->free_proxy();
DEBUG_STREAM << "Alarm::delete_device(): device proxy deleted!" << endl;
/*
* kill alarm thread
*/
bei_t e;
e.ev_name = ALARM_THREAD_EXIT;
e.value.push_back(ALARM_THREAD_EXIT_VALUE);
e.value.push_back(ALARM_THREAD_EXIT_VALUE);
evlist.push_back(e);
#ifdef _RW_LOCK
alarms.del_rwlock();
#endif
Loading full blame...