From 1275bf13e4fc02f644d841021cdcfe40b7695e95 Mon Sep 17 00:00:00 2001 From: Giulio Gaio <giulio.gaio@elettra.eu> Date: Tue, 2 May 2023 21:42:35 +0200 Subject: [PATCH] Clean debug code --- src/DataVampire.cpp | 144 +++++++++++++++++--------------- src/DataVampire.h | 23 ++--- src/DataVampire.xmi | 4 +- src/DataVampireClass.cpp | 90 ++++++++++---------- src/DataVampireClass.h | 28 +++---- src/DataVampireStateMachine.cpp | 42 +++++----- 6 files changed, 170 insertions(+), 161 deletions(-) diff --git a/src/DataVampire.cpp b/src/DataVampire.cpp index 90986fc..d18d6c3 100644 --- a/src/DataVampire.cpp +++ b/src/DataVampire.cpp @@ -82,8 +82,8 @@ // CacheSize | Tango::DevLong Scalar // AutoBackgroundSamples | Tango::DevLong Scalar // PostAcqRoi | Tango::DevBoolean Scalar -// ImageWidth | Tango::DevLong Scalar -// ImageHeight | Tango::DevLong Scalar +// Width | Tango::DevLong Scalar +// Height | Tango::DevLong Scalar // RoiParam | Tango::DevLong Spectrum ( max = 4) // Spectrum | Tango::DevDouble Spectrum ( max = 1000000) // HorBackground | Tango::DevDouble Spectrum ( max = 1000000) @@ -149,6 +149,11 @@ void DataVampire::delete_device() /* clang-format on */ // Delete device allocated objects /* clang-format off */ + if (attr_CommandString_read) { + delete [] *attr_CommandString_read; + attr_CommandString_read = 0; + } + if (device) delete device; @@ -171,8 +176,8 @@ void DataVampire::delete_device() delete[] attr_CacheSize_read; delete[] attr_AutoBackgroundSamples_read; delete[] attr_PostAcqRoi_read; - delete[] attr_ImageWidth_read; - delete[] attr_ImageHeight_read; + delete[] attr_Width_read; + delete[] attr_Height_read; delete[] attr_RoiParam_read; delete[] attr_Spectrum_read; delete[] attr_HorBackground_read; @@ -215,8 +220,8 @@ void DataVampire::init_device() attr_CacheSize_read = new Tango::DevLong[1]; attr_AutoBackgroundSamples_read = new Tango::DevLong[1]; attr_PostAcqRoi_read = new Tango::DevBoolean[1]; - attr_ImageWidth_read = new Tango::DevLong[1]; - attr_ImageHeight_read = new Tango::DevLong[1]; + attr_Width_read = new Tango::DevLong[1]; + attr_Height_read = new Tango::DevLong[1]; attr_RoiParam_read = new Tango::DevLong[4]; attr_Spectrum_read = new Tango::DevDouble[1000000]; attr_HorBackground_read = new Tango::DevDouble[1000000]; @@ -227,6 +232,8 @@ void DataVampire::init_device() // Initialize device /* clang-format off */ + *attr_CommandString_read = new char[DATAVAMPIRE_MAX_STR_LEN]; + *attr_AutoBackgroundSamples_read = 0; *attr_MinThreshold_read = -99999; *attr_MaxThreshold_read = 99999; @@ -260,7 +267,7 @@ void DataVampire::init_device() Tango::CommandInfo cmd_info = device->command_query(command_name); cmd_in_type = cmd_info.in_type; cmd_out_type = cmd_info.out_type; - + snprintf(*attr_CommandString_read, DATAVAMPIRE_MAX_STR_LEN, "%s", new_configuration.c_str()); cache_buffer = 0; allocate_cache_buffer(); @@ -525,6 +532,28 @@ void DataVampire::write_CommandString(Tango::WAttribute &attr) /*----- PROTECTED REGION ID(DataVampire::write_CommandString) ENABLED START -----*/ /* clang-format on */ // Add your own code + std::vector<std::string> results; + std::string new_configuration(w_val); + string_explode(new_configuration, "/", &results); + + command_name = results[results.size()-1]; + size_t pos = new_configuration.find(command_name); + if (pos != std::string::npos) { // if str2 found in str1 + new_configuration.erase(pos-1, command_name.length()+1); // erase str2 from str1 + } + device_name = new_configuration; + + if (device) + delete device; + device = new Tango::DeviceProxy(device_name); + + Tango::CommandInfo cmd_info = device->command_query(command_name); + cmd_in_type = cmd_info.in_type; + cmd_out_type = cmd_info.out_type; + + snprintf(*attr_CommandString_read, DATAVAMPIRE_MAX_STR_LEN, "%s", new_configuration.c_str()); + store_command_string(w_val); + /* clang-format off */ /*----- PROTECTED REGION END -----*/ // DataVampire::write_CommandString } @@ -913,83 +942,79 @@ void DataVampire::write_PostAcqRoi(Tango::WAttribute &attr) } //-------------------------------------------------------- /** - * Read attribute ImageWidth related method + * Read attribute Width related method * Description: * * Data type: Tango::DevLong * Attr type: Scalar */ //-------------------------------------------------------- -void DataVampire::read_ImageWidth(Tango::Attribute &attr) +void DataVampire::read_Width(Tango::Attribute &attr) { - DEBUG_STREAM << "DataVampire::read_ImageWidth(Tango::Attribute &attr) entering... " << endl; - /*----- PROTECTED REGION ID(DataVampire::read_ImageWidth) ENABLED START -----*/ - /* clang-format on */ + DEBUG_STREAM << "DataVampire::read_Width(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(DataVampire::read_Width) ENABLED START -----*/ // Set the attribute value - attr.set_value(attr_ImageWidth_read); - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::read_ImageWidth + attr.set_value(attr_Width_read); + + /*----- PROTECTED REGION END -----*/ // DataVampire::read_Width } //-------------------------------------------------------- /** - * Write attribute ImageWidth related method + * Write attribute Width related method * Description: * * Data type: Tango::DevLong * Attr type: Scalar */ //-------------------------------------------------------- -void DataVampire::write_ImageWidth(Tango::WAttribute &attr) +void DataVampire::write_Width(Tango::WAttribute &attr) { - DEBUG_STREAM << "DataVampire::write_ImageWidth(Tango::WAttribute &attr) entering... " << endl; + DEBUG_STREAM << "DataVampire::write_Width(Tango::WAttribute &attr) entering... " << endl; // Retrieve write value Tango::DevLong w_val; attr.get_write_value(w_val); - /*----- PROTECTED REGION ID(DataVampire::write_ImageWidth) ENABLED START -----*/ - /* clang-format on */ - // Add your own code - /* clang-format off */ - *attr_ImageWidth_read = w_val; - - /*----- PROTECTED REGION END -----*/ // DataVampire::write_ImageWidth + /*----- PROTECTED REGION ID(DataVampire::write_Width) ENABLED START -----*/ + *attr_Width_read = w_val; + + /*----- PROTECTED REGION END -----*/ // DataVampire::write_Width } //-------------------------------------------------------- /** - * Read attribute ImageHeight related method + * Read attribute Height related method * Description: * * Data type: Tango::DevLong * Attr type: Scalar */ //-------------------------------------------------------- -void DataVampire::read_ImageHeight(Tango::Attribute &attr) +void DataVampire::read_Height(Tango::Attribute &attr) { - DEBUG_STREAM << "DataVampire::read_ImageHeight(Tango::Attribute &attr) entering... " << endl; - /*----- PROTECTED REGION ID(DataVampire::read_ImageHeight) ENABLED START -----*/ + DEBUG_STREAM << "DataVampire::read_Height(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(DataVampire::read_Height) ENABLED START -----*/ // Set the attribute value - attr.set_value(attr_ImageHeight_read); + attr.set_value(attr_Height_read); - /*----- PROTECTED REGION END -----*/ // DataVampire::read_ImageHeight + /*----- PROTECTED REGION END -----*/ // DataVampire::read_Height } //-------------------------------------------------------- /** - * Write attribute ImageHeight related method + * Write attribute Height related method * Description: * * Data type: Tango::DevLong * Attr type: Scalar */ //-------------------------------------------------------- -void DataVampire::write_ImageHeight(Tango::WAttribute &attr) +void DataVampire::write_Height(Tango::WAttribute &attr) { - DEBUG_STREAM << "DataVampire::write_ImageHeight(Tango::WAttribute &attr) entering... " << endl; + DEBUG_STREAM << "DataVampire::write_Height(Tango::WAttribute &attr) entering... " << endl; // Retrieve write value Tango::DevLong w_val; attr.get_write_value(w_val); - /*----- PROTECTED REGION ID(DataVampire::write_ImageHeight) ENABLED START -----*/ - *attr_ImageHeight_read = w_val; + /*----- PROTECTED REGION ID(DataVampire::write_Height) ENABLED START -----*/ + *attr_Height_read = w_val; - /*----- PROTECTED REGION END -----*/ // DataVampire::write_ImageHeight + /*----- PROTECTED REGION END -----*/ // DataVampire::write_Height } //-------------------------------------------------------- /** @@ -1506,8 +1531,6 @@ void DataVampire::cmd_extract_values(Tango::DeviceData *cmd_value, std::vector<d } else { - printf("AZZ\n"); - std::ostringstream o; o << "unknown type" << std::ends; throw o.str(); @@ -1993,10 +2016,6 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, int32_t wave_size = val.size() / num_samples; - printf("rows=%d cols=%d valsize=%d num_samples=%d\n",num_rows,num_cols,val.size(),num_samples); - - printf("GGT1\n"); - if (((num_cols * num_rows * num_samples) != val.size()) && (*attr_PostAcqRoi_read == false)) { Tango::Except::throw_exception ( (const char *)"Failed to store data", @@ -2004,8 +2023,6 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, __FUNCTION__); } - printf("GGT3\n"); - // reallocate buffer if (val.size() != cache_buffer[cache_idx].data_size) { cache_buffer[cache_idx].databuf = (double *)realloc(cache_buffer[cache_idx].databuf, val.size() * sizeof(double)); @@ -2022,8 +2039,6 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, cache_buffer[cache_idx].validvalues = (double *)realloc(cache_buffer[cache_idx].validvalues, num_samples * sizeof(double)); } - printf("GGT4\n"); - if (*attr_PostAcqRoi_read == false) { for (int i = 0; i < cache_buffer[cache_idx].data_size; i++) { cache_buffer[cache_idx].databuf[i] = val[i]; @@ -2041,16 +2056,16 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, for (int i = 0; i < num_samples; i++) { int offset = wave_size * i; - printf("num_samples = %d, wave_size = %d offset = %d val.size=%d\n",num_samples, wave_size, offset, val.size()); + //printf("num_samples = %d, wave_size = %d offset = %d val.size=%d\n",num_samples, wave_size, offset, val.size()); double *data = &val[offset]; // ImageWidth must be defined because command_inout does not report the Image width/length values - if ((*attr_ImageWidth_read > 0) && (roi_dim == 4)) { + if ((*attr_Width_read > 0) && (roi_dim == 4)) { for (int j = roi[1]; j <= roi[3]; j++) { for (int k = roi[0]; k <= roi[2]; k++) { - //cache_buffer[cache_idx].databuf[cnt] = data[j * *attr_ImageWidth_read + k]; - cache_buffer[cache_idx].databuf[cnt] = k; - if ((data[j * *attr_ImageWidth_read + k] >= *attr_MinThreshold_read) || - (data[j * *attr_ImageWidth_read + k] <= *attr_MaxThreshold_read)) + cache_buffer[cache_idx].databuf[cnt] = data[j * *attr_Width_read + k]; + //cache_buffer[cache_idx].databuf[cnt] = k; + if ((data[j * *attr_Width_read + k] >= *attr_MinThreshold_read) || + (data[j * *attr_Width_read + k] <= *attr_MaxThreshold_read)) cache_buffer[cache_idx].datavalid[cnt] = true; else cache_buffer[cache_idx].datavalid[cnt] = false; @@ -2061,7 +2076,7 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, } } else if (roi_dim == 2) { - printf("roi0 = %d roi1 = %d\n",roi[0],roi[1]); + //printf("roi0 = %d roi1 = %d\n",roi[0],roi[1]); for (int k = roi[0]; k <= roi[1]; k++) { cache_buffer[cache_idx].databuf[cnt] = data[k]; @@ -2086,6 +2101,8 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, num_rows_image = num_rows; num_cols_image = num_cols; } + + /* performed in process_1D else if (num_rows == 1) { for (int i = 0; i < num_cols; i++) { @@ -2094,11 +2111,6 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, num_cols_spectrum = num_cols; }*/ - - - - printf("GGT5 num_cols=%d\n", num_cols); - cache_buffer[cache_idx].bn_start = bn_start; cache_buffer[cache_idx].bn_end = bn_end; cache_buffer[cache_idx].num_samples = num_samples; @@ -2117,13 +2129,9 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, else if (cache_buffer[cache_idx].num_rows > 1) { process_2D(cache_idx, *attr_AutoBackgroundSamples_read); } - - printf("GGT6\n"); *rec_data = &cache_buffer[cache_idx]; - printf("GGT7\n"); - cache_idx++; if (cache_idx >= *attr_CacheSize_read) cache_idx = 0; @@ -2184,17 +2192,17 @@ void DataVampire::process_2D(int32_t cache_idx, int32_t auto_bck_samples) int idx = k*num_cols+j+wave_size*i; if (cache_buffer[cache_idx].datavalid[idx]) { ver_profile_bck[k] += cache_buffer[cache_idx].databuf[idx]; - printf("k=%d ver_bck=%f idx=%d \n",k,cache_buffer[cache_idx].databuf[idx],idx); + //printf("k=%d ver_bck=%f idx=%d \n",k,cache_buffer[cache_idx].databuf[idx],idx); ver_profile_bck_cnt[k]++; } //int idx2 = (num_rows-k-1)*num_cols-j+wave_size*i; int idx2 = idx + (num_cols - 1) - j; if (cache_buffer[cache_idx].datavalid[idx2]) { ver_profile_bck[k] += cache_buffer[cache_idx].databuf[idx2]; - printf("k=%d ver_bck=%f idx2=%d \n",k,cache_buffer[cache_idx].databuf[idx2],idx2); + //printf("k=%d ver_bck=%f idx2=%d \n",k,cache_buffer[cache_idx].databuf[idx2],idx2); ver_profile_bck_cnt[k]++; } - printf("k=%d ver_bck=%f ver_bck_cnt=%d idx=%d idx2=%d\n",k,ver_profile_bck[k],ver_profile_bck_cnt[k],idx,idx2); + //printf("k=%d ver_bck=%f ver_bck_cnt=%d idx=%d idx2=%d\n",k,ver_profile_bck[k],ver_profile_bck_cnt[k],idx,idx2); } } @@ -2287,7 +2295,7 @@ void DataVampire::process_2D(int32_t cache_idx, int32_t auto_bck_samples) } cache_buffer[cache_idx].sum[i] = total_sum; - printf("total sum %d = %f\n", cache_idx, cache_buffer[cache_idx].sum[i]); + cache_buffer[cache_idx].mean[i] = total_sum / (double)valid_values; cache_buffer[cache_idx].horpos[i] = hor_pos; cache_buffer[cache_idx].verpos[i] = ver_pos; @@ -2312,7 +2320,7 @@ void DataVampire::process_1D(int32_t cache_idx, int32_t auto_bck_samples) int32_t num_samples = cache_buffer[cache_idx].num_samples; int32_t data_size = cache_buffer[cache_idx].data_size; - printf("GG 1 process_1D cache_idx=%d num_cols=%d\n",cache_idx,cache_buffer[cache_idx].num_cols); + //printf("GG 1 process_1D cache_idx=%d num_cols=%d\n",cache_idx,cache_buffer[cache_idx].num_cols); // for spectrum display num_cols_spectrum = cache_buffer[cache_idx].num_cols; diff --git a/src/DataVampire.h b/src/DataVampire.h index 1c3adc9..f9f3ac6 100644 --- a/src/DataVampire.h +++ b/src/DataVampire.h @@ -40,6 +40,9 @@ #include <tango/tango.h> +#define DATAVAMPIRE_MAX_STR_LEN 256 + + /* clang-format off */ /*----- PROTECTED REGION END -----*/ // DataVampire.h @@ -127,8 +130,8 @@ public: Tango::DevLong *attr_CacheSize_read; Tango::DevLong *attr_AutoBackgroundSamples_read; Tango::DevBoolean *attr_PostAcqRoi_read; - Tango::DevLong *attr_ImageWidth_read; - Tango::DevLong *attr_ImageHeight_read; + Tango::DevLong *attr_Width_read; + Tango::DevLong *attr_Height_read; Tango::DevLong *attr_RoiParam_read; Tango::DevDouble *attr_Spectrum_read; Tango::DevDouble *attr_HorBackground_read; @@ -356,25 +359,25 @@ public: virtual void write_PostAcqRoi(Tango::WAttribute &attr); virtual bool is_PostAcqRoi_allowed(Tango::AttReqType type); /** - * Attribute ImageWidth related methods + * Attribute Width related methods * Description: * * Data type: Tango::DevLong * Attr type: Scalar */ - virtual void read_ImageWidth(Tango::Attribute &attr); - virtual void write_ImageWidth(Tango::WAttribute &attr); - virtual bool is_ImageWidth_allowed(Tango::AttReqType type); + virtual void read_Width(Tango::Attribute &attr); + virtual void write_Width(Tango::WAttribute &attr); + virtual bool is_Width_allowed(Tango::AttReqType type); /** - * Attribute ImageHeight related methods + * Attribute Height related methods * Description: * * Data type: Tango::DevLong * Attr type: Scalar */ - virtual void read_ImageHeight(Tango::Attribute &attr); - virtual void write_ImageHeight(Tango::WAttribute &attr); - virtual bool is_ImageHeight_allowed(Tango::AttReqType type); + virtual void read_Height(Tango::Attribute &attr); + virtual void write_Height(Tango::WAttribute &attr); + virtual bool is_Height_allowed(Tango::AttReqType type); /** * Attribute RoiParam related methods * Description: diff --git a/src/DataVampire.xmi b/src/DataVampire.xmi index 377c5b8..825420d 100644 --- a/src/DataVampire.xmi +++ b/src/DataVampire.xmi @@ -241,7 +241,7 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> - <attributes name="ImageWidth" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> + <attributes name="Width" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:IntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> @@ -249,7 +249,7 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="%d" maxValue="9999" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> - <attributes name="ImageHeight" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> + <attributes name="Height" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:IntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> diff --git a/src/DataVampireClass.cpp b/src/DataVampireClass.cpp index dffa77c..a3cdf68 100644 --- a/src/DataVampireClass.cpp +++ b/src/DataVampireClass.cpp @@ -924,55 +924,55 @@ void DataVampireClass::attribute_factory(vector<Tango::Attr *> &att_list) postacqroi->set_memorized_init(true); att_list.push_back(postacqroi); - // Attribute : ImageWidth - ImageWidthAttrib *imagewidth = new ImageWidthAttrib(); - Tango::UserDefaultAttrProp imagewidth_prop; - // description not set for ImageWidth - // label not set for ImageWidth - // unit not set for ImageWidth - // standard_unit not set for ImageWidth - // display_unit not set for ImageWidth - imagewidth_prop.set_format("%d"); - imagewidth_prop.set_max_value("9999"); - imagewidth_prop.set_min_value("0"); - // max_alarm not set for ImageWidth - // min_alarm not set for ImageWidth - // max_warning not set for ImageWidth - // min_warning not set for ImageWidth - // delta_t not set for ImageWidth - // delta_val not set for ImageWidth + // Attribute : Width + WidthAttrib *width = new WidthAttrib(); + Tango::UserDefaultAttrProp width_prop; + // description not set for Width + // label not set for Width + // unit not set for Width + // standard_unit not set for Width + // display_unit not set for Width + width_prop.set_format("%d"); + width_prop.set_max_value("9999"); + width_prop.set_min_value("0"); + // max_alarm not set for Width + // min_alarm not set for Width + // max_warning not set for Width + // min_warning not set for Width + // delta_t not set for Width + // delta_val not set for Width - imagewidth->set_default_properties(imagewidth_prop); + width->set_default_properties(width_prop); // Not Polled - imagewidth->set_disp_level(Tango::OPERATOR); - imagewidth->set_memorized(); - imagewidth->set_memorized_init(true); - att_list.push_back(imagewidth); - - // Attribute : ImageHeight - ImageHeightAttrib *imageheight = new ImageHeightAttrib(); - Tango::UserDefaultAttrProp imageheight_prop; - // description not set for ImageHeight - // label not set for ImageHeight - // unit not set for ImageHeight - // standard_unit not set for ImageHeight - // display_unit not set for ImageHeight - imageheight_prop.set_format("%d"); - imageheight_prop.set_max_value("9999"); - imageheight_prop.set_min_value("0"); - // max_alarm not set for ImageHeight - // min_alarm not set for ImageHeight - // max_warning not set for ImageHeight - // min_warning not set for ImageHeight - // delta_t not set for ImageHeight - // delta_val not set for ImageHeight + width->set_disp_level(Tango::OPERATOR); + width->set_memorized(); + width->set_memorized_init(true); + att_list.push_back(width); + + // Attribute : Height + HeightAttrib *height = new HeightAttrib(); + Tango::UserDefaultAttrProp height_prop; + // description not set for Height + // label not set for Height + // unit not set for Height + // standard_unit not set for Height + // display_unit not set for Height + height_prop.set_format("%d"); + height_prop.set_max_value("9999"); + height_prop.set_min_value("0"); + // max_alarm not set for Height + // min_alarm not set for Height + // max_warning not set for Height + // min_warning not set for Height + // delta_t not set for Height + // delta_val not set for Height - imageheight->set_default_properties(imageheight_prop); + height->set_default_properties(height_prop); // Not Polled - imageheight->set_disp_level(Tango::OPERATOR); - imageheight->set_memorized(); - imageheight->set_memorized_init(true); - att_list.push_back(imageheight); + height->set_disp_level(Tango::OPERATOR); + height->set_memorized(); + height->set_memorized_init(true); + att_list.push_back(height); // Attribute : RoiParam RoiParamAttrib *roiparam = new RoiParamAttrib(); diff --git a/src/DataVampireClass.h b/src/DataVampireClass.h index 1691c73..02f93e7 100644 --- a/src/DataVampireClass.h +++ b/src/DataVampireClass.h @@ -282,34 +282,34 @@ public: {return (static_cast<DataVampire *>(dev))->is_PostAcqRoi_allowed(ty);} }; -// Attribute ImageWidth class definition -class ImageWidthAttrib: public Tango::Attr +// Attribute Width class definition +class WidthAttrib: public Tango::Attr { public: - ImageWidthAttrib():Attr("ImageWidth", + WidthAttrib():Attr("Width", Tango::DEV_LONG, Tango::READ_WRITE) {}; - ~ImageWidthAttrib() {}; + ~WidthAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<DataVampire *>(dev))->read_ImageWidth(att);} + {(static_cast<DataVampire *>(dev))->read_Width(att);} virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) - {(static_cast<DataVampire *>(dev))->write_ImageWidth(att);} + {(static_cast<DataVampire *>(dev))->write_Width(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<DataVampire *>(dev))->is_ImageWidth_allowed(ty);} + {return (static_cast<DataVampire *>(dev))->is_Width_allowed(ty);} }; -// Attribute ImageHeight class definition -class ImageHeightAttrib: public Tango::Attr +// Attribute Height class definition +class HeightAttrib: public Tango::Attr { public: - ImageHeightAttrib():Attr("ImageHeight", + HeightAttrib():Attr("Height", Tango::DEV_LONG, Tango::READ_WRITE) {}; - ~ImageHeightAttrib() {}; + ~HeightAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<DataVampire *>(dev))->read_ImageHeight(att);} + {(static_cast<DataVampire *>(dev))->read_Height(att);} virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) - {(static_cast<DataVampire *>(dev))->write_ImageHeight(att);} + {(static_cast<DataVampire *>(dev))->write_Height(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<DataVampire *>(dev))->is_ImageHeight_allowed(ty);} + {return (static_cast<DataVampire *>(dev))->is_Height_allowed(ty);} }; // Attribute RoiParam class definition diff --git a/src/DataVampireStateMachine.cpp b/src/DataVampireStateMachine.cpp index 2edcc8b..ae46882 100644 --- a/src/DataVampireStateMachine.cpp +++ b/src/DataVampireStateMachine.cpp @@ -367,43 +367,41 @@ bool DataVampire::is_PostAcqRoi_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : DataVampire::is_ImageWidth_allowed() - * Description : Execution allowed for ImageWidth attribute + * Method : DataVampire::is_Width_allowed() + * Description : Execution allowed for Width attribute */ //-------------------------------------------------------- -bool DataVampire::is_ImageWidth_allowed(TANGO_UNUSED(Tango::AttReqType type)) +bool DataVampire::is_Width_allowed(TANGO_UNUSED(Tango::AttReqType type)) { - // Not any excluded states for ImageWidth attribute in Write access. - /*----- PROTECTED REGION ID(DataVampire::ImageWidthStateAllowed_WRITE) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::ImageWidthStateAllowed_WRITE + // Not any excluded states for Width attribute in Write access. + /*----- PROTECTED REGION ID(DataVampire::WidthStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::WidthStateAllowed_WRITE - // Not any excluded states for ImageWidth attribute in read access. - /*----- PROTECTED REGION ID(DataVampire::ImageWidthStateAllowed_READ) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::ImageWidthStateAllowed_READ + // Not any excluded states for Width attribute in read access. + /*----- PROTECTED REGION ID(DataVampire::WidthStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::WidthStateAllowed_READ return true; } //-------------------------------------------------------- /** - * Method : DataVampire::is_ImageHeight_allowed() - * Description : Execution allowed for ImageHeight attribute + * Method : DataVampire::is_Height_allowed() + * Description : Execution allowed for Height attribute */ //-------------------------------------------------------- -bool DataVampire::is_ImageHeight_allowed(TANGO_UNUSED(Tango::AttReqType type)) +bool DataVampire::is_Height_allowed(TANGO_UNUSED(Tango::AttReqType type)) { - // Not any excluded states for ImageHeight attribute in Write access. - /*----- PROTECTED REGION ID(DataVampire::ImageHeightStateAllowed_WRITE) ENABLED START -----*/ + // Not any excluded states for Height attribute in Write access. + /*----- PROTECTED REGION ID(DataVampire::HeightStateAllowed_WRITE) ENABLED START -----*/ - /*----- PROTECTED REGION END -----*/ // DataVampire::ImageHeightStateAllowed_WRITE + /*----- PROTECTED REGION END -----*/ // DataVampire::HeightStateAllowed_WRITE - // Not any excluded states for ImageHeight attribute in read access. - /*----- PROTECTED REGION ID(DataVampire::ImageHeightStateAllowed_READ) ENABLED START -----*/ + // Not any excluded states for Height attribute in read access. + /*----- PROTECTED REGION ID(DataVampire::HeightStateAllowed_READ) ENABLED START -----*/ - /*----- PROTECTED REGION END -----*/ // DataVampire::ImageHeightStateAllowed_READ + /*----- PROTECTED REGION END -----*/ // DataVampire::HeightStateAllowed_READ return true; } -- GitLab