diff --git a/cpp_test_suite/cpp_test_ds/DevTest.cpp b/cpp_test_suite/cpp_test_ds/DevTest.cpp index 8c6380589..c37375578 100644 --- a/cpp_test_suite/cpp_test_ds/DevTest.cpp +++ b/cpp_test_suite/cpp_test_ds/DevTest.cpp @@ -113,6 +113,7 @@ void DevTest::init_device() PollLong_attr_num = 0; PollString_spec_attr_num = 0; attr_asyn_write_val = 42; + attr_string_rw = Tango::string_dup("The incredible initial string!"); Short_attr_except = false; if (tg->is_svr_starting() == true || tg->is_device_restarting(device_name) == true) @@ -948,6 +949,12 @@ void DevTest::write_State_attr_rw(Tango::WAttribute &att) att.get_write_value(attr_state_rw); } +void DevTest::write_String_attr_rw(Tango::WAttribute &att) +{ + cout << "In write_String_attr_rw for attribute " << att.get_name() << endl; + att.get_write_value(attr_string_rw); +} + void DevTest::write_Float_attr_w(Tango::WAttribute &att) { cout << "In write_Float_attr_w for attribute " << att.get_name() << endl; @@ -1473,6 +1480,12 @@ void DevTest::read_State_attr_rw(Tango::Attribute &att) att.set_value(&attr_state_rw); } +void DevTest::read_String_attr_rw(Tango::Attribute &att) +{ + cout << "[DevTest::read_attr] attribute name String_attr_rw" << endl; + att.set_value(&attr_string_rw); +} + void DevTest::read_attr_asyn(Tango::Attribute &att) { cout << "[DevTest::read_attr] attribute attr_asyn" << endl; diff --git a/cpp_test_suite/cpp_test_ds/DevTest.h b/cpp_test_suite/cpp_test_ds/DevTest.h index 2294270cc..c7dfee623 100644 --- a/cpp_test_suite/cpp_test_ds/DevTest.h +++ b/cpp_test_suite/cpp_test_ds/DevTest.h @@ -99,6 +99,7 @@ public : void read_ULong_attr_rw(Tango::Attribute &att); void read_ULong64_attr_rw(Tango::Attribute &att); void read_State_attr_rw(Tango::Attribute &att); + void read_String_attr_rw(Tango::Attribute &att); void read_attr_asyn(Tango::Attribute &att); void read_attr_asyn_to(Tango::Attribute &att); void read_attr_asyn_except(Tango::Attribute &att); @@ -162,6 +163,7 @@ public : void write_ULong_attr_rw(Tango::WAttribute &att); void write_ULong64_attr_rw(Tango::WAttribute &att); void write_State_attr_rw(Tango::WAttribute &att); + void write_String_attr_rw(Tango::WAttribute &att); void write_Short_attr_w(Tango::WAttribute &att); void write_Short_attr_w2(Tango::WAttribute &att); void write_Long_attr_w(Tango::WAttribute &att); @@ -258,6 +260,7 @@ protected : Tango::DevULong attr_ulong_rw; Tango::DevULong64 attr_ulong64_rw; Tango::DevState attr_state_rw; + Tango::DevString attr_string_rw; Tango::DevLong attr_long; Tango::DevLong64 attr_long64; Tango::DevDouble attr_db_array[3]; diff --git a/cpp_test_suite/cpp_test_ds/DevTestClass.cpp b/cpp_test_suite/cpp_test_ds/DevTestClass.cpp index 297013232..b31843269 100644 --- a/cpp_test_suite/cpp_test_ds/DevTestClass.cpp +++ b/cpp_test_suite/cpp_test_ds/DevTestClass.cpp @@ -846,6 +846,7 @@ void DevTestClass::attribute_factory(vector &att_list) att_list.push_back(new ULong_attr_rwAttr()); att_list.push_back(new ULong64_attr_rwAttr()); att_list.push_back(new State_attr_rwAttr()); + att_list.push_back(new String_attr_rwAttr()); att_list.push_back(new Long64_spec_attr_rwAttr()); att_list.push_back(new ULong_spec_attr_rwAttr()); diff --git a/cpp_test_suite/cpp_test_ds/DevTestClass.h b/cpp_test_suite/cpp_test_ds/DevTestClass.h index 943e51729..ee8813c0b 100644 --- a/cpp_test_suite/cpp_test_ds/DevTestClass.h +++ b/cpp_test_suite/cpp_test_ds/DevTestClass.h @@ -368,6 +368,18 @@ class State_attr_rwAttr: public Tango::Attr {(static_cast(dev))->write_State_attr_rw(att);} }; +class String_attr_rwAttr: public Tango::Attr +{ +public: + String_attr_rwAttr():Attr("String_attr_rw", Tango::DEV_STRING, Tango::READ_WRITE) {}; + ~String_attr_rwAttr() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast(dev))->read_String_attr_rw(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast(dev))->write_String_attr_rw(att);} +}; + class Short_attr_wAttr: public Tango::Attr { diff --git a/cpp_test_suite/cpp_test_ds/fwd_ds/FwdTestClass.cpp b/cpp_test_suite/cpp_test_ds/fwd_ds/FwdTestClass.cpp index d3eec38ce..27322fb46 100644 --- a/cpp_test_suite/cpp_test_ds/fwd_ds/FwdTestClass.cpp +++ b/cpp_test_suite/cpp_test_ds/fwd_ds/FwdTestClass.cpp @@ -441,6 +441,9 @@ void FwdTestClass::attribute_factory(vector &att_list) FwdAttrImaStr *att4 = new FwdAttrImaStr("fwd_ima_string_rw"); att_list.push_back(att4); + + FwdAttrScaStr *att5 = new FwdAttrScaStr("fwd_string_rw"); + att_list.push_back(att5); /*----- PROTECTED REGION END -----*/ // FwdTestClass::attribute_factory_before // Create a list of static attributes diff --git a/cpp_test_suite/new_tests/conf_devtest.cpp b/cpp_test_suite/new_tests/conf_devtest.cpp index 0515c0497..0f0921a0f 100644 --- a/cpp_test_suite/new_tests/conf_devtest.cpp +++ b/cpp_test_suite/new_tests/conf_devtest.cpp @@ -478,7 +478,13 @@ int main(int argc, char **argv) { db_data.push_back(fwd_att4); db_data.push_back(root_att4); - + Tango::DbDatum fwd_att5("fwd_string_rw"); + Tango::DbDatum root_att5("__root_att"); + fwd_att5 << (short) 1; + r_name = device1_name + "/string_attr_rw";; + root_att5 << r_name; + db_data.push_back(fwd_att5); + db_data.push_back(root_att5); try { db->put_device_attribute_property(fwd_dev_name, db_data); diff --git a/cpp_test_suite/new_tests/cxx_fwd_att.cpp b/cpp_test_suite/new_tests/cxx_fwd_att.cpp index 4809b7d20..de52bae4f 100644 --- a/cpp_test_suite/new_tests/cxx_fwd_att.cpp +++ b/cpp_test_suite/new_tests/cxx_fwd_att.cpp @@ -273,7 +273,7 @@ class FwdAttTestSuite: public CxxTest::TestSuite void test_reading_forwarded_attribute(void) { - DeviceAttribute short_attr, string_attr, sp_db, ima_str; + DeviceAttribute short_attr, string_attr, sp_db, ima_str, string_rw_attr; // read attributes @@ -317,6 +317,15 @@ class FwdAttTestSuite: public CxxTest::TestSuite TS_ASSERT(v_str[0] == "Alors la, pour une surprise"); TS_ASSERT(v_str[1] == "c'est une surprise"); TS_ASSERT(v_str[2] == "Not initialised"); + + TS_ASSERT_THROWS_NOTHING(string_rw_attr = fwd_device->read_attribute("fwd_string_rw")); + string string_rw_str; + string_rw_attr >> string_rw_str; + TS_ASSERT(string_rw_attr.name == "fwd_string_rw"); + TS_ASSERT(string_rw_attr.quality == Tango::ATTR_VALID); + TS_ASSERT(string_rw_attr.dim_x == 1); + TS_ASSERT(string_rw_attr.dim_y == 0); + TS_ASSERT(string_rw_str == "The incredible initial string!"); } // Test attribute writing