Commit 185100b8 authored by Alessandro Abrami's avatar Alessandro Abrami

2020/08/13:

	Tolti gli ultimi mem leak, aggiunte stampe dbg via ifdef
parent 530b6154
......@@ -4,8 +4,10 @@ EXTRAFLAGS =
#CXXFLAGS =
#CXXFLAGS += -D_DBG_INIT_DEVICE
#CXXFLAGS += -D_DBG_DB
#CXXFLAGS += -D_DBG_REINIT_DEVICE
#CXXFLAGS += -D_DBG_UPDATER
#CXXFLAGS += -D_DBG_REMOVE_DYN_ATTRS
##----------------------------------------------------------------------------
#
......
......@@ -124,6 +124,12 @@ void AxisG2Mps::delete_device()
if ( *attr_MPSHeartBeat_read ) delete[] *attr_MPSHeartBeat_read;
nick2idx_ro.clear();
vector<string>::iterator it;
for (it=MPSBit_dynAttr.begin(); it!= MPSBit_dynAttr.end(); ++it){
remove_MPSBit_dynamic_attribute(*it);
}
MPSBit_dynAttr.clear();
for (int i=0; i<100; i++){
if (attr_ExtStatus_read[i] != NULL){
delete[] attr_ExtStatus_read[i];
......@@ -132,6 +138,11 @@ void AxisG2Mps::delete_device()
}
name2idx_mpsdata.clear();
for (it=MPSRange_dynAttr.begin(); it!= MPSRange_dynAttr.end(); ++it){
remove_MPSRange_dynamic_attribute(*it);
}
MPSRange_dynAttr.clear();
/*----- PROTECTED REGION END -----*/ // AxisG2Mps::delete_device
delete[] attr_MPSStatus_read;
......@@ -155,7 +166,9 @@ void AxisG2Mps::init_device()
// Initialization before get_device_property() call
Tango::Database *db = Tango::Util::instance()->get_database();
cout << db->get_info() << endl;
#ifdef _DBG_DB
cout << db->get_info() << endl;
#endif
/*----- PROTECTED REGION END -----*/ // AxisG2Mps::init_device_before
......@@ -199,15 +212,15 @@ void AxisG2Mps::init_device()
try {
dp = new Tango::DeviceProxy(driver);
cout << "connected to: " << driver << endl;
cout << device_name << " connected to: " << driver << endl;
} catch(Tango::DevFailed &e) {
string ss( e.errors[0].desc );
cout << ss << endl;
cout << device_name << " " << ss << endl;
append_status(ss, true);
init_device_ok &= false;
} catch (...) {
string ss("Exception on Tango::DeviceProxy(" + driver + ")!");
cout << ss << endl;
cout << device_name << " " << ss << endl;
append_status(ss, true);
init_device_ok &= false;
};
......@@ -317,6 +330,7 @@ void AxisG2Mps::init_device()
mpsdata[mapOfAxis[ch]].per = per;
mpsdata[mapOfAxis[ch]].peo = peo;
cout << device_name << " ";
cout << "db_data.size()=" << db_data.size() << " ";
cout << "ch? " << (db_data[0].is_empty()?"empty":"data") << " ";
cout << "per? " << (db_data[1].is_empty()?"empty":"data") << " ";
......@@ -325,12 +339,13 @@ void AxisG2Mps::init_device()
cout << *axisDit << " ch= " << ch << " per= " << per << " peo= " << peo << endl;
}
} catch (...) {
cout << " ERR DB " << endl;
cout << device_name << " " << " ERR DB " << endl;
}
for (int j = 0; j < 8 ; j++ ) {
if ( (mpsdata[j].axis != -1) && (mpsdata[j].axis < 8) ){
cout << endl;
cout << device_name << endl;
cout << "mpsdata[" << j << "].axis : " << AxisNames[mpsdata[j].axis] << endl;
cout << "mpsdata[" << j << "].No_of_Intervals : " << mpsdata[j].No_of_Intervals << endl;
cout << "mpsdata[" << j << "].per : " << mpsdata[j].per << endl;
......@@ -356,6 +371,7 @@ void AxisG2Mps::init_device()
// MYCODE-END
cout << device_name << ": END of INIT" << endl << endl;
/*----- PROTECTED REGION END -----*/ // AxisG2Mps::init_device
}
......@@ -768,6 +784,7 @@ void AxisG2Mps::add_dynamic_attributes()
for ( it = bits_ro.begin(); it != bits_ro.end(); it ++ ){
add_MPSBit_dynamic_attribute((*it).nickname);
MPSBit_dynAttr.push_back((*it).nickname);
}
stringstream att_name;
......@@ -778,6 +795,7 @@ void AxisG2Mps::add_dynamic_attributes()
att_name.str("");
att_name << "MPS" << AxisNames[mpsdata[j].axis];
att_name << "Range_" << 1+std::distance(mpsdata[j].MpsInterval.begin(), mpsit);
MPSRange_dynAttr.push_back(att_name.str());
add_MPSRange_dynamic_attribute(att_name.str());
Attr_MpsInterval_t amps;
amps.axis = mpsdata[j].axis;
......@@ -786,12 +804,12 @@ void AxisG2Mps::add_dynamic_attributes()
string s(att_name.str());
Tango::DevString *att_value = get_MPSRange_data_ptr(s);
//cout << "!" << *att_value << "!" << strlen(*att_value) << endl;
//cout << "!" << att_value[0] << "!" << strlen(att_value[0]) << endl;
att_value[0] = CORBA::string_dup(" z;z ");
}
}
}
/*----- PROTECTED REGION END -----*/ // AxisG2Mps::add_dynamic_attributes
}
......
......@@ -77,9 +77,11 @@ private:
vector<bit_t> bits_ro;
map<string, int> nick2idx_ro;
vector<string> MPSBit_dynAttr;
MpsData_t mpsdata[8];
map<string, Attr_MpsInterval_t> name2idx_mpsdata;
vector<string> MPSRange_dynAttr;
/*----- PROTECTED REGION END -----*/ // AxisG2Mps::Data Members
......
......@@ -112,6 +112,10 @@ void AxisG2Mps::remove_MPSRange_dynamic_attribute(string attname)
if ((ite=MPSRange_data.find(attname))!=MPSRange_data.end())
{
/*----- PROTECTED REGION ID(AxisG2Mps::remove_MPSRange_dynamic_attribute) ENABLED START -----*/
#ifdef _DBG_REMOVE_DYN_ATTRS
cout << device_name << " ============= remove_MPSRange_dynamic_attribute ============== " << attname << endl;
#endif
if (ite->second) CORBA::string_free(ite->second);
/*----- PROTECTED REGION END -----*/ // AxisG2Mps::remove_MPSRange_dynamic_attribute
MPSRange_data.erase(ite);
......@@ -169,6 +173,9 @@ void AxisG2Mps::remove_MPSBit_dynamic_attribute(string attname)
if ((ite=MPSBit_data.find(attname))!=MPSBit_data.end())
{
/*----- PROTECTED REGION ID(AxisG2Mps::remove_MPSBit_dynamic_attribute) ENABLED START -----*/
#ifdef _DBG_REMOVE_DYN_ATTRS
cout << device_name << " ============= remove_MPSBit_dynamic_attribute ============== " << attname << endl;
#endif
/*----- PROTECTED REGION END -----*/ // AxisG2Mps::remove_MPSBit_dynamic_attribute
MPSBit_data.erase(ite);
......
......@@ -10,6 +10,7 @@ long AxisG2Mps::RW(string query){
data = CORBA::string_dup(query.c_str());
Din << data;
CORBA::string_free(data);
try {
Dout = dp->command_inout("WriteRead", Din);
......
......@@ -14,8 +14,9 @@ bool AxisG2Mps::readBit(short bit, bool rw){
else ss << "MG @IN[" << bit << "]";
data = CORBA::string_dup(ss.str().c_str());
Din << data;
CORBA::string_free(data);
try {
Dout = dp->command_inout("WriteRead", Din);
//cout << Dout << endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment