Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cs/ds/alarm-handler
  • francesco.tripaldi/alarm-handler
2 results
Show changes
Commits on Source (5)
Showing with 108 additions and 92 deletions
......@@ -7,6 +7,8 @@ stages:
build_job:
stage: build
tags:
- docker
before_script:
- sudo apt update && sudo apt -y --no-install-recommends install build-essential cmake pkg-config libboost-thread-dev
script:
......@@ -21,6 +23,8 @@ build_job:
test_load_job:
stage: test
tags:
- docker
before_script:
- sudo apt update && sudo apt -y --no-install-recommends install libboost-thread-dev
script:
......
......@@ -107,7 +107,7 @@ set_target_properties(alarm_handler
PROPERTIES
OUTPUT_NAME ${AH_NAME}
LINK_FLAGS "-Wl,--no-undefined"
CXX_STANDARD 11)
CXX_STANDARD 17)
if(DO_CLANG_TIDY)
set_target_properties(alarm_handler
......
......@@ -372,7 +372,7 @@ void AlarmHandler::init_device()
if(instanceCounter > 1)
{
ERROR_STREAM << "More than one instance in the same executable of Alarm Server is not allowed!!" << endl;
cout << "ERROR: second instance of Alarm Server, exiting..." << endl;
TANGO_LOG << "ERROR: second instance of Alarm Server, exiting..." << endl;
exit(-1);
} //-------------------------------------------
alarmedlock = new(ReadersWritersLock);
......@@ -524,7 +524,7 @@ void AlarmHandler::init_device()
} catch(string & e)
{
ERROR_STREAM << "AlarmHandler::init_device(): " << e << endl;
cout << "Error: " << e << ". Exiting..." << endl;
TANGO_LOG << "Error: " << e << ". Exiting..." << endl;
exit(-4);
}
......@@ -3469,7 +3469,7 @@ void AlarmHandler::add_alarm(alarm_t& a, bool starting)
}
}
void AlarmHandler::add_event(alarm_t& a, vector<string> &evn) throw(string&)
void AlarmHandler::add_event(alarm_t& a, vector<string> &evn)
{
DEBUG_STREAM << "AlarmHandler::add_event(): formula '" << a.formula << "' found " << evn.size() << " events" << endl;
/*
......@@ -4217,7 +4217,7 @@ void AlarmHandler::timer_update()
}
}
bool AlarmHandler::remove_alarm(string& s) throw(string&)
bool AlarmHandler::remove_alarm(string& s)
{
DEBUG_STREAM << "AlarmHandler::"<<__func__<<": entering alm name=" << s << endl;
alarms.vlock->writerIn();
......@@ -4327,7 +4327,7 @@ bool AlarmHandler::remove_alarm(string& s) throw(string&)
} /* remove_alarm() */
/*void AlarmHandler::add_to_database(alarm_t& a) throw(string&)
/*void AlarmHandler::add_to_database(alarm_t& a)
{
Tango::DbDatum alarm("alarm");
Tango::DbData db_data;
......@@ -5359,7 +5359,7 @@ void AlarmHandler::eval_node_event(iter_t const& i, vector<string> & ev)
std::transform(s.begin(), s.end(), s.begin(), (int(*)(int))tolower); //transform to lowercase
ev.push_back(s);
}
//cout << endl;
//TANGO_LOG << endl;
//iter_t it = i->children.begin();
for(iter_t it = i->children.begin(); it != i->children.end(); it++)
eval_node_event(it, ev);
......@@ -5478,7 +5478,7 @@ void AlarmHandler::prepare_alarm_attr()
if(almstate == "OOSRV" || almstate == "SHLVD")
{
//cout << __func__ << ": " << ai->first << " silenced="<< ai->second.silenced << endl;
//TANGO_LOG << __func__ << ": " << ai->first << " silenced="<< ai->second.silenced << endl;
#if 0
alm_disabled << KEY(ALARM_TIME_KEY) << time_buf << "." << ai->second.ts.tv_usec << SEP;
alm_disabled << KEY(NAME_KEY) << ai->first << SEP;
......@@ -5614,7 +5614,7 @@ void AlarmHandler::prepare_alarm_attr()
* found, change stat only if switching from
* S_NORMAL or S_ALARM status to S_ERROR
*/
//cout << "read_attr(): S_ERROR: found: " << aid->name << endl;
//TANGO_LOG << "read_attr(): S_ERROR: found: " << aid->name << endl;
if (aid->stat != S_ERROR) {
aid->stat = S_ERROR;
aid->ack = NOT_ACK;
......@@ -5665,7 +5665,7 @@ void AlarmHandler::prepare_alarm_attr()
* found, change stat only if switching from
* S_NORMAL to S_ALARM status
*/
//cout << "read_attr(): S_ALARM: found: " << aid->name << endl;
//TANGO_LOG << "read_attr(): S_ALARM: found: " << aid->name << endl;
if (aid->stat == S_NORMAL || aid->stat == S_ERROR) {
aid->stat = S_ALARM;
aid->ack = NOT_ACK;
......
......@@ -33,7 +33,7 @@
#ifndef AlarmHandler_H
#define AlarmHandler_H
#include <tango.h>
#include <tango/tango.h>
#include <boost/version.hpp>
#if BOOST_VERSION >= 103600
......@@ -61,7 +61,15 @@ class update_thread;
# define ELAPSED(before, after) \
1000.0*(after.tv_sec-before.tv_sec) + \
((double)after.tv_usec-before.tv_usec) / 1000
#ifndef TANGO_LOG
#define TANGO_LOG cout
#endif
#ifndef TANGO_LOG_INFO
#define TANGO_LOG_INFO cout2
#endif
#ifndef TANGO_LOG_DEBUG
#define TANGO_LOG_DEBUG cout4
#endif
/*----- PROTECTED REGION END -----*/ // AlarmHandler.h
......@@ -585,13 +593,13 @@ private:
void init_alarms(map< string,vector<string> > &alarm_events);
#endif
void add_alarm(alarm_t& a, bool starting=false);
void add_event(alarm_t& a, vector<string> &evn) throw(string&);
void add_event(alarm_t& a, vector<string> &evn);
#if 0
void subscribe_event(alarm_t& a, EventCallBack& ecb, vector<string> &evn) throw(string&);
void subscribe_event(alarm_t& a, EventCallBack& ecb, vector<string> &evn);
#endif
// void do_alarm(bei_t& e); //gcc 4 problem??
bool remove_alarm(string& s) throw(string&);
//void add_to_database(alarm_t& a) throw(string&);
bool remove_alarm(string& s);
//void add_to_database(alarm_t& a);
void set_internal_alarm(string name, Tango::TimeVal t, string msg, unsigned int count=1);
void load_alarm(string alarm_string, alarm_t &alm, vector<string> &evn);
......
......@@ -73,7 +73,7 @@ AlarmHandlerClass *AlarmHandlerClass::_instance = NULL;
//--------------------------------------------------------
AlarmHandlerClass::AlarmHandlerClass(string &s):Tango::DeviceClass(s)
{
cout2 << "Entering AlarmHandlerClass constructor" << endl;
TANGO_LOG_INFO << "Entering AlarmHandlerClass constructor" << endl;
set_default_property();
get_class_property();
write_class_property();
......@@ -82,7 +82,7 @@ AlarmHandlerClass::AlarmHandlerClass(string &s):Tango::DeviceClass(s)
/*----- PROTECTED REGION END -----*/ // AlarmHandlerClass::constructor
cout2 << "Leaving AlarmHandlerClass constructor" << endl;
TANGO_LOG_INFO << "Leaving AlarmHandlerClass constructor" << endl;
}
//--------------------------------------------------------
......@@ -162,7 +162,7 @@ AlarmHandlerClass *AlarmHandlerClass::instance()
//--------------------------------------------------------
CORBA::Any *AckClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "AckClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "AckClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
((static_cast<AlarmHandler *>(device))->ack(argin));
......@@ -182,7 +182,7 @@ CORBA::Any *AckClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_an
//--------------------------------------------------------
CORBA::Any *LoadClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "LoadClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "LoadClass::execute(): arrived" << endl;
Tango::DevString argin;
extract(in_any, argin);
((static_cast<AlarmHandler *>(device))->load(argin));
......@@ -202,7 +202,7 @@ CORBA::Any *LoadClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_a
//--------------------------------------------------------
CORBA::Any *RemoveClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "RemoveClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "RemoveClass::execute(): arrived" << endl;
Tango::DevString argin;
extract(in_any, argin);
((static_cast<AlarmHandler *>(device))->remove(argin));
......@@ -222,7 +222,7 @@ CORBA::Any *RemoveClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in
//--------------------------------------------------------
CORBA::Any *SearchAlarmClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "SearchAlarmClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "SearchAlarmClass::execute(): arrived" << endl;
Tango::DevString argin;
extract(in_any, argin);
return insert((static_cast<AlarmHandler *>(device))->search_alarm(argin));
......@@ -241,7 +241,7 @@ CORBA::Any *SearchAlarmClass::execute(Tango::DeviceImpl *device, const CORBA::An
//--------------------------------------------------------
CORBA::Any *StopAudibleClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "StopAudibleClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "StopAudibleClass::execute(): arrived" << endl;
((static_cast<AlarmHandler *>(device))->stop_audible());
return new CORBA::Any();
}
......@@ -259,7 +259,7 @@ CORBA::Any *StopAudibleClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(co
//--------------------------------------------------------
CORBA::Any *SilenceClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "SilenceClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "SilenceClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
((static_cast<AlarmHandler *>(device))->silence(argin));
......@@ -279,7 +279,7 @@ CORBA::Any *SilenceClass::execute(Tango::DeviceImpl *device, const CORBA::Any &i
//--------------------------------------------------------
CORBA::Any *ModifyClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "ModifyClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "ModifyClass::execute(): arrived" << endl;
Tango::DevString argin;
extract(in_any, argin);
((static_cast<AlarmHandler *>(device))->modify(argin));
......@@ -299,7 +299,7 @@ CORBA::Any *ModifyClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in
//--------------------------------------------------------
CORBA::Any *ShelveClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "ShelveClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "ShelveClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
((static_cast<AlarmHandler *>(device))->shelve(argin));
......@@ -319,7 +319,7 @@ CORBA::Any *ShelveClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in
//--------------------------------------------------------
CORBA::Any *EnableClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "EnableClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "EnableClass::execute(): arrived" << endl;
Tango::DevString argin;
extract(in_any, argin);
((static_cast<AlarmHandler *>(device))->enable(argin));
......@@ -339,7 +339,7 @@ CORBA::Any *EnableClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in
//--------------------------------------------------------
CORBA::Any *DisableClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "DisableClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "DisableClass::execute(): arrived" << endl;
Tango::DevString argin;
extract(in_any, argin);
((static_cast<AlarmHandler *>(device))->disable(argin));
......@@ -359,7 +359,7 @@ CORBA::Any *DisableClass::execute(Tango::DeviceImpl *device, const CORBA::Any &i
//--------------------------------------------------------
CORBA::Any *ResetStatisticsClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "ResetStatisticsClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "ResetStatisticsClass::execute(): arrived" << endl;
((static_cast<AlarmHandler *>(device))->reset_statistics());
return new CORBA::Any();
}
......@@ -377,7 +377,7 @@ CORBA::Any *ResetStatisticsClass::execute(Tango::DeviceImpl *device, TANGO_UNUSE
//--------------------------------------------------------
CORBA::Any *StopNewClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "StopNewClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "StopNewClass::execute(): arrived" << endl;
((static_cast<AlarmHandler *>(device))->stop_new());
return new CORBA::Any();
}
......@@ -395,7 +395,7 @@ CORBA::Any *StopNewClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const
//--------------------------------------------------------
CORBA::Any *GetAlarmInfoClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "GetAlarmInfoClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "GetAlarmInfoClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
return insert((static_cast<AlarmHandler *>(device))->get_alarm_info(argin));
......@@ -414,7 +414,7 @@ CORBA::Any *GetAlarmInfoClass::execute(Tango::DeviceImpl *device, const CORBA::A
//--------------------------------------------------------
CORBA::Any *ReLoadAllClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "ReLoadAllClass::execute(): arrived" << endl;
TANGO_LOG_INFO << "ReLoadAllClass::execute(): arrived" << endl;
((static_cast<AlarmHandler *>(device))->re_load_all());
return new CORBA::Any();
}
......@@ -784,7 +784,7 @@ void AlarmHandlerClass::device_factory(const Tango::DevVarStringArray *devlist_p
// Create devices and add it into the device list
for (unsigned long i=0 ; i<devlist_ptr->length() ; i++)
{
cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl;
TANGO_LOG_DEBUG << "Device name : " << (*devlist_ptr)[i].in() << endl;
device_list.push_back(new AlarmHandler(this, (*devlist_ptr)[i]));
}
......@@ -1432,7 +1432,7 @@ void AlarmHandlerClass::create_static_attribute_list(vector<Tango::Attr *> &att_
defaultAttList.push_back(att_name);
}
cout2 << defaultAttList.size() << " attributes in default list" << endl;
TANGO_LOG_INFO << defaultAttList.size() << " attributes in default list" << endl;
/*----- PROTECTED REGION ID(AlarmHandlerClass::create_static_att_list) ENABLED START -----*/
......@@ -1468,7 +1468,7 @@ void AlarmHandlerClass::erase_dynamic_attributes(const Tango::DevVarStringArray
vector<string>::iterator ite_str = find(defaultAttList.begin(), defaultAttList.end(), att_name);
if (ite_str == defaultAttList.end())
{
cout2 << att_name << " is a UNWANTED dynamic attribute for device " << (*devlist_ptr)[i] << endl;
TANGO_LOG_INFO << att_name << " is a UNWANTED dynamic attribute for device " << (*devlist_ptr)[i] << endl;
Tango::Attribute &att = dev->get_device_attr()->get_attr_by_name(att_name.c_str());
dev->remove_attribute(att_list[att.get_attr_idx()], true, false);
--ite_att;
......
......@@ -37,7 +37,7 @@
#ifndef AlarmHandlerClass_H
#define AlarmHandlerClass_H
#include <tango.h>
#include <tango/tango.h>
#include <AlarmHandler.h>
......
......@@ -32,7 +32,7 @@
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <tango.h>
#include <tango/tango.h>
#include <AlarmHandlerClass.h>
// Add class header files if needed
......
#ifndef _SUBSCRIBE_THREAD_H
#define _SUBSCRIBE_THREAD_H
#include <tango.h>
#include <eventconsumer.h>
#include <tango/tango.h>
#include <stdint.h>
#include "event_table.h"
......
......@@ -14,7 +14,7 @@ static const char __FILE__rev[] = __FILE__ " $Revision: 1.7 $";
*/
alarm_thread::alarm_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p)
{
//cout << __FILE__rev << endl;
//TANGO_LOG << __FILE__rev << endl;
}
/*
......@@ -136,5 +136,5 @@ void alarm_thread::run(void *)
printf("alarm_thread::run(): catched unknown exception!!");
}
}
//cout << "alarm_thread::run(): returning" << endl;
//TANGO_LOG << "alarm_thread::run(): returning" << endl;
} /* alarm_thread::run() */
......@@ -10,7 +10,7 @@
#define ALARM_THREAD_H
#include <omnithread.h>
#include <tango.h>
#include <tango/tango.h>
#include <AlarmHandler.h>
#define ALARM_THREAD_EXIT "alarm_thread_exit"
......
......@@ -7,7 +7,7 @@
*/
#include <sys/time.h>
#include <tango.h>
#include <tango/tango.h>
#include "alarm_table.h"
#include "alarm_grammar.h"
#include "cmd_thread.h"
......@@ -940,7 +940,7 @@ void alarm_table::save_alarm_conf_db(const string &att_name, const string &name,
}
catch(Tango::DevFailed &e)
{
cout << __func__ << ": Exception saving configuration = " << e.errors[0].desc<<endl;
TANGO_LOG << __func__ << ": Exception saving configuration = " << e.errors[0].desc<<endl;
}
}
......@@ -988,7 +988,7 @@ void alarm_table::delete_alarm_conf_db(string att_name)
}
catch(Tango::DevFailed &e)
{
cout << __func__ << ": Exception deleting " << att_name << " = " << e.errors[0].desc<<endl;
TANGO_LOG << __func__ << ": Exception deleting " << att_name << " = " << e.errors[0].desc<<endl;
}
}
......@@ -1012,7 +1012,7 @@ void alarm_table::get_alarm_list_db(vector<string> &al_list, map<string, string>
}
catch(Tango::DevFailed &e)
{
cout << __func__ << ": Exception reading configuration = " << e.errors[0].desc<<endl;
TANGO_LOG << __func__ << ": Exception reading configuration = " << e.errors[0].desc<<endl;
}
savedlock->writerIn();
saved_alarms.clear();
......@@ -1067,7 +1067,7 @@ void alarm_table::get_alarm_list_db(vector<string> &al_list, map<string, string>
db_data[i] >> alm_receivers;
else
{
cout << "att_name="<<att_name<<" UNKWNOWN prop_name="<<prop_name<<endl;
TANGO_LOG << "att_name="<<att_name<<" UNKWNOWN prop_name="<<prop_name<<endl;
i++;
continue;
}
......@@ -1092,7 +1092,7 @@ void alarm_table::get_alarm_list_db(vector<string> &al_list, map<string, string>
KEY(ENABLED_KEY)<< alm_enabled;
if(alm_name.empty() || alm_formula.empty() || alm_level.empty() || alm_group.empty() || alm_message.empty()) //TODO: decide if all mandatory
{
cout << __func__ << ": skipped '" << alm.str() << "'" << endl;
TANGO_LOG << __func__ << ": skipped '" << alm.str() << "'" << endl;
continue;
}
al_list.push_back(alm.str());
......
......@@ -15,7 +15,7 @@
#include <string>
#include <map>
#include <tango.h>
#include <tango/tango.h>
//spirit defines have to be put befor first inclusion of spirit headers
#ifndef BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT
......@@ -45,7 +45,7 @@
//#include "log_thread.h"
#define LOG_STREAM cout
#define LOG_STREAM TANGO_LOG
using namespace std;
......@@ -102,10 +102,10 @@ struct rwlock_t
rwlock_t(string n){name=n;};
rwlock_t(){name=string("RWLOCK");};
boost::shared_mutex mut;
void readerIn(){cout<<name<<": " << __func__<<endl;mut.lock_shared();}
void readerOut(){cout<<name<<": " << __func__<<endl;mut.unlock_shared();}
void writerIn(){cout<<name<<": " << __func__<<endl;mut.lock();}
void writerOut(){cout<<name<<": " << __func__<<endl;mut.unlock();}
void readerIn(){TANGO_LOG<<name<<": " << __func__<<endl;mut.lock_shared();}
void readerOut(){TANGO_LOG<<name<<": " << __func__<<endl;mut.unlock_shared();}
void writerIn(){TANGO_LOG<<name<<": " << __func__<<endl;mut.lock();}
void writerOut(){TANGO_LOG<<name<<": " << __func__<<endl;mut.unlock();}
};
#endif
......
......@@ -14,8 +14,8 @@ static const char __FILE__rev[] = __FILE__ " $Revision: 1.3 $";
*/
cmd_thread::cmd_thread()
{
cout << __FILE__rev << endl;
cout << gettime().tv_sec << " cmd_thread::cmd_thread(): constructor... !" << endl;
TANGO_LOG << __FILE__rev << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::cmd_thread(): constructor... !" << endl;
//mutex_dp = new omni_mutex::omni_mutex();
}
......@@ -24,7 +24,7 @@ cmd_thread::cmd_thread()
*/
cmd_thread::~cmd_thread()
{
cout << gettime().tv_sec << " cmd_thread::~cmd_thread(): delete device entering..." << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::~cmd_thread(): delete device entering..." << endl;
//delete mutex_dp;
}
......@@ -44,13 +44,13 @@ void cmd_thread::run(void *)
switch(cmd.cmd_id)
{
case CMD_THREAD_EXIT:
cout << gettime().tv_sec << " cmd_thread::run(): received command THREAD_EXIT -> exiting..." << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run(): received command THREAD_EXIT -> exiting..." << endl;
return;
case CMD_COMMAND:
{
try {
cout << gettime().tv_sec << " cmd_thread::run(): COMMAND ... action=" << cmd.arg_s3 << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run(): COMMAND ... action=" << cmd.arg_s3 << endl;
dp = (Tango::DeviceProxy *)cmd.dp_add;
if(cmd.arg_b)
{
......@@ -64,7 +64,7 @@ void cmd_thread::run(void *)
}
else
call_id = dp->command_inout_asynch(cmd.arg_s2);
cout << gettime().tv_sec << " cmd_thread::run() executed action: " << cmd.arg_s3 << " !!! call_id=" << call_id << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run() executed action: " << cmd.arg_s3 << " !!! call_id=" << call_id << endl;
/*cmd_t arg;
arg.cmd_id = CMD_RESPONSE;
arg.call_id = call_id;
......@@ -83,11 +83,11 @@ void cmd_thread::run(void *)
if(err.find("is not yet arrived") == string::npos) //TODO: change this!!
{
out_stream << "Failed to execute action " << cmd.arg_s3 << ", err=" << e.errors[0].desc << ends;
cout << gettime().tv_sec << " cmd_thread::run() ERROR: " << out_stream.str() << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run() ERROR: " << out_stream.str() << endl;
}
else
{
cout << gettime().tv_sec << " cmd_thread::run() exception 'is not yet arrived': pushing request of response, call_id=" << call_id << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run() exception 'is not yet arrived': pushing request of response, call_id=" << call_id << endl;
cmd.cmd_id = CMD_RESPONSE; //if no exception till now push in list request of response
cmd.call_id = call_id; //if no exception till now push in list request of response
list.push_back(cmd); //if no exception till now push in list request of response
......@@ -99,12 +99,12 @@ void cmd_thread::run(void *)
case CMD_RESPONSE:
{
//cout << gettime().tv_sec << " cmd_thread::run(): RESPONSE WAKE UP... action=" << cmd.arg_s3 << " call_id=" << cmd.call_id << endl;
//TANGO_LOG << gettime().tv_sec << " cmd_thread::run(): RESPONSE WAKE UP... action=" << cmd.arg_s3 << " call_id=" << cmd.call_id << endl;
Tango::DeviceData resp;
dp = (Tango::DeviceProxy *)cmd.dp_add;
try {
resp = dp->command_inout_reply(cmd.call_id);
cout << gettime().tv_sec << " cmd_thread::run() RECEIVED response to action " << cmd.arg_s3 << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run() RECEIVED response to action " << cmd.arg_s3 << endl;
} catch(Tango::DevFailed &e)
{
TangoSys_MemStream out_stream;
......@@ -118,7 +118,7 @@ void cmd_thread::run(void *)
}
else
{
cout << gettime().tv_sec << " cmd_thread::run() " << out_stream.str() << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run() " << out_stream.str() << endl;
Tango::Except::print_exception(e);
}
}
......@@ -127,19 +127,19 @@ void cmd_thread::run(void *)
}
/* if(cmd.arg_s == CMD_THREAD_EXIT)
{
cout << gettime().tv_sec << " cmd_thread::run(): received command THREAD_EXIT -> exiting..." << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run(): received command THREAD_EXIT -> exiting..." << endl;
return;
}
else
{
cout << gettime().tv_sec << " cmd_thread::run(): WAKE UP... action=" << cmd.arg_s << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run(): WAKE UP... action=" << cmd.arg_s << endl;
Tango::DeviceData resp;
dp = (Tango::DeviceProxy *)cmd.dp_add;
try {
mutex_dp->lock();
resp = dp->command_inout_reply(cmd.cmd_id);
mutex_dp->unlock();
cout << gettime().tv_sec << " cmd_thread::run() received response to action " << cmd.arg_s << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run() received response to action " << cmd.arg_s << endl;
} catch(Tango::DevFailed &e)
{
TangoSys_MemStream out_stream;
......@@ -152,7 +152,7 @@ void cmd_thread::run(void *)
omni_thread::sleep(0,300000000); //0.2 s
}
else
cout << gettime().tv_sec << " cmd_thread::run() " << out_stream.str() << endl;
TANGO_LOG << gettime().tv_sec << " cmd_thread::run() " << out_stream.str() << endl;
}
}*/
......@@ -178,7 +178,7 @@ void cmd_thread::run(void *)
printf("cmd_thread::run(): catched unknown exception!!");
}
}
//cout << "alarm_thread::run(): returning" << endl;
//TANGO_LOG << "alarm_thread::run(): returning" << endl;
} /* cmd_thread::run() */
/*
......@@ -188,7 +188,7 @@ void cmd_list::push_back(cmd_t& cmd)
{
this->lock();
//cout << "cmd_list::push_back: cmd_id=" << cmd.cmd_id << " call_id=" << cmd.call_id << endl;
//TANGO_LOG << "cmd_list::push_back: cmd_id=" << cmd.cmd_id << " call_id=" << cmd.call_id << endl;
try{
l_cmd.push_back(cmd);
empty.signal();
......@@ -255,7 +255,7 @@ const cmd_t cmd_list::pop_front(void)
/*const*/ cmd_t cmd;
cmd = *(l_cmd.begin());
//cout << "cmd_list::pop_front: " << e.name << " value=" << e.value[0] << endl;
//TANGO_LOG << "cmd_list::pop_front: " << e.name << " value=" << e.value[0] << endl;
l_cmd.pop_front();
this->unlock();
......
......@@ -19,7 +19,7 @@
#define CMD_THREAD_EXIT 3
#include <omnithread.h>
#include <tango.h>
#include <tango/tango.h>
#include "AlarmHandler.h"
struct cmd_t
......
......@@ -7,13 +7,11 @@
*/
#include <sys/time.h>
#include <tango.h>
#include <tango/tango.h>
#include "event_table.h"
#include "AlarmHandler.h"
#include "alarm_grammar.h"
//for get_event_system_for_event_id, to know if ZMQ
#include <eventconsumer.h>
#include <regex>
static const char __FILE__rev[] = __FILE__ " $Revision: 1.5 $";
......@@ -147,7 +145,7 @@ void alarm_list::pop(const string& a)
if(it != l_alarm.end())
l_alarm.erase(it);
else
cout << "alarm_list::"<<__func__<< ": ALARM '"<< a << "' NOT FOUND!"<< endl;
TANGO_LOG << "alarm_list::"<<__func__<< ": ALARM '"<< a << "' NOT FOUND!"<< endl;
l.unlock();
return;
......@@ -387,7 +385,7 @@ void event_table::free_proxy(void)
}
}
void event_table::subscribe(EventCallBack& ecb) throw(vector<string> &)//throw(string&)
void event_table::subscribe(EventCallBack& ecb)
{
vector<string> subscribe_error;
if (v_event.empty() == false) {
......@@ -411,7 +409,7 @@ void event_table::subscribe(EventCallBack& ecb) throw(vector<string> &)//throw(s
throw subscribe_error;
}
void event_table::unsubscribe(void) throw(string&)
void event_table::unsubscribe(void)
{
ostringstream o;
if (v_event.empty() == false) {
......@@ -1264,7 +1262,7 @@ void EventCallBack::push_event(Tango::EventData* ev)
try {
//e.errors = ev->errors;
e.quality = Tango::ATTR_VALID;
//cout << "EVENT="<<ev->attr_name<<" quality="<<e.quality<<endl;
//TANGO_LOG << "EVENT="<<ev->attr_name<<" quality="<<e.quality<<endl;
if (!ev->err) {
e.quality = (int)ev->attr_value->get_quality();
#if 0//TANGO_VER >= 711
......
......@@ -13,7 +13,7 @@
#include <string>
#include <map>
#include <atomic>
#include <tango.h>
#include <tango/tango.h>
using namespace std;
......@@ -154,8 +154,8 @@ class event_table : public Tango::TangoMonitor, public Tango::LogAdapter {
#if 0
void init_proxy(void) throw(vector<string> &);
void free_proxy(void);
void subscribe(EventCallBack& ecb) throw(vector<string> &);//throw(string&);
void unsubscribe(void) throw(string&);
void subscribe(EventCallBack& ecb);
void unsubscribe(void);
#endif
/**
* Add a new signal.
......
......@@ -31,7 +31,7 @@
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <tango.h>
#include <tango/tango.h>
// Check if crash reporting is used.
#if defined(ENABLE_CRASH_REPORT)
......@@ -43,8 +43,15 @@
DECLARE_CRASH_HANDLER;
#ifndef TANGO_LOG
#define TANGO_LOG cout
#endif
int main(int argc,char *argv[])
{
using std::endl;
using std::bad_alloc;
INSTALL_CRASH_HANDLER
try
{
......@@ -59,20 +66,20 @@ int main(int argc,char *argv[])
// Run the endless loop
//----------------------------------------
cout << "Ready to accept request" << endl;
TANGO_LOG << "Ready to accept request" << endl;
tg->server_run();
}
catch (bad_alloc &)
{
cout << "Can't allocate memory to store device object !!!" << endl;
cout << "Exiting" << endl;
TANGO_LOG << "Can't allocate memory to store device object !!!" << endl;
TANGO_LOG << "Exiting" << endl;
}
catch (CORBA::Exception &e)
{
Tango::Except::print_exception(e);
cout << "Received a CORBA_Exception" << endl;
cout << "Exiting" << endl;
TANGO_LOG << "Received a CORBA_Exception" << endl;
TANGO_LOG << "Exiting" << endl;
}
Tango::Util::instance()->server_cleanup();
return(0);
......
......@@ -10,7 +10,7 @@ static const char __FILE__rev[] = __FILE__ " $Revision: 1.2 $";
*/
update_thread::update_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p),Tango::LogAdapter(p)
{
//cout << __FILE__rev << endl;
//TANGO_LOG << __FILE__rev << endl;
}
/*
......
......@@ -6,7 +6,7 @@
#define UPDATE_THREAD_H
#include <omnithread.h>
#include <tango.h>
#include <tango/tango.h>
#include <AlarmHandler.h>
class update_thread : public omni_thread, public Tango::TangoMonitor, public Tango::LogAdapter {
......
......@@ -80,7 +80,7 @@ set_target_properties(testdevice
PROPERTIES
OUTPUT_NAME ${DEV_NAME}
LINK_FLAGS "-Wl,--no-undefined"
CXX_STANDARD 11)
CXX_STANDARD 17)
target_compile_options(testdevice
PRIVATE "$<$<CONFIG:DEBUG>:-g>")
......