From f3fa387de1cea851ff7f7269054843aaea1de808 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sat, 11 Jul 2020 11:16:19 +0200 Subject: [PATCH 01/13] Add macro for detecting current function name --- cppapi/server/CMakeLists.txt | 4 +++- cppapi/server/tango.h | 2 ++ cppapi/server/tango_current_function.h | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 cppapi/server/tango_current_function.h diff --git a/cppapi/server/CMakeLists.txt b/cppapi/server/CMakeLists.txt index 49b34b9a6..34475c72c 100644 --- a/cppapi/server/CMakeLists.txt +++ b/cppapi/server/CMakeLists.txt @@ -129,7 +129,9 @@ set(HEADERS attrdesc.h subdev_diag.h encoded_attribute.h encoded_format.h - event_subscription_state.h) + event_subscription_state.h + tango_current_function.h + ) add_subdirectory(idl) add_subdirectory(jpeg) diff --git a/cppapi/server/tango.h b/cppapi/server/tango.h index dd30f26d7..4b5ddf40b 100644 --- a/cppapi/server/tango.h +++ b/cppapi/server/tango.h @@ -44,6 +44,8 @@ #include +#include + // // A short inline function to hide the CORBA::string_dup function // diff --git a/cppapi/server/tango_current_function.h b/cppapi/server/tango_current_function.h new file mode 100644 index 000000000..d2990d461 --- /dev/null +++ b/cppapi/server/tango_current_function.h @@ -0,0 +1,26 @@ +#ifndef _TANGO_CURRENT_FUNCTION_H +#define _TANGO_CURRENT_FUNCTION_H + +// Adapted from: https://www.boost.org/doc/libs/1_73_0/boost/current_function.hpp +// +#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__) || defined(__clang__) +# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__DMC__) && (__DMC__ >= 0x810) +# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__FUNCSIG__) +# define BOOST_CURRENT_FUNCTION __FUNCSIG__ +#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) +# define BOOST_CURRENT_FUNCTION __FUNCTION__ +#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) +# define BOOST_CURRENT_FUNCTION __FUNC__ +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) +# define BOOST_CURRENT_FUNCTION __func__ +#elif defined(__cplusplus) && (__cplusplus >= 201103) +# define BOOST_CURRENT_FUNCTION __func__ +#else +# define BOOST_CURRENT_FUNCTION "(unknown)" +#endif + +#define TANGO_CURRENT_FUNCTION BOOST_CURRENT_FUNCTION + +#endif From a7f5dd8c633dc100eeec3ef5b13abe71f6cb19e9 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sat, 11 Jul 2020 11:32:46 +0200 Subject: [PATCH 02/13] Replace explicit logger access with macros --- cppapi/server/attrgetsetprop.cpp | 3 +-- cppapi/server/deviceclass.cpp | 10 +++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cppapi/server/attrgetsetprop.cpp b/cppapi/server/attrgetsetprop.cpp index ee795cf27..ae5457ccf 100644 --- a/cppapi/server/attrgetsetprop.cpp +++ b/cppapi/server/attrgetsetprop.cpp @@ -1804,8 +1804,7 @@ void Attribute::set_rds_prop_val(const AttributeAlarm &att_alarm, std::string &d std::cerr.clear(); } - if (dev->get_logger()->is_warn_enabled()) - dev->get_logger()->warn_stream() << log4tango::LogInitiator::_begin_log << "RDS (Read Different Set) incoherent in attribute " << name << " (only " << (delta_t_defined ? "delta_t" : "delta_val") << " is set) " << std::endl; + DEV_WARN_STREAM(dev) << "RDS (Read Different Set) incoherent in attribute " << name << " (only " << (delta_t_defined ? "delta_t" : "delta_val") << " is set) " << std::endl; } catch(...) { diff --git a/cppapi/server/deviceclass.cpp b/cppapi/server/deviceclass.cpp index f812ae20d..654e55310 100644 --- a/cppapi/server/deviceclass.cpp +++ b/cppapi/server/deviceclass.cpp @@ -592,14 +592,10 @@ void DeviceClass::set_memorized_values(bool all,long idx,bool from_init) { WAttribute &att = device_list[i]->get_device_attr()->get_w_attr_by_name(att_val[e.errors[k].index_in_call].name.in()); att.set_mem_exception(e.errors[k].err_list); - log4tango::Logger *log = device_list[i]->get_logger(); - if (log->is_warn_enabled()) - { - log->warn_stream() << log4tango::LogInitiator::_begin_log << "Writing set_point for attribute " << att.get_name() << " failed" << std::endl; - log->warn_stream() << log4tango::LogInitiator::_begin_log << "\tException desc = " << e.errors[k].err_list[0].desc.in() << std::endl; - log->warn_stream() << log4tango::LogInitiator::_begin_log << "\tException reason = " << e.errors[k].err_list[0].reason.in() << std::endl; - } + DEV_WARN_STREAM(device_list[i]) << "Writing set_point for attribute " << att.get_name() << " failed" << std::endl; + DEV_WARN_STREAM(device_list[i]) << "\tException desc = " << e.errors[k].err_list[0].desc.in() << std::endl; + DEV_WARN_STREAM(device_list[i]) << "\tException reason = " << e.errors[k].err_list[0].reason.in() << std::endl; } device_list[i]->set_run_att_conf_loop(true); Tango::NamedDevFailedList e_list (e, device_list[i]->get_name(), (const char *)"DeviceClass::set_memorized_values()", From 3aeb11a9f925df1a1672606f92ae43a040fe0a05 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Tue, 14 Jul 2020 10:06:19 +0200 Subject: [PATCH 03/13] Correct line feed stripping in compare_test What we had was broken as if one of the strings was empty the other one was truncated to 0 size as well. --- cpp_test_suite/new_tests/compare_test.cpp | 26 +++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/cpp_test_suite/new_tests/compare_test.cpp b/cpp_test_suite/new_tests/compare_test.cpp index 6a28efc57..213ad610f 100644 --- a/cpp_test_suite/new_tests/compare_test.cpp +++ b/cpp_test_suite/new_tests/compare_test.cpp @@ -7,6 +7,19 @@ using namespace CmpTst; #define TMP_SUFFIX ".tmp" +namespace +{ + +void strip_cr_lf(std::string& line) +{ + while (line.size() > 0 && (line.back() == '\r' || line.back() == '\n')) + { + line.pop_back(); + } +} + +} // namespace + //+------------------------------------------------------------------------- // // method : out_set_event_properties @@ -320,7 +333,7 @@ void CmpTst::CompareTest::ref_replace_keywords(string file, map k // // method : out_remove_entries // -// description : +// description : // argument : in : - file : output file to be modified // - prop_val_map : keys - properties to be modified, // values - new values of the properties @@ -442,21 +455,20 @@ void CmpTst::CompareTest::compare(string ref, string out) while(refstream && outstream) { line_number++; - string ref_line, out_line, ref_line_orig, out_line_orig; + string ref_line, out_line; getline(refstream, ref_line); getline(outstream, out_line); - ref_line_orig = ref_line; // stores original line for error message, see linebreak hook below - out_line_orig = out_line; - size_t end_line = min(ref_line.size(), out_line.size()); - out_line.erase(end_line); // trick to make it work with different linebreak encoding; + strip_cr_lf(ref_line); + strip_cr_lf(out_line); + if(ref_line.compare(out_line) != 0) { refstream.close(); outstream.close(); stringstream ss; ss << line_number; - throw CmpTst::CompareTestException("[CmpTst::CompareTest::compare] FAILED in file: " + out + ":" + ss.str() + "\nEXPECTED:\t" + ref_line_orig + "\n WAS:\t" + out_line_orig); + throw CmpTst::CompareTestException("[CmpTst::CompareTest::compare] FAILED in file: " + out + ":" + ss.str() + "\nEXPECTED:\t" + ref_line + "\n WAS:\t" + out_line); } } From e4b267f2420c6c683903ffbbf0d11034fe2ff3a5 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Tue, 14 Jul 2020 10:07:51 +0200 Subject: [PATCH 04/13] Correct expected output in cxx_always_hook test Due to broken comparator implementation (see previous commit), this test was never correct. --- cpp_test_suite/new_tests/out/always_hook.out | 195 +++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/cpp_test_suite/new_tests/out/always_hook.out b/cpp_test_suite/new_tests/out/always_hook.out index c7578b1e3..6800003f8 100644 --- a/cpp_test_suite/new_tests/out/always_hook.out +++ b/cpp_test_suite/new_tests/out/always_hook.out @@ -258,3 +258,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b79d92d77edaf2a7a1694fd7ce99d85a477d8103 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sat, 11 Jul 2020 11:54:46 +0200 Subject: [PATCH 05/13] Include current file and line number in log messages --- cpp_test_suite/new_tests/cxx_attr_misc.cpp | 12 +++++----- cppapi/server/log4tango.h | 17 +++++++++----- cppapi/server/logging.h | 11 ++++++--- cppapi/server/tango_current_function.h | 4 ++++ cppapi/server/utils.h | 26 +++++++++++++--------- 5 files changed, 45 insertions(+), 25 deletions(-) diff --git a/cpp_test_suite/new_tests/cxx_attr_misc.cpp b/cpp_test_suite/new_tests/cxx_attr_misc.cpp index 893a407ea..8ed815492 100644 --- a/cpp_test_suite/new_tests/cxx_attr_misc.cpp +++ b/cpp_test_suite/new_tests/cxx_attr_misc.cpp @@ -3,6 +3,8 @@ #include "cxx_common.h" +#include + #undef SUITE_NAME #define SUITE_NAME AttrMiscTestSuite @@ -1039,9 +1041,9 @@ cout << "status = " << status << endl; TS_ASSERT_THROWS_NOTHING(device1->command_inout("IOAttrThrowEx", data)); } - void __assert_dev_state(DevState expected, const char* file, const char* line) + void __assert_dev_state(DevState expected, const char* location) { - std::string message = std::string("Called from ") + file + ":" + line; + std::string message = std::string("Called from ") + location; DevState state; DeviceData data; @@ -1050,9 +1052,7 @@ cout << "status = " << status << endl; TSM_ASSERT_EQUALS(message, expected, state); } -#define __QUOTE(x) #x -#define QUOTE(x) __QUOTE(x) -#define assert_dev_state(expected) __assert_dev_state(expected, __FILE__, QUOTE(__LINE__)) +#define assert_dev_state(expected) __assert_dev_state(expected, TANGO_FILE_AND_LINE) // Verifies that device state is set correctly when alarm is configured for an attribute // but no value is provided for this attribute in user callback (e.g. an exception is thrown). @@ -1075,8 +1075,6 @@ cout << "status = " << status << endl; } #undef assert_dev_state -#undef QUOTE -#undef __QUOTE /* * Test for changing alarm treshold to value lower than currently read from diff --git a/cppapi/server/log4tango.h b/cppapi/server/log4tango.h index 0b43163f1..3b8936c79 100644 --- a/cppapi/server/log4tango.h +++ b/cppapi/server/log4tango.h @@ -46,6 +46,8 @@ #include #include +#include + //------------------------------------------------------------- // LOGGING MACROS (FOR DEVICE DEVELOPERS) //------------------------------------------------------------- @@ -67,27 +69,32 @@ #define DEV_FATAL_STREAM(device) \ if (device->get_logger()->is_fatal_enabled()) \ device->get_logger()->fatal_stream() \ - << log4tango::LogInitiator::_begin_log + << log4tango::LogInitiator::_begin_log \ + << "(" TANGO_FILE_AND_LINE ") " #define DEV_ERROR_STREAM(device) \ if (device->get_logger()->is_error_enabled()) \ device->get_logger()->error_stream() \ - << log4tango::LogInitiator::_begin_log + << log4tango::LogInitiator::_begin_log \ + << "(" TANGO_FILE_AND_LINE ") " #define DEV_WARN_STREAM(device) \ if (device->get_logger()->is_warn_enabled()) \ device->get_logger()->warn_stream() \ - << log4tango::LogInitiator::_begin_log + << log4tango::LogInitiator::_begin_log \ + << "(" TANGO_FILE_AND_LINE ") " #define DEV_INFO_STREAM(device) \ if (device->get_logger()->is_info_enabled()) \ device->get_logger()->info_stream() \ - << log4tango::LogInitiator::_begin_log + << log4tango::LogInitiator::_begin_log \ + << "(" TANGO_FILE_AND_LINE ") " #define DEV_DEBUG_STREAM(device) \ if (device->get_logger()->is_debug_enabled()) \ device->get_logger()->debug_stream() \ - << log4tango::LogInitiator::_begin_log + << log4tango::LogInitiator::_begin_log \ + << "(" TANGO_FILE_AND_LINE ") " #define ENDLOG \ log4tango::LogSeparator::_end_log diff --git a/cppapi/server/logging.h b/cppapi/server/logging.h index 9c53e8f04..aa7f110f8 100644 --- a/cppapi/server/logging.h +++ b/cppapi/server/logging.h @@ -36,6 +36,8 @@ #ifdef TANGO_HAS_LOG4TANGO +#include + // A shortcut to the core logger ------------------------------ #define API_LOGGER Tango::Logging::get_core_logger() @@ -45,7 +47,8 @@ #define cout \ if (API_LOGGER) \ API_LOGGER->get_stream(log4tango::Level::INFO, false) \ - << log4tango::LogInitiator::_begin_log + << log4tango::LogInitiator::_begin_log \ + << "(" TANGO_FILE_AND_LINE ") " #else @@ -57,7 +60,8 @@ #define cout1 \ if (API_LOGGER && API_LOGGER->is_info_enabled()) \ API_LOGGER->info_stream() \ - << log4tango::LogInitiator::_begin_log + << log4tango::LogInitiator::_begin_log \ + << "(" TANGO_FILE_AND_LINE ") " #define cout2 cout1 @@ -65,7 +69,8 @@ #define cout3 \ if (API_LOGGER && API_LOGGER->is_debug_enabled()) \ API_LOGGER->debug_stream() \ - << log4tango::LogInitiator::_begin_log + << log4tango::LogInitiator::_begin_log \ + << "(" TANGO_FILE_AND_LINE ") " #define cout4 cout3 #define cout5 cout4 diff --git a/cppapi/server/tango_current_function.h b/cppapi/server/tango_current_function.h index d2990d461..6f1c69dfe 100644 --- a/cppapi/server/tango_current_function.h +++ b/cppapi/server/tango_current_function.h @@ -23,4 +23,8 @@ #define TANGO_CURRENT_FUNCTION BOOST_CURRENT_FUNCTION +#define TANGO_QUOTE_(s) #s +#define TANGO_QUOTE(s) TANGO_QUOTE_(s) +#define TANGO_FILE_AND_LINE __FILE__ ":" TANGO_QUOTE(__LINE__) + #endif diff --git a/cppapi/server/utils.h b/cppapi/server/utils.h index 781b9bc77..b3636b744 100644 --- a/cppapi/server/utils.h +++ b/cppapi/server/utils.h @@ -40,6 +40,7 @@ #include #include #include +#include #ifndef _TG_WINDOWS_ #include @@ -54,16 +55,21 @@ #ifndef TANGO_HAS_LOG4TANGO -#define cout1 if ((Tango::Util::_tracelevel >= 1) && \ - (Tango::Util::_tracelevel < 5)) cout -#define cout2 if ((Tango::Util::_tracelevel >= 2) && \ - (Tango::Util::_tracelevel < 5)) cout -#define cout3 if ((Tango::Util::_tracelevel >= 3) && \ - (Tango::Util::_tracelevel < 5)) cout -#define cout4 if ((Tango::Util::_tracelevel >= 4) && \ - (Tango::Util::_tracelevel < 5)) cout - -#define cout5 if (Tango::Util::_tracelevel >= 5) cout +#define cout1 \ + if ((Tango::Util::_tracelevel >= 1) && (Tango::Util::_tracelevel < 5)) \ + cout << "(" TANGO_FILE_AND_LINE ") " +#define cout2 \ + if ((Tango::Util::_tracelevel >= 2) && (Tango::Util::_tracelevel < 5)) \ + cout << "(" TANGO_FILE_AND_LINE ") " +#define cout3 \ + if ((Tango::Util::_tracelevel >= 3) && (Tango::Util::_tracelevel < 5)) \ + cout << "(" TANGO_FILE_AND_LINE ") " +#define cout4 \ + if ((Tango::Util::_tracelevel >= 4) && (Tango::Util::_tracelevel < 5)) \ + cout << "(" TANGO_FILE_AND_LINE ") " +#define cout5 \ + if (Tango::Util::_tracelevel >= 5) \ + cout << "(" TANGO_FILE_AND_LINE ") " #endif //TANGO_HAS_LOG4TANGO From 2edd7706a0a8a75e0ee5fff1f4c3a760eb4c64a0 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Tue, 14 Jul 2020 10:14:15 +0200 Subject: [PATCH 06/13] Correct log message comparison in tests The log messages now contain file name and line number. Comparator must be extended to support this scenario. --- cpp_test_suite/new_tests/compare_test.cpp | 35 ++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/cpp_test_suite/new_tests/compare_test.cpp b/cpp_test_suite/new_tests/compare_test.cpp index 213ad610f..c426ed627 100644 --- a/cpp_test_suite/new_tests/compare_test.cpp +++ b/cpp_test_suite/new_tests/compare_test.cpp @@ -10,6 +10,9 @@ using namespace CmpTst; namespace { +const std::string LOG_PREFIX = ""; + void strip_cr_lf(std::string& line) { while (line.size() > 0 && (line.back() == '\r' || line.back() == '\n')) @@ -18,6 +21,36 @@ void strip_cr_lf(std::string& line) } } +bool is_log_message(const std::string& line) +{ + return line.compare(0, LOG_PREFIX.size(), LOG_PREFIX) == 0 + && line.compare(line.size() - LOG_SUFFIX.size(), LOG_SUFFIX.size(), LOG_SUFFIX) == 0; +} + +auto strip_log_tags(const std::string& line) +{ + return line.substr(LOG_PREFIX.size(), line.size() - LOG_PREFIX.size() - LOG_SUFFIX.size()); +} + +bool is_matching_log_message(const std::string& ref_line, const std::string& out_line) +{ + // For log messages, we only check that emitted message contains expected + // substring. There may be extra information included (like line numbers). + + return is_log_message(ref_line) && is_log_message(out_line) + && out_line.find(strip_log_tags(ref_line)) != std::string::npos; +} + +bool is_line_equal(const std::string& ref_line, const std::string& out_line) +{ + return ref_line.compare(out_line) == 0; +} + +bool compare_lines(const std::string& ref_line, const std::string& out_line) +{ + return is_line_equal(ref_line, out_line) || is_matching_log_message(ref_line, out_line); +} + } // namespace //+------------------------------------------------------------------------- @@ -462,7 +495,7 @@ void CmpTst::CompareTest::compare(string ref, string out) strip_cr_lf(ref_line); strip_cr_lf(out_line); - if(ref_line.compare(out_line) != 0) + if (!compare_lines(ref_line, out_line)) { refstream.close(); outstream.close(); From 829860ea03cd8f6b748e40c36778f5e4f710a637 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Mon, 13 Jul 2020 14:44:49 +0200 Subject: [PATCH 07/13] Add macros for throwing exception with location info --- cppapi/client/apiexcept.h | 10 ++++++++++ cppapi/server/except.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/cppapi/client/apiexcept.h b/cppapi/client/apiexcept.h index ae880392e..ebc4c089d 100644 --- a/cppapi/client/apiexcept.h +++ b/cppapi/client/apiexcept.h @@ -28,9 +28,12 @@ #include #include +#include #include +#include + #ifdef TANGO_USE_USING_NAMESPACE using namespace std; #endif @@ -497,6 +500,13 @@ MAKE_EXCEPT(NotAllowed,NotAllowedExcept) (const char*)"Connection::command_inout()"); \ } +#define TANGO_THROW_API_EXCEPTION(ExceptionClass, reason, desc) \ + ExceptionClass ::throw_exception(reason, desc, \ + (std::string(TANGO_CURRENT_FUNCTION) + " at (" TANGO_FILE_AND_LINE ")").c_str()) + +#define TANGO_RETHROW_API_EXCEPTION(ExceptionClass, original, reason, desc) \ + ExceptionClass ::re_throw_exception(original, reason, desc, \ + (std::string(TANGO_CURRENT_FUNCTION) + " at (" TANGO_FILE_AND_LINE ")").c_str()) } // End of Tango namespace diff --git a/cppapi/server/except.h b/cppapi/server/except.h index 276ad8fb4..ae9106b63 100644 --- a/cppapi/server/except.h +++ b/cppapi/server/except.h @@ -38,6 +38,8 @@ #include +#include + #ifdef TANGO_USE_USING_NAMESPACE using namespace std; #endif @@ -1892,6 +1894,14 @@ class Except static char mess[256]; }; +#define TANGO_THROW_EXCEPTION(reason, desc) \ + ::Tango::Except::throw_exception(reason, desc, \ + (std::string(TANGO_CURRENT_FUNCTION) + " at (" TANGO_FILE_AND_LINE ")").c_str()) + +#define TANGO_RETHROW_EXCEPTION(original, reason, desc) \ + ::Tango::Except::re_throw_exception(original, reason, desc, \ + (std::string(TANGO_CURRENT_FUNCTION) + " at (" TANGO_FILE_AND_LINE ")").c_str()) + } // End of Tango namespace #endif /* EXCEPT */ From 158f5a2142c3563f3fc2e84366702c895c8805d5 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Tue, 14 Jul 2020 11:49:22 +0200 Subject: [PATCH 08/13] Define constants for DB exception reasons --- cpp_test_suite/new_tests/cxx_syntax.cpp | 2 +- cppapi/client/attr_proxy.cpp | 6 +++--- cppapi/client/dbapi_base.cpp | 22 +++++++++++----------- cppapi/client/dbapi_cache.cpp | 24 ++++++++++++------------ cppapi/client/devapi_base.cpp | 4 ++-- cppapi/server/notifdeventsupplier.cpp | 2 +- cppapi/server/tango_const.h.in | 7 +++++++ 7 files changed, 37 insertions(+), 30 deletions(-) diff --git a/cpp_test_suite/new_tests/cxx_syntax.cpp b/cpp_test_suite/new_tests/cxx_syntax.cpp index df890c856..2a5574861 100644 --- a/cpp_test_suite/new_tests/cxx_syntax.cpp +++ b/cpp_test_suite/new_tests/cxx_syntax.cpp @@ -256,7 +256,7 @@ class SyntaxTestSuite: public CxxTest::TestSuite DeviceProxy *device2 = nullptr; TS_ASSERT_THROWS_NOTHING(device2 = new DeviceProxy(device2_name)); TS_ASSERT_THROWS_ASSERT(device2->alias(), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "DB_AliasNotDefined" + TS_ASSERT(string(e.errors[0].reason.in()) == DB_AliasNotDefined && e.errors[0].severity == Tango::ERR)); delete device2; } diff --git a/cppapi/client/attr_proxy.cpp b/cppapi/client/attr_proxy.cpp index bb4dbffa3..045627435 100644 --- a/cppapi/client/attr_proxy.cpp +++ b/cppapi/client/attr_proxy.cpp @@ -626,7 +626,7 @@ void AttributeProxy::parse_name(std::string &full_name) } catch (DevFailed &dfe) { - if (strcmp(dfe.errors[0].reason,"DB_SQLError") == 0) + if (strcmp(dfe.errors[0].reason,DB_SQLError) == 0) { TangoSys_OMemStream desc; desc << "Can't connect to attribute with alias " << device_name << std::ends; @@ -648,7 +648,7 @@ void AttributeProxy::parse_name(std::string &full_name) } catch (DevFailed &dfe) { - if (strcmp(dfe.errors[0].reason,"DB_SQLError") == 0) + if (strcmp(dfe.errors[0].reason,DB_SQLError) == 0) { TangoSys_OMemStream desc; desc << "Can't connect to attribute with alias " << device_name << std::ends; @@ -671,7 +671,7 @@ void AttributeProxy::parse_name(std::string &full_name) } catch (DevFailed &dfe) { - if (strcmp(dfe.errors[0].reason,"DB_SQLError") == 0) + if (strcmp(dfe.errors[0].reason,DB_SQLError) == 0) { TangoSys_OMemStream desc; desc << "Can't connect to attribute with alias " << device_name << std::ends; diff --git a/cppapi/client/dbapi_base.cpp b/cppapi/client/dbapi_base.cpp index 4a7076ead..8ca0b83ea 100644 --- a/cppapi/client/dbapi_base.cpp +++ b/cppapi/client/dbapi_base.cpp @@ -1160,7 +1160,7 @@ void Database::get_device_property(std::string dev, DbData &db_data,DbServerCach } catch(Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"DB_DeviceNotFoundInCache") == 0) + if (::strcmp(e.errors[0].reason.in(),DB_DeviceNotFoundInCache) == 0) { // @@ -1375,7 +1375,7 @@ void Database::get_device_attribute_property(std::string dev, DbData &db_data, D } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"DB_DeviceNotFoundInCache") == 0) + if (::strcmp(e.errors[0].reason.in(),DB_DeviceNotFoundInCache) == 0) { // @@ -1692,7 +1692,7 @@ void Database::get_class_property(std::string device_class, DbData &db_data, DbS } catch(Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"DB_ClassNotFoundInCache") == 0) + if (::strcmp(e.errors[0].reason.in(),DB_ClassNotFoundInCache) == 0) { // @@ -1922,7 +1922,7 @@ void Database::get_class_attribute_property(std::string device_class, DbData &db } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"DB_ClassNotFoundInCache") == 0) + if (::strcmp(e.errors[0].reason.in(),DB_ClassNotFoundInCache) == 0) { // @@ -2500,7 +2500,7 @@ void Database::get_property(std::string obj, DbData &db_data,DbServerCache *db_c } catch(Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"DB_DeviceNotFoundInCache") == 0) + if (::strcmp(e.errors[0].reason.in(),DB_DeviceNotFoundInCache) == 0) { // @@ -2906,7 +2906,7 @@ void Database::get_device_property_list(std::string &dev, const std::string &wil } catch(Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"DB_DeviceNotFoundInCache") == 0) + if (::strcmp(e.errors[0].reason.in(),DB_DeviceNotFoundInCache) == 0) { // @@ -4405,7 +4405,7 @@ AccessControlType Database::check_access_control(std::string &devname) } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),API_DeviceNotExported) == 0 || ::strcmp(e.errors[0].reason.in(),"DB_DeviceNotDefined") == 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceNotExported) == 0 || ::strcmp(e.errors[0].reason.in(),DB_DeviceNotDefined) == 0) { std::string tmp_err_desc(e.errors[0].desc.in()); tmp_err_desc = tmp_err_desc + "\nControlled access service defined in Db but unreachable --> Read access given to all devices..."; @@ -4793,10 +4793,10 @@ void Database::get_class_pipe_property(std::string device_class, DbData &db_data { std::string err_reason(e.errors[0].reason.in()); - if (err_reason == "DB_ClassNotFoundInCache" || err_reason == "DB_TooOldStoredProc") + if (err_reason == DB_ClassNotFoundInCache || err_reason == DB_TooOldStoredProc) { - if (err_reason == "DB_TooOldStoredProc") + if (err_reason == DB_TooOldStoredProc) { cout << "WARNING: You database stored procedure is too old to support device pipe" << std::endl; cout << "Please, update to stored procedure release 1.9 or more" << std::endl; @@ -4953,9 +4953,9 @@ void Database::get_device_pipe_property(std::string dev, DbData &db_data, DbServ { std::string err_reason(e.errors[0].reason.in()); - if (err_reason == "DB_DeviceNotFoundInCache" || err_reason == "DB_TooOldStoredProc") + if (err_reason == DB_DeviceNotFoundInCache || err_reason == DB_TooOldStoredProc) { - if (err_reason == "DB_TooOldStoredProc") + if (err_reason == DB_TooOldStoredProc) { cout << "WARNING: You database stored procedure is too old to support device pipe" << std::endl; cout << "Please, update to stored procedure release 1.9 or more" << std::endl; diff --git a/cppapi/client/dbapi_cache.cpp b/cppapi/client/dbapi_cache.cpp index 6b01b98d6..b621c168d 100644 --- a/cppapi/client/dbapi_cache.cpp +++ b/cppapi/client/dbapi_cache.cpp @@ -436,7 +436,7 @@ const DevVarStringArray *DbServerCache::get_class_property(DevVarStringArray *in TangoSys_OMemStream o; o << "Class " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)"DB_ClassNotFoundInCache",o.str(), + Tango::Except::throw_exception((const char *)DB_ClassNotFoundInCache,o.str(), (const char *)"DbServerCache::get_dev_property"); } } @@ -554,7 +554,7 @@ const DevVarStringArray *DbServerCache::get_dev_property(DevVarStringArray *in_p TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)"DB_DeviceNotFoundInCache",o.str(), + Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), (const char *)"DbServerCache::get_dev_property"); } ret_obj_prop.length(ret_length); @@ -571,7 +571,7 @@ const DevVarStringArray *DbServerCache::get_dev_property(DevVarStringArray *in_p TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)"DB_DeviceNotFoundInCache",o.str(), + Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), (const char *)"DbServerCache::get_dev_property"); } else @@ -726,7 +726,7 @@ const DevVarStringArray *DbServerCache::get_class_att_property(DevVarStringArray TangoSys_OMemStream o; o << "Class " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)"DB_ClassNotFoundInCache",o.str(), + Tango::Except::throw_exception((const char *)DB_ClassNotFoundInCache,o.str(), (const char *)"DbServerCache::get_dev_property"); } @@ -817,7 +817,7 @@ const DevVarStringArray *DbServerCache::get_dev_att_property(DevVarStringArray * TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)"DB_DeviceNotFoundInCache",o.str(), + Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), (const char *)"DbServerCache::get_dev_att_property"); } else @@ -1136,7 +1136,7 @@ const DevVarStringArray *DbServerCache::get_obj_property(DevVarStringArray *in_p TangoSys_OMemStream o; o << "Object " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)"DB_DeviceNotFoundInCache",o.str(), + Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), (const char *)"DbServerCache::get_obj_property"); } else @@ -1192,7 +1192,7 @@ const DevVarStringArray *DbServerCache::get_device_property_list(DevVarStringArr TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)"DB_DeviceNotFoundInCache",o.str(), + Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), (const char *)"DbServerCache::get_device_property_list"); } else @@ -1410,7 +1410,7 @@ const DevVarLongStringArray *DbServerCache::import_tac_dev(std::string &tac_dev) TangoSys_OMemStream o; o << "Device " << tac_dev << " not defined in database" << std::ends; - Tango::Except::throw_exception((const char *)"DB_DeviceNotDefined",o.str(), + Tango::Except::throw_exception((const char *)DB_DeviceNotDefined,o.str(), (const char *)"DbServerCache::import_tac_dev"); } @@ -1458,7 +1458,7 @@ const DevVarStringArray *DbServerCache::get_class_pipe_property(DevVarStringArra if (proc_release < 109) { std::string mess("Your database stored procedure is too old to support pipe. Please update to stored procedure release 1.9 or more"); - Tango::Except::throw_exception("DB_TooOldStoredProc",mess,"DbServerCache::get_class_pipe_property"); + Tango::Except::throw_exception(DB_TooOldStoredProc,mess,"DbServerCache::get_class_pipe_property"); } int found_pipe = 0; @@ -1527,7 +1527,7 @@ const DevVarStringArray *DbServerCache::get_class_pipe_property(DevVarStringArra TangoSys_OMemStream o; o << "Class " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception("DB_ClassNotFoundInCache",o.str(), + Tango::Except::throw_exception(DB_ClassNotFoundInCache,o.str(), "DbServerCache::get_class_pipe_property"); } @@ -1566,7 +1566,7 @@ const DevVarStringArray *DbServerCache::get_dev_pipe_property(DevVarStringArray if (proc_release < 109) { std::string mess("Your database stored procedure is too old to support pipe. Please update to stored procedure release 1.9 or more"); - Tango::Except::throw_exception("DB_TooOldStoredProc",mess,"DbServerCache::get_dev_pipe_property"); + Tango::Except::throw_exception(DB_TooOldStoredProc,mess,"DbServerCache::get_dev_pipe_property"); } int found_pipe = 0; @@ -1630,7 +1630,7 @@ const DevVarStringArray *DbServerCache::get_dev_pipe_property(DevVarStringArray TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)"DB_DeviceNotFoundInCache",o.str(), + Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), (const char *)"DbServerCache::get_dev_pipe_property"); } else diff --git a/cppapi/client/devapi_base.cpp b/cppapi/client/devapi_base.cpp index 83d1a9c94..45659e7b7 100644 --- a/cppapi/client/devapi_base.cpp +++ b/cppapi/client/devapi_base.cpp @@ -1743,7 +1743,7 @@ void DeviceProxy::real_constructor(std::string &name, bool need_check_acc) } catch (Tango::DevFailed &dfe) { - if (strcmp(dfe.errors[0].reason, "DB_DeviceNotDefined") == 0) + if (strcmp(dfe.errors[0].reason, DB_DeviceNotDefined) == 0) { delete db_dev; TangoSys_OMemStream desc; @@ -2822,7 +2822,7 @@ std::string DeviceProxy::alias() } else { - Tango::Except::throw_exception((const char *) "DB_AliasNotDefined", + Tango::Except::throw_exception((const char *) DB_AliasNotDefined, (const char *) "No alias found for your device", (const char *) "DeviceProxy::alias()"); } diff --git a/cppapi/server/notifdeventsupplier.cpp b/cppapi/server/notifdeventsupplier.cpp index 01f7d5f8c..bfdb18e39 100644 --- a/cppapi/server/notifdeventsupplier.cpp +++ b/cppapi/server/notifdeventsupplier.cpp @@ -207,7 +207,7 @@ void NotifdEventSupplier::connect_to_notifd(NotifService &ns,CORBA::ORB_var &_or catch (Tango::DevFailed &e) { std::string reason(e.errors[0].reason.in()); - if (reason == "DB_DeviceNotDefined") + if (reason == DB_DeviceNotDefined) { std::string::size_type pos = factory_name.find('.'); if (pos != std::string::npos) diff --git a/cppapi/server/tango_const.h.in b/cppapi/server/tango_const.h.in index e3a95bfca..1f09ca724 100644 --- a/cppapi/server/tango_const.h.in +++ b/cppapi/server/tango_const.h.in @@ -470,6 +470,13 @@ const char* const API_WrongNumberOfArgs = "API_WrongNumberOfArgs"; const char* const API_ZmqFailed = "API_ZmqFailed"; const char* const API_ZmqInitFailed = "API_ZmqInitFailed"; +const char* const DB_AliasNotDefined = "DB_AliasNotDefined"; +const char* const DB_ClassNotFoundInCache = "DB_ClassNotFoundInCache"; +const char* const DB_DeviceNotDefined = "DB_DeviceNotDefined"; +const char* const DB_DeviceNotFoundInCache = "DB_DeviceNotFoundInCache"; +const char* const DB_SQLError = "DB_SQLError"; +const char* const DB_TooOldStoredProc = "DB_TooOldStoredProc"; + // // Many, many typedef // From 23bba98aec666734048949986d486b44e0c332cb Mon Sep 17 00:00:00 2001 From: mliszcz Date: Tue, 14 Jul 2020 13:02:11 +0200 Subject: [PATCH 09/13] Define constants for API exception reasons Done automatically with sed. See script published in: https://github.com/tango-controls/cppTango/pull/742 --- cpp_test_suite/asyn/asyn_attr.cpp | 6 +- cpp_test_suite/asyn/asyn_attr_cb.cpp | 4 +- cpp_test_suite/asyn/asyn_attr_multi.cpp | 6 +- cpp_test_suite/asyn/asyn_cb_cmd.cpp | 4 +- cpp_test_suite/asyn/asyn_cmd.cpp | 6 +- cpp_test_suite/asyn/asyn_write_attr.cpp | 6 +- cpp_test_suite/asyn/asyn_write_attr_multi.cpp | 6 +- cpp_test_suite/asyn/asyn_write_cb.cpp | 6 +- cpp_test_suite/asyn/auto_asyn_cmd.cpp | 10 +- cpp_test_suite/cpp_test_ds/SigThrow.cpp | 2 +- cpp_test_suite/event/change_event.cpp | 2 +- cpp_test_suite/event/data_ready_event.cpp | 2 +- cpp_test_suite/event/multi_event.cpp | 2 +- cpp_test_suite/event/per_event.cpp | 2 +- cpp_test_suite/new_tests/cxx_attr_conf.cpp | 2 +- cpp_test_suite/new_tests/cxx_attr_misc.cpp | 10 +- cpp_test_suite/new_tests/cxx_attr_write.cpp | 6 +- cpp_test_suite/new_tests/cxx_blackbox.cpp | 12 +- cpp_test_suite/new_tests/cxx_class_signal.cpp | 4 +- cpp_test_suite/new_tests/cxx_cmd_query.cpp | 2 +- cpp_test_suite/new_tests/cxx_dserver_cmd.cpp | 2 +- cpp_test_suite/new_tests/cxx_dserver_misc.cpp | 2 +- cpp_test_suite/new_tests/cxx_enum_att.cpp | 10 +- cpp_test_suite/new_tests/cxx_exception.cpp | 4 +- cpp_test_suite/new_tests/cxx_fwd_att.cpp | 8 +- cpp_test_suite/new_tests/cxx_group.cpp | 30 +-- cpp_test_suite/new_tests/cxx_mem_attr.cpp | 2 +- cpp_test_suite/new_tests/cxx_misc_util.cpp | 4 +- cpp_test_suite/new_tests/cxx_old_poll.cpp | 4 +- cpp_test_suite/new_tests/cxx_pipe.cpp | 34 +-- cpp_test_suite/new_tests/cxx_poll.cpp | 22 +- cpp_test_suite/new_tests/cxx_poll_admin.cpp | 8 +- cpp_test_suite/new_tests/cxx_signal.cpp | 4 +- cpp_test_suite/new_tests/cxx_syntax.cpp | 6 +- cpp_test_suite/new_tests/cxx_templ_cmd.cpp | 8 +- cpp_test_suite/new_tests/cxx_template.cpp | 2 +- cpp_test_suite/old_tests/acc_right.cpp | 22 +- cpp_test_suite/old_tests/allowed_cmd.cpp | 4 +- cpp_test_suite/old_tests/attr_misc.cpp | 14 +- cpp_test_suite/old_tests/lock.cpp | 12 +- cpp_test_suite/old_tests/locked_device.cpp | 12 +- cpp_test_suite/old_tests/restart_device.cpp | 4 +- cpp_test_suite/old_tests/w_r_attr.cpp | 2 +- cpp_test_suite/old_tests/wait_mcast_dev.cpp | 2 +- cpp_test_suite/old_tests/write_attr.cpp | 2 +- cpp_test_suite/old_tests/write_attr_3.cpp | 8 +- cppapi/client/apiexcept.h | 22 +- cppapi/client/asynreq.cpp | 8 +- cppapi/client/attr_proxy.cpp | 18 +- cppapi/client/dbapi.h | 2 +- cppapi/client/dbapi_base.cpp | 6 +- cppapi/client/dbapi_datum.cpp | 44 ++-- cppapi/client/dbapi_serverdata.cpp | 4 +- cppapi/client/devapi.h | 10 +- cppapi/client/devapi_attr.cpp | 8 +- cppapi/client/devapi_attr.tpp | 4 +- cppapi/client/devapi_base.cpp | 226 +++++++++--------- cppapi/client/devapi_data.cpp | 2 +- cppapi/client/event.cpp | 30 +-- cppapi/client/eventkeepalive.cpp | 2 +- cppapi/client/group.cpp | 18 +- cppapi/client/notifdeventconsumer.cpp | 2 +- cppapi/client/proxy_asyn.cpp | 50 ++-- cppapi/client/proxy_asyn_cb.cpp | 24 +- cppapi/server/CMakeLists.txt | 1 + cppapi/server/device_3.cpp | 2 +- cppapi/server/dserverlock.cpp | 6 +- cppapi/server/encoded_attribute.cpp | 6 +- cppapi/server/exception_reason_consts.h | 174 ++++++++++++++ cppapi/server/fwdattribute.cpp | 12 +- cppapi/server/pollthread.cpp | 2 +- cppapi/server/rootattreg.cpp | 2 +- cppapi/server/tango_const.h.in | 147 +----------- cppapi/server/utils.cpp | 4 +- 74 files changed, 600 insertions(+), 568 deletions(-) create mode 100644 cppapi/server/exception_reason_consts.h diff --git a/cpp_test_suite/asyn/asyn_attr.cpp b/cpp_test_suite/asyn/asyn_attr.cpp index f4e1a321f..525bfb611 100644 --- a/cpp_test_suite/asyn/asyn_attr.cpp +++ b/cpp_test_suite/asyn/asyn_attr.cpp @@ -200,7 +200,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -241,7 +241,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -270,7 +270,7 @@ int main(int argc, char **argv) } catch (CommunicationFailed &e) { - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; diff --git a/cpp_test_suite/asyn/asyn_attr_cb.cpp b/cpp_test_suite/asyn/asyn_attr_cb.cpp index 36c519e1a..9071d534f 100644 --- a/cpp_test_suite/asyn/asyn_attr_cb.cpp +++ b/cpp_test_suite/asyn/asyn_attr_cb.cpp @@ -45,7 +45,7 @@ void MyCallBack::attr_read(AttrReadEvent *att) catch (DevFailed &e) { long nb_err = e.errors.length(); - if (strcmp(e.errors[nb_err - 1].reason,"API_AttributeFailed") == 0) + if (strcmp(e.errors[nb_err - 1].reason,API_AttributeFailed) == 0) { attr_failed = true; coutv << "Read attributes failed error" << std::endl; @@ -63,7 +63,7 @@ void MyCallBack::attr_read(AttrReadEvent *att) coutv << "error[" << i << "].reason = " << att->errors[i].reason << std::endl; attr_failed = true; - if (strcmp(att->errors[nb_err - 1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(att->errors[nb_err - 1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout error" << std::endl; diff --git a/cpp_test_suite/asyn/asyn_attr_multi.cpp b/cpp_test_suite/asyn/asyn_attr_multi.cpp index 6ce923d3d..7047af330 100644 --- a/cpp_test_suite/asyn/asyn_attr_multi.cpp +++ b/cpp_test_suite/asyn/asyn_attr_multi.cpp @@ -178,7 +178,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -219,7 +219,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -248,7 +248,7 @@ int main(int argc, char **argv) } catch (CommunicationFailed &e) { - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; diff --git a/cpp_test_suite/asyn/asyn_cb_cmd.cpp b/cpp_test_suite/asyn/asyn_cb_cmd.cpp index c60fee711..49e52ced8 100644 --- a/cpp_test_suite/asyn/asyn_cb_cmd.cpp +++ b/cpp_test_suite/asyn/asyn_cb_cmd.cpp @@ -41,12 +41,12 @@ void MyCallBack::cmd_ended(CmdDoneEvent *cmd) coutv << "error length = " << nb_err << std::endl; for (int i = 0;i < nb_err;i++) coutv << "error[" << i << "].reason = " << cmd->errors[i].reason << std::endl; - if (strcmp(cmd->errors[nb_err - 1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(cmd->errors[nb_err - 1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout error" << std::endl; } - else if (strcmp(cmd->errors[nb_err - 1].reason,"API_CommandFailed") == 0) + else if (strcmp(cmd->errors[nb_err - 1].reason,API_CommandFailed) == 0) { cmd_failed = true; coutv << "Command failed error" << std::endl; diff --git a/cpp_test_suite/asyn/asyn_cmd.cpp b/cpp_test_suite/asyn/asyn_cmd.cpp index b5ee059c0..1ac948fbc 100644 --- a/cpp_test_suite/asyn/asyn_cmd.cpp +++ b/cpp_test_suite/asyn/asyn_cmd.cpp @@ -163,7 +163,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -203,7 +203,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -232,7 +232,7 @@ int main(int argc, char **argv) } catch (CommunicationFailed &e) { - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; diff --git a/cpp_test_suite/asyn/asyn_write_attr.cpp b/cpp_test_suite/asyn/asyn_write_attr.cpp index 5c9ecdaef..5e753941f 100644 --- a/cpp_test_suite/asyn/asyn_write_attr.cpp +++ b/cpp_test_suite/asyn/asyn_write_attr.cpp @@ -193,7 +193,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -233,7 +233,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -261,7 +261,7 @@ int main(int argc, char **argv) } catch (CommunicationFailed &e) { - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; diff --git a/cpp_test_suite/asyn/asyn_write_attr_multi.cpp b/cpp_test_suite/asyn/asyn_write_attr_multi.cpp index 93ec5c5e6..b7c0d5a1c 100644 --- a/cpp_test_suite/asyn/asyn_write_attr_multi.cpp +++ b/cpp_test_suite/asyn/asyn_write_attr_multi.cpp @@ -163,7 +163,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -203,7 +203,7 @@ int main(int argc, char **argv) catch (CommunicationFailed &e) { finish = true; - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; @@ -231,7 +231,7 @@ int main(int argc, char **argv) } catch (CommunicationFailed &e) { - if (strcmp(e.errors[1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(e.errors[1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout exception" << std::endl; diff --git a/cpp_test_suite/asyn/asyn_write_cb.cpp b/cpp_test_suite/asyn/asyn_write_cb.cpp index 5f8ef684f..9f4160c85 100644 --- a/cpp_test_suite/asyn/asyn_write_cb.cpp +++ b/cpp_test_suite/asyn/asyn_write_cb.cpp @@ -41,12 +41,12 @@ void MyCallBack::attr_written(AttrWrittenEvent *att) coutv << "error length = " << nb_err << std::endl; for (int i = 0;i < nb_err;i++) coutv << "error[" << i << "].reason = " << att->errors.errors[i].reason << std::endl; - if (strcmp(att->errors.errors[nb_err - 1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(att->errors.errors[nb_err - 1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout error" << std::endl; } - else if (strcmp(att->errors.errors[nb_err - 1].reason,"API_AttributeFailed") == 0) + else if (strcmp(att->errors.errors[nb_err - 1].reason,API_AttributeFailed) == 0) { attr_failed = true; coutv << "Write attributes failed error" << std::endl; @@ -58,7 +58,7 @@ void MyCallBack::attr_written(AttrWrittenEvent *att) { if (faulty_attr_nb != 0) { - if (strcmp(att->errors.errors[0].reason,"API_AttributeFailed") == 0) + if (strcmp(att->errors.errors[0].reason,API_AttributeFailed) == 0) { if ((strcmp(att->errors.err_list[0].err_stack[0].reason,"aaa") == 0) && (att->errors.err_list[0].idx_in_call == 0) && diff --git a/cpp_test_suite/asyn/auto_asyn_cmd.cpp b/cpp_test_suite/asyn/auto_asyn_cmd.cpp index 438e7f6c1..9879b8b11 100644 --- a/cpp_test_suite/asyn/auto_asyn_cmd.cpp +++ b/cpp_test_suite/asyn/auto_asyn_cmd.cpp @@ -47,12 +47,12 @@ void MyCallBack::cmd_ended(CmdDoneEvent *cmd) coutv << "error length = " << nb_err << std::endl; for (int i = 0;i < nb_err;i++) coutv << "error[" << i << "].reason = " << cmd->errors[i].reason.in() << std::endl; - if (strcmp(cmd->errors[nb_err - 1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(cmd->errors[nb_err - 1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout error" << std::endl; } - else if (strcmp(cmd->errors[nb_err - 1].reason,"API_CommandFailed") == 0) + else if (strcmp(cmd->errors[nb_err - 1].reason,API_CommandFailed) == 0) { cmd_failed = true; coutv << "Command failed error" << std::endl; @@ -87,12 +87,12 @@ void MyCallBack::attr_read(AttrReadEvent *att) coutv << "error length = " << nb_err << std::endl; for (int i = 0;i < nb_err;i++) coutv << "error[" << i << "].reason = " << att->errors[i].reason.in() << std::endl; - if (strcmp(att->errors[nb_err - 1].reason,"API_DeviceTimedOut") == 0) + if (strcmp(att->errors[nb_err - 1].reason,API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout error" << std::endl; } - else if (strcmp(att->errors[nb_err - 1].reason,"API_AttributeFailed") == 0) + else if (strcmp(att->errors[nb_err - 1].reason,API_AttributeFailed) == 0) { attr_failed = true; coutv << "Read attributes failed error" << std::endl; @@ -120,7 +120,7 @@ void MyCallBack::attr_written(AttrWrittenEvent *att) coutv << "error length = " << nb_err << std::endl; for (long i = 0;i < nb_err;i++) coutv << "error[" << i << "].reason = " << att->errors.err_list[i].err_stack[0].reason.in() << std::endl; - if (strcmp(att->errors.err_list[nb_err - 1].err_stack[0].reason.in(),"API_DeviceTimedOut") == 0) + if (strcmp(att->errors.err_list[nb_err - 1].err_stack[0].reason.in(),API_DeviceTimedOut) == 0) { to = true; coutv << "Timeout error" << std::endl; diff --git a/cpp_test_suite/cpp_test_ds/SigThrow.cpp b/cpp_test_suite/cpp_test_ds/SigThrow.cpp index 618558dfb..603fa98cc 100644 --- a/cpp_test_suite/cpp_test_ds/SigThrow.cpp +++ b/cpp_test_suite/cpp_test_ds/SigThrow.cpp @@ -97,7 +97,7 @@ bool IOExcept::is_allowed(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::A CORBA::Any *IOExcept::execute(TANGO_UNUSED(Tango::DeviceImpl *device),TANGO_UNUSED(const CORBA::Any &in_any)) { - Tango::Except::throw_exception((const char *)"API_ThrowException", + Tango::Except::throw_exception((const char *)API_ThrowException, (const char *)"This is a test ", (const char *)"IOExcept::execute()"); diff --git a/cpp_test_suite/event/change_event.cpp b/cpp_test_suite/event/change_event.cpp index 5df8ca02f..584bc0f30 100644 --- a/cpp_test_suite/event/change_event.cpp +++ b/cpp_test_suite/event/change_event.cpp @@ -846,7 +846,7 @@ device = new DeviceProxy(device_name); { // Tango::Except::print_exception(e); std::string reason(e.errors[0].reason); - if (reason == "API_EventNotFound") + if (reason == API_EventNotFound) unsub = true; } diff --git a/cpp_test_suite/event/data_ready_event.cpp b/cpp_test_suite/event/data_ready_event.cpp index 9609716d7..c3e14b1e5 100644 --- a/cpp_test_suite/event/data_ready_event.cpp +++ b/cpp_test_suite/event/data_ready_event.cpp @@ -227,7 +227,7 @@ int main(int argc, char **argv) } assert (received_err == true); - assert (err_reason == "API_AttrNotFound"); + assert (err_reason == API_AttrNotFound); // // unsubscribe to the event diff --git a/cpp_test_suite/event/multi_event.cpp b/cpp_test_suite/event/multi_event.cpp index c7256aab7..3785b3b5a 100644 --- a/cpp_test_suite/event/multi_event.cpp +++ b/cpp_test_suite/event/multi_event.cpp @@ -533,7 +533,7 @@ int main(int argc, char **argv) { // Tango::Except::print_exception(e); std::string reason(e.errors[0].reason); - if (reason == "API_EventNotFound") + if (reason == API_EventNotFound) unsub = true; } diff --git a/cpp_test_suite/event/per_event.cpp b/cpp_test_suite/event/per_event.cpp index d3d1d39c8..9e240db01 100644 --- a/cpp_test_suite/event/per_event.cpp +++ b/cpp_test_suite/event/per_event.cpp @@ -75,7 +75,7 @@ void EventCallBack::push_event(Tango::EventData* event_data) // Tango::Except::print_error_stack(event_data->errors); if (strcmp(event_data->errors[0].reason.in(),"aaa") == 0) cb_err++; - else if (strcmp(event_data->errors[0].reason.in(),"API_PollThreadOutOfSync") == 0) + else if (strcmp(event_data->errors[0].reason.in(),API_PollThreadOutOfSync) == 0) cb_err_out_of_sync++; } } diff --git a/cpp_test_suite/new_tests/cxx_attr_conf.cpp b/cpp_test_suite/new_tests/cxx_attr_conf.cpp index e1c6cbb67..c1c6050de 100644 --- a/cpp_test_suite/new_tests/cxx_attr_conf.cpp +++ b/cpp_test_suite/new_tests/cxx_attr_conf.cpp @@ -75,7 +75,7 @@ class AttrConfTestSuite: public CxxTest::TestSuite void test_some_basic_exception_cases(void) { TS_ASSERT_THROWS_ASSERT(device1->get_attribute_config("toto"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotFound && e.errors[0].severity == Tango::ERR)); } diff --git a/cpp_test_suite/new_tests/cxx_attr_misc.cpp b/cpp_test_suite/new_tests/cxx_attr_misc.cpp index 8ed815492..92a435645 100644 --- a/cpp_test_suite/new_tests/cxx_attr_misc.cpp +++ b/cpp_test_suite/new_tests/cxx_attr_misc.cpp @@ -758,27 +758,27 @@ cout << "required time for command SetGetProperties = " << elapsed << endl; TS_ASSERT_THROWS_NOTHING(attr = device1->read_attribute("Toto")); TS_ASSERT_THROWS_ASSERT(attr >> sh, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotFound && e.errors[0].severity == Tango::ERR)); TS_ASSERT_THROWS_NOTHING(attr = device1->read_attribute("attr_no_data")); TS_ASSERT_THROWS_ASSERT(attr >> sh, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrValueNotSet" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrValueNotSet && e.errors[0].severity == Tango::ERR)); TS_ASSERT_THROWS_NOTHING(attr = device1->read_attribute("attr_wrong_type")); TS_ASSERT_THROWS_ASSERT(attr >> sh, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrOptProp" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrOptProp && e.errors[0].severity == Tango::ERR)); TS_ASSERT_THROWS_NOTHING(attr = device1->read_attribute("attr_wrong_size")); TS_ASSERT_THROWS_ASSERT(attr >> lg, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrOptProp" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrOptProp && e.errors[0].severity == Tango::ERR)); TS_ASSERT_THROWS_NOTHING(attr = device1->read_attribute("attr_no_alarm")); TS_ASSERT_THROWS_ASSERT(attr >> lg, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNoAlarm" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNoAlarm && e.errors[0].severity == Tango::ERR)); } diff --git a/cpp_test_suite/new_tests/cxx_attr_write.cpp b/cpp_test_suite/new_tests/cxx_attr_write.cpp index 02a852179..d9d875219 100644 --- a/cpp_test_suite/new_tests/cxx_attr_write.cpp +++ b/cpp_test_suite/new_tests/cxx_attr_write.cpp @@ -79,7 +79,7 @@ class AttrWriteTestSuite: public CxxTest::TestSuite vector attributes; TS_ASSERT_THROWS_ASSERT(device1->write_attribute(toto), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotFound && e.errors[0].severity == Tango::ERR)); // WARNING: @@ -88,7 +88,7 @@ class AttrWriteTestSuite: public CxxTest::TestSuite attributes.push_back(short_attr_w); attributes.push_back(toto); TS_ASSERT_THROWS_ASSERT(device1->write_attributes(attributes), Tango::NamedDevFailedList &e, - TS_ASSERT(string(e.err_list[0].err_stack[0].reason.in()) == "API_AttrNotFound" + TS_ASSERT(string(e.err_list[0].err_stack[0].reason.in()) == API_AttrNotFound && e.errors[0].severity == Tango::ERR)); attributes.clear(); @@ -96,7 +96,7 @@ class AttrWriteTestSuite: public CxxTest::TestSuite attributes.push_back(short_attr); attributes.push_back(long_attr_w); TS_ASSERT_THROWS_ASSERT(device1->write_attributes(attributes), Tango::NamedDevFailedList &e, - TS_ASSERT(string(e.err_list[0].err_stack[0].reason.in()) == "API_AttrNotWritable" + TS_ASSERT(string(e.err_list[0].err_stack[0].reason.in()) == API_AttrNotWritable && e.errors[0].severity == Tango::ERR)); } diff --git a/cpp_test_suite/new_tests/cxx_blackbox.cpp b/cpp_test_suite/new_tests/cxx_blackbox.cpp index bc3c11b60..a398c6df8 100644 --- a/cpp_test_suite/new_tests/cxx_blackbox.cpp +++ b/cpp_test_suite/new_tests/cxx_blackbox.cpp @@ -113,7 +113,7 @@ class BlackboxTestSuite: public CxxTest::TestSuite void test_blackbox_device_feature(void) { TS_ASSERT_THROWS_ASSERT(device1->black_box(0), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_BlackBoxArgument" + TS_ASSERT(string(e.errors[0].reason.in()) == API_BlackBoxArgument && e.errors[0].severity == Tango::ERR)); DeviceData din, dout; @@ -243,8 +243,8 @@ catch (Tango::DevFailed &e) cout << "Again exception when talking to adm device!!!" << endl; } cout << "===> Nothing yet stored in blackbox, error reason = " << reas << endl; -// TS_ASSERT (reas == "API_BlackBoxEmpty"); - if (reas == "API_CorbaException") +// TS_ASSERT (reas == API_BlackBoxEmpty); + if (reas == API_CorbaException) { cout << "Too early, sleeping 4 more seconds...." << endl; Tango_sleep(4); @@ -279,11 +279,11 @@ catch (Tango::DevFailed &e) cout << "Again exception when talking to adm device!!!" << endl; } cout << "===> Nothing yet stored in blackbox, error reason = " << reas << endl; - TS_ASSERT (reas == "API_BlackBoxEmpty"); + TS_ASSERT (reas == API_BlackBoxEmpty); } } else - TS_ASSERT (reas == "API_BlackBoxEmpty"); + TS_ASSERT (reas == API_BlackBoxEmpty); } catch(...) { @@ -292,7 +292,7 @@ cout << "Again exception when talking to adm device!!!" << endl; } /* TS_ASSERT_THROWS_ASSERT(device3->black_box(2), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_BlackBoxEmpty" + TS_ASSERT(string(e.errors[0].reason.in()) == API_BlackBoxEmpty && e.errors[0].severity == Tango::ERR));*/ delete device3; diff --git a/cpp_test_suite/new_tests/cxx_class_signal.cpp b/cpp_test_suite/new_tests/cxx_class_signal.cpp index defc78abc..46bdea152 100644 --- a/cpp_test_suite/new_tests/cxx_class_signal.cpp +++ b/cpp_test_suite/new_tests/cxx_class_signal.cpp @@ -169,12 +169,12 @@ class ClassSignalTestSuite: public CxxTest::TestSuite // try to register class signal of out of range value TS_ASSERT_THROWS_ASSERT(device1->command_inout("IORegClassSig", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_SignalOutOfRange" + TS_ASSERT(string(e.errors[0].reason.in()) == API_SignalOutOfRange && e.errors[0].severity == Tango::ERR)); // try to unregister class signal of out of range value TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOUnregClassSig", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_SignalOutOfRange" + TS_ASSERT(string(e.errors[0].reason.in()) == API_SignalOutOfRange && e.errors[0].severity == Tango::ERR)); } diff --git a/cpp_test_suite/new_tests/cxx_cmd_query.cpp b/cpp_test_suite/new_tests/cxx_cmd_query.cpp index 9a654ca79..77fe6291c 100644 --- a/cpp_test_suite/new_tests/cxx_cmd_query.cpp +++ b/cpp_test_suite/new_tests/cxx_cmd_query.cpp @@ -100,7 +100,7 @@ class CmdQueryTestSuite: public CxxTest::TestSuite void test_fake_command(void) { TS_ASSERT_THROWS_ASSERT(device1->command_query("DevToto"),Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotFound && e.errors[0].severity == Tango::ERR)); } diff --git a/cpp_test_suite/new_tests/cxx_dserver_cmd.cpp b/cpp_test_suite/new_tests/cxx_dserver_cmd.cpp index 2ae6ee2af..ad291a35e 100644 --- a/cpp_test_suite/new_tests/cxx_dserver_cmd.cpp +++ b/cpp_test_suite/new_tests/cxx_dserver_cmd.cpp @@ -227,7 +227,7 @@ class DServerCmdTestSuite : public CxxTest::TestSuite { din << fake_logging_target; TS_ASSERT_THROWS_ASSERT(dserver->command_inout("AddLoggingTarget", din), Tango::DevFailed & e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CannotOpenFile" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CannotOpenFile && e.errors[0].severity == Tango::ERR)); // add logging target diff --git a/cpp_test_suite/new_tests/cxx_dserver_misc.cpp b/cpp_test_suite/new_tests/cxx_dserver_misc.cpp index 7cfaec42e..714401bf4 100644 --- a/cpp_test_suite/new_tests/cxx_dserver_misc.cpp +++ b/cpp_test_suite/new_tests/cxx_dserver_misc.cpp @@ -163,7 +163,7 @@ class DServerMiscTestSuite: public CxxTest::TestSuite str = "a/b/c"; din << str; TS_ASSERT_THROWS_ASSERT(dserver->command_inout("DevRestart", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_DeviceNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_DeviceNotFound && e.errors[0].severity == Tango::ERR)); state_in = Tango::OFF; diff --git a/cpp_test_suite/new_tests/cxx_enum_att.cpp b/cpp_test_suite/new_tests/cxx_enum_att.cpp index f0e5f2190..0e781c8a0 100644 --- a/cpp_test_suite/new_tests/cxx_enum_att.cpp +++ b/cpp_test_suite/new_tests/cxx_enum_att.cpp @@ -186,7 +186,7 @@ class EnumAttTestSuite: public CxxTest::TestSuite aile[0].enum_labels.push_back("North"); TS_ASSERT_THROWS_ASSERT(device1->set_attribute_config(aile),Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrOptProp" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrOptProp && e.errors[0].severity == Tango::ERR)); // Reset to lib default is invalid @@ -195,7 +195,7 @@ class EnumAttTestSuite: public CxxTest::TestSuite aile[0].enum_labels.push_back("Not specified"); TS_ASSERT_THROWS_ASSERT(device1->set_attribute_config(aile),Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrOptProp" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrOptProp && e.errors[0].severity == Tango::ERR)); // Change enum labels number is not authorized from outside the Tango class @@ -205,7 +205,7 @@ class EnumAttTestSuite: public CxxTest::TestSuite aile[0].enum_labels.push_back("South"); TS_ASSERT_THROWS_ASSERT(device1->set_attribute_config(aile),Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_NotSupportedFeature" + TS_ASSERT(string(e.errors[0].reason.in()) == API_NotSupportedFeature && e.errors[0].severity == Tango::ERR)); } @@ -424,7 +424,7 @@ class EnumAttTestSuite: public CxxTest::TestSuite /* TS_ASSERT_THROWS_NOTHING(da = device1->read_attribute("DynEnum_attr")); TS_ASSERT_THROWS_ASSERT(da >> sh,Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrConfig" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrConfig && e.errors[0].severity == Tango::ERR));*/ // Add labels to the enum @@ -461,7 +461,7 @@ class EnumAttTestSuite: public CxxTest::TestSuite TS_ASSERT_THROWS_NOTHING(da = device1->read_attribute("DynEnum_attr")); TS_ASSERT_THROWS_ASSERT(da >> sh,Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrOptProp" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrOptProp && e.errors[0].severity == Tango::ERR)); f_val = 4; diff --git a/cpp_test_suite/new_tests/cxx_exception.cpp b/cpp_test_suite/new_tests/cxx_exception.cpp index 1c1bb4479..3a1dceae6 100644 --- a/cpp_test_suite/new_tests/cxx_exception.cpp +++ b/cpp_test_suite/new_tests/cxx_exception.cpp @@ -124,7 +124,7 @@ class ExceptionTestSuite: public CxxTest::TestSuite void test_command_not_found_exception(void) { TS_ASSERT_THROWS_ASSERT(device1->command_inout("DevToto"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotFound && e.errors[0].severity == Tango::ERR)); } @@ -146,7 +146,7 @@ class ExceptionTestSuite: public CxxTest::TestSuite DevLong num = 1L; din << num; TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOLong", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotAllowed" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotAllowed && e.errors[0].severity == Tango::ERR)); state_in = Tango::ON; diff --git a/cpp_test_suite/new_tests/cxx_fwd_att.cpp b/cpp_test_suite/new_tests/cxx_fwd_att.cpp index e02f403ff..f9f3aa30e 100644 --- a/cpp_test_suite/new_tests/cxx_fwd_att.cpp +++ b/cpp_test_suite/new_tests/cxx_fwd_att.cpp @@ -99,7 +99,7 @@ class FwdAttTestSuite: public CxxTest::TestSuite cerr << "cxx_fwd_att.cpp test suite - DevFailed exception" << endl; Except::print_exception(e); string reason(e.errors[0].reason); - if (reason == "API_AttrNotFound") + if (reason == API_AttrNotFound) { string status = fwd_device->status(); cout << "Forward device status = " << status << endl; @@ -634,7 +634,7 @@ class FwdAttTestSuite: public CxxTest::TestSuite attr_poll.svalue[2] = "fwd_short_rw"; din << attr_poll; TS_ASSERT_THROWS_ASSERT(ad->command_inout("AddObjPolling",din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_NotSupportedFeature" + TS_ASSERT(string(e.errors[0].reason.in()) == API_NotSupportedFeature && e.errors[0].severity == Tango::ERR)); // Start polling on root device @@ -693,7 +693,7 @@ class FwdAttTestSuite: public CxxTest::TestSuite DeviceAttribute da_fail = fwd_device->read_attribute("fwd_short_rw"); TS_ASSERT_THROWS_ASSERT(da_fail >> ds, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotPolled" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotPolled && e.errors[0].severity == Tango::ERR)); } @@ -718,7 +718,7 @@ class FwdAttTestSuite: public CxxTest::TestSuite } TS_ASSERT_THROWS_ASSERT(fwd_device->subscribe_event("fwd_short_rw",Tango::PERIODIC_EVENT,&cb),Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttributePollingNotStarted" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttributePollingNotStarted && e.errors[0].severity == Tango::ERR)); // Start polling on root device and subscribe diff --git a/cpp_test_suite/new_tests/cxx_group.cpp b/cpp_test_suite/new_tests/cxx_group.cpp index 155ad054b..6631a1e64 100644 --- a/cpp_test_suite/new_tests/cxx_group.cpp +++ b/cpp_test_suite/new_tests/cxx_group.cpp @@ -377,7 +377,7 @@ class GroupTestSuite: public CxxTest::TestSuite dd << 75.0; arguments.push_back(dd); TS_ASSERT_THROWS_ASSERT(group->command_inout_asynch("IODouble",arguments), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_MethodArgument" + TS_ASSERT(string(e.errors[0].reason.in()) == API_MethodArgument && e.errors[0].severity == Tango::ERR)); } @@ -389,7 +389,7 @@ class GroupTestSuite: public CxxTest::TestSuite arguments[0] = 15.0; arguments[1] = 25.0; TS_ASSERT_THROWS_ASSERT(group->command_inout("IODouble",arguments), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_MethodArgument" + TS_ASSERT(string(e.errors[0].reason.in()) == API_MethodArgument && e.errors[0].severity == Tango::ERR)); } @@ -403,13 +403,13 @@ class GroupTestSuite: public CxxTest::TestSuite TS_ASSERT(crl.has_failed() == true); TS_ASSERT(crl.size() == 3); TS_ASSERT_THROWS_ASSERT(crl[0] >> db, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_ThrowException" + TS_ASSERT(string(e.errors[0].reason.in()) == API_ThrowException && e.errors[0].severity == Tango::ERR)); TS_ASSERT_THROWS_ASSERT(crl[1] >> db, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_ThrowException" + TS_ASSERT(string(e.errors[0].reason.in()) == API_ThrowException && e.errors[0].severity == Tango::ERR)); TS_ASSERT_THROWS_ASSERT(crl[2] >> db, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_ThrowException" + TS_ASSERT(string(e.errors[0].reason.in()) == API_ThrowException && e.errors[0].severity == Tango::ERR)); GroupReply::enable_exception(last_mode); } @@ -425,9 +425,9 @@ class GroupTestSuite: public CxxTest::TestSuite TS_ASSERT(crl[0].has_failed() == true); TS_ASSERT(crl[1].has_failed() == true); TS_ASSERT(crl[2].has_failed() == true); - TS_ASSERT(string(crl[0].get_err_stack()[0].reason.in()) == "API_ThrowException"); - TS_ASSERT(string(crl[1].get_err_stack()[0].reason.in()) == "API_ThrowException"); - TS_ASSERT(string(crl[2].get_err_stack()[0].reason.in()) == "API_ThrowException"); + TS_ASSERT(string(crl[0].get_err_stack()[0].reason.in()) == API_ThrowException); + TS_ASSERT(string(crl[1].get_err_stack()[0].reason.in()) == API_ThrowException); + TS_ASSERT(string(crl[2].get_err_stack()[0].reason.in()) == API_ThrowException); GroupReply::enable_exception(last_mode); } @@ -526,13 +526,13 @@ class GroupTestSuite: public CxxTest::TestSuite TS_ASSERT(arl.has_failed() == true); TS_ASSERT(arl.size() == 3); TS_ASSERT_THROWS_ASSERT(arl[0] >> db, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotFound && e.errors[0].severity == Tango::ERR)); TS_ASSERT_THROWS_ASSERT(arl[1] >> db, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotFound && e.errors[0].severity == Tango::ERR)); TS_ASSERT_THROWS_ASSERT(arl[2] >> db, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotFound && e.errors[0].severity == Tango::ERR)); GroupReply::enable_exception(last_mode); } @@ -548,9 +548,9 @@ class GroupTestSuite: public CxxTest::TestSuite TS_ASSERT(arl[0].has_failed() == true); TS_ASSERT(arl[1].has_failed() == true); TS_ASSERT(arl[2].has_failed() == true); - TS_ASSERT(string(arl[0].get_err_stack()[0].reason.in()) == "API_AttrNotFound"); - TS_ASSERT(string(arl[1].get_err_stack()[0].reason.in()) == "API_AttrNotFound"); - TS_ASSERT(string(arl[2].get_err_stack()[0].reason.in()) == "API_AttrNotFound"); + TS_ASSERT(string(arl[0].get_err_stack()[0].reason.in()) == API_AttrNotFound); + TS_ASSERT(string(arl[1].get_err_stack()[0].reason.in()) == API_AttrNotFound); + TS_ASSERT(string(arl[2].get_err_stack()[0].reason.in()) == API_AttrNotFound); GroupReply::enable_exception(last_mode); } @@ -793,7 +793,7 @@ class GroupTestSuite: public CxxTest::TestSuite // wrong number of arguments values.push_back(da4); TS_ASSERT_THROWS_ASSERT(group->write_attribute_asynch(values,true), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_MethodArgument" + TS_ASSERT(string(e.errors[0].reason.in()) == API_MethodArgument && e.errors[0].severity == Tango::ERR)); // read attribute to check if new value was properly set diff --git a/cpp_test_suite/new_tests/cxx_mem_attr.cpp b/cpp_test_suite/new_tests/cxx_mem_attr.cpp index 1712d1d75..30cdfbcdd 100644 --- a/cpp_test_suite/new_tests/cxx_mem_attr.cpp +++ b/cpp_test_suite/new_tests/cxx_mem_attr.cpp @@ -123,7 +123,7 @@ class MemAttrTestSuite: public CxxTest::TestSuite short s_val; TS_ASSERT_THROWS_ASSERT(read_da >> s_val,Tango::DevFailed &e, TS_ASSERT(string(e.errors[0].reason.in()) == "Aaaa" && e.errors[0].severity == Tango::ERR && - string(e.errors[1].reason.in()) == "API_MemAttFailedDuringInit" && e.errors[1].severity == Tango::ERR)); + string(e.errors[1].reason.in()) == API_MemAttFailedDuringInit && e.errors[1].severity == Tango::ERR)); // // Ask attribute not to throw exception any more diff --git a/cpp_test_suite/new_tests/cxx_misc_util.cpp b/cpp_test_suite/new_tests/cxx_misc_util.cpp index a957f0530..514c806cf 100644 --- a/cpp_test_suite/new_tests/cxx_misc_util.cpp +++ b/cpp_test_suite/new_tests/cxx_misc_util.cpp @@ -92,7 +92,7 @@ class MiscUtilTestSuite: public CxxTest::TestSuite din << class_name; TS_ASSERT_THROWS_ASSERT(device1->command_inout("IODevListByClass", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_ClassNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_ClassNotFound && e.errors[0].severity == Tango::ERR)); } @@ -129,7 +129,7 @@ class MiscUtilTestSuite: public CxxTest::TestSuite const char *fake_name = "dev/test/1000"; din << fake_name; TS_ASSERT_THROWS_ASSERT(device1->command_inout("IODevByName", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_DeviceNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_DeviceNotFound && e.errors[0].severity == Tango::ERR)); } }; diff --git a/cpp_test_suite/new_tests/cxx_old_poll.cpp b/cpp_test_suite/new_tests/cxx_old_poll.cpp index 73aa38fb1..6633b9924 100644 --- a/cpp_test_suite/new_tests/cxx_old_poll.cpp +++ b/cpp_test_suite/new_tests/cxx_old_poll.cpp @@ -323,7 +323,7 @@ class OldPollTestSuite__loop : public CxxTest::TestSuite { TS_ASSERT((*d_hist)[i].has_failed() == true); TS_ASSERT((*d_hist)[i].get_err_stack().length() == 1); - TS_ASSERT(!strcmp((*d_hist)[i].get_err_stack()[0].reason, "API_ThrowException")); + TS_ASSERT(!strcmp((*d_hist)[i].get_err_stack()[0].reason, API_ThrowException)); } delete d_hist; } @@ -637,7 +637,7 @@ class OldPollTestSuite__loop : public CxxTest::TestSuite { TS_ASSERT((*a_hist)[i].has_failed() == true); TS_ASSERT((*a_hist)[i].get_err_stack().length() == 1); - TS_ASSERT(!strcmp((*a_hist)[i].get_err_stack()[0].reason, "API_AttrOptProp")); + TS_ASSERT(!strcmp((*a_hist)[i].get_err_stack()[0].reason, API_AttrOptProp)); // AttributeDimension dim; // dim = (*a_hist)[i].get_r_dimension(); diff --git a/cpp_test_suite/new_tests/cxx_pipe.cpp b/cpp_test_suite/new_tests/cxx_pipe.cpp index 6d971e606..d6f886f1c 100644 --- a/cpp_test_suite/new_tests/cxx_pipe.cpp +++ b/cpp_test_suite/new_tests/cxx_pipe.cpp @@ -443,13 +443,13 @@ class PipeTestSuite: public CxxTest::TestSuite vector v_sta; TS_ASSERT_THROWS_ASSERT(pipe_data >> dl >> v_db >> v_us >> v_sta >> dl_extra;, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeWrongArg" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeWrongArg && e.errors[0].severity == Tango::ERR)); pipe_data = device1->read_pipe("rPipe"); TS_ASSERT_THROWS_ASSERT(pipe_data >> dl >> dl_extra;, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_IncompatibleArgumentType" + TS_ASSERT(string(e.errors[0].reason.in()) == API_IncompatibleArgumentType && e.errors[0].severity == Tango::ERR)); d_in << (short)4; @@ -460,7 +460,7 @@ class PipeTestSuite: public CxxTest::TestSuite TS_ASSERT(pipe_data.get_data_elt_nb() == 2); TS_ASSERT_THROWS_ASSERT(pipe_data >> dl >> dl;, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_EmptyDataElement" + TS_ASSERT(string(e.errors[0].reason.in()) == API_EmptyDataElement && e.errors[0].severity == Tango::ERR)); // Same error with bit test instead of exceptions @@ -493,13 +493,13 @@ class PipeTestSuite: public CxxTest::TestSuite device1->command_inout("SetPipeOutput",d_in); TS_ASSERT_THROWS_ASSERT(pipe_data = device1->read_pipe("rpipe");, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeValueNotSet" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeValueNotSet && e.errors[0].severity == Tango::ERR)); // Error pipe not found TS_ASSERT_THROWS_ASSERT(pipe_data = device1->read_pipe("pi");, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeNotFound && e.errors[0].severity == Tango::ERR)); // Not allowed error @@ -508,7 +508,7 @@ class PipeTestSuite: public CxxTest::TestSuite device1->command_inout("IOState",d_in); TS_ASSERT_THROWS_ASSERT(pipe_data = device1->read_pipe("rpipe");, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeNotAllowed" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeNotAllowed && e.errors[0].severity == Tango::ERR)); d_in << Tango::ON; @@ -520,7 +520,7 @@ class PipeTestSuite: public CxxTest::TestSuite device1->command_inout("SetPipeOutput",d_in); TS_ASSERT_THROWS_ASSERT(pipe_data = device1->read_pipe("rpipe");, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeDuplicateDEName" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeDuplicateDEName && e.errors[0].severity == Tango::ERR)); // Duplicate DE name @@ -529,7 +529,7 @@ class PipeTestSuite: public CxxTest::TestSuite device1->command_inout("SetPipeOutput",d_in); TS_ASSERT_THROWS_ASSERT(pipe_data = device1->read_pipe("rpipe");, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeNoDataElement" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeNoDataElement && e.errors[0].severity == Tango::ERR)); // Mixing insertion method type @@ -538,7 +538,7 @@ class PipeTestSuite: public CxxTest::TestSuite device1->command_inout("SetPipeOutput",d_in); TS_ASSERT_THROWS_ASSERT(pipe_data = device1->read_pipe("rpipe");, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_NotSupportedFeature" + TS_ASSERT(string(e.errors[0].reason.in()) == API_NotSupportedFeature && e.errors[0].severity == Tango::ERR)); // Not enough data element @@ -547,7 +547,7 @@ class PipeTestSuite: public CxxTest::TestSuite device1->command_inout("SetPipeOutput",d_in); TS_ASSERT_THROWS_ASSERT(pipe_data = device1->read_pipe("rpipe");, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeWrongArg" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeWrongArg && e.errors[0].severity == Tango::ERR)); // Mixing extraction method type @@ -563,7 +563,7 @@ class PipeTestSuite: public CxxTest::TestSuite pipe_data >> de_dl; TS_ASSERT_THROWS_ASSERT(pipe_data["SecondDE"] >> de_v_db;, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_NotSupportedFeature" + TS_ASSERT(string(e.errors[0].reason.in()) == API_NotSupportedFeature && e.errors[0].severity == Tango::ERR)); } @@ -601,7 +601,7 @@ class PipeTestSuite: public CxxTest::TestSuite v_fl.push_back(8.88); TS_ASSERT_THROWS_ASSERT(device1->write_pipe(dp);, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeNoDataElement" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeNoDataElement && e.errors[0].severity == Tango::ERR)); // Empty data element @@ -609,7 +609,7 @@ class PipeTestSuite: public CxxTest::TestSuite dp.set_data_elt_names(de_names); TS_ASSERT_THROWS_ASSERT(device1->write_pipe(dp);, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_EmptyDataElement" + TS_ASSERT(string(e.errors[0].reason.in()) == API_EmptyDataElement && e.errors[0].severity == Tango::ERR)); // Pipe not found @@ -619,7 +619,7 @@ class PipeTestSuite: public CxxTest::TestSuite dp << str << v_fl; TS_ASSERT_THROWS_ASSERT(device1->write_pipe(dp);, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeNotFound && e.errors[0].severity == Tango::ERR)); // Pipe not writable @@ -629,7 +629,7 @@ class PipeTestSuite: public CxxTest::TestSuite dp << str << v_fl; TS_ASSERT_THROWS_ASSERT(device1->write_pipe(dp);, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PipeNotWritable" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PipeNotWritable && e.errors[0].severity == Tango::ERR)); // Wrong data sent to pipe @@ -641,7 +641,7 @@ class PipeTestSuite: public CxxTest::TestSuite dp << v_fl; TS_ASSERT_THROWS_ASSERT(device1->write_pipe(dp);, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_IncompatibleArgumentType" + TS_ASSERT(string(e.errors[0].reason.in()) == API_IncompatibleArgumentType && e.errors[0].severity == Tango::ERR)); de_names.clear(); @@ -653,7 +653,7 @@ class PipeTestSuite: public CxxTest::TestSuite dp << str << str; TS_ASSERT_THROWS_ASSERT(device1->write_pipe(dp);, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_IncompatibleArgumentType" + TS_ASSERT(string(e.errors[0].reason.in()) == API_IncompatibleArgumentType && e.errors[0].severity == Tango::ERR)); } diff --git a/cpp_test_suite/new_tests/cxx_poll.cpp b/cpp_test_suite/new_tests/cxx_poll.cpp index 4fec2aa5c..78e0b6995 100644 --- a/cpp_test_suite/new_tests/cxx_poll.cpp +++ b/cpp_test_suite/new_tests/cxx_poll.cpp @@ -192,7 +192,7 @@ class PollTestSuite__loop: public CxxTest::TestSuite // execute non-existing command TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOxxx"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotFound && e.errors[0].severity == Tango::ERR)); // now set the data source to polling buffer (CACHE) @@ -200,12 +200,12 @@ class PollTestSuite__loop: public CxxTest::TestSuite // execute non-existing command TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOxxx"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotFound && e.errors[0].severity == Tango::ERR)); // execute non-polled command TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOStr1"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CmdNotPolled" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CmdNotPolled && e.errors[0].severity == Tango::ERR)); // set the data source again to device (DEV) @@ -223,7 +223,7 @@ class PollTestSuite__loop: public CxxTest::TestSuite // read a non-existing attribute TS_ASSERT_THROWS_NOTHING(mock_attr = device1->read_attribute("xxx")); TS_ASSERT_THROWS_ASSERT(mock_attr >> sh, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotFound && e.errors[0].severity == Tango::ERR)); // set the data source again to polling buffer (CACHE) @@ -232,13 +232,13 @@ class PollTestSuite__loop: public CxxTest::TestSuite // again read a non-existing attribute TS_ASSERT_THROWS_NOTHING(mock_attr = device1->read_attribute("xxx")); TS_ASSERT_THROWS_ASSERT(mock_attr >> sh, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotFound && e.errors[0].severity == Tango::ERR)); // read a non-polled attribute TS_ASSERT_THROWS_NOTHING(short_attr = device1->read_attribute("Short_attr")); TS_ASSERT_THROWS_ASSERT(short_attr >> sh, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotPolled" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotPolled && e.errors[0].severity == Tango::ERR)); } @@ -315,12 +315,12 @@ class PollTestSuite__loop: public CxxTest::TestSuite DevLong lg; TS_ASSERT_THROWS_NOTHING(mock_attr = device1->read_attribute("attr_wrong_size")); TS_ASSERT_THROWS_ASSERT(mock_attr >> lg, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrOptProp" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrOptProp && e.errors[0].severity == Tango::ERR)); // execute a command which throws an exception TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOExcept"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_ThrowException" + TS_ASSERT(string(e.errors[0].reason.in()) == API_ThrowException && e.errors[0].severity == Tango::ERR)); } @@ -354,7 +354,7 @@ class PollTestSuite__loop: public CxxTest::TestSuite // read an attribute from cache, which throws an exception TS_ASSERT_THROWS_NOTHING(mock_attr = device1->read_attribute("attr_wrong_size")); TS_ASSERT_THROWS_ASSERT(mock_attr >> lg, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrOptProp" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrOptProp && e.errors[0].severity == Tango::ERR)); // @@ -367,12 +367,12 @@ class PollTestSuite__loop: public CxxTest::TestSuite // read a non-polled attribute from cache TS_ASSERT_THROWS_NOTHING(lg_attr = device1->read_attribute("Long_attr")); TS_ASSERT_THROWS_ASSERT(lg_attr >> lg, Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_AttrNotPolled" + TS_ASSERT(string(e.errors[0].reason.in()) == API_AttrNotPolled && e.errors[0].severity == Tango::ERR)); // execute non-polled command with polling buffer as data source TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOStr2"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CmdNotPolled" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CmdNotPolled && e.errors[0].severity == Tango::ERR)); // diff --git a/cpp_test_suite/new_tests/cxx_poll_admin.cpp b/cpp_test_suite/new_tests/cxx_poll_admin.cpp index eea370eff..c51c9ffc4 100644 --- a/cpp_test_suite/new_tests/cxx_poll_admin.cpp +++ b/cpp_test_suite/new_tests/cxx_poll_admin.cpp @@ -263,7 +263,7 @@ class PollAdminTestSuite__loop: public CxxTest::TestSuite string mock_device = "toto"; din << mock_device; TS_ASSERT_THROWS_ASSERT(dserver->command_inout("DevPollStatus", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_DeviceNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_DeviceNotFound && e.errors[0].severity == Tango::ERR)); // get polling status for a non polled device @@ -1066,14 +1066,14 @@ class PollAdminTestSuite__loop: public CxxTest::TestSuite string mock_command = "toto"; din << mock_command; TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOTrigPoll", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PollObjNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PollObjNotFound && e.errors[0].severity == Tango::ERR)); // trigger polling for a non-polled command string non_polled_command = "IOPollStr1"; din << non_polled_command; TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOTrigPoll", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_PollObjNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_PollObjNotFound && e.errors[0].severity == Tango::ERR)); // add polling for a non externally triggered command @@ -1090,7 +1090,7 @@ class PollAdminTestSuite__loop: public CxxTest::TestSuite string non_ext_trig_command = "IOPollStr1"; din << non_ext_trig_command; TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOTrigPoll", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_NotSupported" + TS_ASSERT(string(e.errors[0].reason.in()) == API_NotSupported && e.errors[0].severity == Tango::ERR)); // stop polling for the non externally triggered command diff --git a/cpp_test_suite/new_tests/cxx_signal.cpp b/cpp_test_suite/new_tests/cxx_signal.cpp index 868ff418c..bd8c0bdfc 100644 --- a/cpp_test_suite/new_tests/cxx_signal.cpp +++ b/cpp_test_suite/new_tests/cxx_signal.cpp @@ -173,12 +173,12 @@ class SignalTestSuite: public CxxTest::TestSuite // try to register signal of out of range value TS_ASSERT_THROWS_ASSERT(device1->command_inout("IORegSig", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_SignalOutOfRange" + TS_ASSERT(string(e.errors[0].reason.in()) == API_SignalOutOfRange && e.errors[0].severity == Tango::ERR)); // try to unregister signal of out of range value TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOUnregSig", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_SignalOutOfRange" + TS_ASSERT(string(e.errors[0].reason.in()) == API_SignalOutOfRange && e.errors[0].severity == Tango::ERR)); } diff --git a/cpp_test_suite/new_tests/cxx_syntax.cpp b/cpp_test_suite/new_tests/cxx_syntax.cpp index 2a5574861..f80de5afe 100644 --- a/cpp_test_suite/new_tests/cxx_syntax.cpp +++ b/cpp_test_suite/new_tests/cxx_syntax.cpp @@ -81,7 +81,7 @@ class SyntaxTestSuite: public CxxTest::TestSuite } catch (DevFailed &e) { - if (strcmp(e.errors[0].reason.in(),"API_WrongDeviceNameSyntax") == 0) + if (strcmp(e.errors[0].reason.in(),API_WrongDeviceNameSyntax) == 0) ret = 0; else ret = 1; @@ -101,9 +101,9 @@ class SyntaxTestSuite: public CxxTest::TestSuite } catch (DevFailed &e) { - if (strcmp(e.errors[0].reason.in(),"API_WrongAttributeNameSyntax") == 0) + if (strcmp(e.errors[0].reason.in(),API_WrongAttributeNameSyntax) == 0) ret = 0; - else if (strcmp(e.errors[0].reason.in(),"API_UnsupportedAttribute") == 0) + else if (strcmp(e.errors[0].reason.in(),API_UnsupportedAttribute) == 0) ret = 1; else ret = 2; diff --git a/cpp_test_suite/new_tests/cxx_templ_cmd.cpp b/cpp_test_suite/new_tests/cxx_templ_cmd.cpp index 4b9666e36..a292bf644 100644 --- a/cpp_test_suite/new_tests/cxx_templ_cmd.cpp +++ b/cpp_test_suite/new_tests/cxx_templ_cmd.cpp @@ -106,7 +106,7 @@ class TemplateCmdTestSuite: public CxxTest::TestSuite TS_ASSERT_THROWS_NOTHING(device1->command_inout("IOState", din)); TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOTemplState"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotAllowed" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotAllowed && e.errors[0].severity == Tango::ERR)); state_in = Tango::ON; @@ -148,7 +148,7 @@ class TemplateCmdTestSuite: public CxxTest::TestSuite din << lg; TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOTemplInState", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotAllowed" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotAllowed && e.errors[0].severity == Tango::ERR)); state_in = Tango::ON; @@ -196,7 +196,7 @@ class TemplateCmdTestSuite: public CxxTest::TestSuite TS_ASSERT_THROWS_NOTHING(device1->command_inout("IOState", din)); TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOTemplOutState"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotAllowed" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotAllowed && e.errors[0].severity == Tango::ERR)); state_in = Tango::ON; @@ -246,7 +246,7 @@ class TemplateCmdTestSuite: public CxxTest::TestSuite din << db; TS_ASSERT_THROWS_ASSERT(device1->command_inout("IOTemplInOutState", din), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotAllowed" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotAllowed && e.errors[0].severity == Tango::ERR)); state_in = Tango::ON; diff --git a/cpp_test_suite/new_tests/cxx_template.cpp b/cpp_test_suite/new_tests/cxx_template.cpp index 646664573..381e4ca32 100644 --- a/cpp_test_suite/new_tests/cxx_template.cpp +++ b/cpp_test_suite/new_tests/cxx_template.cpp @@ -106,7 +106,7 @@ class TemplateTestSuite: public CxxTest::TestSuite CxxTest::TangoPrinter::restore_set("my_restore_point"); TS_ASSERT(true); TS_ASSERT_THROWS_ASSERT(device1->command_inout("UndefinedCommand"), Tango::DevFailed &e, - TS_ASSERT(string(e.errors[0].reason.in()) == "API_CommandNotFound" + TS_ASSERT(string(e.errors[0].reason.in()) == API_CommandNotFound && e.errors[0].severity == Tango::ERR)); // if the test suite fails here, thanks to the restore point, the test suite TearDown method will restore the defaults // after you set back the default configuration, append the following line diff --git a/cpp_test_suite/old_tests/acc_right.cpp b/cpp_test_suite/old_tests/acc_right.cpp index 59333830e..a4a6d1233 100644 --- a/cpp_test_suite/old_tests/acc_right.cpp +++ b/cpp_test_suite/old_tests/acc_right.cpp @@ -716,7 +716,7 @@ void check_device_access(DeviceProxy *dev,bool allowed,bool all_cmd_not_allowed) catch (Tango::DevFailed &e) { // Except::print_exception(e); - if (::strcmp(e.errors[0].reason.in(),"API_ReadOnlyMode") == 0) + if (::strcmp(e.errors[0].reason.in(),API_ReadOnlyMode) == 0) read_only_except = true; } @@ -742,7 +742,7 @@ void check_device_access(DeviceProxy *dev,bool allowed,bool all_cmd_not_allowed) catch (Tango::DevFailed &e) { // Except::print_exception(e); - if (::strcmp(e.errors[0].reason.in(),"API_ReadOnlyMode") == 0) + if (::strcmp(e.errors[0].reason.in(),API_ReadOnlyMode) == 0) read_only_except = true; } @@ -774,7 +774,7 @@ void check_device_access(DeviceProxy *dev,bool allowed,bool all_cmd_not_allowed) catch (Tango::DevFailed &e) { // Except::print_exception(e); - if (::strcmp(e.errors[0].reason.in(),"API_ReadOnlyMode") == 0) + if (::strcmp(e.errors[0].reason.in(),API_ReadOnlyMode) == 0) read_only_except = true; } @@ -807,12 +807,12 @@ void call_devices_ds_off(DeviceProxy *dev_dp,DeviceProxy *another_dev_dp,bool ki // Except::print_exception(e); if (e.errors.length() == 2) { - if (::strcmp(e.errors[0].reason.in(),"API_DeviceNotExported") == 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceNotExported) == 0) not_exported_except = true; } else if (e.errors.length() == 3) { - if (::strcmp(e.errors[1].reason.in(),"API_CantConnectToDevice") == 0) + if (::strcmp(e.errors[1].reason.in(),API_CantConnectToDevice) == 0) cant_connect_except = true; } } @@ -835,12 +835,12 @@ void call_devices_ds_off(DeviceProxy *dev_dp,DeviceProxy *another_dev_dp,bool ki // Except::print_exception(e); if (e.errors.length() == 2) { - if (::strcmp(e.errors[0].reason.in(),"API_DeviceNotExported") == 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceNotExported) == 0) not_exported_except = true; } else if (e.errors.length() == 3) { - if (::strcmp(e.errors[1].reason.in(),"API_CantConnectToDevice") == 0) + if (::strcmp(e.errors[1].reason.in(),API_CantConnectToDevice) == 0) cant_connect_except = true; } } @@ -863,12 +863,12 @@ void call_devices_ds_off(DeviceProxy *dev_dp,DeviceProxy *another_dev_dp,bool ki // Except::print_exception(e); if (e.errors.length() == 2) { - if (::strcmp(e.errors[0].reason.in(),"API_DeviceNotExported") == 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceNotExported) == 0) not_exported_except = true; } else if (e.errors.length() == 3) { - if (::strcmp(e.errors[1].reason.in(),"API_CantConnectToDevice") == 0) + if (::strcmp(e.errors[1].reason.in(),API_CantConnectToDevice) == 0) cant_connect_except = true; } } @@ -891,12 +891,12 @@ void call_devices_ds_off(DeviceProxy *dev_dp,DeviceProxy *another_dev_dp,bool ki // Except::print_exception(e); if (e.errors.length() == 2) { - if (::strcmp(e.errors[0].reason.in(),"API_DeviceNotExported") == 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceNotExported) == 0) not_exported_except = true; } else if (e.errors.length() == 3) { - if (::strcmp(e.errors[1].reason.in(),"API_CantConnectToDevice") == 0) + if (::strcmp(e.errors[1].reason.in(),API_CantConnectToDevice) == 0) cant_connect_except = true; } } diff --git a/cpp_test_suite/old_tests/allowed_cmd.cpp b/cpp_test_suite/old_tests/allowed_cmd.cpp index 7950f20d8..e860d7acf 100644 --- a/cpp_test_suite/old_tests/allowed_cmd.cpp +++ b/cpp_test_suite/old_tests/allowed_cmd.cpp @@ -4,7 +4,7 @@ * Possible return code: * -1 : major error * 0 : success - * 1 : Exception "API_DeviceLocked" + * 1 : Exception API_DeviceLocked * 2 : All other exceptions */ @@ -63,7 +63,7 @@ int main(int argc, char **argv) catch (Tango::DevFailed &e) { // Except::print_exception(e); - if (::strcmp(e.errors[0].reason.in(),"API_DeviceLocked") == 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceLocked) == 0) return 1; else return 2; diff --git a/cpp_test_suite/old_tests/attr_misc.cpp b/cpp_test_suite/old_tests/attr_misc.cpp index 7b1223652..4f740d969 100644 --- a/cpp_test_suite/old_tests/attr_misc.cpp +++ b/cpp_test_suite/old_tests/attr_misc.cpp @@ -189,7 +189,7 @@ int main(int argc, char **argv) } assert (failed == true); - assert (reason == "API_WAttrOutsideLimit"); + assert (reason == API_WAttrOutsideLimit); in[2] = (float)17.6; failed = false; @@ -207,7 +207,7 @@ int main(int argc, char **argv) } assert (failed == true); - assert (reason == "API_WAttrOutsideLimit"); + assert (reason == API_WAttrOutsideLimit); cout << " Writing outside attribute limits --> OK" << endl; @@ -1057,7 +1057,7 @@ int main(int argc, char **argv) } catch (DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_AttrNotFound") == 0) + if (::strcmp(e.errors[0].reason.in(),API_AttrNotFound) == 0) except = true; } assert (except == true); @@ -1077,7 +1077,7 @@ int main(int argc, char **argv) } catch (DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_AttrNotAllowed") == 0) + if (::strcmp(e.errors[0].reason.in(),API_AttrNotAllowed) == 0) except = true; } assert (except == true); @@ -1097,7 +1097,7 @@ int main(int argc, char **argv) } catch (DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_AttrNotAllowed") == 0) + if (::strcmp(e.errors[0].reason.in(),API_AttrNotAllowed) == 0) except = true; } assert (except == true); @@ -1117,7 +1117,7 @@ int main(int argc, char **argv) } catch (DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_AttrNotAllowed") == 0) + if (::strcmp(e.errors[0].reason.in(),API_AttrNotAllowed) == 0) except = true; } assert (except == true); @@ -1137,7 +1137,7 @@ int main(int argc, char **argv) } catch (DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_AttrNotAllowed") == 0) + if (::strcmp(e.errors[0].reason.in(),API_AttrNotAllowed) == 0) except = true; } assert (except == true); diff --git a/cpp_test_suite/old_tests/lock.cpp b/cpp_test_suite/old_tests/lock.cpp index add6663fc..65cb83d27 100644 --- a/cpp_test_suite/old_tests/lock.cpp +++ b/cpp_test_suite/old_tests/lock.cpp @@ -67,7 +67,7 @@ int main(int argc, char **argv) } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_DeviceUnlockable") == 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceUnlockable) == 0) except = true; } @@ -88,7 +88,7 @@ int main(int argc, char **argv) } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_MethodArgument") == 0) + if (::strcmp(e.errors[0].reason.in(),API_MethodArgument) == 0) except = true; } @@ -101,7 +101,7 @@ int main(int argc, char **argv) } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_MethodArgument") == 0) + if (::strcmp(e.errors[0].reason.in(),API_MethodArgument) == 0) except = true; } @@ -164,7 +164,7 @@ int main(int argc, char **argv) } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_MethodArgument") == 0) + if (::strcmp(e.errors[0].reason.in(),API_MethodArgument) == 0) except = true; } @@ -375,7 +375,7 @@ int main(int argc, char **argv) } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_DeviceUnlocked") == 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceUnlocked) == 0) except = true; } @@ -415,7 +415,7 @@ int main(int argc, char **argv) } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[1].reason.in(),"API_DeviceUnlocked") == 0) + if (::strcmp(e.errors[1].reason.in(),API_DeviceUnlocked) == 0) except = true; } assert ( except == true ); diff --git a/cpp_test_suite/old_tests/locked_device.cpp b/cpp_test_suite/old_tests/locked_device.cpp index e8dd7c54d..c41498156 100644 --- a/cpp_test_suite/old_tests/locked_device.cpp +++ b/cpp_test_suite/old_tests/locked_device.cpp @@ -4,7 +4,7 @@ * Possible return code: * -1 : major error * 0 : success - * 1 : Exception "API_DeviceLocked" + * 1 : Exception API_DeviceLocked * 2 : All other exceptions * 3 : State or Status command failed */ @@ -71,7 +71,7 @@ int main(int argc, char **argv) catch (Tango::DevFailed &e) { // Except::print_exception(e); - if (::strcmp(e.errors[0].reason.in(),"API_DeviceLocked") != 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceLocked) != 0) return 2; } @@ -96,7 +96,7 @@ int main(int argc, char **argv) catch (DevFailed &e) { // Except::print_exception(e); - if (::strcmp(e.errors[0].reason.in(),"API_DeviceLocked") != 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceLocked) != 0) return 2; else finish = true; @@ -116,7 +116,7 @@ int main(int argc, char **argv) catch (Tango::DevFailed &e) { // Except::print_exception(e); - if (::strcmp(e.errors[0].reason.in(),"API_DeviceLocked") != 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceLocked) != 0) return 2; } @@ -141,7 +141,7 @@ int main(int argc, char **argv) catch (DevFailed &e) { // Except::print_exception(e); - if (::strcmp(e.errors[0].reason.in(),"API_DeviceLocked") != 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceLocked) != 0) return 2; else finish = true; @@ -165,7 +165,7 @@ int main(int argc, char **argv) catch (Tango::DevFailed &e) { // Except::print_exception(e); - if (::strcmp(e.errors[0].reason.in(),"API_DeviceLocked") != 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceLocked) != 0) return 2; else return 1; diff --git a/cpp_test_suite/old_tests/restart_device.cpp b/cpp_test_suite/old_tests/restart_device.cpp index b4e160a6e..646ea9899 100644 --- a/cpp_test_suite/old_tests/restart_device.cpp +++ b/cpp_test_suite/old_tests/restart_device.cpp @@ -5,7 +5,7 @@ * Possible return code: * -1 : major error * 0 : success - * 1 : Exception "API_DeviceLocked" + * 1 : Exception API_DeviceLocked * 2 : All other exceptions */ @@ -128,7 +128,7 @@ int main(int argc, char **argv) } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(),"API_DeviceLocked") == 0) + if (::strcmp(e.errors[0].reason.in(),API_DeviceLocked) == 0) return 1; else return 2; diff --git a/cpp_test_suite/old_tests/w_r_attr.cpp b/cpp_test_suite/old_tests/w_r_attr.cpp index 29e7d6190..e738ce416 100644 --- a/cpp_test_suite/old_tests/w_r_attr.cpp +++ b/cpp_test_suite/old_tests/w_r_attr.cpp @@ -256,7 +256,7 @@ int main(int argc, char **argv) } assert (devfailed_except == true); - assert (except_reason == "API_AttrNotWritable"); + assert (except_reason == API_AttrNotWritable); cout << " Some basic exception cases --> OK" << endl; diff --git a/cpp_test_suite/old_tests/wait_mcast_dev.cpp b/cpp_test_suite/old_tests/wait_mcast_dev.cpp index 56d716a81..b632eeb10 100644 --- a/cpp_test_suite/old_tests/wait_mcast_dev.cpp +++ b/cpp_test_suite/old_tests/wait_mcast_dev.cpp @@ -43,7 +43,7 @@ int main(int argc, char **argv) catch (Tango::DevFailed &e) { string reason(e.errors[0].reason.in()); - if (reason != "API_DeviceNotExported" && reason != "API_CorbaException") + if (reason != API_DeviceNotExported && reason != API_CorbaException) { Except::print_exception(e); exit(-1); diff --git a/cpp_test_suite/old_tests/write_attr.cpp b/cpp_test_suite/old_tests/write_attr.cpp index 02cfe79ec..45daec7b2 100644 --- a/cpp_test_suite/old_tests/write_attr.cpp +++ b/cpp_test_suite/old_tests/write_attr.cpp @@ -457,7 +457,7 @@ int main(int argc, char **argv) } assert (devfailed == true); - assert (except_reason == "API_AttrNotWritable"); + assert (except_reason == API_AttrNotWritable); cout << " write_attribute() method with exception --> OK" << endl; diff --git a/cpp_test_suite/old_tests/write_attr_3.cpp b/cpp_test_suite/old_tests/write_attr_3.cpp index c86fae1e2..cff09c556 100644 --- a/cpp_test_suite/old_tests/write_attr_3.cpp +++ b/cpp_test_suite/old_tests/write_attr_3.cpp @@ -63,7 +63,7 @@ int main(int argc, char **argv) } assert (devfailed_except == true); - assert (except_reason == "API_AttrNotWritable"); + assert (except_reason == API_AttrNotWritable); // Send too many data @@ -86,7 +86,7 @@ int main(int argc, char **argv) } assert (devfailed_except == true); - assert (except_reason == "API_WAttrOutsideLimit"); + assert (except_reason == API_WAttrOutsideLimit); // Send data above the max_value @@ -111,7 +111,7 @@ int main(int argc, char **argv) } assert (devfailed_except == true); - assert (except_reason == "API_WAttrOutsideLimit"); + assert (except_reason == API_WAttrOutsideLimit); // Send incorrect data number (mainly for image) @@ -136,7 +136,7 @@ int main(int argc, char **argv) } assert (devfailed_except == true); - assert (except_reason == "API_AttrIncorrectDataNumber"); + assert (except_reason == API_AttrIncorrectDataNumber); cout << " Exception cases --> OK" << endl; diff --git a/cppapi/client/apiexcept.h b/cppapi/client/apiexcept.h index ebc4c089d..34dac7817 100644 --- a/cppapi/client/apiexcept.h +++ b/cppapi/client/apiexcept.h @@ -172,7 +172,7 @@ public: \ errors[0].desc = Tango::string_dup(tmp);\ Tango::Except::the_mutex.unlock(); \ errors[0].severity = sever;\ - errors[0].reason = Tango::string_dup("API_CorbaException");\ + errors[0].reason = Tango::string_dup(API_CorbaException);\ errors[0].origin = Tango::string_dup(origin);\ errors[1].desc = Tango::string_dup(desc.c_str());\ errors[1].severity = sever;\ @@ -193,7 +193,7 @@ public: \ errors[0].desc = Tango::string_dup(tmp);\ Tango::Except::the_mutex.unlock(); \ errors[0].severity = sever;\ - errors[0].reason = Tango::string_dup("API_CorbaException");\ + errors[0].reason = Tango::string_dup(API_CorbaException);\ errors[0].origin = Tango::string_dup(origin);\ errors[1].desc = Tango::string_dup(desc);\ errors[1].severity = sever;\ @@ -215,7 +215,7 @@ public: \ errors[0].desc = Tango::string_dup(tmp);\ Tango::Except::the_mutex.unlock(); \ errors[0].severity = sever;\ - errors[0].reason = Tango::string_dup("API_CorbaException");\ + errors[0].reason = Tango::string_dup(API_CorbaException);\ errors[0].origin = Tango::string_dup(origin);\ errors[1].desc = Tango::string_dup(desc.c_str());\ errors[1].severity = sever;\ @@ -235,7 +235,7 @@ public: \ errors[0].desc = Tango::string_dup(tmp);\ Tango::Except::the_mutex.unlock(); \ errors[0].severity = sever;\ - errors[0].reason = Tango::string_dup("API_CorbaException");\ + errors[0].reason = Tango::string_dup(API_CorbaException);\ errors[0].origin = Tango::string_dup(origin.c_str());\ errors[1].desc = Tango::string_dup(desc.c_str());\ errors[1].severity = sever;\ @@ -256,7 +256,7 @@ public: \ errors[0].desc = Tango::string_dup(tmp);\ Tango::Except::the_mutex.unlock(); \ errors[0].severity = sever;\ - errors[0].reason = Tango::string_dup("API_CorbaException");\ + errors[0].reason = Tango::string_dup(API_CorbaException);\ errors[0].origin = Tango::string_dup(origin);\ errors[1].desc = Tango::string_dup(desc);\ errors[1].severity = sever;\ @@ -345,7 +345,7 @@ public: \ errors.length(2);\ errors[0].desc = Tango::string_dup(CORBA_error_desc);\ errors[0].severity = sever;\ - errors[0].reason = Tango::string_dup("API_CorbaException");\ + errors[0].reason = Tango::string_dup(API_CorbaException);\ errors[0].origin = Tango::string_dup(origin);\ errors[1].desc = Tango::string_dup(desc);\ errors[1].severity = sever;\ @@ -364,7 +364,7 @@ public: \ errors.length(2);\ errors[0].desc = Tango::string_dup(CORBA_error_desc);\ errors[0].severity = sever;\ - errors[0].reason = Tango::string_dup("API_CorbaException");\ + errors[0].reason = Tango::string_dup(API_CorbaException);\ errors[0].origin = Tango::string_dup(origin);\ errors[1].desc = Tango::string_dup(desc.c_str());\ errors[1].severity = sever;\ @@ -421,7 +421,7 @@ MAKE_EXCEPT(NotAllowed,NotAllowedExcept) TangoSys_OMemStream ori; \ ori << CLASS << ":" << NAME << std::ends; \ ApiCommExcept::re_throw_exception(E, \ - (const char *)"API_DeviceTimedOut", \ + (const char *)API_DeviceTimedOut, \ desc.str(), ori.str());\ }\ } \ @@ -439,7 +439,7 @@ MAKE_EXCEPT(NotAllowed,NotAllowedExcept) TangoSys_OMemStream ori; \ ori << CLASS << ":" << NAME << std::ends; \ ApiCommExcept::re_throw_exception(E, \ - (const char*)"API_CommunicationFailed", \ + (const char*)API_CommunicationFailed, \ desc.str(),ori.str()); \ } @@ -471,7 +471,7 @@ MAKE_EXCEPT(NotAllowed,NotAllowedExcept) desc << "Timeout (" << timeout << " mS) exceeded on device " << dev_name(); \ desc << ", command " << command << std::ends; \ ApiCommExcept::re_throw_exception(E, \ - (const char *)"API_DeviceTimedOut", \ + (const char *)API_DeviceTimedOut, \ desc.str(), \ (const char *)"Connection::command_inout()"); \ }\ @@ -495,7 +495,7 @@ MAKE_EXCEPT(NotAllowed,NotAllowedExcept) desc << "Failed to execute command_inout on device " << dev_name(); \ desc << ", command " << command << std::ends; \ ApiCommExcept::re_throw_exception(E, \ - (const char*)"API_CommunicationFailed", \ + (const char*)API_CommunicationFailed, \ desc.str(), \ (const char*)"Connection::command_inout()"); \ } diff --git a/cppapi/client/asynreq.cpp b/cppapi/client/asynreq.cpp index b46315abb..01d875ebd 100644 --- a/cppapi/client/asynreq.cpp +++ b/cppapi/client/asynreq.cpp @@ -152,7 +152,7 @@ Tango::TgRequest &AsynReq::get_request(long req_id) TangoSys_OMemStream desc; desc << "Failed to find a asynchronous polling request "; desc << "with id = " << req_id << std::ends; - ApiAsynExcept::throw_exception((const char*)"API_BadAsynPollId", + ApiAsynExcept::throw_exception((const char*)API_BadAsynPollId, desc.str(), (const char*)"AsynReq::get_request()"); } @@ -185,7 +185,7 @@ Tango::TgRequest &AsynReq::get_request(CORBA::Request_ptr req) { TangoSys_OMemStream desc; desc << "Failed to find a asynchronous callback request "; - ApiAsynExcept::throw_exception((const char*)"API_BadAsyn", + ApiAsynExcept::throw_exception((const char*)API_BadAsyn, desc.str(), (const char*)"AsynReq::get_request() (by request)"); } @@ -278,7 +278,7 @@ void AsynReq::remove_request(long req_id) TangoSys_OMemStream desc; desc << "Failed to find a asynchronous polling request "; desc << "with id = " << req_id << std::ends; - ApiAsynExcept::throw_exception((const char*)"API_BadAsynPollId", + ApiAsynExcept::throw_exception((const char*)API_BadAsynPollId, desc.str(), (const char*)"AsynReq::remove_request()"); } @@ -389,7 +389,7 @@ void AsynReq::mark_as_cancelled(long req_id) TangoSys_OMemStream desc; desc << "Failed to find a asynchronous polling request "; desc << "with id = " << req_id << std::ends; - ApiAsynExcept::throw_exception((const char*)"API_BadAsynPollId", + ApiAsynExcept::throw_exception((const char*)API_BadAsynPollId, desc.str(), (const char*)"AsynReq::mark_as_cancelled()"); } diff --git a/cppapi/client/attr_proxy.cpp b/cppapi/client/attr_proxy.cpp index 045627435..30e23cf48 100644 --- a/cppapi/client/attr_proxy.cpp +++ b/cppapi/client/attr_proxy.cpp @@ -138,7 +138,7 @@ void AttributeProxy::real_constructor (std::string &name) TangoSys_OMemStream desc; desc << "Attribute " << attr_name << " is not supported by device " << device_name << std::ends; - ApiWrongNameExcept::throw_exception((const char*)"API_UnsupportedAttribute", + ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedAttribute, desc.str(), (const char*)"AttributeProxy::real_constructor()"); } @@ -218,7 +218,7 @@ void AttributeProxy::ctor_from_dp(const DeviceProxy *dev_ptr,std::string &att_na TangoSys_OMemStream desc; desc << "Attribute " << attr_name << " is not supported by device " << device_name << std::ends; - ApiWrongNameExcept::throw_exception((const char*)"API_UnsupportedAttribute", + ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedAttribute, desc.str(), (const char*)"AttributeProxy::ctor_from_dp()"); } @@ -417,7 +417,7 @@ void AttributeProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << protocol; desc << " protocol is an unsupported protocol" << std::ends; - ApiWrongNameExcept::throw_exception((const char*)"API_UnsupportedProtocol", + ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedProtocol, desc.str(), (const char*)"AttributeProxy::parse_name()"); } @@ -449,7 +449,7 @@ void AttributeProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << mod; desc << " modifier is an unsupported db modifier" << std::ends; - ApiWrongNameExcept::throw_exception((const char*)"API_UnsupportedDBaseModifier", + ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedDBaseModifier, desc.str(), (const char*)"AttributeProxy::parse_name()"); } @@ -631,7 +631,7 @@ void AttributeProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Can't connect to attribute with alias " << device_name << std::ends; ApiConnExcept::re_throw_exception(dfe, - (const char *)"API_AliasNotDefined", + (const char *)API_AliasNotDefined, desc.str(), (const char *)"AttributeProxy::parse_name"); } @@ -653,7 +653,7 @@ void AttributeProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Can't connect to attribute with alias " << device_name << std::ends; ApiConnExcept::re_throw_exception(dfe, - (const char *)"API_AliasNotDefined", + (const char *)API_AliasNotDefined, desc.str(), (const char *)"AttributeProxy::parse_name"); } @@ -676,7 +676,7 @@ void AttributeProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Can't connect to attribute with alias " << device_name << std::ends; ApiConnExcept::re_throw_exception(dfe, - (const char *)"API_AliasNotDefined", + (const char *)API_AliasNotDefined, desc.str(), (const char *)"AttributeProxy::parse_name"); } @@ -1162,7 +1162,7 @@ void AttributeProxy::set_config(AttributeInfo &dev_attr_info) TangoSys_OMemStream desc; desc << "Failed to execute set_attribute_config on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char*)"API_CommunicationFailed", + (const char*)API_CommunicationFailed, desc.str(), (const char*)"AttributeProxy::set_attribute_config()"); } @@ -1183,7 +1183,7 @@ void AttributeProxy::set_config(AttributeInfoEx &dev_attr_info) TangoSys_OMemStream desc; desc << "Failed to execute set_attribute_config on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char*)"API_CommunicationFailed", + (const char*)API_CommunicationFailed, desc.str(), (const char*)"AttributeProxy::set_attribute_config()"); } diff --git a/cppapi/client/dbapi.h b/cppapi/client/dbapi.h index 24a4b4198..30f0b576c 100644 --- a/cppapi/client/dbapi.h +++ b/cppapi/client/dbapi.h @@ -1152,7 +1152,7 @@ class DbServerData { \ if (e.errors.length() >= 2) \ { \ - if (::strcmp(e.errors[1].reason.in(),"API_DeviceTimedOut") == 0) \ + if (::strcmp(e.errors[1].reason.in(),API_DeviceTimedOut) == 0) \ { \ if (db_retries != 0) \ { \ diff --git a/cppapi/client/dbapi_base.cpp b/cppapi/client/dbapi_base.cpp index 8ca0b83ea..3c32284c1 100644 --- a/cppapi/client/dbapi_base.cpp +++ b/cppapi/client/dbapi_base.cpp @@ -3606,7 +3606,7 @@ std::vector Database::make_history_array(bool is_attribute, Any_var & istream >> count; if (!istream) { - Except::throw_exception( (const char *)"API_HistoryInvalid", + Except::throw_exception( (const char *)API_HistoryInvalid, (const char *)"History format is invalid", (const char *)"Database::make_history_array()"); } @@ -3805,7 +3805,7 @@ DbDatum Database::get_services(std::string &servname,std::string &instname) catch (Tango::DevFailed &e) { std::string reason = e.errors[0].reason.in(); - if (reason == "API_UtilSingletonNotCreated" && db_tg != NULL) + if (reason == API_UtilSingletonNotCreated && db_tg != NULL) dsc = db_tg->get_db_cache(); else dsc = NULL; @@ -3886,7 +3886,7 @@ DbDatum Database::get_device_service_list(std::string &servname) catch (Tango::DevFailed &e) { std::string reason = e.errors[0].reason.in(); - if (reason == "API_UtilSingletonNotCreated" && db_tg != NULL) + if (reason == API_UtilSingletonNotCreated && db_tg != NULL) dsc = db_tg->get_db_cache(); else dsc = NULL; diff --git a/cppapi/client/dbapi_datum.cpp b/cppapi/client/dbapi_datum.cpp index 7e165d7eb..cb6c9de9f 100644 --- a/cppapi/client/dbapi_datum.cpp +++ b/cppapi/client/dbapi_datum.cpp @@ -124,7 +124,7 @@ bool DbDatum::is_empty() { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"The DbDatum object is empty", (const char*)"DbDatum::is_empty"); } @@ -168,7 +168,7 @@ bool DbDatum::operator >> (bool &datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"Cannot extract short, no data in DbDatum object ", (const char*)"DbDatum::operator >>(short)"); } @@ -234,7 +234,7 @@ bool DbDatum::operator >> (short &datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"Cannot extract short, no data in DbDatum object ", (const char*)"DbDatum::operator >>(short)"); } @@ -293,7 +293,7 @@ bool DbDatum::operator >> (unsigned char& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract unsigned short, no data in DbDatum object ", (const char*)"DbDatum::operator >>(unsigned char)"); } @@ -351,7 +351,7 @@ bool DbDatum::operator >> (unsigned short& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract unsigned short, no data in DbDatum object ", (const char*)"DbDatum::operator >>(unsigned short)"); } @@ -409,7 +409,7 @@ bool DbDatum::operator >> (DevLong& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDbDatum, (const char*)"cannot extract long, no data in DbDatum object ", (const char*)"DbDatum::operator >>(long)"); } @@ -467,7 +467,7 @@ bool DbDatum::operator >> (DevULong& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract unsigned long, no data in DbDatum object ", (const char*)"DbDatum::operator >>(unsigned long)"); } @@ -525,7 +525,7 @@ bool DbDatum::operator >> (DevLong64 &datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract unsigned long, no data in DbDatum object ", (const char*)"DbDatum::operator >>(DevLong64)"); } @@ -583,7 +583,7 @@ bool DbDatum::operator >> (DevULong64 &datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract unsigned long, no data in DbDatum object ", (const char*)"DbDatum::operator >>(DevLong64)"); } @@ -641,7 +641,7 @@ bool DbDatum::operator >> (float& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDbDatum, (const char*)"cannot extract float, no data in DbDatum object ", (const char*)"DbDatum::operator >>(float)"); } @@ -716,7 +716,7 @@ bool DbDatum::operator >> (double& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract double, no data in DbDatum object ", (const char*)"DbDatum::operator >>(double)"); } @@ -788,7 +788,7 @@ bool DbDatum::operator >> (std::string& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract string, no data in DbDatum object ", (const char*)"DbDatum::operator >>(string)"); } @@ -860,7 +860,7 @@ bool DbDatum::operator >> (const char*& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract string, no data in DbDatum object ", (const char*)"DbDatum::operator >>(string)"); } @@ -909,7 +909,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract short vector, no data in DbDatum object ", (const char*)"DbDatum::operator >>(vector)"); } @@ -980,7 +980,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract unsigned short vector, no data in DbDatum object ", (const char*)"DbDatum::operator >>(vector)"); } @@ -1052,7 +1052,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract long vector, no data in DbDatum object ", (const char*)"DbDatum::operator >>(vector)"); } @@ -1124,7 +1124,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract unsigned long vector, no data in DbDatum object ", (const char*)"DbDatum::operator >>(vector)"); } @@ -1196,7 +1196,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract unsigned long vector, no data in DbDatum object ", (const char*)"DbDatum::operator >>(vector)"); } @@ -1268,7 +1268,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract unsigned long vector, no data in DbDatum object ", (const char*)"DbDatum::operator >>(vector)"); } @@ -1340,7 +1340,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract float vector, no data in DbDatum object ", (const char*)"DbDatum::operator >>(vector)"); } @@ -1428,7 +1428,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract double vector, no data in DbDatum object ", (const char*)"DbDatum::operator >>(vector)"); } @@ -1510,7 +1510,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDbDatum", + ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, (const char*)"cannot extract string vector, no data in DbDatum object ", (const char*)"DbDatum::operator >>(vector)"); } diff --git a/cppapi/client/dbapi_serverdata.cpp b/cppapi/client/dbapi_serverdata.cpp index 0e22b44d9..3292d5e0b 100644 --- a/cppapi/client/dbapi_serverdata.cpp +++ b/cppapi/client/dbapi_serverdata.cpp @@ -484,7 +484,7 @@ DbServerData::TangoDevice::TangoDevice(std::string &na):DeviceProxy(na),name(na) catch (DevFailed &e) { std::string reason(e.errors[0].reason.in()); - if (reason != "API_CommandNotFound") + if (reason != API_CommandNotFound) throw; } @@ -691,7 +691,7 @@ DbServerData::TangoClass::TangoClass(const std::string &na,const std::string &fu catch (DevFailed &e) { std::string reason(e.errors[0].reason.in()); - if (reason != "API_CommandNotFound") + if (reason != API_CommandNotFound) throw; } diff --git a/cppapi/client/devapi.h b/cppapi/client/devapi.h index 9821c85e1..28a7dc2ba 100644 --- a/cppapi/client/devapi.h +++ b/cppapi/client/devapi.h @@ -851,7 +851,7 @@ inline int DeviceProxy::subscribe_event (const std::string &attr_name, EventType TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name; \ desc << ", attribute " << NAME_CHAR << std::ends; \ - ApiConnExcept::re_throw_exception(e,(const char*)"API_AttributeFailed", \ + ApiConnExcept::re_throw_exception(e,(const char*)API_AttributeFailed, \ desc.str(), (const char*)"DeviceProxy::read_attribute()"); \ } \ catch (Tango::DevFailed &e) \ @@ -859,7 +859,7 @@ inline int DeviceProxy::subscribe_event (const std::string &attr_name, EventType TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name; \ desc << ", attribute " << NAME_CHAR << std::ends; \ - Except::re_throw_exception(e,(const char*)"API_AttributeFailed", \ + Except::re_throw_exception(e,(const char*)API_AttributeFailed, \ desc.str(), (const char*)"DeviceProxy::read_attribute()"); \ } \ catch (CORBA::TRANSIENT &trans) \ @@ -878,7 +878,7 @@ inline int DeviceProxy::subscribe_event (const std::string &attr_name, EventType TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name << std::ends; \ ApiCommExcept::re_throw_exception(one, \ - (const char*)"API_CommunicationFailed", \ + (const char*)API_CommunicationFailed, \ desc.str(), \ (const char*)"DeviceProxy::read_attribute()"); \ } \ @@ -895,7 +895,7 @@ inline int DeviceProxy::subscribe_event (const std::string &attr_name, EventType TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name << std::ends; \ ApiCommExcept::re_throw_exception(comm, \ - (const char*)"API_CommunicationFailed", \ + (const char*)API_CommunicationFailed, \ desc.str(), \ (const char*)"DeviceProxy::read_attribute()"); \ } \ @@ -906,7 +906,7 @@ inline int DeviceProxy::subscribe_event (const std::string &attr_name, EventType TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name << std::ends; \ ApiCommExcept::re_throw_exception(ce, \ - (const char*)"API_CommunicationFailed", \ + (const char*)API_CommunicationFailed, \ desc.str(), \ (const char*)"DeviceProxy::read_attribute()"); \ } diff --git a/cppapi/client/devapi_attr.cpp b/cppapi/client/devapi_attr.cpp index b9714bdd2..3ba4e2e9a 100644 --- a/cppapi/client/devapi_attr.cpp +++ b/cppapi/client/devapi_attr.cpp @@ -1414,7 +1414,7 @@ AttrDataFormat DeviceAttribute::get_data_format() { if (exceptions_flags.test(unknown_format_flag) && (data_format == Tango::FMT_UNKNOWN)) { - ApiDataExcept::throw_exception((const char*)"API_EmptyDeviceAttribute", + ApiDataExcept::throw_exception((const char*)API_EmptyDeviceAttribute, (const char*)"Cannot returned data_type from DeviceAttribute object: Not initialised yet or too old device (< V7)", (const char*)"DeviceAttribute::get_data_format"); } @@ -3509,7 +3509,7 @@ bool DeviceAttribute::operator >> (DevVarEncodedArray* &datum) if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char*)"API_IncompatibleAttrArgumentType", + ApiDataExcept::throw_exception((const char*)API_IncompatibleAttrArgumentType, (const char*)"Cannot extract, data in DeviceAttribute object is not an array of DevEncoded", (const char*)"DeviceAttribute::operator>>"); } @@ -5448,7 +5448,7 @@ bool DeviceAttribute::check_wrong_type_exception() if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception("API_IncompatibleAttrArgumentType", + ApiDataExcept::throw_exception(API_IncompatibleAttrArgumentType, "Cannot extract, data type in DeviceAttribute object is not coherent with the type provided to extraction method", "DeviceAttribute::operator>>"); } @@ -5483,7 +5483,7 @@ int DeviceAttribute::check_set_value_size(int seq_length) { // no set point available - ApiDataExcept::throw_exception((const char*)"API_NoSetValueAvailable", + ApiDataExcept::throw_exception((const char*)API_NoSetValueAvailable, (const char*)"Cannot extract, data from the DeviceAttribute object. No set value available", (const char*)"DeviceAttribute::extract_set"); diff --git a/cppapi/client/devapi_attr.tpp b/cppapi/client/devapi_attr.tpp index b6da61ebf..9ff865072 100644 --- a/cppapi/client/devapi_attr.tpp +++ b/cppapi/client/devapi_attr.tpp @@ -415,7 +415,7 @@ bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception("API_IncompatibleAttrArgumentType", + ApiDataExcept::throw_exception(API_IncompatibleAttrArgumentType, "Type provided for insertion is not a valid enum. Only C enum or C++11 enum with underlying short data type are supported", "DeviceAttribute::operator<<"); } @@ -427,7 +427,7 @@ bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception("API_IncompatibleAttrArgumentType", + ApiDataExcept::throw_exception(API_IncompatibleAttrArgumentType, "Type provided for insertion is not an enumeration", "DeviceAttribute::operator<<"); } diff --git a/cppapi/client/devapi_base.cpp b/cppapi/client/devapi_base.cpp index 45659e7b7..baddac8cc 100644 --- a/cppapi/client/devapi_base.cpp +++ b/cppapi/client/devapi_base.cpp @@ -565,7 +565,7 @@ void Connection::connect(std::string &corba_name) desc << "database on host "; desc << db_host << " with port "; desc << db_port << std::ends; - reason << "API_CantConnectToDatabase" << std::ends; + reason << API_CantConnectToDatabase << std::ends; db_retries--; if (db_retries != 0) { @@ -577,11 +577,11 @@ void Connection::connect(std::string &corba_name) desc << "device " << dev_name() << std::ends; if (CORBA::OBJECT_NOT_EXIST::_downcast(&ce) != 0) { - reason << "API_DeviceNotDefined" << std::ends; + reason << API_DeviceNotDefined << std::ends; } else if (CORBA::TRANSIENT::_downcast(&ce) != 0) { - reason << "API_ServerNotRunning" << std::ends; + reason << API_ServerNotRunning << std::ends; } else { @@ -1379,7 +1379,7 @@ DeviceData Connection::command_inout(std::string &command, DeviceData &data_in) desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "Connection::command_inout()"); } @@ -1397,7 +1397,7 @@ DeviceData Connection::command_inout(std::string &command, DeviceData &data_in) desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "Connection::command_inout()"); } @@ -1410,7 +1410,7 @@ DeviceData Connection::command_inout(std::string &command, DeviceData &data_in) desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "Connection::command_inout()"); } @@ -1588,7 +1588,7 @@ CORBA::Any_var Connection::command_inout(std::string &command, CORBA::Any &any) desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "Connection::command_inout()"); } @@ -1606,7 +1606,7 @@ CORBA::Any_var Connection::command_inout(std::string &command, CORBA::Any &any) desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "Connection::command_inout()"); } @@ -1619,7 +1619,7 @@ CORBA::Any_var Connection::command_inout(std::string &command, CORBA::Any &any) desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "Connection::command_inout()"); } @@ -1749,7 +1749,7 @@ void DeviceProxy::real_constructor(std::string &name, bool need_check_acc) TangoSys_OMemStream desc; desc << "Can't connect to device " << device_name << std::ends; ApiConnExcept::re_throw_exception(dfe, - (const char *) "API_DeviceNotDefined", + (const char *) API_DeviceNotDefined, desc.str(), (const char *) "DeviceProxy::DeviceProxy"); } @@ -1796,7 +1796,7 @@ void DeviceProxy::real_constructor(std::string &name, bool need_check_acc) set_connection_state(CONNECTION_NOTOK); if (dbase_used == false) { - if (strcmp(dfe.errors[1].reason, "API_DeviceNotDefined") == 0) + if (strcmp(dfe.errors[1].reason, API_DeviceNotDefined) == 0) { throw; } @@ -1824,7 +1824,7 @@ void DeviceProxy::real_constructor(std::string &name, bool need_check_acc) } catch (Tango::ConnectionFailed &dfe) { - if (strcmp(dfe.errors[1].reason, "API_DeviceNotDefined") == 0) + if (strcmp(dfe.errors[1].reason, API_DeviceNotDefined) == 0) { throw; } @@ -1847,7 +1847,7 @@ void DeviceProxy::real_constructor(std::string &name, bool need_check_acc) } catch (Tango::DevFailed &e) { - if (::strcmp(e.errors[0].reason.in(), "API_UtilSingletonNotCreated") != 0) + if (::strcmp(e.errors[0].reason.in(), API_UtilSingletonNotCreated) != 0) { throw; } @@ -2064,7 +2064,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << protocol; desc << " protocol is an unsupported protocol" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) "API_UnsupportedProtocol", + ApiWrongNameExcept::throw_exception((const char *) API_UnsupportedProtocol, desc.str(), (const char *) "DeviceProxy::parse_name()"); } @@ -2098,7 +2098,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << mod; desc << " modifier is an unsupported db modifier" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) "API_UnsupportedDBaseModifier", + ApiWrongNameExcept::throw_exception((const char *) API_UnsupportedDBaseModifier, desc.str(), (const char *) "DeviceProxy::parse_name()"); } @@ -2682,7 +2682,7 @@ int DeviceProxy::ping() TangoSys_OMemStream desc; desc << "Failed to execute ping on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::ping()"); } @@ -2699,7 +2699,7 @@ int DeviceProxy::ping() TangoSys_OMemStream desc; desc << "Failed to execute ping on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::ping()"); } @@ -2711,7 +2711,7 @@ int DeviceProxy::ping() TangoSys_OMemStream desc; desc << "Failed to execute ping on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::ping()"); } @@ -2767,7 +2767,7 @@ std::string DeviceProxy::name() TangoSys_OMemStream desc; desc << "Failed to execute name() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::name()"); } @@ -2784,7 +2784,7 @@ std::string DeviceProxy::name() TangoSys_OMemStream desc; desc << "Failed to execute name() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::name()"); } @@ -2796,7 +2796,7 @@ std::string DeviceProxy::name() TangoSys_OMemStream desc; desc << "Failed to execute name() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::name()"); } @@ -2868,7 +2868,7 @@ DevState DeviceProxy::state() TangoSys_OMemStream desc; desc << "Failed to execute state() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::state()"); } @@ -2885,7 +2885,7 @@ DevState DeviceProxy::state() TangoSys_OMemStream desc; desc << "Failed to execute state() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::state()"); } @@ -2897,7 +2897,7 @@ DevState DeviceProxy::state() TangoSys_OMemStream desc; desc << "Failed to execute state() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::state()"); } @@ -2944,7 +2944,7 @@ std::string DeviceProxy::status() TangoSys_OMemStream desc; desc << "Failed to execute status() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::status()"); } @@ -2961,7 +2961,7 @@ std::string DeviceProxy::status() TangoSys_OMemStream desc; desc << "Failed to execute status() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::status()"); } @@ -2973,7 +2973,7 @@ std::string DeviceProxy::status() TangoSys_OMemStream desc; desc << "Failed to execute status() on device (CORBA exception)" << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::status()"); } @@ -3038,7 +3038,7 @@ std::string DeviceProxy::adm_name() TangoSys_OMemStream desc; desc << "Failed to execute adm_name() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::adm_name()"); } @@ -3055,7 +3055,7 @@ std::string DeviceProxy::adm_name() TangoSys_OMemStream desc; desc << "Failed to execute adm_name() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::adm_name()"); } @@ -3067,7 +3067,7 @@ std::string DeviceProxy::adm_name() TangoSys_OMemStream desc; desc << "Failed to execute adm_name() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::adm_name()"); } @@ -3114,7 +3114,7 @@ std::string DeviceProxy::description() TangoSys_OMemStream desc; desc << "Failed to execute description() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::description()"); } @@ -3131,7 +3131,7 @@ std::string DeviceProxy::description() TangoSys_OMemStream desc; desc << "Failed to execute description() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::description()"); } @@ -3143,7 +3143,7 @@ std::string DeviceProxy::description() TangoSys_OMemStream desc; desc << "Failed to execute description() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::description()"); } @@ -3190,7 +3190,7 @@ std::vector *DeviceProxy::black_box(int last_n_commands) TangoSys_OMemStream desc; desc << "Failed to execute black_box on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::black_box()"); } @@ -3207,7 +3207,7 @@ std::vector *DeviceProxy::black_box(int last_n_commands) TangoSys_OMemStream desc; desc << "Failed to execute black_box on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::black_box()"); } @@ -3219,7 +3219,7 @@ std::vector *DeviceProxy::black_box(int last_n_commands) TangoSys_OMemStream desc; desc << "Failed to execute black_box on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::black_box()"); } @@ -3296,7 +3296,7 @@ DeviceInfo const &DeviceProxy::info() TangoSys_OMemStream desc; desc << "Failed to execute info() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::info()"); } @@ -3313,7 +3313,7 @@ DeviceInfo const &DeviceProxy::info() TangoSys_OMemStream desc; desc << "Failed to execute info() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::info()"); } @@ -3325,7 +3325,7 @@ DeviceInfo const &DeviceProxy::info() TangoSys_OMemStream desc; desc << "Failed to execute info() on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::info()"); } @@ -3398,7 +3398,7 @@ CommandInfo DeviceProxy::command_query(std::string cmd) TangoSys_OMemStream desc; desc << "Failed to execute command_query on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::command_query()"); } @@ -3415,7 +3415,7 @@ CommandInfo DeviceProxy::command_query(std::string cmd) TangoSys_OMemStream desc; desc << "Failed to execute command_query on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::command_query()"); } @@ -3427,7 +3427,7 @@ CommandInfo DeviceProxy::command_query(std::string cmd) TangoSys_OMemStream desc; desc << "Failed to execute command_query on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::command_query()"); } @@ -3560,7 +3560,7 @@ CommandInfoList *DeviceProxy::command_list_query() TangoSys_OMemStream desc; desc << "Failed to execute command_list_query on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::command_list_query()"); } @@ -3577,7 +3577,7 @@ CommandInfoList *DeviceProxy::command_list_query() TangoSys_OMemStream desc; desc << "Failed to execute command_list_query on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::command_list_query()"); } @@ -3589,7 +3589,7 @@ CommandInfoList *DeviceProxy::command_list_query() TangoSys_OMemStream desc; desc << "Failed to execute command_list_query on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::command_list_query()"); } @@ -3857,7 +3857,7 @@ void DeviceProxy::get_property_list(const std::string &wildcard, std::vector 1) { - ApiWrongNameExcept::throw_exception((const char *) "API_WrongWildcardUsage", + ApiWrongNameExcept::throw_exception((const char *) API_WrongWildcardUsage, (const char *) "Only one wildcard character (*) allowed!", (const char *) "DeviceProxy::get_property_list"); } @@ -4004,7 +4004,7 @@ AttributeInfoList *DeviceProxy::get_attribute_config(std::vector &a TangoSys_OMemStream desc; desc << "Failed to execute get_attribute_config on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::get_attribute_config()"); } @@ -4021,7 +4021,7 @@ AttributeInfoList *DeviceProxy::get_attribute_config(std::vector &a TangoSys_OMemStream desc; desc << "Failed to execute get_attribute_config on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::get_attribute_config()"); } @@ -4033,7 +4033,7 @@ AttributeInfoList *DeviceProxy::get_attribute_config(std::vector &a TangoSys_OMemStream desc; desc << "Failed to execute get_attribute_config on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::get_attribute_config()"); } @@ -4234,7 +4234,7 @@ AttributeInfoListEx *DeviceProxy::get_attribute_config_ex(std::vector &pipe_string set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute get_pipe_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, "API_CommunicationFailed", + ApiCommExcept::re_throw_exception(one, API_CommunicationFailed, desc.str(), "DeviceProxy::get_pipe_config()"); } } @@ -5007,7 +5007,7 @@ PipeInfoList *DeviceProxy::get_pipe_config(std::vector &pipe_string set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute get_pipe_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, "API_CommunicationFailed", + ApiCommExcept::re_throw_exception(comm, API_CommunicationFailed, desc.str(), "DeviceProxy::get_pipe_config()"); } } @@ -5017,7 +5017,7 @@ PipeInfoList *DeviceProxy::get_pipe_config(std::vector &pipe_string TangoSys_OMemStream desc; desc << "Failed to execute get_pipe_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, "API_CommunicationFailed", + ApiCommExcept::re_throw_exception(ce, API_CommunicationFailed, desc.str(), "DeviceProxy::get_pipe_config()"); } catch (Tango::DevFailed&) @@ -5136,7 +5136,7 @@ void DeviceProxy::set_pipe_config(PipeInfoList &dev_pipe_list) TangoSys_OMemStream desc; desc << "Failed to execute set_pipe_config on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::set_pipe_config()"); } @@ -5153,7 +5153,7 @@ void DeviceProxy::set_pipe_config(PipeInfoList &dev_pipe_list) TangoSys_OMemStream desc; desc << "Failed to execute set_pipe_config on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::set_pipe_config()"); } @@ -5165,7 +5165,7 @@ void DeviceProxy::set_pipe_config(PipeInfoList &dev_pipe_list) TangoSys_OMemStream desc; desc << "Failed to execute set_pipe_config on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::set_pipe_config()"); } @@ -5267,7 +5267,7 @@ DevicePipe DeviceProxy::read_pipe(const std::string &pipe_name) std::stringstream desc; desc << "Failed to read_pipe on device " << device_name; ApiCommExcept::re_throw_exception(one, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::read_pipe()"); } @@ -5284,7 +5284,7 @@ DevicePipe DeviceProxy::read_pipe(const std::string &pipe_name) std::stringstream desc; desc << "Failed to read_pipe on device " << device_name; ApiCommExcept::re_throw_exception(comm, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::read_pipe()"); } @@ -5294,7 +5294,7 @@ DevicePipe DeviceProxy::read_pipe(const std::string &pipe_name) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to read_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(ce, "API_CommunicationFailed", desc.str(), "DeviceProxy::read_pipe()"); + ApiCommExcept::re_throw_exception(ce, API_CommunicationFailed, desc.str(), "DeviceProxy::read_pipe()"); } } @@ -5420,7 +5420,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) std::stringstream desc; desc << "Failed to write_pipe on device " << device_name; ApiCommExcept::re_throw_exception(one, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::write_pipe()"); } @@ -5440,7 +5440,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) std::stringstream desc; desc << "Failed to write_pipe on device " << device_name; ApiCommExcept::re_throw_exception(comm, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::write_pipe()"); } @@ -5453,7 +5453,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to write_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(ce, "API_CommunicationFailed", desc.str(), "DeviceProxy::write_pipe()"); + ApiCommExcept::re_throw_exception(ce, API_CommunicationFailed, desc.str(), "DeviceProxy::write_pipe()"); } } @@ -5547,7 +5547,7 @@ DevicePipe DeviceProxy::write_read_pipe(DevicePipe &pipe_data) std::stringstream desc; desc << "Failed to write_read_pipe on device " << device_name; ApiCommExcept::re_throw_exception(one, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::write_read_pipe()"); } @@ -5564,7 +5564,7 @@ DevicePipe DeviceProxy::write_read_pipe(DevicePipe &pipe_data) std::stringstream desc; desc << "Failed to write_read_pipe on device " << device_name; ApiCommExcept::re_throw_exception(comm, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::write_read_pipe()"); } @@ -5575,7 +5575,7 @@ DevicePipe DeviceProxy::write_read_pipe(DevicePipe &pipe_data) std::stringstream desc; desc << "Failed to write_read_pipe on device " << device_name; ApiCommExcept::re_throw_exception(ce, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::write_read_pipe()"); } @@ -5726,7 +5726,7 @@ std::vector *DeviceProxy::read_attributes(std::vector *DeviceProxy::read_attributes(std::vector *DeviceProxy::read_attributes(std::vector &attr_list) TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attributes()"); } @@ -6469,7 +6469,7 @@ void DeviceProxy::write_attributes(std::vector &attr_list) TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attributes()"); } @@ -6481,7 +6481,7 @@ void DeviceProxy::write_attributes(std::vector &attr_list) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attributes()"); } @@ -6741,7 +6741,7 @@ void DeviceProxy::write_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attribute()"); } @@ -6758,7 +6758,7 @@ void DeviceProxy::write_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attribute()"); } @@ -6770,7 +6770,7 @@ void DeviceProxy::write_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attribute()"); } @@ -6891,7 +6891,7 @@ void DeviceProxy::write_attribute(const AttributeValueList &attr_val) TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attribute()"); } @@ -6908,7 +6908,7 @@ void DeviceProxy::write_attribute(const AttributeValueList &attr_val) TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attribute()"); } @@ -6920,7 +6920,7 @@ void DeviceProxy::write_attribute(const AttributeValueList &attr_val) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attribute()"); } @@ -7052,7 +7052,7 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attribute()"); } @@ -7069,7 +7069,7 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attribute()"); } @@ -7081,7 +7081,7 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_attribute()"); } @@ -7206,7 +7206,7 @@ std::vector *DeviceProxy::command_history(std::string &cmd_na TangoSys_OMemStream desc; desc << "Command_history failed on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::command_history()"); } @@ -7223,7 +7223,7 @@ std::vector *DeviceProxy::command_history(std::string &cmd_na TangoSys_OMemStream desc; desc << "Command_history failed on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::command_history()"); } @@ -7235,7 +7235,7 @@ std::vector *DeviceProxy::command_history(std::string &cmd_na TangoSys_OMemStream desc; desc << "Command_history failed on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::command_history()"); } @@ -7343,7 +7343,7 @@ std::vector *DeviceProxy::attribute_history(std::string TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::attribute_history()"); } @@ -7360,7 +7360,7 @@ std::vector *DeviceProxy::attribute_history(std::string TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::attribute_history()"); } @@ -7371,7 +7371,7 @@ std::vector *DeviceProxy::attribute_history(std::string TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::attribute_history()"); } @@ -8268,7 +8268,7 @@ void DeviceProxy::unsubscribe_event(int event_id) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::unsubscribe_event()"); } @@ -8286,7 +8286,7 @@ void DeviceProxy::unsubscribe_event(int event_id) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::unsubscribe_event()"); } @@ -8317,7 +8317,7 @@ void DeviceProxy::get_events(int event_id, EventDataList &event_list) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::get_events()"); } @@ -8335,7 +8335,7 @@ void DeviceProxy::get_events(int event_id, EventDataList &event_list) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::get_events()"); } @@ -8487,7 +8487,7 @@ void DeviceProxy::get_events(int event_id, CallBack *cb) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::get_events()"); } @@ -8505,7 +8505,7 @@ void DeviceProxy::get_events(int event_id, CallBack *cb) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::get_events()"); } @@ -8532,7 +8532,7 @@ int DeviceProxy::event_queue_size(int event_id) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::event_queue_size()"); } @@ -8551,7 +8551,7 @@ int DeviceProxy::event_queue_size(int event_id) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::event_queue_size()"); } @@ -8583,7 +8583,7 @@ bool DeviceProxy::is_event_queue_empty(int event_id) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::is_event_queue_empty()"); } @@ -8602,7 +8602,7 @@ bool DeviceProxy::is_event_queue_empty(int event_id) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::is_event_queue_empty()"); } @@ -8634,7 +8634,7 @@ TimeVal DeviceProxy::get_last_event_date(int event_id) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::get_last_event_date()"); } @@ -8653,7 +8653,7 @@ TimeVal DeviceProxy::get_last_event_date(int event_id) desc << "probably no event subscription was done before!"; desc << std::ends; Tango::Except::throw_exception( - (const char *) "API_EventConsumer", + (const char *) API_EventConsumer, desc.str(), (const char *) "DeviceProxy::get_last_event_date()"); } @@ -9597,7 +9597,7 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Failed to execute write_read_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(one, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_read_attribute()"); } @@ -9614,7 +9614,7 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_read_attribute()"); } @@ -9626,7 +9626,7 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char *) "API_CommunicationFailed", + (const char *) API_CommunicationFailed, desc.str(), (const char *) "DeviceProxy::write_read_attribute()"); } @@ -9875,7 +9875,7 @@ std::vector *DeviceProxy::write_read_attributes(std::vector *DeviceProxy::write_read_attributes(std::vector *DeviceProxy::write_read_attributes(std::vectorext_state.set(isempty_flag); if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char *) "API_EmptyDeviceData", + ApiDataExcept::throw_exception((const char *) API_EmptyDeviceData, (const char *) "Cannot extract, no data in DeviceData object ", (const char *) "DeviceData::any_is_null"); } diff --git a/cppapi/client/event.cpp b/cppapi/client/event.cpp index 561d61b5a..65114ecdc 100644 --- a/cppapi/client/event.cpp +++ b/cppapi/client/event.cpp @@ -1831,7 +1831,7 @@ void EventConsumer::unsubscribe_event(int event_id) { if (event_id == 0) { - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to unsubscribe event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::unsubscribe_event()"); } @@ -1928,7 +1928,7 @@ void EventConsumer::unsubscribe_event(int event_id) } catch (...) { - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to unsubscribe event, caught exception while calling remove_filter() or destroy() (hint: check the Notification daemon is running ", (const char*)"EventConsumer::unsubscribe_event()"); } @@ -1994,7 +1994,7 @@ void EventConsumer::unsubscribe_event(int event_id) } catch (...) { - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to unsubscribe event, caught exception while calling remove_filter() or destroy() on the heartbeat filter (hint: check the Notification daemon is running ", (const char*)"EventConsumer::unsubscribe_event()"); } @@ -2060,7 +2060,7 @@ void EventConsumer::unsubscribe_event(int event_id) // nothing was found! - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to unsubscribe event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::unsubscribe_event()"); } @@ -2251,7 +2251,7 @@ void EventConsumer::get_events (int event_id, EventDataList &event_list) // nothing was found! - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to get event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::get_events()"); } @@ -2349,7 +2349,7 @@ void EventConsumer::get_events (int event_id, AttrConfEventDataList &event_list) // nothing was found! - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to get event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::get_events()"); } @@ -2447,7 +2447,7 @@ void EventConsumer::get_events (int event_id, DataReadyEventDataList &event_list // nothing was found! - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to get event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::get_events()"); } @@ -2543,7 +2543,7 @@ void EventConsumer::get_events (int event_id, DevIntrChangeEventDataList &event_ // nothing was found! - EventSystemExcept::throw_exception("API_EventNotFound", + EventSystemExcept::throw_exception(API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one", "EventConsumer::get_events()"); } @@ -2639,7 +2639,7 @@ void EventConsumer::get_events (int event_id, PipeEventDataList &event_list) // nothing was found! - EventSystemExcept::throw_exception("API_EventNotFound", + EventSystemExcept::throw_exception(API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one", "EventConsumer::get_events()"); } @@ -2738,7 +2738,7 @@ void EventConsumer::get_events (int event_id, CallBack *cb) // nothing was found! - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to get event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::get_events()"); } @@ -2831,7 +2831,7 @@ int EventConsumer::event_queue_size(int event_id) // nothing was found! - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to get event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::event_queue_size()"); @@ -2928,7 +2928,7 @@ bool EventConsumer::is_event_queue_empty(int event_id) // nothing was found! - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to get event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::is_event_queue_empty()"); @@ -3025,7 +3025,7 @@ TimeVal EventConsumer::get_last_event_date(int event_id) // nothing was found! - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to get event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::get_last_event_date()"); @@ -3416,7 +3416,7 @@ ChannelType EventConsumer::get_event_system_for_event_id(int event_id) if (event_id == 0) { - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to unsubscribe event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::get_event_system_for_event_id()"); } @@ -3473,7 +3473,7 @@ ChannelType EventConsumer::get_event_system_for_event_id(int event_id) if (found == false) { - EventSystemExcept::throw_exception((const char*)"API_EventNotFound", + EventSystemExcept::throw_exception((const char*)API_EventNotFound, (const char*)"Failed to unsubscribe event, the event id specified does not correspond with any known one", (const char*)"EventConsumer::get_event_system_for_event_id()"); } diff --git a/cppapi/client/eventkeepalive.cpp b/cppapi/client/eventkeepalive.cpp index d090f23d1..1a6ee6c9f 100644 --- a/cppapi/client/eventkeepalive.cpp +++ b/cppapi/client/eventkeepalive.cpp @@ -1096,7 +1096,7 @@ void EventConsumerKeepAliveThread::main_reconnect(ZmqEventConsumer *event_consum errors.length(1); errors[0].severity = Tango::ERR; errors[0].origin = Tango::string_dup("EventConsumer::KeepAliveThread()"); - errors[0].reason = Tango::string_dup("API_EventTimeout"); + errors[0].reason = Tango::string_dup(API_EventTimeout); errors[0].desc = Tango::string_dup("Event channel is not responding anymore, maybe the server or event system is down"); DeviceAttribute *dev_attr = NULL; AttributeInfoEx *dev_attr_conf = NULL; diff --git a/cppapi/client/group.cpp b/cppapi/client/group.cpp index 7934afb2f..b2255a477 100644 --- a/cppapi/client/group.cpp +++ b/cppapi/client/group.cpp @@ -188,7 +188,7 @@ void GroupElementFactory::parse_name (const std::string& p, std::string &db_host TangoSys_OMemStream desc; desc << protocol; desc << " protocol is an unsupported protocol" << std::ends; - ApiWrongNameExcept::throw_exception((const char*)"API_UnsupportedProtocol", + ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedProtocol, desc.str(), (const char*)"GroupElementFactory::parse_name()"); } @@ -1237,7 +1237,7 @@ GroupCmdReplyList Group::command_inout_reply_i (long ari, long tmo) Tango::DevErrorList errors(1); errors.length(1); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_BadAsynPollId"); + errors[0].reason = Tango::string_dup(API_BadAsynPollId); errors[0].desc = Tango::string_dup("Invalid asynch. request identifier specified"); errors[0].origin = Tango::string_dup("Group::command_inout_reply"); throw DevFailed(errors); @@ -1319,7 +1319,7 @@ GroupAttrReplyList Group::read_attribute_reply_i (long ari, long tmo) Tango::DevErrorList errors(1); errors.length(1); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_BadAsynPollId"); + errors[0].reason = Tango::string_dup(API_BadAsynPollId); errors[0].desc = Tango::string_dup("Invalid asynch. request identifier specified"); errors[0].origin = Tango::string_dup("Group::read_attribute_reply"); throw DevFailed(errors); @@ -1383,7 +1383,7 @@ GroupAttrReplyList Group::read_attributes_reply_i (long ari, long tmo) Tango::DevErrorList errors(1); errors.length(1); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_BadAsynPollId"); + errors[0].reason = Tango::string_dup(API_BadAsynPollId); errors[0].desc = Tango::string_dup("Invalid asynch. request identifier specified"); errors[0].origin = Tango::string_dup("Group::read_attributes_reply"); throw DevFailed(errors); @@ -1509,7 +1509,7 @@ GroupReplyList Group::write_attribute_reply_i (long ari, long tmo) Tango::DevErrorList errors(1); errors.length(1); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_BadAsynPollId"); + errors[0].reason = Tango::string_dup(API_BadAsynPollId); errors[0].desc = Tango::string_dup("Invalid asynch. request identifier specified"); errors[0].origin = Tango::string_dup("Group::write_attribute_reply"); throw DevFailed(errors); @@ -1807,7 +1807,7 @@ GroupCmdReplyList GroupDeviceElement::command_inout_reply_i (long id, long tmo) Tango::DevErrorList errors(1); errors.length(1); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_BadAsynPollId"); + errors[0].reason = Tango::string_dup(API_BadAsynPollId); errors[0].desc = Tango::string_dup("Invalid asynch. request identifier specified"); errors[0].origin = Tango::string_dup("GroupDeviceElement::command_inout_reply"); DevFailed df(errors); @@ -1908,7 +1908,7 @@ GroupAttrReplyList GroupDeviceElement::read_attribute_reply_i (long id, long tmo Tango::DevErrorList errors(1); errors.length(1); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_BadAsynPollId"); + errors[0].reason = Tango::string_dup(API_BadAsynPollId); errors[0].desc = Tango::string_dup("Invalid asynch. request identifier specified"); errors[0].origin = Tango::string_dup("GroupDeviceElement::read_attribute_reply"); DevFailed df(errors); @@ -2033,7 +2033,7 @@ GroupAttrReplyList GroupDeviceElement::read_attributes_reply_i (long id, long tm Tango::DevErrorList errors(1); errors.length(1); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_BadAsynPollId"); + errors[0].reason = Tango::string_dup(API_BadAsynPollId); errors[0].desc = Tango::string_dup("Invalid asynch. request identifier specified"); errors[0].origin = Tango::string_dup("GroupDeviceElement::read_attribute_reply"); DevFailed df(errors); @@ -2174,7 +2174,7 @@ GroupReplyList GroupDeviceElement::write_attribute_reply_i (long id, long tmo) Tango::DevErrorList errors(1); errors.length(1); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_BadAsynPollId"); + errors[0].reason = Tango::string_dup(API_BadAsynPollId); errors[0].desc = Tango::string_dup("Invalid asynch. request identifier specified"); errors[0].origin = Tango::string_dup("GroupDeviceElement::write_attribute_reply"); DevFailed df(errors); diff --git a/cppapi/client/notifdeventconsumer.cpp b/cppapi/client/notifdeventconsumer.cpp index b86b622a8..5f43befd7 100644 --- a/cppapi/client/notifdeventconsumer.cpp +++ b/cppapi/client/notifdeventconsumer.cpp @@ -486,7 +486,7 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa } else { - EventSystemExcept::throw_exception((const char*)"API_EventChannelNotExported", + EventSystemExcept::throw_exception((const char*)API_EventChannelNotExported, (const char*)"Failed to narrow EventChannel (hint: make sure a notifd process is running on the server host)", (const char*)"NotifdEventConsumer::connect_event_channel()"); } diff --git a/cppapi/client/proxy_asyn.cpp b/cppapi/client/proxy_asyn.cpp index bb298b6ae..bd248d2db 100644 --- a/cppapi/client/proxy_asyn.cpp +++ b/cppapi/client/proxy_asyn.cpp @@ -368,7 +368,7 @@ DeviceData Connection::command_inout_reply(long id) remove_asyn_request(id); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_DeviceTimedOut", + API_DeviceTimedOut, desc.str(), "Connection::command_inout_reply()"); } @@ -381,7 +381,7 @@ DeviceData Connection::command_inout_reply(long id) ss << "Failed to execute command_inout_asynch on device " << dev_name(); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",ss.str(), + API_CommunicationFailed,ss.str(), "Connection::command_inout_reply()"); } } @@ -477,7 +477,7 @@ DeviceData Connection::command_inout_reply(long id) remove_asyn_request(id); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "Connection::command_inout_reply()"); @@ -694,7 +694,7 @@ DeviceData Connection::command_inout_reply(long id,long call_timeout) remove_asyn_request(id); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_DeviceTimedOut", + API_DeviceTimedOut, desc.str(), "Connection::command_inout_reply()"); } @@ -707,7 +707,7 @@ DeviceData Connection::command_inout_reply(long id,long call_timeout) ss << "Failed to execute command_inout_asynch on device " << dev_name(); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",ss.str(), + API_CommunicationFailed,ss.str(), "Connection::command_inout_reply()"); } } @@ -801,7 +801,7 @@ DeviceData Connection::command_inout_reply(long id,long call_timeout) remove_asyn_request(id); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",desc.str(), + API_CommunicationFailed,desc.str(), "Connection::command_inout_reply()"); @@ -1883,7 +1883,7 @@ void DeviceProxy::read_attr_except(CORBA::Request_ptr req,long id,read_attr_type desc << std::ends; remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess,"API_DeviceTimedOut",desc.str(),meth.c_str()); + ApiCommExcept::re_throw_exception(cb_excep_mess,API_DeviceTimedOut,desc.str(),meth.c_str()); } else { @@ -1892,7 +1892,7 @@ void DeviceProxy::read_attr_except(CORBA::Request_ptr req,long id,read_attr_type std::stringstream ss; ss << "Failed to execute read_attribute_asynch on device " << device_name; - ApiCommExcept::re_throw_exception(cb_excep_mess,"API_CommunicationFailed",ss.str(),meth.c_str()); + ApiCommExcept::re_throw_exception(cb_excep_mess,API_CommunicationFailed,ss.str(),meth.c_str()); } } } @@ -1992,11 +1992,11 @@ void DeviceProxy::read_attr_except(CORBA::Request_ptr req,long id,read_attr_type if (type == SIMPLE) ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",desc.str(), + API_CommunicationFailed,desc.str(), "DeviceProxy::read_attribute_reply()"); else ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",desc.str(), + API_CommunicationFailed,desc.str(), "DeviceProxy::read_attributes_reply()"); } @@ -2535,7 +2535,7 @@ void DeviceProxy::write_attr_except(CORBA::Request_ptr req,long id,TgRequest::Re remove_asyn_request(id); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_DeviceTimedOut", + API_DeviceTimedOut, desc.str(), "DeviceProxy::write_attributes_reply()"); } @@ -2547,7 +2547,7 @@ void DeviceProxy::write_attr_except(CORBA::Request_ptr req,long id,TgRequest::Re std::stringstream ss; ss << "Failed to execute write_attribute_asynch on device " << device_name; ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",ss.str(),"DeviceProxy::write_attributes_reply"); + API_CommunicationFailed,ss.str(),"DeviceProxy::write_attributes_reply"); } } } @@ -2723,7 +2723,7 @@ void DeviceProxy::write_attr_except(CORBA::Request_ptr req,long id,TgRequest::Re remove_asyn_request(id); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",desc.str(), + API_CommunicationFailed,desc.str(), "DeviceProxy::write_attributes_reply()"); } } @@ -2782,7 +2782,7 @@ void DeviceProxy::retrieve_read_args(TgRequest &req,std::vector &at desc << std::ends; ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::redo_simpl_call()"); } @@ -2887,7 +2887,7 @@ void DeviceProxy::redo_synch_write_call(TgRequest &req) desc << "Failed to redo the call synchronously on device " << device_name << std::ends; ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::redo_synch_write_call()"); } @@ -2937,7 +2937,7 @@ DeviceData Connection::redo_synch_cmd(TgRequest &req) desc << "Failed to redo the call synchronously on device " << dev_name() << std::ends; ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed", + API_CommunicationFailed, desc.str(), "DeviceProxy::redo_synch_write_call()"); } @@ -3030,7 +3030,7 @@ void Connection::omni420_timeout(int id,char *cb_excep_mess) { ss << "Timeout (" << timeout << " mS) exceeded on device " << dev_name(); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_DeviceTimedOut",ss.str(), + API_DeviceTimedOut,ss.str(), "Connection::command_inout_reply()"); } else @@ -3039,7 +3039,7 @@ void Connection::omni420_timeout(int id,char *cb_excep_mess) ss << "Failed to execute command_inout_asynch on device " << dev_name(); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",ss.str(), + API_CommunicationFailed,ss.str(), "Connection::command_inout_reply()"); } } @@ -3076,7 +3076,7 @@ DeviceData Connection::omni420_except(int id,char *cb_excep_mess,TgRequest &req) remove_asyn_request(id); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",ss.str(),"Connection::command_inout_reply"); + API_CommunicationFailed,ss.str(),"Connection::command_inout_reply"); DeviceData dummy; return dummy; @@ -3116,7 +3116,7 @@ void DeviceProxy::omni420_timeout_attr(int id,char *cb_excep_mess,read_attr_type { ss << "Timeout (" << timeout << " mS) exceeded on device " << dev_name(); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_DeviceTimedOut",ss.str(),meth.c_str()); + API_DeviceTimedOut,ss.str(),meth.c_str()); } else { @@ -3124,7 +3124,7 @@ void DeviceProxy::omni420_timeout_attr(int id,char *cb_excep_mess,read_attr_type ss << "Failed to execute command_inout_asynch on device " << dev_name(); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",ss.str(),meth.c_str()); + API_CommunicationFailed,ss.str(),meth.c_str()); } } @@ -3154,7 +3154,7 @@ void DeviceProxy::omni420_except_attr(int id,char *cb_excep_mess,read_attr_type meth = "DeviceProxy::read_attributes_reply()"; ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",ss.str(),meth.c_str()); + API_CommunicationFailed,ss.str(),meth.c_str()); } void DeviceProxy::omni420_timeout_wattr(int id,char *cb_excep_mess) @@ -3185,7 +3185,7 @@ void DeviceProxy::omni420_timeout_wattr(int id,char *cb_excep_mess) { ss << "Timeout (" << timeout << " mS) exceeded on device " << dev_name(); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_DeviceTimedOut",ss.str(),"DeviceProxy::write_attributes_reply()"); + API_DeviceTimedOut,ss.str(),"DeviceProxy::write_attributes_reply()"); } else { @@ -3193,7 +3193,7 @@ void DeviceProxy::omni420_timeout_wattr(int id,char *cb_excep_mess) ss << "Failed to execute write_attribute_asynch on device " << dev_name(); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",ss.str(),"DeviceProxy::write_attributes_reply()"); + API_CommunicationFailed,ss.str(),"DeviceProxy::write_attributes_reply()"); } } @@ -3217,7 +3217,7 @@ void DeviceProxy::omni420_except_wattr(int id,char *cb_excep_mess) remove_asyn_request(id); ApiCommExcept::re_throw_exception(cb_excep_mess, - "API_CommunicationFailed",ss.str(),"DeviceProxy::write_attributes_reply()"); + API_CommunicationFailed,ss.str(),"DeviceProxy::write_attributes_reply()"); } } // End of tango namespace diff --git a/cppapi/client/proxy_asyn_cb.cpp b/cppapi/client/proxy_asyn_cb.cpp index 5ea7a2fa3..c6d40eba7 100644 --- a/cppapi/client/proxy_asyn_cb.cpp +++ b/cppapi/client/proxy_asyn_cb.cpp @@ -333,13 +333,13 @@ void Connection::Cb_Cmd_Request(CORBA::Request_ptr req,Tango::CallBack *cb_ptr) errors.length(2); errors[0].desc = Tango::string_dup(cb_excep_mess); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_CorbaException"); + errors[0].reason = Tango::string_dup(API_CorbaException); errors[0].origin = Tango::string_dup("Connection::Cb_Cmd_Request()"); std::string st = desc.str(); errors[1].desc = Tango::string_dup(st.c_str()); errors[1].severity = Tango::ERR; - errors[1].reason = Tango::string_dup("API_DeviceTimedOut"); + errors[1].reason = Tango::string_dup(API_DeviceTimedOut); errors[1].origin = Tango::string_dup("Connection::Cb_Cmd_request()"); } } @@ -396,13 +396,13 @@ void Connection::Cb_Cmd_Request(CORBA::Request_ptr req,Tango::CallBack *cb_ptr) errors.length(2); errors[0].desc = Tango::string_dup(cb_excep_mess); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_CorbaException"); + errors[0].reason = Tango::string_dup(API_CorbaException); errors[0].origin = Tango::string_dup("Connection::Cb_Cmd_Request()"); std::string st = desc.str(); errors[1].desc = Tango::string_dup(st.c_str()); errors[1].severity = Tango::ERR; - errors[1].reason = Tango::string_dup("API_CommunicationFailed"); + errors[1].reason = Tango::string_dup(API_CommunicationFailed); errors[1].origin = Tango::string_dup("Connection::Cb_Cmd_request()"); } } @@ -572,13 +572,13 @@ void Connection::Cb_ReadAttr_Request(CORBA::Request_ptr req,Tango::CallBack *cb_ errors.length(2); errors[0].desc = Tango::string_dup(cb_excep_mess); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_CorbaException"); + errors[0].reason = Tango::string_dup(API_CorbaException); errors[0].origin = Tango::string_dup("Connection::Cb_ReadAttr_Request()"); std::string st = desc.str(); errors[1].desc = Tango::string_dup(st.c_str()); errors[1].severity = Tango::ERR; - errors[1].reason = Tango::string_dup("API_DeviceTimedOut"); + errors[1].reason = Tango::string_dup(API_DeviceTimedOut); errors[1].origin = Tango::string_dup("Connection::Cb_ReadAttr_request()"); } } @@ -643,13 +643,13 @@ void Connection::Cb_ReadAttr_Request(CORBA::Request_ptr req,Tango::CallBack *cb_ errors.length(2); errors[0].desc = Tango::string_dup(cb_excep_mess); errors[0].severity = Tango::ERR; - errors[0].reason = Tango::string_dup("API_CorbaException"); + errors[0].reason = Tango::string_dup(API_CorbaException); errors[0].origin = Tango::string_dup("Connection::Cb_ReadAttr_Request()"); std::string st = desc.str(); errors[1].desc = Tango::string_dup(st.c_str()); errors[1].severity = Tango::ERR; - errors[1].reason = Tango::string_dup("API_CommunicationFailed"); + errors[1].reason = Tango::string_dup(API_CommunicationFailed); errors[1].origin = Tango::string_dup("Connection::Cb_ReadAttr_Request()"); } } @@ -746,13 +746,13 @@ void Connection::Cb_WriteAttr_Request(CORBA::Request_ptr req,Tango::CallBack *cb err_3.errors.length(2); err_3.errors[0].desc = Tango::string_dup(cb_excep_mess); err_3.errors[0].severity = Tango::ERR; - err_3.errors[0].reason = Tango::string_dup("API_CorbaException"); + err_3.errors[0].reason = Tango::string_dup(API_CorbaException); err_3.errors[0].origin = Tango::string_dup("Connection::Cb_WriteAttr_Request()"); std::string st = desc.str(); err_3.errors[1].desc = Tango::string_dup(st.c_str()); err_3.errors[1].severity = Tango::ERR; - err_3.errors[1].reason = Tango::string_dup("API_DeviceTimedOut"); + err_3.errors[1].reason = Tango::string_dup(API_DeviceTimedOut); err_3.errors[1].origin = Tango::string_dup("Connection::Cb_WriteAttr_request()"); } } @@ -870,13 +870,13 @@ void Connection::Cb_WriteAttr_Request(CORBA::Request_ptr req,Tango::CallBack *cb err_3.errors.length(2); err_3.errors[0].desc = Tango::string_dup(cb_excep_mess); err_3.errors[0].severity = Tango::ERR; - err_3.errors[0].reason = Tango::string_dup("API_CorbaException"); + err_3.errors[0].reason = Tango::string_dup(API_CorbaException); err_3.errors[0].origin = Tango::string_dup("Connection::Cb_WriteAttr_Request()"); std::string st = desc.str(); err_3.errors[1].desc = Tango::string_dup(st.c_str()); err_3.errors[1].severity = Tango::ERR; - err_3.errors[1].reason = Tango::string_dup("API_CommunicationFailed"); + err_3.errors[1].reason = Tango::string_dup(API_CommunicationFailed); err_3.errors[1].origin = Tango::string_dup("Connection::Cb_WriteAttr_Request()"); } } diff --git a/cppapi/server/CMakeLists.txt b/cppapi/server/CMakeLists.txt index 34475c72c..fb3edf80d 100644 --- a/cppapi/server/CMakeLists.txt +++ b/cppapi/server/CMakeLists.txt @@ -131,6 +131,7 @@ set(HEADERS attrdesc.h encoded_format.h event_subscription_state.h tango_current_function.h + exception_reason_consts.h ) add_subdirectory(idl) diff --git a/cppapi/server/device_3.cpp b/cppapi/server/device_3.cpp index ae028bc15..5933b67dc 100644 --- a/cppapi/server/device_3.cpp +++ b/cppapi/server/device_3.cpp @@ -602,7 +602,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam del[0].severity = Tango::ERR; del[0].origin = Tango::string_dup("Device_3Impl::read_attributes_no_except"); - del[0].reason = Tango::string_dup("API_CorbaSysException "); + del[0].reason = Tango::string_dup(API_CorbaSysException); del[0].desc = Tango::string_dup("Unforseen exception when trying to read attribute. It was even not a Tango DevFailed exception"); if (aid.data_5 != nullptr) diff --git a/cppapi/server/dserverlock.cpp b/cppapi/server/dserverlock.cpp index 3e30a1b95..3a11e0582 100644 --- a/cppapi/server/dserverlock.cpp +++ b/cppapi/server/dserverlock.cpp @@ -82,7 +82,7 @@ void DServer::lock_device(const Tango::DevVarLongStringArray *in_data) if (cl->client_ident == false) { - Except::throw_exception((const char*)"API_ClientTooOld", + Except::throw_exception((const char*)API_ClientTooOld, (const char*)"Your client cannot lock devices. You are using a too old Tango release. Please, update to tango V7 or more", (const char*)"DServer::lock_device"); } @@ -170,7 +170,7 @@ Tango::DevLong DServer::un_lock_device(const Tango::DevVarLongStringArray *in_da if ((cl->client_ident == false) && (in_data->lvalue[0] == 0)) { - Except::throw_exception((const char*)"API_ClientTooOld", + Except::throw_exception((const char*)API_ClientTooOld, (const char*)"Your client cannot un-lock devices. You are using a too old Tango release. Please, update to tango V7 or more", (const char*)"DServer::un_lock_device"); } @@ -238,7 +238,7 @@ void DServer::re_lock_devices(const Tango::DevVarStringArray *dev_name_list) if (cl->client_ident == false) { - Except::throw_exception((const char*)"API_ClientTooOld", + Except::throw_exception((const char*)API_ClientTooOld, (const char*)"Your client cannot re_lock devices. You are using a too old Tango release. Please, update to tango V7 or more", (const char*)"DServer::re_lock_devices"); } diff --git a/cppapi/server/encoded_attribute.cpp b/cppapi/server/encoded_attribute.cpp index 4e34de05f..e5a9f22d5 100644 --- a/cppapi/server/encoded_attribute.cpp +++ b/cppapi/server/encoded_attribute.cpp @@ -234,7 +234,7 @@ void EncodedAttribute::decode_rgb32(DeviceAttribute *attr,int *width,int *height DevVarEncodedArray_var &encDataSeq = attr->get_Encoded_data(); if (encDataSeq.operator->() == NULL) { - ApiDataExcept::throw_exception((const char*)"API_IncompatibleAttrArgumentType", + ApiDataExcept::throw_exception((const char*)API_IncompatibleAttrArgumentType, (const char*)"Cannot extract, data in DeviceAttribute object is not DevEncoded", (const char*)"EncodedAttribute::decode_gray8"); } @@ -335,7 +335,7 @@ void EncodedAttribute::decode_gray8(DeviceAttribute *attr,int *width,int *height DevVarEncodedArray_var &encDataSeq = attr->get_Encoded_data(); if (encDataSeq.operator->() == NULL) { - ApiDataExcept::throw_exception((const char*)"API_IncompatibleAttrArgumentType", + ApiDataExcept::throw_exception((const char*)API_IncompatibleAttrArgumentType, (const char*)"Cannot extract, data in DeviceAttribute object is not DevEncoded", (const char*)"EncodedAttribute::decode_gray8"); } @@ -425,7 +425,7 @@ void EncodedAttribute::decode_gray16(DeviceAttribute *attr,int *width,int *heigh DevVarEncodedArray_var &encDataSeq = attr->get_Encoded_data(); if (encDataSeq.operator->() == NULL) { - ApiDataExcept::throw_exception((const char*)"API_IncompatibleAttrArgumentType", + ApiDataExcept::throw_exception((const char*)API_IncompatibleAttrArgumentType, (const char*)"Cannot extract, data in DeviceAttribute object is not DevEncoded", (const char*)"EncodedAttribute::decode_gray16"); } diff --git a/cppapi/server/exception_reason_consts.h b/cppapi/server/exception_reason_consts.h new file mode 100644 index 000000000..fecf65935 --- /dev/null +++ b/cppapi/server/exception_reason_consts.h @@ -0,0 +1,174 @@ +#ifndef _EXCEPTION_REASON_CONSTS_H +#define _EXCEPTION_REASON_CONSTS_H + +namespace Tango +{ + +constexpr const char* API_AliasNotDefined = "API_AliasNotDefined"; +constexpr const char* API_AlreadyPolled = "API_AlreadyPolled"; +constexpr const char* API_AsynReplyNotArrived = "API_AsynReplyNotArrived"; +constexpr const char* API_AttrConfig = "API_AttrConfig"; +constexpr const char* API_AttrEventProp = "API_AttrEventProp"; +constexpr const char* API_AttributeFailed = "API_AttributeFailed"; +constexpr const char* API_AttributeNotDataReadyEnabled = "API_AttributeNotDataReadyEnabled"; +constexpr const char* API_AttributePollingNotStarted = "API_AttributePollingNotStarted"; +constexpr const char* API_AttrIncorrectDataNumber = "API_AttrIncorrectDataNumber"; +constexpr const char* API_AttrNoAlarm = "API_AttrNoAlarm"; +constexpr const char* API_AttrNotAllowed = "API_AttrNotAllowed"; +constexpr const char* API_AttrNotFound = "API_AttrNotFound"; +constexpr const char* API_AttrNotPolled = "API_AttrNotPolled"; +constexpr const char* API_AttrNotWritable = "API_AttrNotWritable"; +constexpr const char* API_AttrOptProp = "API_AttrOptProp"; +constexpr const char* API_AttrPropValueNotSet = "API_AttrPropValueNotSet"; +constexpr const char* API_AttrValueNotSet = "API_AttrValueNotSet"; +constexpr const char* API_AttrWrongDefined = "API_AttrWrongDefined"; +constexpr const char* API_AttrWrongMemValue = "API_AttrWrongMemValue"; +constexpr const char* API_BadAsyn = "API_BadAsyn"; +constexpr const char* API_BadAsynPollId = "API_BadAsynPollId"; +constexpr const char* API_BadAsynReqType = "API_BadAsynReqType"; +constexpr const char* API_BadConfigurationProperty = "API_BadConfigurationProperty"; +constexpr const char* API_BlackBoxArgument = "API_BlackBoxArgument"; +constexpr const char* API_BlackBoxEmpty = "API_BlackBoxEmpty"; +constexpr const char* API_CannotCheckAccessControl = "API_CannotCheckAccessControl"; +constexpr const char* API_CannotOpenFile = "API_CannotOpenFile"; +constexpr const char* API_CantActivatePOAManager = "API_CantActivatePOAManager"; +constexpr const char* API_CantConnectToDatabase = "API_CantConnectToDatabase"; +constexpr const char* API_CantConnectToDevice = "API_CantConnectToDevice"; +constexpr const char* API_CantCreateClassPoa = "API_CantCreateClassPoa"; +constexpr const char* API_CantCreateLockingThread = "API_CantCreateLockingThread"; +constexpr const char* API_CantDestroyDevice = "API_CantDestroyDevice"; +constexpr const char* API_CantFindLockingThread = "API_CantFindLockingThread"; +constexpr const char* API_CantGetClientIdent = "API_CantGetClientIdent"; +constexpr const char* API_CantGetDevObjectId = "API_CantGetDevObjectId"; +constexpr const char* API_CantInstallSignal = "API_CantInstallSignal"; +constexpr const char* API_CantRetrieveClass = "API_CantRetrieveClass"; +constexpr const char* API_CantRetrieveClassList = "API_CantRetrieveClassList"; +constexpr const char* API_CantStoreDeviceClass = "API_CantStoreDeviceClass"; +constexpr const char* API_ClassNotFound = "API_ClassNotFound"; +constexpr const char* API_ClientTooOld = "API_ClientTooOld"; +constexpr const char* API_CmdArgumentTypeNotSupported = "API_CmdArgumentTypeNotSupported"; +constexpr const char* API_CmdNotPolled = "API_CmdNotPolled"; +constexpr const char* API_CommandFailed = "API_CommandFailed"; +constexpr const char* API_CommandNotAllowed = "API_CommandNotAllowed"; +constexpr const char* API_CommandNotFound = "API_CommandNotFound"; +constexpr const char* API_CommandTimedOut = "API_CommandTimedOut"; +constexpr const char* API_CommunicationFailed = "API_CommunicationFailed"; +constexpr const char* API_ConnectionFailed = "API_ConnectionFailed"; +constexpr const char* API_CorbaException = "API_CorbaException"; +constexpr const char* API_CorbaSysException = "API_CorbaSysException"; +constexpr const char* API_CorruptedDatabase = "API_CorruptedDatabase"; +constexpr const char* API_DatabaseAccess = "API_DatabaseAccess"; +constexpr const char* API_DatabaseCacheAccess = "API_DatabaseCacheAccess"; +constexpr const char* API_DatabaseFileError = "API_DatabaseFileError"; +constexpr const char* API_DecodeErr = "API_DecodeErr"; +constexpr const char* API_DeprecatedCommand = "API_DeprecatedCommand"; +constexpr const char* API_DeviceLocked = "API_DeviceLocked"; +constexpr const char* API_DeviceNotDefined = "API_DeviceNotDefined"; +constexpr const char* API_DeviceNotExported = "API_DeviceNotExported"; +constexpr const char* API_DeviceNotFound = "API_DeviceNotFound"; +constexpr const char* API_DeviceNotLocked = "API_DeviceNotLocked"; +constexpr const char* API_DeviceNotPolled = "API_DeviceNotPolled"; +constexpr const char* API_DeviceTimedOut = "API_DeviceTimedOut"; +constexpr const char* API_DeviceUnlockable = "API_DeviceUnlockable"; +constexpr const char* API_DeviceUnlocked = "API_DeviceUnlocked"; +constexpr const char* API_DServerClassNotInitialised = "API_DServerClassNotInitialised"; +constexpr const char* API_DSFailedRegisteringEvent = "API_DSFailedRegisteringEvent"; +constexpr const char* API_DummyException = "API_DummyException"; +constexpr const char* API_EmptyDataElement = "API_EmptyDataElement"; +constexpr const char* API_EmptyDbDatum = "API_EmptyDbDatum"; +constexpr const char* API_EmptyDbDbDatum = "API_EmptyDbDbDatum"; +constexpr const char* API_EmptyDeviceAttribute = "API_EmptyDeviceAttribute"; +constexpr const char* API_EmptyDeviceData = "API_EmptyDeviceData"; +constexpr const char* API_EventChannelNotExported = "API_EventChannelNotExported"; +constexpr const char* API_EventConsumer = "API_EventConsumer"; +constexpr const char* API_EventNotFound = "API_EventNotFound"; +constexpr const char* API_EventPropertiesNotSet = "API_EventPropertiesNotSet"; +constexpr const char* API_EventQueues = "API_EventQueues"; +constexpr const char* API_EventSupplierNotConstructed = "API_EventSupplierNotConstructed"; +constexpr const char* API_EventTimeout = "API_EventTimeout"; +constexpr const char* API_FwdAttrInconsistency = "API_FwdAttrInconsistency"; +constexpr const char* API_FwdAttrNotConfigured = "API_FwdAttrNotConfigured"; +constexpr const char* API_HistoryInvalid = "API_HistoryInvalid"; +constexpr const char* API_IncoherentDbData = "API_IncoherentDbData"; +constexpr const char* API_IncoherentDevData = "API_IncoherentDevData"; +constexpr const char* API_IncoherentValues = "API_IncoherentValues"; +constexpr const char* API_IncompatibleArgumentType = "API_IncompatibleArgumentType"; +constexpr const char* API_IncompatibleAttrArgumentType = "API_IncompatibleAttrArgumentType"; +constexpr const char* API_IncompatibleAttrDataType = "API_IncompatibleAttrDataType"; +constexpr const char* API_IncompatibleCmdArgumentType = "API_IncompatibleCmdArgumentType"; +constexpr const char* API_InitMethodNotFound = "API_InitMethodNotFound"; +constexpr const char* API_InitNotPublic = "API_InitNotPublic"; +constexpr const char* API_InitThrowsException = "API_InitThrowsException"; +constexpr const char* API_InternalError = "API_InternalError"; +constexpr const char* API_InvalidArgs = "API_InvalidArgs"; +constexpr const char* API_JavaRuntimeSecurityException = "API_JavaRuntimeSecurityException"; +constexpr const char* API_MemAttFailedDuringInit = "API_MemAttFailedDuringInit"; +constexpr const char* API_MemoryAllocation = "API_MemoryAllocation"; +constexpr const char* API_MethodArgument = "API_MethodArgument"; +constexpr const char* API_MethodNotFound = "API_MethodNotFound"; +constexpr const char* API_MissedEvents = "API_MissedEvents"; +constexpr const char* API_NoDataYet = "API_NoDataYet"; +constexpr const char* API_NonDatabaseDevice = "API_NonDatabaseDevice"; +constexpr const char* API_NoSetValueAvailable = "API_NoSetValueAvailable"; +constexpr const char* API_NotificationServiceFailed = "API_NotificationServiceFailed"; +constexpr const char* API_NotSupported = "API_NotSupported"; +constexpr const char* API_NotSupportedFeature = "API_NotSupportedFeature"; +constexpr const char* API_NotUpdatedAnyMore = "API_NotUpdatedAnyMore"; +constexpr const char* API_NtDebugWindowError = "API_NtDebugWindowError"; +constexpr const char* API_OverloadingNotSupported = "API_OverloadingNotSupported"; +constexpr const char* API_PipeDataEltNotFound = "API_PipeDataEltNotFound"; +constexpr const char* API_PipeDuplicateDEName = "API_PipeDuplicateDEName"; +constexpr const char* API_PipeFailed = "API_PipeFailed"; +constexpr const char* API_PipeNoDataElement = "API_PipeNoDataElement"; +constexpr const char* API_PipeNotAllowed = "API_PipeNotAllowed"; +constexpr const char* API_PipeNotFound = "API_PipeNotFound"; +constexpr const char* API_PipeNotWritable = "API_PipeNotWritable"; +constexpr const char* API_PipeOptProp = "API_PipeOptProp"; +constexpr const char* API_PipeValueNotSet = "API_PipeValueNotSet"; +constexpr const char* API_PipeWrongArg = "API_PipeWrongArg"; +constexpr const char* API_PipeWrongArgNumber = "API_PipeWrongArgNumber"; +constexpr const char* API_PolledDeviceNotInPoolConf = "API_PolledDeviceNotInPoolConf"; +constexpr const char* API_PolledDeviceNotInPoolMap = "API_PolledDeviceNotInPoolMap"; +constexpr const char* API_PollingThreadNotFound = "API_PollingThreadNotFound"; +constexpr const char* API_PollObjNotFound = "API_PollObjNotFound"; +constexpr const char* API_PollRingBufferEmpty = "API_PollRingBufferEmpty"; +constexpr const char* API_PollThreadOutOfSync = "API_PollThreadOutOfSync"; +constexpr const char* API_ReadOnlyMode = "API_ReadOnlyMode"; +constexpr const char* API_RootAttrFailed = "API_RootAttrFailed"; +constexpr const char* API_ServerNotRunning = "API_ServerNotRunning"; +constexpr const char* API_ShutdownInProgress = "API_ShutdownInProgress"; +constexpr const char* API_SignalOutOfRange = "API_SignalOutOfRange"; +constexpr const char* API_StartupSequence = "API_StartupSequence"; +constexpr const char* API_StdException = "API_StdException"; +constexpr const char* API_SystemCallFailed = "API_SystemCallFailed"; +constexpr const char* API_TangoHostNotSet = "API_TangoHostNotSet"; +constexpr const char* API_ThrowException = "API_ThrowException"; +constexpr const char* API_UnsupportedAttribute = "API_UnsupportedAttribute"; +constexpr const char* API_UnsupportedDBaseModifier = "API_UnsupportedDBaseModifier"; +constexpr const char* API_UnsupportedFeature = "API_UnsupportedFeature"; +constexpr const char* API_UnsupportedProtocol = "API_UnsupportedProtocol"; +constexpr const char* API_UtilSingletonNotCreated = "API_UtilSingletonNotCreated"; +constexpr const char* API_WAttrOutsideLimit = "API_WAttrOutsideLimit"; +constexpr const char* API_WizardConfError = "API_WizardConfError"; +constexpr const char* API_WrongAttributeNameSyntax = "API_WrongAttributeNameSyntax"; +constexpr const char* API_WrongCmdLineArgs = "API_WrongCmdLineArgs"; +constexpr const char* API_WrongDeviceNameSyntax = "API_WrongDeviceNameSyntax"; +constexpr const char* API_WrongEventData = "API_WrongEventData"; +constexpr const char* API_WrongFormat = "API_WrongFormat"; +constexpr const char* API_WrongHistoryDataBuffer = "API_WrongHistoryDataBuffer"; +constexpr const char* API_WrongLockingStatus = "API_WrongLockingStatus"; +constexpr const char* API_WrongNumberOfArgs = "API_WrongNumberOfArgs"; +constexpr const char* API_WrongWildcardUsage = "API_WrongWildcardUsage"; +constexpr const char* API_ZmqFailed = "API_ZmqFailed"; +constexpr const char* API_ZmqInitFailed = "API_ZmqInitFailed"; + +constexpr const char* DB_AliasNotDefined = "DB_AliasNotDefined"; +constexpr const char* DB_ClassNotFoundInCache = "DB_ClassNotFoundInCache"; +constexpr const char* DB_DeviceNotDefined = "DB_DeviceNotDefined"; +constexpr const char* DB_DeviceNotFoundInCache = "DB_DeviceNotFoundInCache"; +constexpr const char* DB_SQLError = "DB_SQLError"; +constexpr const char* DB_TooOldStoredProc = "DB_TooOldStoredProc"; + +} // namespace Tango + +#endif diff --git a/cppapi/server/fwdattribute.cpp b/cppapi/server/fwdattribute.cpp index cdb892423..5ca015c7a 100644 --- a/cppapi/server/fwdattribute.cpp +++ b/cppapi/server/fwdattribute.cpp @@ -937,7 +937,7 @@ DevAttrHistory_5 *FwdAttribute::read_root_att_history(long n) dp->set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << get_fwd_dev_name() << std::ends; - ApiCommExcept::re_throw_exception(one,"API_CommunicationFailed", + ApiCommExcept::re_throw_exception(one,API_CommunicationFailed, desc.str(),"FwdAttribute::read_root_att_history()"); } } @@ -952,7 +952,7 @@ DevAttrHistory_5 *FwdAttribute::read_root_att_history(long n) dp->set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << get_fwd_dev_name() << std::ends; - ApiCommExcept::re_throw_exception(comm,"API_CommunicationFailed", + ApiCommExcept::re_throw_exception(comm,API_CommunicationFailed, desc.str(),"FwdAttribute::read_root_att_history()"); } } @@ -961,7 +961,7 @@ DevAttrHistory_5 *FwdAttribute::read_root_att_history(long n) dp->set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << get_fwd_dev_name() << std::ends; - ApiCommExcept::re_throw_exception(ce,"API_CommunicationFailed", + ApiCommExcept::re_throw_exception(ce,API_CommunicationFailed, desc.str(),"FwdAttribute::read_root_att_history()"); } } @@ -1107,7 +1107,7 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis TangoSys_OMemStream desc; desc << "Failed to execute write_read_attribute on device " << get_fwd_dev_name() << std::ends; ApiCommExcept::re_throw_exception(one, - (const char*)"API_CommunicationFailed", + (const char*)API_CommunicationFailed, desc.str(), (const char*)"FwdAttribute::write_read_root_att()"); } @@ -1124,7 +1124,7 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << get_fwd_dev_name() << std::ends; ApiCommExcept::re_throw_exception(comm, - (const char*)"API_CommunicationFailed", + (const char*)API_CommunicationFailed, desc.str(), (const char*)"FwdAttribute::write_read_root_att"); } @@ -1136,7 +1136,7 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << get_fwd_dev_name() << std::ends; ApiCommExcept::re_throw_exception(ce, - (const char*)"API_CommunicationFailed", + (const char*)API_CommunicationFailed, desc.str(), (const char*)"FwdAttribute::write_read_root_att()"); } diff --git a/cppapi/server/pollthread.cpp b/cppapi/server/pollthread.cpp index cf439e275..449a2d15e 100644 --- a/cppapi/server/pollthread.cpp +++ b/cppapi/server/pollthread.cpp @@ -1461,7 +1461,7 @@ void PollThread::err_out_of_sync(WorkItem &to_do) errs.length(1); errs[0].severity = Tango::ERR; - errs[0].reason = Tango::string_dup("API_PollThreadOutOfSync"); + errs[0].reason = Tango::string_dup(API_PollThreadOutOfSync); errs[0].origin = Tango::string_dup("PollThread::err_out_of_sync"); errs[0].desc = Tango::string_dup("The polling thread is late and discard this object polling.\nAdvice: Tune device server polling"); diff --git a/cppapi/server/rootattreg.cpp b/cppapi/server/rootattreg.cpp index 0469c526a..ba46fc563 100644 --- a/cppapi/server/rootattreg.cpp +++ b/cppapi/server/rootattreg.cpp @@ -759,7 +759,7 @@ void RootAttRegistry::add_root_att(std::string &device_name,std::string &att_nam map_event_id.insert({a_name,event_id}); cbp.update_err_kind(a_name,attdesc->get_err_kind()); - Tango::Except::re_throw_exception(e,"API_DummyException","nothing","RootAttRegistry::add_root_att"); + Tango::Except::re_throw_exception(e,API_DummyException,"nothing","RootAttRegistry::add_root_att"); } } else diff --git a/cppapi/server/tango_const.h.in b/cppapi/server/tango_const.h.in index 1f09ca724..f91974f80 100644 --- a/cppapi/server/tango_const.h.in +++ b/cppapi/server/tango_const.h.in @@ -31,6 +31,8 @@ #ifndef _TANGO_CONST_H #define _TANGO_CONST_H +#include + namespace Tango { @@ -332,151 +334,6 @@ const char* const RootAttrPropName = "__root_att"; typedef DevShort DevEnum; -/* - * List of strings used by the API as the DevError reason field. - * This list is given here only for API writers to re-use (if possible) - * strings already used. - * - */ - -const char* const API_AlreadyPolled = "API_AlreadyPolled"; -const char* const API_AsynReplyNotArrived = "API_AsynReplyNotArrived"; -const char* const API_AttrConfig = "API_AttrConfig"; -const char* const API_AttrEventProp = "API_AttrEventProp"; -const char* const API_AttributeFailed = "API_AttributeFailed"; -const char* const API_AttributeNotDataReadyEnabled = "API_AttributeNotDataReadyEnabled"; -const char* const API_AttributePollingNotStarted = "API_AttributePollingNotStarted"; -const char* const API_AttrIncorrectDataNumber = "API_AttrIncorrectDataNumber"; -const char* const API_AttrNoAlarm = "API_AttrNoAlarm"; -const char* const API_AttrNotAllowed = "API_AttrNotAllowed"; -const char* const API_AttrNotFound = "API_AttrNotFound"; -const char* const API_AttrNotPolled = "API_AttrNotPolled"; -const char* const API_AttrNotWritable = "API_AttrNotWritable"; -const char* const API_AttrOptProp = "API_AttrOptProp"; -const char* const API_AttrPropValueNotSet = "API_AttrPropValueNotSet"; -const char* const API_AttrValueNotSet = "API_AttrValueNotSet"; -const char* const API_AttrWrongDefined = "API_AttrWrongDefined"; -const char* const API_AttrWrongMemValue = "API_AttrWrongMemValue"; -const char* const API_BadAsynReqType = "API_BadAsynReqType"; -const char* const API_BadConfigurationProperty = "API_BadConfigurationProperty"; -const char* const API_BlackBoxArgument = "API_BlackBoxArgument"; -const char* const API_BlackBoxEmpty = "API_BlackBoxEmpty"; -const char* const API_CannotCheckAccessControl = "API_CannotCheckAccessControl"; -const char* const API_CannotOpenFile = "API_CannotOpenFile"; -const char* const API_CantActivatePOAManager = "API_CantActivatePOAManager"; -const char* const API_CantConnectToDevice = "API_CantConnectToDevice"; -const char* const API_CantCreateClassPoa = "API_CantCreateClassPoa"; -const char* const API_CantCreateLockingThread = "API_CantCreateLockingThread"; -const char* const API_CantDestroyDevice = "API_CantDestroyDevice"; -const char* const API_CantFindLockingThread = "API_CantFindLockingThread"; -const char* const API_CantGetClientIdent = "API_CantGetClientIdent"; -const char* const API_CantGetDevObjectId = "API_CantGetDevObjectId"; -const char* const API_CantInstallSignal = "API_CantInstallSignal"; -const char* const API_CantRetrieveClass = "API_CantRetrieveClass"; -const char* const API_CantRetrieveClassList = "API_CantRetrieveClassList"; -const char* const API_CantStoreDeviceClass = "API_CantStoreDeviceClass"; -const char* const API_ClassNotFound = "API_ClassNotFound"; -const char* const API_CmdArgumentTypeNotSupported = "API_CmdArgumentTypeNotSupported"; -const char* const API_CmdNotPolled = "API_CmdNotPolled"; -const char* const API_CommandFailed = "API_CommandFailed"; -const char* const API_CommandNotAllowed = "API_CommandNotAllowed"; -const char* const API_CommandNotFound = "API_CommandNotFound"; -const char* const API_CommandTimedOut = "API_CommandTimedOut"; -const char* const API_ConnectionFailed = "API_ConnectionFailed"; -const char* const API_CorbaSysException = "API_CorbaSysException"; -const char* const API_CorruptedDatabase = "API_CorruptedDatabase"; -const char* const API_DatabaseAccess = "API_DatabaseAccess"; -const char* const API_DatabaseCacheAccess = "API_DatabaseCacheAccess"; -const char* const API_DatabaseFileError = "API_DatabaseFileError"; -const char* const API_DecodeErr = "API_DecodeErr"; -const char* const API_DeprecatedCommand = "API_DeprecatedCommand"; -const char* const API_DeviceLocked = "API_DeviceLocked"; -const char* const API_DeviceNotExported = "API_DeviceNotExported"; -const char* const API_DeviceNotFound = "API_DeviceNotFound"; -const char* const API_DeviceNotLocked = "API_DeviceNotLocked"; -const char* const API_DeviceNotPolled = "API_DeviceNotPolled"; -const char* const API_DeviceUnlockable = "API_DeviceUnlockable"; -const char* const API_DeviceUnlocked = "API_DeviceUnlocked"; -const char* const API_DServerClassNotInitialised = "API_DServerClassNotInitialised"; -const char* const API_DSFailedRegisteringEvent = "API_DSFailedRegisteringEvent"; -const char* const API_EmptyDataElement = "API_EmptyDataElement"; -const char* const API_EmptyDeviceAttribute = "API_EmptyDeviceAttribute"; -const char* const API_EventConsumer = "API_EventConsumer"; -const char* const API_EventPropertiesNotSet = "API_EventPropertiesNotSet"; -const char* const API_EventQueues = "API_EventQueues"; -const char* const API_EventSupplierNotConstructed = "API_EventSupplierNotConstructed"; -const char* const API_FwdAttrNotConfigured = "API_FwdAttrNotConfigured"; -const char* const API_FwdAttrInconsistency = "API_FwdAttrInconsistency"; -const char* const API_IncoherentDbData = "API_IncoherentDbData"; -const char* const API_IncoherentDevData = "API_IncoherentDevData"; -const char* const API_IncoherentValues = "API_IncoherentValues"; -const char* const API_IncompatibleArgumentType = "API_IncompatibleArgumentType"; -const char* const API_IncompatibleAttrDataType = "API_IncompatibleAttrDataType"; -const char* const API_IncompatibleCmdArgumentType = "API_IncompatibleCmdArgumentType"; -const char* const API_InitMethodNotFound = "API_InitMethodNotFound"; -const char* const API_InitNotPublic = "API_InitNotPublic"; -const char* const API_InitThrowsException = "API_InitThrowsException"; -const char* const API_InternalError = "API_InternalError"; -const char* const API_InvalidArgs = "API_InvalidArgs"; -const char* const API_JavaRuntimeSecurityException = "API_JavaRuntimeSecurityException"; -const char* const API_MemAttFailedDuringInit = "API_MemAttFailedDuringInit"; -const char* const API_MemoryAllocation = "API_MemoryAllocation"; -const char* const API_MethodArgument = "API_MethodArgument"; -const char* const API_MethodNotFound = "API_MethodNotFound"; -const char* const API_MissedEvents = "API_MissedEvents"; -const char* const API_NoDataYet = "API_NoDataYet"; -const char* const API_NonDatabaseDevice = "API_NonDatabaseDevice"; -const char* const API_NotificationServiceFailed = "API_NotificationServiceFailed"; -const char* const API_NotSupported = "API_NotSupported"; -const char* const API_NotSupportedFeature = "API_NotSupportedFeature"; -const char* const API_NotUpdatedAnyMore = "API_NotUpdatedAnyMore"; -const char* const API_NtDebugWindowError = "API_NtDebugWindowError"; -const char* const API_OverloadingNotSupported = "API_OverloadingNotSupported"; -const char* const API_PipeDataEltNotFound = "API_PipeDataEltNotFound"; -const char* const API_PipeDuplicateDEName = "API_PipeDuplicateDEName"; -const char* const API_PipeFailed = "API_PipeFailed"; -const char* const API_PipeNoDataElement = "API_PipeNoDataElement"; -const char* const API_PipeNotAllowed = "API_PipeNotAllowed"; -const char* const API_PipeNotFound = "API_PipeNotFound"; -const char* const API_PipeNotWritable = "API_PipeNotWritable"; -const char* const API_PipeOptProp = "API_PipeOptProp"; -const char* const API_PipeValueNotSet = "API_PipeValueNotSet"; -const char* const API_PipeWrongArgNumber = "API_PipeWrongArgNumber"; -const char* const API_PipeWrongArg = "API_PipeWrongArg"; -const char* const API_PolledDeviceNotInPoolConf = "API_PolledDeviceNotInPoolConf"; -const char* const API_PolledDeviceNotInPoolMap = "API_PolledDeviceNotInPoolMap"; -const char* const API_PollingThreadNotFound = "API_PollingThreadNotFound"; -const char* const API_PollObjNotFound = "API_PollObjNotFound"; -const char* const API_PollRingBufferEmpty = "API_PollRingBufferEmpty"; -const char* const API_ReadOnlyMode = "API_ReadOnlyMode"; -const char* const API_RootAttrFailed = "API_RootAttrFailed"; -const char* const API_ShutdownInProgress = "API_ShutdownInProgress"; -const char* const API_SignalOutOfRange = "API_SignalOutOfRange"; -const char* const API_StartupSequence = "API_StartupSequence"; -const char* const API_StdException = "API_StdException"; -const char* const API_SystemCallFailed = "API_SystemCallFailed"; -const char* const API_TangoHostNotSet = "API_TangoHostNotSet"; -const char* const API_UnsupportedFeature = "API_UnsupportedFeature"; -const char* const API_WAttrOutsideLimit = "API_WAttrOutsideLimit"; -const char* const API_WizardConfError = "API_WizardConfError"; -const char* const API_WrongAttributeNameSyntax = "API_WrongAttributeNameSyntax"; -const char* const API_WrongCmdLineArgs = "API_WrongCmdLineArgs"; -const char* const API_WrongDeviceNameSyntax = "API_WrongDeviceNameSyntax"; -const char* const API_WrongEventData = "API_WrongEventData"; -const char* const API_WrongFormat = "API_WrongFormat"; -const char* const API_WrongHistoryDataBuffer = "API_WrongHistoryDataBuffer"; -const char* const API_WrongLockingStatus = "API_WrongLockingStatus"; -const char* const API_WrongNumberOfArgs = "API_WrongNumberOfArgs"; -const char* const API_ZmqFailed = "API_ZmqFailed"; -const char* const API_ZmqInitFailed = "API_ZmqInitFailed"; - -const char* const DB_AliasNotDefined = "DB_AliasNotDefined"; -const char* const DB_ClassNotFoundInCache = "DB_ClassNotFoundInCache"; -const char* const DB_DeviceNotDefined = "DB_DeviceNotDefined"; -const char* const DB_DeviceNotFoundInCache = "DB_DeviceNotFoundInCache"; -const char* const DB_SQLError = "DB_SQLError"; -const char* const DB_TooOldStoredProc = "DB_TooOldStoredProc"; - // // Many, many typedef // diff --git a/cppapi/server/utils.cpp b/cppapi/server/utils.cpp index dd35a6ec8..cb4645864 100644 --- a/cppapi/server/utils.cpp +++ b/cppapi/server/utils.cpp @@ -139,7 +139,7 @@ Util *Util::instance(bool exit) Util::print_err_message("Tango is not initialised !!!\nExiting"); else { - Except::throw_exception((const char*)"API_UtilSingletonNotCreated", + Except::throw_exception((const char*)API_UtilSingletonNotCreated, (const char*)"Util singleton not created", (const char*)"Util::instance"); } @@ -1169,7 +1169,7 @@ void Util::connect_db() { if (e.errors.length() == 2) { - if (strcmp(e.errors[1].reason.in(),"API_CantConnectToDatabase") == 0) + if (strcmp(e.errors[1].reason.in(),API_CantConnectToDatabase) == 0) { TangoSys_OMemStream o; From 63320c840c0ab1e562ea4aaf31c69c9b53db444a Mon Sep 17 00:00:00 2001 From: mliszcz Date: Tue, 14 Jul 2020 13:26:44 +0200 Subject: [PATCH 10/13] Correct SigThrow compilation --- cpp_test_suite/cpp_test_ds/SigThrow.cpp | 60 ++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/cpp_test_suite/cpp_test_ds/SigThrow.cpp b/cpp_test_suite/cpp_test_ds/SigThrow.cpp index 603fa98cc..8d02693e2 100644 --- a/cpp_test_suite/cpp_test_ds/SigThrow.cpp +++ b/cpp_test_suite/cpp_test_ds/SigThrow.cpp @@ -3,8 +3,8 @@ //+---------------------------------------------------------------------------- // // method : IOThrow::IOThrow() -// -// description : constructor for the IOThrow command of the +// +// description : constructor for the IOThrow command of the // DevTest. // // In : - name : The command name @@ -39,17 +39,17 @@ bool IOThrow::is_allowed(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::An CORBA::Any *IOThrow::execute(TANGO_UNUSED(Tango::DeviceImpl *device),const CORBA::Any &in_any) -{ +{ const Tango::DevVarLongStringArray *theException; extract(in_any, theException); Tango::ErrSeverity severity= (Tango::ErrSeverity) (theException->lvalue)[0]; cout << "[IOThrow::execute] throwing severity exception " << severity << std::endl; - + Tango::Except::throw_exception((const char *)(theException->svalue)[0], (const char *)"This is a test ", (const char *)"IOThrow::execute()", (Tango::ErrSeverity)severity ); - + #if ((defined WIN32) || (defined __SUNPRO_CC)) CORBA::Any *out = NULL; return(out); @@ -60,8 +60,8 @@ CORBA::Any *IOThrow::execute(TANGO_UNUSED(Tango::DeviceImpl *device),const CORBA //+---------------------------------------------------------------------------- // // method : IOExcept::IOExcept() -// -// description : constructor for the IOThrow command of the +// +// description : constructor for the IOThrow command of the // DevTest. // // In : - name : The command name @@ -95,8 +95,8 @@ bool IOExcept::is_allowed(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::A CORBA::Any *IOExcept::execute(TANGO_UNUSED(Tango::DeviceImpl *device),TANGO_UNUSED(const CORBA::Any &in_any)) -{ - +{ + using Tango::API_ThrowException; Tango::Except::throw_exception((const char *)API_ThrowException, (const char *)"This is a test ", (const char *)"IOExcept::execute()"); @@ -111,8 +111,8 @@ CORBA::Any *IOExcept::execute(TANGO_UNUSED(Tango::DeviceImpl *device),TANGO_UNUS //+---------------------------------------------------------------------------- // // method : IOReThrow::IOReThrow() -// -// description : constructor for the IOReThrow command of the +// +// description : constructor for the IOReThrow command of the // DevTest. // // In : - name : The command name @@ -146,14 +146,14 @@ bool IOReThrow::is_allowed(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA:: CORBA::Any *IOReThrow::execute(TANGO_UNUSED(Tango::DeviceImpl *device),const CORBA::Any &in_any) -{ +{ const Tango::DevVarLongStringArray *theException; extract(in_any, theException); Tango::ErrSeverity severity= (Tango::ErrSeverity) (theException->lvalue)[0]; long nb_except = theException->lvalue.length(); cout << "[IOReThrow::execute] throwing " << nb_except << " exception(s) " << std::endl; try - { + { Tango::Except::throw_exception((const char *)(theException->svalue)[0], (const char *)"This is a test ", (const char *)"IOThrow::execute()", @@ -177,7 +177,7 @@ CORBA::Any *IOReThrow::execute(TANGO_UNUSED(Tango::DeviceImpl *device),const COR catch (Tango::DevFailed &ex) { e = ex; - ind++; + ind++; } } } @@ -187,7 +187,7 @@ CORBA::Any *IOReThrow::execute(TANGO_UNUSED(Tango::DeviceImpl *device),const COR (const char *)"IOReThrow::execute()", (Tango::ErrSeverity)((theException->lvalue)[nb_except - 1])); } - + #if ((defined WIN32) || (defined __SUNPRO_CC)) CORBA::Any *out = NULL; return out; @@ -198,8 +198,8 @@ CORBA::Any *IOReThrow::execute(TANGO_UNUSED(Tango::DeviceImpl *device),const COR //+---------------------------------------------------------------------------- // // method : IORegClassSig::IORegClassSig() -// -// description : constructor for the IORegClassSig command of the +// +// description : constructor for the IORegClassSig command of the // DevTest. // // In : - name : The command name @@ -233,7 +233,7 @@ bool IORegClassSig::is_allowed(Tango::DeviceImpl *device, TANGO_UNUSED(const COR CORBA::Any *IORegClassSig::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) -{ +{ try { Tango::DevLong theSignal; extract(in_any,theSignal); @@ -252,8 +252,8 @@ CORBA::Any *IORegClassSig::execute(Tango::DeviceImpl *device,const CORBA::Any &i //+---------------------------------------------------------------------------- // // method : IORegSig::IORegSig() -// -// description : constructor for the IOregSig command of the +// +// description : constructor for the IOregSig command of the // DevTest. // // In : - name : The command name @@ -287,7 +287,7 @@ bool IORegSig::is_allowed(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::A CORBA::Any *IORegSig::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) -{ +{ try { Tango::DevLong theSignal; extract(in_any,theSignal); @@ -306,8 +306,8 @@ CORBA::Any *IORegSig::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any //+---------------------------------------------------------------------------- // // method : IORegSigOwn::IORegSigOwn() -// -// description : constructor for the IOregSigOwn command of the +// +// description : constructor for the IOregSigOwn command of the // DevTest. // // In : - name : The command name @@ -342,7 +342,7 @@ bool IORegSigOwn::is_allowed(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA CORBA::Any *IORegSigOwn::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) { -#ifdef __linux +#ifdef __linux try { Tango::DevLong theSignal; extract(in_any,theSignal); @@ -365,8 +365,8 @@ CORBA::Any *IORegSigOwn::execute(Tango::DeviceImpl *device,const CORBA::Any &in_ //+---------------------------------------------------------------------------- // // method : IOUnregClassSig::IOUnregClassSig() -// -// description : constructor for the IOUnregClassSig command of the +// +// description : constructor for the IOUnregClassSig command of the // DevTest. // // In : - name : The command name @@ -400,7 +400,7 @@ bool IOUnregClassSig::is_allowed(Tango::DeviceImpl *device, TANGO_UNUSED(const C CORBA::Any *IOUnregClassSig::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) -{ +{ try { Tango::DevLong theSignal; extract(in_any,theSignal); @@ -419,8 +419,8 @@ CORBA::Any *IOUnregClassSig::execute(Tango::DeviceImpl *device,const CORBA::Any //+---------------------------------------------------------------------------- // // method : IOUnregSig::IOUnregSig() -// -// description : constructor for the IOUnregSig command of the +// +// description : constructor for the IOUnregSig command of the // DevTest. // // In : - name : The command name @@ -454,7 +454,7 @@ bool IOUnregSig::is_allowed(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA: CORBA::Any *IOUnregSig::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) -{ +{ try { Tango::DevLong theSignal; extract(in_any,theSignal); From 63eaac7d820a46fdf044fb96c1a451da07d53369 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Tue, 14 Jul 2020 14:59:45 +0200 Subject: [PATCH 11/13] Replace Except::throw_exception with macro Done automatically with script published in: https://github.com/tango-controls/cppTango/pull/742 --- cpp_test_suite/cpp_test_ds/DevTest.cpp | 43 +- cpp_test_suite/cpp_test_ds/IOMisc.cpp | 4 +- cpp_test_suite/cpp_test_ds/IOStr1.cpp | 2 +- cppapi/client/accessproxy.cpp | 4 +- cppapi/client/api_util.cpp | 24 +- cppapi/client/asynreq.cpp | 16 +- cppapi/client/attr_proxy.cpp | 109 +-- cppapi/client/dbapi_base.cpp | 118 +-- cppapi/client/dbapi_cache.cpp | 52 +- cppapi/client/dbapi_datum.cpp | 160 +--- cppapi/client/dbapi_serverdata.cpp | 10 +- cppapi/client/devapi.h | 23 +- cppapi/client/devapi_attr.cpp | 20 +- cppapi/client/devapi_attr.tpp | 8 +- cppapi/client/devapi_base.cpp | 880 ++++++---------------- cppapi/client/devapi_data.cpp | 236 ++---- cppapi/client/devapi_pipe.cpp | 47 +- cppapi/client/devapi_utils.cpp | 4 +- cppapi/client/devapi_utils.tpp | 4 +- cppapi/client/event.cpp | 172 ++--- cppapi/client/eventkeepalive.cpp | 12 +- cppapi/client/eventqueue.cpp | 8 +- cppapi/client/filedatabase.cpp | 112 +-- cppapi/client/group.cpp | 20 +- cppapi/client/group.h | 8 +- cppapi/client/helpers/DeviceProxyHelper.h | 5 +- cppapi/client/notifdeventconsumer.cpp | 56 +- cppapi/client/proxy_asyn.cpp | 208 ++--- cppapi/client/proxy_asyn_cb.cpp | 16 +- cppapi/client/zmqeventconsumer.cpp | 74 +- cppapi/server/attrdesc.cpp | 82 +- cppapi/server/attrgetsetprop.cpp | 12 +- cppapi/server/attribute.cpp | 50 +- cppapi/server/attribute.h | 7 +- cppapi/server/attribute.tpp | 54 +- cppapi/server/attribute_spec.tpp | 16 +- cppapi/server/attrprop.h | 4 +- cppapi/server/attrsetval.cpp | 94 +-- cppapi/server/attrsetval.tpp | 16 +- cppapi/server/basiccommand.cpp | 15 +- cppapi/server/blackbox.cpp | 12 +- cppapi/server/classattribute.cpp | 15 +- cppapi/server/classpipe.cpp | 5 +- cppapi/server/command.cpp | 11 +- cppapi/server/coutbuf.cpp | 4 +- cppapi/server/dev_poll.cpp | 7 +- cppapi/server/device.cpp | 183 ++--- cppapi/server/device_2.cpp | 96 +-- cppapi/server/device_3.cpp | 54 +- cppapi/server/device_3.tpp | 4 +- cppapi/server/device_4.cpp | 31 +- cppapi/server/device_5.cpp | 34 +- cppapi/server/deviceclass.cpp | 57 +- cppapi/server/dserver.cpp | 64 +- cppapi/server/dserverclass.cpp | 94 +-- cppapi/server/dserverlock.cpp | 32 +- cppapi/server/dserverpoll.cpp | 81 +- cppapi/server/dserversignal.cpp | 44 +- cppapi/server/encoded_attribute.cpp | 52 +- cppapi/server/eventcmds.cpp | 62 +- cppapi/server/fwdattrdesc.cpp | 15 +- cppapi/server/fwdattribute.cpp | 38 +- cppapi/server/logcmds.cpp | 20 +- cppapi/server/logging.cpp | 106 +-- cppapi/server/multiattribute.cpp | 41 +- cppapi/server/notifdeventsupplier.cpp | 40 +- cppapi/server/ntservice.cpp | 4 +- cppapi/server/pipe.cpp | 12 +- cppapi/server/pipe.h | 2 +- cppapi/server/pollcmds.cpp | 16 +- cppapi/server/pollext.h | 8 +- cppapi/server/pollring.cpp | 4 +- cppapi/server/rootattreg.cpp | 22 +- cppapi/server/subdev_diag.cpp | 4 +- cppapi/server/tango_monitor.h | 4 +- cppapi/server/utils.cpp | 30 +- cppapi/server/utils.h | 8 +- cppapi/server/utils.tpp | 35 +- cppapi/server/utils_polling.cpp | 60 +- cppapi/server/utils_spec.tpp | 28 +- cppapi/server/w32win.cpp | 8 +- cppapi/server/w_attribute.cpp | 218 ++---- cppapi/server/w_attribute.h | 2 +- cppapi/server/w_attribute.tpp | 28 +- cppapi/server/w_attribute_spec.tpp | 8 +- cppapi/server/w_attrsetval.tpp | 7 +- cppapi/server/zmqeventsupplier.cpp | 24 +- 87 files changed, 1258 insertions(+), 3281 deletions(-) diff --git a/cpp_test_suite/cpp_test_ds/DevTest.cpp b/cpp_test_suite/cpp_test_ds/DevTest.cpp index 2700be29f..7c1cac888 100644 --- a/cpp_test_suite/cpp_test_ds/DevTest.cpp +++ b/cpp_test_suite/cpp_test_ds/DevTest.cpp @@ -371,7 +371,7 @@ Tango::DevLong DevTest::IOSubscribeEvent(const Tango::DevVarStringArray *in_data { std::stringstream ss; ss << "Event type " << (*in_data)[2] << " not recognized as a valid event type"; - Tango::Except::throw_exception("DevTest_WrongEventType",ss.str(),"DevTest::IOSubscribeEvent"); + TANGO_THROW_EXCEPTION("DevTest_WrongEventType", ss.str()); } int eve_id = remote_dev->subscribe_event(att_name,eve,&cb,filters); @@ -390,9 +390,7 @@ void DevTest::IOUnSubscribeEvent(Tango::DevLong &in_data) std::map::iterator ite = event_atts.find(in_data); if (ite == event_atts.end()) { - Tango::Except::throw_exception("DevTest_WrongEventID", - "Cant find event id in map", - "DevTest::IOUnSubscribeEvent"); + TANGO_THROW_EXCEPTION("DevTest_WrongEventID", "Cant find event id in map"); } remote_dev->unsubscribe_event(in_data); @@ -819,7 +817,7 @@ void DevTest::write_Short_attr_w(Tango::WAttribute &att) att.get_write_value(sh); // cout << "Attribute value = " << sh << std::endl; if (Short_attr_w_except == true) - Tango::Except::throw_exception("Aaaa","Bbbb","Cccc"); + TANGO_THROW_EXCEPTION("Aaaa", "Bbbb"); } void DevTest::write_Short_attr_w2(Tango::WAttribute &att) @@ -904,9 +902,7 @@ void DevTest::write_attr_asyn_write_except(Tango::WAttribute &att) att.get_write_value(lg); cout << "Attribute value = " << lg << std::endl; Tango_sleep(2); - Tango::Except::throw_exception((const char *)"aaa", - (const char *)"This is a test", - (const char *)"DevTest::write_attr_hardware"); + TANGO_THROW_EXCEPTION("aaa", "This is a test"); } void DevTest::write_String_spec_attr_w(Tango::WAttribute &att) @@ -1245,7 +1241,7 @@ void DevTest::write_attr_hardware(std::vector &att_idx) break; case 1: - Tango::Except::throw_exception("DevTest_WriteAttrHardware","DevFailed from write_attr_hardware","DevTest::write_attr_hardware"); + TANGO_THROW_EXCEPTION("DevTest_WriteAttrHardware", "DevFailed from write_attr_hardware"); break; case 2: @@ -1279,9 +1275,7 @@ void DevTest::read_Short_attr(Tango::Attribute &att) } else { - Tango::Except::throw_exception((const char *)"aaa", - (const char *)"This is a test", - (const char *)"DevTest::read_attr"); + TANGO_THROW_EXCEPTION("aaa", "This is a test"); } } @@ -1290,10 +1284,7 @@ void DevTest::read_Long_attr(Tango::Attribute &att) cout << "[DevTest::read_attr] attribute name Long_attr" << std::endl; if (Long_attr_except) { - Tango::Except::throw_exception( - "Long_attr_except", - "Test exception is enabled for this attribute", - "DevTest::read_Long_attr"); + TANGO_THROW_EXCEPTION("Long_attr_except", "Test exception is enabled for this attribute"); } att.set_value(&attr_long); } @@ -1510,9 +1501,7 @@ void DevTest::read_attr_asyn_except(TANGO_UNUSED(Tango::Attribute &att)) Tango_sleep(2); cout << "Leaving reading attr_asyn_except attribute" << std::endl; - Tango::Except::throw_exception((const char *)"aaa", - (const char *)"This is a test", - (const char *)"DevTest::read_attr"); + TANGO_THROW_EXCEPTION("aaa", "This is a test"); } void DevTest::read_PollLong_attr(Tango::Attribute &att) @@ -1544,11 +1533,11 @@ void DevTest::read_PollString_spec_attr(Tango::Attribute &att) } else if ((PollString_spec_attr_num % 4) == 2) { - Tango::Except::throw_exception((const char *)"aaaa",(const char *)"bbb",(const char *)"ccc"); + TANGO_THROW_EXCEPTION("aaaa", "bbb"); } else { - Tango::Except::throw_exception((const char *)"xxx",(const char *)"yyy",(const char *)"zzz"); + TANGO_THROW_EXCEPTION("xxx", "yyy"); } // att.set_value(attr_str_array, 2); @@ -1675,9 +1664,7 @@ void DevTest::read_Event_change_tst(Tango::Attribute &att) } else { - Tango::Except::throw_exception((const char *)"bbb", - (const char *)"This is a test", - (const char *)"DevTest::read_attr"); + TANGO_THROW_EXCEPTION("bbb", "This is a test"); } } @@ -1690,9 +1677,7 @@ void DevTest::read_Event64_change_tst(Tango::Attribute &att) } else { - Tango::Except::throw_exception((const char *)"bbb64", - (const char *)"This is a test", - (const char *)"DevTest::read_attr"); + TANGO_THROW_EXCEPTION("bbb64", "This is a test"); } } void DevTest::read_Event_quality_tst(Tango::Attribute &att) @@ -1706,9 +1691,7 @@ void DevTest::read_Event_quality_tst(Tango::Attribute &att) } else { - Tango::Except::throw_exception((const char *)"ccc", - (const char *)"This is a test", - (const char *)"DevTest::read_attr"); + TANGO_THROW_EXCEPTION("ccc", "This is a test"); } } diff --git a/cpp_test_suite/cpp_test_ds/IOMisc.cpp b/cpp_test_suite/cpp_test_ds/IOMisc.cpp index 125a8f9d7..d19aa945d 100644 --- a/cpp_test_suite/cpp_test_ds/IOMisc.cpp +++ b/cpp_test_suite/cpp_test_ds/IOMisc.cpp @@ -422,9 +422,7 @@ CORBA::Any *IOSleepExcept::execute(TANGO_UNUSED(Tango::DeviceImpl *device), cons Tango_sleep(in); - Tango::Except::throw_exception((const char *)"aaa", - (const char *)"This is a test ", - (const char *)"IOSleepExcept::execute()"); + TANGO_THROW_EXCEPTION("aaa", "This is a test "); return insert(); } diff --git a/cpp_test_suite/cpp_test_ds/IOStr1.cpp b/cpp_test_suite/cpp_test_ds/IOStr1.cpp index 1e678fafc..d0311f4c2 100644 --- a/cpp_test_suite/cpp_test_ds/IOStr1.cpp +++ b/cpp_test_suite/cpp_test_ds/IOStr1.cpp @@ -163,7 +163,7 @@ CORBA::Any *IOPollStr1::execute(TANGO_UNUSED(Tango::DeviceImpl *device),TANGO_UN else { delete [] argout; - Tango::Except::throw_exception((const char*)"qqq",(const char *)"www",(const char *)"eee"); + TANGO_THROW_EXCEPTION("qqq", "www"); } return insert(argout); diff --git a/cppapi/client/accessproxy.cpp b/cppapi/client/accessproxy.cpp index 1cb6062f2..1510ee87c 100644 --- a/cppapi/client/accessproxy.cpp +++ b/cppapi/client/accessproxy.cpp @@ -268,9 +268,7 @@ AccessControlType AccessProxy::check_access_control(std::string &devname) } else if (::strcmp(e.errors[0].reason.in(),API_DeviceNotExported) == 0) { - Except::re_throw_exception(e,(const char *)API_CannotCheckAccessControl, - (const char *)"Cannot import Access Control device !", - (const char *)"AccessProxy::check_access_control()"); + TANGO_RETHROW_EXCEPTION(e, API_CannotCheckAccessControl, "Cannot import Access Control device !"); } else throw; diff --git a/cppapi/client/api_util.cpp b/cppapi/client/api_util.cpp index ea3ae5bde..d35cb01d2 100644 --- a/cppapi/client/api_util.cpp +++ b/cppapi/client/api_util.cpp @@ -662,9 +662,7 @@ void ApiUtil::get_asynch_replies(long call_timeout) { TangoSys_OMemStream desc; desc << "Still some reply(ies) for asynchronous callback call(s) to be received" << std::ends; - ApiAsynNotThereExcept::throw_exception((const char *) API_AsynReplyNotArrived, - desc.str(), - (const char *) "ApiUtil::get_asynch_replies"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } } else @@ -1399,9 +1397,7 @@ void ApiUtil::device_to_attr(const DeviceAttribute &dev_attr, AttributeValue &at TangoSys_OMemStream desc; desc << "Device " << d_name; desc << " does not support DevEncoded data type" << std::ends; - ApiNonSuppExcept::throw_exception((const char *) API_UnsupportedFeature, - desc.str(), - (const char *) "DeviceProxy::device_to_attr"); + TANGO_THROW_API_EXCEPTION(ApiNonSuppExcept, API_UnsupportedFeature, desc.str()); } } @@ -1564,9 +1560,7 @@ void ApiUtil::get_ip_from_if(std::vector &ip_adr_list) { std::cerr << "ApiUtil::get_ip_from_if: getifaddrs() failed: " << strerror(errno) << std::endl; - Tango::Except::throw_exception((const char *) API_SystemCallFailed, - (const char *) strerror(errno), - (const char *) "ApiUtil::get_ip_from_if()"); + TANGO_THROW_EXCEPTION(API_SystemCallFailed, strerror(errno)); } // @@ -1607,9 +1601,7 @@ void ApiUtil::get_ip_from_if(std::vector &ip_adr_list) freeifaddrs(ifaddr); - Tango::Except::throw_exception((const char *) API_SystemCallFailed, - (const char *) gai_strerror(s), - (const char *) "ApiUtil::get_ip_from_if()"); + TANGO_THROW_EXCEPTION(API_SystemCallFailed, gai_strerror(s)); } else { @@ -1650,9 +1642,7 @@ void ApiUtil::get_ip_from_if(std::vector &ip_adr_list) TangoSys_OMemStream desc; desc << "Can't retrieve list of all interfaces addresses (WSAIoctl)! Error = " << err << std::ends; - Tango::Except::throw_exception((const char *) API_SystemCallFailed, - (const char *) desc.str().c_str(), - (const char *) "ApiUtil::get_ip_from_if()"); + TANGO_THROW_EXCEPTION(API_SystemCallFailed, desc.str().c_str()); } closesocket(sock); @@ -1677,9 +1667,7 @@ void ApiUtil::get_ip_from_if(std::vector &ip_adr_list) std::cerr << "Warning: getnameinfo failed" << std::endl; std::cerr << "Unable to convert IP address to string (getnameinfo)." << std::endl; - Tango::Except::throw_exception((const char *) API_SystemCallFailed, - (const char *) "Can't convert IP address to string (getnameinfo)!", - (const char *) "ApiUtil::get_ip_from_if()"); + TANGO_THROW_EXCEPTION(API_SystemCallFailed, "Can't convert IP address to string (getnameinfo)!"); } std::string tmp_str(dest); if (tmp_str != "0.0.0.0" && tmp_str != "0:0:0:0:0:0:0:0" && tmp_str != "::") diff --git a/cppapi/client/asynreq.cpp b/cppapi/client/asynreq.cpp index 01d875ebd..d70e025a8 100644 --- a/cppapi/client/asynreq.cpp +++ b/cppapi/client/asynreq.cpp @@ -152,9 +152,7 @@ Tango::TgRequest &AsynReq::get_request(long req_id) TangoSys_OMemStream desc; desc << "Failed to find a asynchronous polling request "; desc << "with id = " << req_id << std::ends; - ApiAsynExcept::throw_exception((const char*)API_BadAsynPollId, - desc.str(), - (const char*)"AsynReq::get_request()"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynPollId, desc.str()); } return pos->second; @@ -185,9 +183,7 @@ Tango::TgRequest &AsynReq::get_request(CORBA::Request_ptr req) { TangoSys_OMemStream desc; desc << "Failed to find a asynchronous callback request "; - ApiAsynExcept::throw_exception((const char*)API_BadAsyn, - desc.str(), - (const char*)"AsynReq::get_request() (by request)"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsyn, desc.str()); } return pos->second; @@ -278,9 +274,7 @@ void AsynReq::remove_request(long req_id) TangoSys_OMemStream desc; desc << "Failed to find a asynchronous polling request "; desc << "with id = " << req_id << std::ends; - ApiAsynExcept::throw_exception((const char*)API_BadAsynPollId, - desc.str(), - (const char*)"AsynReq::remove_request()"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynPollId, desc.str()); } else { @@ -389,9 +383,7 @@ void AsynReq::mark_as_cancelled(long req_id) TangoSys_OMemStream desc; desc << "Failed to find a asynchronous polling request "; desc << "with id = " << req_id << std::ends; - ApiAsynExcept::throw_exception((const char*)API_BadAsynPollId, - desc.str(), - (const char*)"AsynReq::mark_as_cancelled()"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynPollId, desc.str()); } } diff --git a/cppapi/client/attr_proxy.cpp b/cppapi/client/attr_proxy.cpp index 30e23cf48..774ecd5e1 100644 --- a/cppapi/client/attr_proxy.cpp +++ b/cppapi/client/attr_proxy.cpp @@ -138,9 +138,7 @@ void AttributeProxy::real_constructor (std::string &name) TangoSys_OMemStream desc; desc << "Attribute " << attr_name << " is not supported by device " << device_name << std::ends; - ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedAttribute, - desc.str(), - (const char*)"AttributeProxy::real_constructor()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_UnsupportedAttribute, desc.str()); } } @@ -218,9 +216,7 @@ void AttributeProxy::ctor_from_dp(const DeviceProxy *dev_ptr,std::string &att_na TangoSys_OMemStream desc; desc << "Attribute " << attr_name << " is not supported by device " << device_name << std::ends; - ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedAttribute, - desc.str(), - (const char*)"AttributeProxy::ctor_from_dp()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_UnsupportedAttribute, desc.str()); } } } @@ -417,9 +413,7 @@ void AttributeProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << protocol; desc << " protocol is an unsupported protocol" << std::ends; - ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedProtocol, - desc.str(), - (const char*)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_UnsupportedProtocol, desc.str()); } } @@ -449,9 +443,7 @@ void AttributeProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << mod; desc << " modifier is an unsupported db modifier" << std::ends; - ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedDBaseModifier, - desc.str(), - (const char*)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_UnsupportedDBaseModifier, desc.str()); } } else @@ -470,18 +462,14 @@ void AttributeProxy::parse_name(std::string &full_name) pos = name_wo_db_mod.find(HOST_SEP); if (pos == std::string::npos) { - ApiWrongNameExcept::throw_exception((const char*)API_WrongAttributeNameSyntax, - (const char*)"Host and port not correctly defined in device name", - (const char*)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Host and port not correctly defined in device name"); } host = name_wo_db_mod.substr(0,pos); std::string::size_type tmp = name_wo_db_mod.find(PORT_SEP); if (tmp == std::string::npos) { - ApiWrongNameExcept::throw_exception((const char*)API_WrongAttributeNameSyntax, - (const char*)"Host and port not correctly defined in device name", - (const char*)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Host and port not correctly defined in device name"); } port = name_wo_db_mod.substr(pos + 1,tmp - pos - 1); TangoSys_MemStream s; @@ -552,17 +540,13 @@ void AttributeProxy::parse_name(std::string &full_name) { if (pos == 0) { - ApiWrongNameExcept::throw_exception((const char*)API_WrongAttributeNameSyntax, - (const char*)"Attribute name must have four fields separated by /'s or no /'s at all if it is an alias (e.g. my/device/name/an_attr or myalias)", - (const char*)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Attribute name must have four fields separated by /'s or no /'s at all if it is an alias (e.g. my/device/name/an_attr or myalias)"); } n_sep++; device_name_tmp = device_name_tmp.substr(pos+1); if (device_name_tmp.size() == 0) { - ApiWrongNameExcept::throw_exception((const char*)API_WrongAttributeNameSyntax, - (const char*)"Attribute name must have four fields separated by /'s or no /'s at all if it is an alias (e.g. my/device/name/an_attr or myalias)", - (const char*)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Attribute name must have four fields separated by /'s or no /'s at all if it is an alias (e.g. my/device/name/an_attr or myalias)"); } device_name_end_pos += pos+1; } @@ -571,9 +555,7 @@ void AttributeProxy::parse_name(std::string &full_name) if ((n_sep > 1) && (n_sep != 3)) { - ApiWrongNameExcept::throw_exception((const char*)API_WrongAttributeNameSyntax, - (const char*)"Attribute name must have four fields separated by /'s or no /'s at all if it is an alias (e.g. my/device/name/an_attr or myalias)", - (const char*)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Attribute name must have four fields separated by /'s or no /'s at all if it is an alias (e.g. my/device/name/an_attr or myalias)"); } // @@ -585,9 +567,7 @@ void AttributeProxy::parse_name(std::string &full_name) { if (dbase_used == false) { - ApiWrongNameExcept::throw_exception((const char *)API_WrongAttributeNameSyntax, - (const char *)"Attribute alias is not supported when not using database", - (const char *)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Attribute alias is not supported when not using database"); } // @@ -597,17 +577,13 @@ void AttributeProxy::parse_name(std::string &full_name) pos = device_name.find(HOST_SEP); if (pos != std::string::npos) { - ApiWrongNameExcept::throw_exception((const char *)API_WrongAttributeNameSyntax, - (const char *)"Wrong alias name (: not allowed in alias name)", - (const char *)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Wrong alias name (: not allowed in alias name)"); } pos = device_name.find(RES_SEP); if (pos != std::string::npos) { - ApiWrongNameExcept::throw_exception((const char *)API_WrongAttributeNameSyntax, - (const char *)"Wrong alias name (-> not allowed in alias name)", - (const char *)"DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Wrong alias name (-> not allowed in alias name)"); } // @@ -630,10 +606,7 @@ void AttributeProxy::parse_name(std::string &full_name) { TangoSys_OMemStream desc; desc << "Can't connect to attribute with alias " << device_name << std::ends; - ApiConnExcept::re_throw_exception(dfe, - (const char *)API_AliasNotDefined, - desc.str(), - (const char *)"AttributeProxy::parse_name"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, dfe, API_AliasNotDefined, desc.str()); } else throw; @@ -652,10 +625,7 @@ void AttributeProxy::parse_name(std::string &full_name) { TangoSys_OMemStream desc; desc << "Can't connect to attribute with alias " << device_name << std::ends; - ApiConnExcept::re_throw_exception(dfe, - (const char *)API_AliasNotDefined, - desc.str(), - (const char *)"AttributeProxy::parse_name"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, dfe, API_AliasNotDefined, desc.str()); } else throw; @@ -675,10 +645,7 @@ void AttributeProxy::parse_name(std::string &full_name) { TangoSys_OMemStream desc; desc << "Can't connect to attribute with alias " << device_name << std::ends; - ApiConnExcept::re_throw_exception(dfe, - (const char *)API_AliasNotDefined, - desc.str(), - (const char *)"AttributeProxy::parse_name"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, dfe, API_AliasNotDefined, desc.str()); } else throw; @@ -705,9 +672,7 @@ void AttributeProxy::parse_name(std::string &full_name) if (n_sep != 3) { - ApiWrongNameExcept::throw_exception((const char*)API_WrongAttributeNameSyntax, - (const char*)"Attribute name must have four fields separated by /'s (check the alias entry in the database) ", - (const char*)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Attribute name must have four fields separated by /'s (check the alias entry in the database) "); } attr_name = db_attr_name.substr(device_name_end_pos); device_name = db_attr_name.substr(0,device_name_end_pos - 1); @@ -732,9 +697,7 @@ void AttributeProxy::parse_name(std::string &full_name) // but the no dbase option was used. This is an error. // We can't have alias without db // - ApiWrongNameExcept::throw_exception((const char*)API_WrongAttributeNameSyntax, - (const char*)"Can't use device or attribute alias without database", - (const char*)"AttributeProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongAttributeNameSyntax, "Can't use device or attribute alias without database"); } @@ -846,9 +809,7 @@ void AttributeProxy::get_property(std::string &property_name, DbData &user_data) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *)API_NonDatabaseDevice, - desc.str(), - (const char *)"AttributeProxy::get_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -899,9 +860,7 @@ void AttributeProxy::get_property(std::vector &property_names, DbDa desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *)API_NonDatabaseDevice, - desc.str(), - (const char *)"AttributeProxy::get_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -954,9 +913,7 @@ void AttributeProxy::get_property(DbData &user_data) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *)API_NonDatabaseDevice, - desc.str(), - (const char *)"AttributeProxy::get_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -1005,9 +962,7 @@ void AttributeProxy::put_property(DbData &user_data) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *)API_NonDatabaseDevice, - desc.str(), - (const char *)"AttributeProxy::put_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -1040,9 +995,7 @@ void AttributeProxy::delete_property(std::string &property_name) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *)API_NonDatabaseDevice, - desc.str(), - (const char *)"AttributeProxy::delete_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -1073,9 +1026,7 @@ void AttributeProxy::delete_property(std::vector &property_names) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *)API_NonDatabaseDevice, - desc.str(), - (const char *)"AttributeProxy::delete_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -1109,9 +1060,7 @@ void AttributeProxy::delete_property(DbData &user_data) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *)API_NonDatabaseDevice, - desc.str(), - (const char *)"AttributeProxy::delete_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -1161,10 +1110,7 @@ void AttributeProxy::set_config(AttributeInfo &dev_attr_info) { TangoSys_OMemStream desc; desc << "Failed to execute set_attribute_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char*)API_CommunicationFailed, - desc.str(), - (const char*)"AttributeProxy::set_attribute_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -1182,10 +1128,7 @@ void AttributeProxy::set_config(AttributeInfoEx &dev_attr_info) { TangoSys_OMemStream desc; desc << "Failed to execute set_attribute_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char*)API_CommunicationFailed, - desc.str(), - (const char*)"AttributeProxy::set_attribute_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } //----------------------------------------------------------------------------- diff --git a/cppapi/client/dbapi_base.cpp b/cppapi/client/dbapi_base.cpp index 3c32284c1..b9f36f647 100644 --- a/cppapi/client/dbapi_base.cpp +++ b/cppapi/client/dbapi_base.cpp @@ -72,9 +72,7 @@ access_proxy(NULL),access_checked(false),access_service_defined(false),db_tg(NUL { TangoSys_MemStream desc; desc << "TANGO_HOST env. variable not set, set it and retry (e.g. TANGO_HOST=:)" << std::ends; - ApiConnExcept::throw_exception((const char *)API_TangoHostNotSet, - desc.str(), - (const char *)"Database::Database"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_TangoHostNotSet, desc.str()); } check_tango_host(tango_host_env_var.c_str()); @@ -107,9 +105,7 @@ access_proxy(NULL),access_checked(false),access_service_defined(false),db_tg(NUL { TangoSys_MemStream desc; desc << "TANGO_HOST env. variable not set, set it and retry (e.g. TANGO_HOST=:)" << std::ends; - ApiConnExcept::throw_exception((const char *)API_TangoHostNotSet, - desc.str(), - (const char *)"Database::Database"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_TangoHostNotSet, desc.str()); } check_tango_host(tango_host_env_c_str); @@ -169,9 +165,7 @@ void Database::check_tango_host(const char *tango_host_env_c_str) { TangoSys_MemStream desc; desc << "TANGO_HOST env. variable syntax incorrect (e.g. TANGO_HOST=:,:)" << std::ends; - ApiConnExcept::throw_exception((const char *)API_TangoHostNotSet, - desc.str(), - (const char *)"Database::Database"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_TangoHostNotSet, desc.str()); } multi_db_port.push_back(sub.substr(host_sep + 1)); } @@ -179,9 +173,7 @@ void Database::check_tango_host(const char *tango_host_env_c_str) { TangoSys_MemStream desc; desc << "TANGO_HOST env. variable syntax incorrect (e.g. TANGO_HOST=:,:)" << std::ends; - ApiConnExcept::throw_exception((const char *)API_TangoHostNotSet, - desc.str(), - (const char *)"Database::Database"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_TangoHostNotSet, desc.str()); } std::string tmp_host(sub.substr(0,host_sep)); if (tmp_host.find('.') == std::string::npos) @@ -196,9 +188,7 @@ void Database::check_tango_host(const char *tango_host_env_c_str) { TangoSys_MemStream desc; desc << "TANGO_HOST env. variable syntax incorrect (e.g. TANGO_HOST=:,:)" << std::ends; - ApiConnExcept::throw_exception((const char *)API_TangoHostNotSet, - desc.str(), - (const char *)"Database::Database"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_TangoHostNotSet, desc.str()); } multi_db_port.push_back(last.substr(host_sep + 1)); } @@ -206,9 +196,7 @@ void Database::check_tango_host(const char *tango_host_env_c_str) { TangoSys_MemStream desc; desc << "TANGO_HOST env. variable syntax incorrect (e.g. TANGO_HOST=:,:)" << std::ends; - ApiConnExcept::throw_exception((const char *)API_TangoHostNotSet, - desc.str(), - (const char *)"Database::Database"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_TangoHostNotSet, desc.str()); } std::string tmp_host(last.substr(0,host_sep)); if (tmp_host.find('.') == std::string::npos) @@ -233,9 +221,7 @@ void Database::check_tango_host(const char *tango_host_env_c_str) { TangoSys_MemStream desc; desc << "TANGO_HOST env. variable syntax incorrect (e.g. TANGO_HOST=:)" << std::ends; - ApiConnExcept::throw_exception((const char *)API_TangoHostNotSet, - desc.str(), - (const char *)"Database::Database"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_TangoHostNotSet, desc.str()); } db_port = tango_host_env.substr(separator+1); db_port_num = atoi(db_port.c_str()); @@ -244,9 +230,7 @@ void Database::check_tango_host(const char *tango_host_env_c_str) { TangoSys_MemStream desc; desc << "TANGO_HOST env. variable syntax incorrect (e.g. TANGO_HOST=:)" << std::ends; - ApiConnExcept::throw_exception((const char *)API_TangoHostNotSet, - desc.str(), - (const char *)"Database::Database"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_TangoHostNotSet, desc.str()); } db_host = tango_host_env.substr(0,separator); @@ -516,9 +500,7 @@ const std::string&Database::get_file_name() { if (filedb == 0) { - Tango::Except::throw_exception ((const char *)API_NotSupportedFeature, - (const char *)"The database is not a file-based database", - (const char *)"Database::get_file_name"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, "The database is not a file-based database"); } return file_name; @@ -831,8 +813,7 @@ DbDevImportInfo Database::import_device(std::string &dev) { TangoSys_OMemStream o; o << "Can't insert device class for device " << dev << " in device class cache" << std::ends; - Tango::Except::throw_exception((const char *)API_CantStoreDeviceClass,o.str(), - (const char *)"DeviceProxy::import_device()"); + TANGO_THROW_EXCEPTION(API_CantStoreDeviceClass, o.str()); } } } @@ -1097,9 +1078,7 @@ DbServerInfo Database::get_server_info(std::string &server) } else { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_server_info()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } return(server_info); @@ -2270,9 +2249,7 @@ DbDatum Database::get_device_exported(std::string &filter) DbDatum db_datum; if (device_names == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_device_exported()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else { @@ -2316,9 +2293,7 @@ DbDatum Database::get_device_member(std::string &wildcard) DbDatum db_datum; if (device_member == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_device_member()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else { @@ -2363,9 +2338,7 @@ DbDatum Database::get_device_family(std::string &wildcard) if (device_family == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_device_family()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else { @@ -2411,9 +2384,7 @@ DbDatum Database::get_device_domain(std::string &wildcard) if (device_domain == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_device_domain()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else { @@ -2720,9 +2691,7 @@ void Database::get_attribute_alias(std::string attr_alias, std::string &attr_na if (attr_name_tmp == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_attribute_alias()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else attr_name = attr_name_tmp; @@ -2754,9 +2723,7 @@ DbDatum Database::get_device_alias_list(std::string &alias) if (alias_array == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_device_alias_list()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else { @@ -2799,9 +2766,7 @@ DbDatum Database::get_attribute_alias_list(std::string &alias) if (alias_array == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_attribute_alias_list()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else { @@ -2832,9 +2797,7 @@ DbDatum Database::make_string_array(std::string name,Any_var &received) { received.inout() >>= prop_list; if (prop_list == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::make_string_array()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else { @@ -3003,9 +2966,7 @@ DbDatum Database::get_server_class_list(std::string &servname) DbDatum db_datum; if (prop_list == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_server_class_list()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else { @@ -3340,8 +3301,7 @@ std::string Database::get_class_for_device(std::string &devname) { TangoSys_OMemStream o; o << "Can't insert device class for device " << devname << " in device class cache" << std::ends; - Tango::Except::throw_exception((const char *)API_CantStoreDeviceClass,o.str(), - (const char *)"DeviceProxy::get_class_for_device()"); + TANGO_THROW_EXCEPTION(API_CantStoreDeviceClass, o.str()); } } else @@ -3570,9 +3530,7 @@ std::vector Database::make_history_array(bool is_attribute, Any_var & std::vector v; if (ret == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::make_history_array()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else { @@ -3606,9 +3564,7 @@ std::vector Database::make_history_array(bool is_attribute, Any_var & istream >> count; if (!istream) { - Except::throw_exception( (const char *)API_HistoryInvalid, - (const char *)"History format is invalid", - (const char *)"Database::make_history_array()"); + TANGO_THROW_EXCEPTION(API_HistoryInvalid, "History format is invalid"); } std::vector value; for(int j=0;j/", - (const char *)"Database::fill_server_cache"); + TANGO_THROW_EXCEPTION(API_MethodArgument, "The device server name parameter is incorrect. Should be: /"); } // @@ -4283,9 +4237,7 @@ void Database::delete_all_device_attribute_property(std::string dev_name,DbData if (filedb != 0) { - Tango::Except::throw_exception((const char *)API_NotSupportedFeature, - (const char *)"The underlying database command is not implemented when the database is a file", - (const char *)"Database::delete_all_device_attribute_property"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, "The underlying database command is not implemented when the database is a file"); } else CALL_DB_SERVER_NO_RET("DbDeleteAllDeviceAttributeProperty",send); @@ -4497,9 +4449,7 @@ void Database::write_event_channel_ior_filedatabase(std::string &ec_ior) { if (filedb == NULL) { - Tango::Except::throw_exception((const char *)API_NotSupportedFeature, - (const char *)"This call is supported only when the database is a file", - (const char *)"Database::write_event_channel_ior_filedatabase"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, "This call is supported only when the database is a file"); } filedb->write_event_channel_ior(ec_ior); @@ -4555,9 +4505,7 @@ DbDevFullInfo Database::get_device_info(std::string &dev) } else { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_device_info()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } return(dev_info); @@ -4635,9 +4583,7 @@ void Database::get_attribute_from_alias(std::string attr_alias, std::string &att if (attr_name_tmp == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_attribute_from_alias()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else attr_name = attr_name_tmp; @@ -4667,9 +4613,7 @@ void Database::get_alias_from_attribute(std::string attr_name, std::string &attr if (attr_alias_tmp == NULL) { - Tango::Except::throw_exception((const char *)API_IncoherentDbData, - (const char *)"Incoherent data received from database", - (const char *)"Database::get_alias_from_attribute()"); + TANGO_THROW_EXCEPTION(API_IncoherentDbData, "Incoherent data received from database"); } else attr_alias = attr_alias_tmp; @@ -5185,9 +5129,7 @@ void Database::delete_all_device_pipe_property(std::string dev_name,DbData &db_d if (filedb != 0) { - Tango::Except::throw_exception(API_NotSupportedFeature, - "The underlying database command is not implemented when the database is a file", - "Database::delete_all_device_pipe_property"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, "The underlying database command is not implemented when the database is a file"); } else CALL_DB_SERVER_NO_RET("DbDeleteAllDevicePipeProperty",send); diff --git a/cppapi/client/dbapi_cache.cpp b/cppapi/client/dbapi_cache.cpp index b621c168d..1b1e84173 100644 --- a/cppapi/client/dbapi_cache.cpp +++ b/cppapi/client/dbapi_cache.cpp @@ -302,7 +302,7 @@ const DevVarLongStringArray *DbServerCache::import_adm_dev() if (imp_adm.last_idx == last_index) { - Tango::Except::throw_exception("aaa","bbb","ccc"); + TANGO_THROW_EXCEPTION("aaa", "bbb"); } imp_adm_data.lvalue.length(2); @@ -335,7 +335,7 @@ const DevVarLongStringArray *DbServerCache::import_notifd_event() { if (imp_notifd_event.last_idx == imp_notifd_event.first_idx + 1) { - Tango::Except::throw_exception("aaa","bbb","ccc"); + TANGO_THROW_EXCEPTION("aaa", "bbb"); } imp_notifd_event_data.lvalue.length(2); @@ -369,7 +369,7 @@ const DevVarLongStringArray *DbServerCache::import_adm_event() { if (imp_adm_event.last_idx == imp_adm_event.first_idx + 1) { - Tango::Except::throw_exception("aaa","bbb","ccc"); + TANGO_THROW_EXCEPTION("aaa", "bbb"); } imp_adm_event_data.lvalue.length(2); @@ -436,8 +436,7 @@ const DevVarStringArray *DbServerCache::get_class_property(DevVarStringArray *in TangoSys_OMemStream o; o << "Class " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)DB_ClassNotFoundInCache,o.str(), - (const char *)"DbServerCache::get_dev_property"); + TANGO_THROW_EXCEPTION(DB_ClassNotFoundInCache, o.str()); } } @@ -554,8 +553,7 @@ const DevVarStringArray *DbServerCache::get_dev_property(DevVarStringArray *in_p TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), - (const char *)"DbServerCache::get_dev_property"); + TANGO_THROW_EXCEPTION(DB_DeviceNotFoundInCache, o.str()); } ret_obj_prop.length(ret_length); ret_obj_prop[0] = Tango::string_dup((*in_param)[0]); @@ -571,8 +569,7 @@ const DevVarStringArray *DbServerCache::get_dev_property(DevVarStringArray *in_p TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), - (const char *)"DbServerCache::get_dev_property"); + TANGO_THROW_EXCEPTION(DB_DeviceNotFoundInCache, o.str()); } else { @@ -726,8 +723,7 @@ const DevVarStringArray *DbServerCache::get_class_att_property(DevVarStringArray TangoSys_OMemStream o; o << "Class " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)DB_ClassNotFoundInCache,o.str(), - (const char *)"DbServerCache::get_dev_property"); + TANGO_THROW_EXCEPTION(DB_ClassNotFoundInCache, o.str()); } // cout4 << "DbCache --> Returned data for a get_class_att_property for class " << (*in_param)[0] << std::endl; @@ -817,8 +813,7 @@ const DevVarStringArray *DbServerCache::get_dev_att_property(DevVarStringArray * TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), - (const char *)"DbServerCache::get_dev_att_property"); + TANGO_THROW_EXCEPTION(DB_DeviceNotFoundInCache, o.str()); } else { @@ -1136,8 +1131,7 @@ const DevVarStringArray *DbServerCache::get_obj_property(DevVarStringArray *in_p TangoSys_OMemStream o; o << "Object " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), - (const char *)"DbServerCache::get_obj_property"); + TANGO_THROW_EXCEPTION(DB_DeviceNotFoundInCache, o.str()); } else { @@ -1192,8 +1186,7 @@ const DevVarStringArray *DbServerCache::get_device_property_list(DevVarStringArr TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), - (const char *)"DbServerCache::get_device_property_list"); + TANGO_THROW_EXCEPTION(DB_DeviceNotFoundInCache, o.str()); } else { @@ -1372,9 +1365,7 @@ const DevVarLongStringArray *DbServerCache::import_tac_dev(std::string &tac_dev) if (imp_tac.last_idx == -1 || imp_tac.first_idx >= (int)data_list->length()) { - Tango::Except::throw_exception((const char *)API_DatabaseCacheAccess, - (const char *)"No TAC device in Db cache", - (const char *)"DbServerCache::import_tac_dev"); + TANGO_THROW_EXCEPTION(API_DatabaseCacheAccess, "No TAC device in Db cache"); } // @@ -1383,9 +1374,7 @@ const DevVarLongStringArray *DbServerCache::import_tac_dev(std::string &tac_dev) if (tac_dev.size() != strlen((*data_list)[imp_tac.first_idx])) { - Tango::Except::throw_exception((const char *)API_DatabaseCacheAccess, - (const char *)"Device not available from cache", - (const char *)"DbServerCache::import_tac_dev"); + TANGO_THROW_EXCEPTION(API_DatabaseCacheAccess, "Device not available from cache"); } std::string local_tac_dev(tac_dev); @@ -1396,9 +1385,7 @@ const DevVarLongStringArray *DbServerCache::import_tac_dev(std::string &tac_dev) if (local_tac_dev != cache_tac_dev) { - Tango::Except::throw_exception((const char *)API_DatabaseCacheAccess, - (const char *)"Device not available from cache", - (const char *)"DbServerCache::import_tac_dev"); + TANGO_THROW_EXCEPTION(API_DatabaseCacheAccess, "Device not available from cache"); } // @@ -1410,8 +1397,7 @@ const DevVarLongStringArray *DbServerCache::import_tac_dev(std::string &tac_dev) TangoSys_OMemStream o; o << "Device " << tac_dev << " not defined in database" << std::ends; - Tango::Except::throw_exception((const char *)DB_DeviceNotDefined,o.str(), - (const char *)"DbServerCache::import_tac_dev"); + TANGO_THROW_EXCEPTION(DB_DeviceNotDefined, o.str()); } // @@ -1458,7 +1444,7 @@ const DevVarStringArray *DbServerCache::get_class_pipe_property(DevVarStringArra if (proc_release < 109) { std::string mess("Your database stored procedure is too old to support pipe. Please update to stored procedure release 1.9 or more"); - Tango::Except::throw_exception(DB_TooOldStoredProc,mess,"DbServerCache::get_class_pipe_property"); + TANGO_THROW_EXCEPTION(DB_TooOldStoredProc, mess); } int found_pipe = 0; @@ -1527,8 +1513,7 @@ const DevVarStringArray *DbServerCache::get_class_pipe_property(DevVarStringArra TangoSys_OMemStream o; o << "Class " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception(DB_ClassNotFoundInCache,o.str(), - "DbServerCache::get_class_pipe_property"); + TANGO_THROW_EXCEPTION(DB_ClassNotFoundInCache, o.str()); } // cout4 << "DbCache --> Returned data for a get_class_pipe_property for class " << (*in_param)[0] << std::endl; @@ -1566,7 +1551,7 @@ const DevVarStringArray *DbServerCache::get_dev_pipe_property(DevVarStringArray if (proc_release < 109) { std::string mess("Your database stored procedure is too old to support pipe. Please update to stored procedure release 1.9 or more"); - Tango::Except::throw_exception(DB_TooOldStoredProc,mess,"DbServerCache::get_dev_pipe_property"); + TANGO_THROW_EXCEPTION(DB_TooOldStoredProc, mess); } int found_pipe = 0; @@ -1630,8 +1615,7 @@ const DevVarStringArray *DbServerCache::get_dev_pipe_property(DevVarStringArray TangoSys_OMemStream o; o << "Device " << (*in_param)[0] << " not found in DB cache" << std::ends; - Tango::Except::throw_exception((const char *)DB_DeviceNotFoundInCache,o.str(), - (const char *)"DbServerCache::get_dev_pipe_property"); + TANGO_THROW_EXCEPTION(DB_DeviceNotFoundInCache, o.str()); } else { diff --git a/cppapi/client/dbapi_datum.cpp b/cppapi/client/dbapi_datum.cpp index cb6c9de9f..f344d8ddb 100644 --- a/cppapi/client/dbapi_datum.cpp +++ b/cppapi/client/dbapi_datum.cpp @@ -124,9 +124,7 @@ bool DbDatum::is_empty() { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"The DbDatum object is empty", - (const char*)"DbDatum::is_empty"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "The DbDatum object is empty"); } return true; } @@ -168,9 +166,7 @@ bool DbDatum::operator >> (bool &datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"Cannot extract short, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(short)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "Cannot extract short, no data in DbDatum object "); } ret = false; } @@ -188,9 +184,7 @@ bool DbDatum::operator >> (bool &datum) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not a short", - (const char *)"DbDatum::operator >>(short)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not a short"); } ret = false; } @@ -234,9 +228,7 @@ bool DbDatum::operator >> (short &datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"Cannot extract short, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(short)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "Cannot extract short, no data in DbDatum object "); } ret = false; } @@ -249,9 +241,7 @@ bool DbDatum::operator >> (short &datum) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not a short", - (const char *)"DbDatum::operator >>(short)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not a short"); } ret = false; } @@ -293,9 +283,7 @@ bool DbDatum::operator >> (unsigned char& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract unsigned short, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(unsigned char)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract unsigned short, no data in DbDatum object "); } ret = false; } @@ -307,9 +295,7 @@ bool DbDatum::operator >> (unsigned char& datum) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not an unsigned short", - (const char *)"DbDatum::operator >>(unsigned short)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not an unsigned short"); } ret = false; } @@ -351,9 +337,7 @@ bool DbDatum::operator >> (unsigned short& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract unsigned short, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(unsigned short)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract unsigned short, no data in DbDatum object "); } ret = false; } @@ -365,9 +349,7 @@ bool DbDatum::operator >> (unsigned short& datum) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not an unsigned short", - (const char *)"DbDatum::operator >>(unsigned short)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not an unsigned short"); } ret = false; } @@ -409,9 +391,7 @@ bool DbDatum::operator >> (DevLong& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDbDatum, - (const char*)"cannot extract long, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(long)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDbDatum, "cannot extract long, no data in DbDatum object "); } ret = false; } @@ -423,9 +403,7 @@ bool DbDatum::operator >> (DevLong& datum) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not a DevLong (long 32 bits)", - (const char *)"DbDatum::operator >>(DevLong)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not a DevLong (long 32 bits)"); } ret = false; } @@ -467,9 +445,7 @@ bool DbDatum::operator >> (DevULong& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract unsigned long, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(unsigned long)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract unsigned long, no data in DbDatum object "); } ret = false; } @@ -481,9 +457,7 @@ bool DbDatum::operator >> (DevULong& datum) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not a DevULong (unsigned long 32 bits)", - (const char *)"DbDatum::operator >>(DevULong)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not a DevULong (unsigned long 32 bits)"); } ret = false; } @@ -525,9 +499,7 @@ bool DbDatum::operator >> (DevLong64 &datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract unsigned long, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(DevLong64)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract unsigned long, no data in DbDatum object "); } ret = false; } @@ -539,9 +511,7 @@ bool DbDatum::operator >> (DevLong64 &datum) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not a DevLong64 (long 64 bits)", - (const char *)"DbDatum::operator >>(DevULong)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not a DevLong64 (long 64 bits)"); } ret = false; } @@ -583,9 +553,7 @@ bool DbDatum::operator >> (DevULong64 &datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract unsigned long, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(DevLong64)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract unsigned long, no data in DbDatum object "); } ret = false; } @@ -597,9 +565,7 @@ bool DbDatum::operator >> (DevULong64 &datum) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not a DevULong64 (unsigned long 64 bits)", - (const char *)"DbDatum::operator >>(DevULong)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not a DevULong64 (unsigned long 64 bits)"); } ret = false; } @@ -641,9 +607,7 @@ bool DbDatum::operator >> (float& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDbDatum, - (const char*)"cannot extract float, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(float)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDbDatum, "cannot extract float, no data in DbDatum object "); } ret = false; } @@ -669,9 +633,7 @@ bool DbDatum::operator >> (float& datum) } else if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not a float", - (const char *)"DbDatum::operator >>(float)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not a float"); } else { @@ -716,9 +678,7 @@ bool DbDatum::operator >> (double& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract double, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(double)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract double, no data in DbDatum object "); } ret = false; } @@ -744,9 +704,7 @@ bool DbDatum::operator >> (double& datum) } else if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *)API_IncompatibleArgumentType, - (const char *)"Cannot extract, data in DbDatum is not a double", - (const char *)"DbDatum::operator >>(double)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, "Cannot extract, data in DbDatum is not a double"); } else { @@ -788,9 +746,7 @@ bool DbDatum::operator >> (std::string& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract string, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(string)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract string, no data in DbDatum object "); } ret = false; } @@ -860,9 +816,7 @@ bool DbDatum::operator >> (const char*& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract string, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(string)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract string, no data in DbDatum object "); } ret = false; } @@ -909,9 +863,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract short vector, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract short vector, no data in DbDatum object "); } datum.resize(0); ret = false; @@ -934,9 +886,7 @@ bool DbDatum::operator >> (std::vector& datum) desc << "Cannot extract short vector, elt number "; desc << i+1 << " is not a short" << std::ends; - ApiDataExcept::throw_exception((const char*)API_IncompatibleArgumentType, - desc.str(), - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, desc.str()); } ret = false; break; @@ -980,9 +930,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract unsigned short vector, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract unsigned short vector, no data in DbDatum object "); } datum.resize(0); ret = false; @@ -1005,9 +953,7 @@ bool DbDatum::operator >> (std::vector& datum) desc << "Cannot extract unsigned short vector, elt number "; desc << i+1 << " is not an unsigned short" << std::ends; - ApiDataExcept::throw_exception((const char*)API_IncompatibleArgumentType, - desc.str(), - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, desc.str()); } ret = false; break; @@ -1052,9 +998,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract long vector, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract long vector, no data in DbDatum object "); } datum.resize(0); ret = false; @@ -1077,9 +1021,7 @@ bool DbDatum::operator >> (std::vector& datum) desc << "Cannot extract long vector, elt number "; desc << i+1 << " is not a DevLong (long 32 bits)" << std::ends; - ApiDataExcept::throw_exception((const char*)API_IncompatibleArgumentType, - desc.str(), - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, desc.str()); } ret = false; break; @@ -1124,9 +1066,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract unsigned long vector, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract unsigned long vector, no data in DbDatum object "); } datum.resize(0); ret = false; @@ -1149,9 +1089,7 @@ bool DbDatum::operator >> (std::vector& datum) desc << "Cannot extract unsigned long vector, elt number "; desc << i+1 << " is not a DevULong (unsigned long 32 bits)" << std::ends; - ApiDataExcept::throw_exception((const char*)API_IncompatibleArgumentType, - desc.str(), - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, desc.str()); } ret = false; break; @@ -1196,9 +1134,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract unsigned long vector, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract unsigned long vector, no data in DbDatum object "); } datum.resize(0); ret = false; @@ -1221,9 +1157,7 @@ bool DbDatum::operator >> (std::vector& datum) desc << "Cannot extract unsigned long vector, elt number "; desc << i+1 << " is not a DevLong64 (long 64 bits)" << std::ends; - ApiDataExcept::throw_exception((const char*)API_IncompatibleArgumentType, - desc.str(), - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, desc.str()); } ret = false; break; @@ -1268,9 +1202,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract unsigned long vector, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract unsigned long vector, no data in DbDatum object "); } datum.resize(0); ret = false; @@ -1293,9 +1225,7 @@ bool DbDatum::operator >> (std::vector& datum) desc << "Cannot extract unsigned long vector, elt number "; desc << i+1 << " is not a DevULong64 (unsigned long 64 bits)" << std::ends; - ApiDataExcept::throw_exception((const char*)API_IncompatibleArgumentType, - desc.str(), - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, desc.str()); } ret = false; break; @@ -1340,9 +1270,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract float vector, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract float vector, no data in DbDatum object "); } datum.resize(0); ret = false; @@ -1377,9 +1305,7 @@ bool DbDatum::operator >> (std::vector& datum) TangoSys_OMemStream desc; desc << "Cannot extract float vector, elt number "; desc << i+1 << " is not a float" << std::ends; - ApiDataExcept::throw_exception((const char*)API_IncompatibleArgumentType, - desc.str(), - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, desc.str()); } else { @@ -1428,9 +1354,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract double vector, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract double vector, no data in DbDatum object "); } datum.resize(0); ret = false; @@ -1465,9 +1389,7 @@ bool DbDatum::operator >> (std::vector& datum) TangoSys_OMemStream desc; desc << "Cannot extract double vector, elt number "; desc << i+1 << " is not a double" << std::ends; - ApiDataExcept::throw_exception((const char*)API_IncompatibleArgumentType, - desc.str(), - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, desc.str()); } else { @@ -1510,9 +1432,7 @@ bool DbDatum::operator >> (std::vector& datum) { if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDbDatum, - (const char*)"cannot extract string vector, no data in DbDatum object ", - (const char*)"DbDatum::operator >>(vector)"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDbDatum, "cannot extract string vector, no data in DbDatum object "); } datum.resize(0); ret = false; diff --git a/cppapi/client/dbapi_serverdata.cpp b/cppapi/client/dbapi_serverdata.cpp index 3292d5e0b..4df146f24 100644 --- a/cppapi/client/dbapi_serverdata.cpp +++ b/cppapi/client/dbapi_serverdata.cpp @@ -78,7 +78,7 @@ DbServerData::DbServerData(const std::string &exec_name,const std::string &inst_ { std::stringstream ss; ss << "Device server process " << full_server_name << " is not defined in database"; - Tango::Except::throw_exception("DBServerNotDefinedInDb",ss.str(),"DbServerData::DbServerData"); + TANGO_THROW_EXCEPTION("DBServerNotDefinedInDb", ss.str()); } // @@ -125,7 +125,7 @@ void DbServerData::put_in_database(const std::string &tg_host) { std::stringstream ss; ss << tg_host << " is not a valid synatx for Tango host (host:port)"; - Tango::Except::throw_exception("DBWrongTangoHostSyntax",ss.str(),"DbServerData::put_in_database"); + TANGO_THROW_EXCEPTION("DBWrongTangoHostSyntax", ss.str()); } // @@ -179,7 +179,7 @@ bool DbServerData::already_exist(const std::string &tg_host) { std::stringstream ss; ss << tg_host << " is not a valid synatx for Tango host (host:port)"; - Tango::Except::throw_exception("DBWrongTangoHostSyntax",ss.str(),"DbServerData::already_exist"); + TANGO_THROW_EXCEPTION("DBWrongTangoHostSyntax", ss.str()); } std::string header("tango://"); @@ -221,7 +221,7 @@ bool DbServerData::already_exist(const std::string &tg_host) { std::stringstream ss; ss << "Failed to check " << dev_name << " in Tango host " << tg_host << std::endl; - Tango::Except::re_throw_exception(e,"DBFailedToCheck",ss.str(),"DbServerData::already_exist"); + TANGO_RETHROW_EXCEPTION(e, "DBFailedToCheck", ss.str()); } } } @@ -318,7 +318,7 @@ void DbServerData::remove(const std::string &tg_host) { std::stringstream ss; ss << tg_host << " is not a valid synatx for Tango host (host:port)"; - Tango::Except::throw_exception("DBWrongTangoHostSyntax",ss.str(),"DbServerData::remove"); + TANGO_THROW_EXCEPTION("DBWrongTangoHostSyntax", ss.str()); } // diff --git a/cppapi/client/devapi.h b/cppapi/client/devapi.h index 28a7dc2ba..f27d916cd 100644 --- a/cppapi/client/devapi.h +++ b/cppapi/client/devapi.h @@ -851,16 +851,14 @@ inline int DeviceProxy::subscribe_event (const std::string &attr_name, EventType TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name; \ desc << ", attribute " << NAME_CHAR << std::ends; \ - ApiConnExcept::re_throw_exception(e,(const char*)API_AttributeFailed, \ - desc.str(), (const char*)"DeviceProxy::read_attribute()"); \ + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_AttributeFailed, desc.str()); \ } \ catch (Tango::DevFailed &e) \ { \ TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name; \ desc << ", attribute " << NAME_CHAR << std::ends; \ - Except::re_throw_exception(e,(const char*)API_AttributeFailed, \ - desc.str(), (const char*)"DeviceProxy::read_attribute()"); \ + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, desc.str()); \ } \ catch (CORBA::TRANSIENT &trans) \ { \ @@ -877,10 +875,7 @@ inline int DeviceProxy::subscribe_event (const std::string &attr_name, EventType set_connection_state(CONNECTION_NOTOK); \ TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name << std::ends; \ - ApiCommExcept::re_throw_exception(one, \ - (const char*)API_CommunicationFailed, \ - desc.str(), \ - (const char*)"DeviceProxy::read_attribute()"); \ + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); \ } \ } \ catch (CORBA::COMM_FAILURE &comm) \ @@ -894,21 +889,15 @@ inline int DeviceProxy::subscribe_event (const std::string &attr_name, EventType set_connection_state(CONNECTION_NOTOK); \ TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name << std::ends; \ - ApiCommExcept::re_throw_exception(comm, \ - (const char*)API_CommunicationFailed, \ - desc.str(), \ - (const char*)"DeviceProxy::read_attribute()"); \ + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); \ } \ } \ catch (CORBA::SystemException &ce) \ - { \ + { \ set_connection_state(CONNECTION_NOTOK); \ TangoSys_OMemStream desc; \ desc << "Failed to read_attribute on device " << device_name << std::ends; \ - ApiCommExcept::re_throw_exception(ce, \ - (const char*)API_CommunicationFailed, \ - desc.str(), \ - (const char*)"DeviceProxy::read_attribute()"); \ + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); \ } diff --git a/cppapi/client/devapi_attr.cpp b/cppapi/client/devapi_attr.cpp index 3ba4e2e9a..db43740cd 100644 --- a/cppapi/client/devapi_attr.cpp +++ b/cppapi/client/devapi_attr.cpp @@ -1317,9 +1317,7 @@ bool DeviceAttribute::is_empty() if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception(API_EmptyDeviceAttribute, - "cannot extract, no data in DeviceAttribute object ", - "DeviceAttribute::is_empty"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDeviceAttribute, "cannot extract, no data in DeviceAttribute object "); } return true; } @@ -1414,9 +1412,7 @@ AttrDataFormat DeviceAttribute::get_data_format() { if (exceptions_flags.test(unknown_format_flag) && (data_format == Tango::FMT_UNKNOWN)) { - ApiDataExcept::throw_exception((const char*)API_EmptyDeviceAttribute, - (const char*)"Cannot returned data_type from DeviceAttribute object: Not initialised yet or too old device (< V7)", - (const char*)"DeviceAttribute::get_data_format"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDeviceAttribute, "Cannot returned data_type from DeviceAttribute object: Not initialised yet or too old device (< V7)"); } return data_format; } @@ -3509,9 +3505,7 @@ bool DeviceAttribute::operator >> (DevVarEncodedArray* &datum) if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char*)API_IncompatibleAttrArgumentType, - (const char*)"Cannot extract, data in DeviceAttribute object is not an array of DevEncoded", - (const char*)"DeviceAttribute::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleAttrArgumentType, "Cannot extract, data in DeviceAttribute object is not an array of DevEncoded"); } } return ret; @@ -5448,9 +5442,7 @@ bool DeviceAttribute::check_wrong_type_exception() if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception(API_IncompatibleAttrArgumentType, - "Cannot extract, data type in DeviceAttribute object is not coherent with the type provided to extraction method", - "DeviceAttribute::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleAttrArgumentType, "Cannot extract, data type in DeviceAttribute object is not coherent with the type provided to extraction method"); } return false; @@ -5483,9 +5475,7 @@ int DeviceAttribute::check_set_value_size(int seq_length) { // no set point available - ApiDataExcept::throw_exception((const char*)API_NoSetValueAvailable, - (const char*)"Cannot extract, data from the DeviceAttribute object. No set value available", - (const char*)"DeviceAttribute::extract_set"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_NoSetValueAvailable, "Cannot extract, data from the DeviceAttribute object. No set value available"); } diff --git a/cppapi/client/devapi_attr.tpp b/cppapi/client/devapi_attr.tpp index 9ff865072..91720d973 100644 --- a/cppapi/client/devapi_attr.tpp +++ b/cppapi/client/devapi_attr.tpp @@ -415,9 +415,7 @@ bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception(API_IncompatibleAttrArgumentType, - "Type provided for insertion is not a valid enum. Only C enum or C++11 enum with underlying short data type are supported", - "DeviceAttribute::operator<<"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleAttrArgumentType, "Type provided for insertion is not a valid enum. Only C enum or C++11 enum with underlying short data type are supported"); } return false; @@ -427,9 +425,7 @@ bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) { if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception(API_IncompatibleAttrArgumentType, - "Type provided for insertion is not an enumeration", - "DeviceAttribute::operator<<"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleAttrArgumentType, "Type provided for insertion is not an enumeration"); } return false; diff --git a/cppapi/client/devapi_base.cpp b/cppapi/client/devapi_base.cpp index baddac8cc..f43405a1f 100644 --- a/cppapi/client/devapi_base.cpp +++ b/cppapi/client/devapi_base.cpp @@ -445,9 +445,7 @@ void Connection::connect(std::string &corba_name) TangoSys_OMemStream desc; desc << "Failed to connect to device " << dev_name(); desc << " (device nil after _narrowing)" << std::ends; - ApiConnExcept::throw_exception((const char *) API_CantConnectToDevice, - desc.str(), - (const char *) "Connection::connect()"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_CantConnectToDevice, desc.str()); } else { @@ -604,8 +602,7 @@ void Connection::connect(std::string &corba_name) if (db_connect == false) { - ApiConnExcept::re_throw_exception(ce, reason.str(), desc.str(), - (const char *) "Connection::connect"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, ce, reason.str(), desc.str()); } } } @@ -723,9 +720,7 @@ void Connection::reconnect(bool db_used) desc << "The connection request was delayed." << std::endl; desc << "The last connection request was done less than " << RECONNECTION_DELAY << " ms ago" << std::ends; - Tango::Except::throw_exception((const char *) API_CantConnectToDevice, - desc.str(), - (const char *) "Connection::reconnect"); + TANGO_THROW_EXCEPTION(API_CantConnectToDevice, desc.str()); } } @@ -800,10 +795,7 @@ void Connection::reconnect(bool db_used) TangoSys_OMemStream desc; desc << "Failed to connect to device " << dev_name() << std::ends; - ApiConnExcept::re_throw_exception(ce, - (const char *) API_CantConnectToDevice, - desc.str(), - (const char *) "Connection::reconnect"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, ce, API_CantConnectToDevice, desc.str()); } } } @@ -1304,8 +1296,7 @@ DeviceData Connection::command_inout(std::string &command, DeviceData &data_in) desc << std::ends; } - NotAllowedExcept::throw_exception((const char *) API_ReadOnlyMode, desc.str(), - (const char *) "Connection::command_inout()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } } @@ -1342,8 +1333,7 @@ DeviceData Connection::command_inout(std::string &command, DeviceData &data_in) TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiConnExcept::re_throw_exception(e, (const char *) API_CommandFailed, - desc.str(), (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } catch (Tango::DevFailed &e) { @@ -1353,13 +1343,11 @@ DeviceData Connection::command_inout(std::string &command, DeviceData &data_in) if (::strcmp(e.errors[0].reason, DEVICE_UNLOCKED_REASON) == 0) { - DeviceUnlockedExcept::re_throw_exception(e, (const char *) DEVICE_UNLOCKED_REASON, - desc.str(), (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(DeviceUnlockedExcept, e, DEVICE_UNLOCKED_REASON, desc.str()); } else { - Except::re_throw_exception(e, (const char *) API_CommandFailed, - desc.str(), (const char *) "Connection::command_inout()"); + TANGO_RETHROW_EXCEPTION(e, API_CommandFailed, desc.str()); } } catch (CORBA::TRANSIENT &trans) @@ -1378,10 +1366,7 @@ DeviceData Connection::command_inout(std::string &command, DeviceData &data_in) TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -1396,10 +1381,7 @@ DeviceData Connection::command_inout(std::string &command, DeviceData &data_in) TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -1409,10 +1391,7 @@ DeviceData Connection::command_inout(std::string &command, DeviceData &data_in) TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -1520,8 +1499,7 @@ CORBA::Any_var Connection::command_inout(std::string &command, CORBA::Any &any) desc << std::ends; } - NotAllowedExcept::throw_exception((const char *) API_ReadOnlyMode, desc.str(), - (const char *) "Connection::command_inout()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } } @@ -1551,8 +1529,7 @@ CORBA::Any_var Connection::command_inout(std::string &command, CORBA::Any &any) TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiConnExcept::re_throw_exception(e, (const char *) API_CommandFailed, - desc.str(), (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } catch (Tango::DevFailed &e) { @@ -1562,13 +1539,11 @@ CORBA::Any_var Connection::command_inout(std::string &command, CORBA::Any &any) if (::strcmp(e.errors[0].reason, DEVICE_UNLOCKED_REASON) == 0) { - DeviceUnlockedExcept::re_throw_exception(e, (const char *) DEVICE_UNLOCKED_REASON, - desc.str(), (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(DeviceUnlockedExcept, e, DEVICE_UNLOCKED_REASON, desc.str()); } else { - Except::re_throw_exception(e, (const char *) API_CommandFailed, - desc.str(), (const char *) "Connection::command_inout()"); + TANGO_RETHROW_EXCEPTION(e, API_CommandFailed, desc.str()); } } catch (CORBA::TRANSIENT &trans) @@ -1587,10 +1562,7 @@ CORBA::Any_var Connection::command_inout(std::string &command, CORBA::Any &any) TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -1605,10 +1577,7 @@ CORBA::Any_var Connection::command_inout(std::string &command, CORBA::Any &any) TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -1618,10 +1587,7 @@ CORBA::Any_var Connection::command_inout(std::string &command, CORBA::Any &any) TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "Connection::command_inout()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -1748,10 +1714,7 @@ void DeviceProxy::real_constructor(std::string &name, bool need_check_acc) delete db_dev; TangoSys_OMemStream desc; desc << "Can't connect to device " << device_name << std::ends; - ApiConnExcept::re_throw_exception(dfe, - (const char *) API_DeviceNotDefined, - desc.str(), - (const char *) "DeviceProxy::DeviceProxy"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, dfe, API_DeviceNotDefined, desc.str()); } else if (strcmp(dfe.errors[0].reason, API_DeviceNotExported) == 0) { @@ -2016,9 +1979,7 @@ void DeviceProxy::parse_name(std::string &full_name) desc << "The given name is an empty string!!! " << full_name << std::endl; desc << "Device name syntax is domain/family/member" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } // @@ -2064,9 +2025,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << protocol; desc << " protocol is an unsupported protocol" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_UnsupportedProtocol, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_UnsupportedProtocol, desc.str()); } } @@ -2098,9 +2057,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << mod; desc << " modifier is an unsupported db modifier" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_UnsupportedDBaseModifier, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_UnsupportedDBaseModifier, desc.str()); } } else @@ -2122,9 +2079,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Host and port not correctly defined in device name " << full_name << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } host = name_wo_db_mod.substr(0, pos); @@ -2134,9 +2089,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Host and port not correctly defined in device name " << full_name << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } port = name_wo_db_mod.substr(pos + 1, tmp - pos - 1); TangoSys_MemStream s; @@ -2156,9 +2109,7 @@ void DeviceProxy::parse_name(std::string &full_name) desc << "Wrong device name syntax (domain/family/member) in " << full_name << std::endl; desc << "Rem: Alias are forbidden when not using a database" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } std::string::size_type prev_sep = tmp; tmp = device_name.find(DEV_NAME_FIELD_SEP, tmp + 1); @@ -2168,9 +2119,7 @@ void DeviceProxy::parse_name(std::string &full_name) desc << "Wrong device name syntax (domain/family/member) in " << full_name << std::endl; desc << "Rem: Alias are forbidden when not using a database" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } prev_sep = tmp; tmp = device_name.find(DEV_NAME_FIELD_SEP, tmp + 1); @@ -2180,9 +2129,7 @@ void DeviceProxy::parse_name(std::string &full_name) desc << "Wrong device name syntax (domain/family/member) in " << full_name << std::endl; desc << "Rem: Alias are forbidden when not using a database" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } db_host = db_port = NOT_USED; @@ -2210,9 +2157,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Wrong alias name syntax in " << full_name << " (: is not allowed in alias name)" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } pos = name_wo_db_mod.find(RES_SEP); @@ -2221,9 +2166,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Wrong alias name syntax in " << full_name << " (-> is not allowed in alias name)" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } // @@ -2254,9 +2197,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Wrong device name syntax (domain/family/member) in " << full_name << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } std::string::size_type prev_sep = pos; @@ -2267,9 +2208,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Wrong device name syntax (domain/family/member) in " << full_name << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } prev_sep = pos; @@ -2279,9 +2218,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Wrong device name syntax (domain/family/member) in " << full_name << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } device_name = name_wo_db_mod; @@ -2353,9 +2290,7 @@ void DeviceProxy::parse_name(std::string &full_name) desc << "Wrong alias name syntax in " << full_name << " (: is not allowed in alias name)" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } pos = object_name.find(RES_SEP); @@ -2365,9 +2300,7 @@ void DeviceProxy::parse_name(std::string &full_name) desc << "Wrong alias name syntax in " << full_name << " (-> is not allowed in alias name)" << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } alias_name = device_name = object_name; is_alias = true; @@ -2392,9 +2325,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Wrong device name syntax (domain/family/member) in " << full_name << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } prev_sep = pos; @@ -2404,9 +2335,7 @@ void DeviceProxy::parse_name(std::string &full_name) TangoSys_OMemStream desc; desc << "Wrong device name syntax (domain/family/member) in " << full_name << std::ends; - ApiWrongNameExcept::throw_exception((const char *) API_WrongDeviceNameSyntax, - desc.str(), - (const char *) "DeviceProxy::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } device_name = object_name; @@ -2458,8 +2387,7 @@ std::string DeviceProxy::get_corba_name(bool need_check_acc) TangoSys_OMemStream desc; desc << "Device " << device_name << " is not exported (hint: try starting the device server)" << std::ends; - ApiConnExcept::throw_exception(API_DeviceNotExported, desc.str(), - "DeviceProxy::get_corba_name()"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_DeviceNotExported, desc.str()); } } @@ -2545,9 +2473,7 @@ DbDevImportInfo DeviceProxy::import_info() desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::import_info"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -2681,10 +2607,7 @@ int DeviceProxy::ping() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute ping on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::ping()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -2698,10 +2621,7 @@ int DeviceProxy::ping() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute ping on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::ping()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -2710,10 +2630,7 @@ int DeviceProxy::ping() TangoSys_OMemStream desc; desc << "Failed to execute ping on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::ping()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } #ifndef _TG_WINDOWS_ @@ -2766,10 +2683,7 @@ std::string DeviceProxy::name() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute name() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::name()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -2783,10 +2697,7 @@ std::string DeviceProxy::name() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute name() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::name()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -2795,10 +2706,7 @@ std::string DeviceProxy::name() TangoSys_OMemStream desc; desc << "Failed to execute name() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::name()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -2822,9 +2730,7 @@ std::string DeviceProxy::alias() } else { - Tango::Except::throw_exception((const char *) DB_AliasNotDefined, - (const char *) "No alias found for your device", - (const char *) "DeviceProxy::alias()"); + TANGO_THROW_EXCEPTION(DB_AliasNotDefined, "No alias found for your device"); } } @@ -2867,10 +2773,7 @@ DevState DeviceProxy::state() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute state() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::state()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -2884,10 +2787,7 @@ DevState DeviceProxy::state() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute state() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::state()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -2896,10 +2796,7 @@ DevState DeviceProxy::state() TangoSys_OMemStream desc; desc << "Failed to execute state() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::state()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -2943,10 +2840,7 @@ std::string DeviceProxy::status() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute status() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::status()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -2960,10 +2854,7 @@ std::string DeviceProxy::status() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute status() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::status()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -2972,10 +2863,7 @@ std::string DeviceProxy::status() TangoSys_OMemStream desc; desc << "Failed to execute status() on device (CORBA exception)" << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::status()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -3037,10 +2925,7 @@ std::string DeviceProxy::adm_name() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute adm_name() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::adm_name()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -3054,10 +2939,7 @@ std::string DeviceProxy::adm_name() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute adm_name() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::adm_name()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -3066,10 +2948,7 @@ std::string DeviceProxy::adm_name() TangoSys_OMemStream desc; desc << "Failed to execute adm_name() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::adm_name()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -3113,10 +2992,7 @@ std::string DeviceProxy::description() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute description() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::description()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -3130,10 +3006,7 @@ std::string DeviceProxy::description() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute description() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::description()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -3142,10 +3015,7 @@ std::string DeviceProxy::description() TangoSys_OMemStream desc; desc << "Failed to execute description() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::description()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -3189,10 +3059,7 @@ std::vector *DeviceProxy::black_box(int last_n_commands) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute black_box on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::black_box()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -3206,10 +3073,7 @@ std::vector *DeviceProxy::black_box(int last_n_commands) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute black_box on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::black_box()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -3218,10 +3082,7 @@ std::vector *DeviceProxy::black_box(int last_n_commands) TangoSys_OMemStream desc; desc << "Failed to execute black_box on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::black_box()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -3295,10 +3156,7 @@ DeviceInfo const &DeviceProxy::info() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute info() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::info()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -3312,10 +3170,7 @@ DeviceInfo const &DeviceProxy::info() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute info() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::info()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -3324,10 +3179,7 @@ DeviceInfo const &DeviceProxy::info() TangoSys_OMemStream desc; desc << "Failed to execute info() on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::info()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -3397,10 +3249,7 @@ CommandInfo DeviceProxy::command_query(std::string cmd) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute command_query on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::command_query()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -3414,10 +3263,7 @@ CommandInfo DeviceProxy::command_query(std::string cmd) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute command_query on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::command_query()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -3426,10 +3272,7 @@ CommandInfo DeviceProxy::command_query(std::string cmd) TangoSys_OMemStream desc; desc << "Failed to execute command_query on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::command_query()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -3559,10 +3402,7 @@ CommandInfoList *DeviceProxy::command_list_query() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute command_list_query on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::command_list_query()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -3576,10 +3416,7 @@ CommandInfoList *DeviceProxy::command_list_query() set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute command_list_query on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::command_list_query()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -3588,10 +3425,7 @@ CommandInfoList *DeviceProxy::command_list_query() TangoSys_OMemStream desc; desc << "Failed to execute command_list_query on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::command_list_query()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -3636,9 +3470,7 @@ void DeviceProxy::get_property(std::string &property_name, DbData &db_data) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::get_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -3666,9 +3498,7 @@ void DeviceProxy::get_property(std::vector &property_names, DbData desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::get_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -3699,9 +3529,7 @@ void DeviceProxy::get_property(DbData &db_data) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::get_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -3726,9 +3554,7 @@ void DeviceProxy::put_property(DbData &db_data) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::put_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -3753,9 +3579,7 @@ void DeviceProxy::delete_property(std::string &property_name) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::delete_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -3784,9 +3608,7 @@ void DeviceProxy::delete_property(std::vector &property_names) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::delete_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -3818,9 +3640,7 @@ void DeviceProxy::delete_property(DbData &db_data) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::delete_property"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } else { @@ -3846,9 +3666,7 @@ void DeviceProxy::get_property_list(const std::string &wildcard, std::vector 1) { - ApiWrongNameExcept::throw_exception((const char *) API_WrongWildcardUsage, - (const char *) "Only one wildcard character (*) allowed!", - (const char *) "DeviceProxy::get_property_list"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongWildcardUsage, "Only one wildcard character (*) allowed!"); } db_dev->get_property_list(wildcard, prop_list); } @@ -4003,10 +3819,7 @@ AttributeInfoList *DeviceProxy::get_attribute_config(std::vector &a set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute get_attribute_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::get_attribute_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -4020,10 +3833,7 @@ AttributeInfoList *DeviceProxy::get_attribute_config(std::vector &a set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute get_attribute_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::get_attribute_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -4032,10 +3842,7 @@ AttributeInfoList *DeviceProxy::get_attribute_config(std::vector &a TangoSys_OMemStream desc; desc << "Failed to execute get_attribute_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::get_attribute_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } catch (Tango::DevFailed&) { @@ -4233,10 +4040,7 @@ AttributeInfoListEx *DeviceProxy::get_attribute_config_ex(std::vector &pipe_string std::stringstream ss; ss << "Device " << device_name << " too old to use get_pipe_config() call. Please upgrade to Tango 9/IDL5"; - ApiNonSuppExcept::throw_exception(API_UnsupportedFeature, - ss.str(), "DeviceProxy::get_pipe_config()"); + TANGO_THROW_API_EXCEPTION(ApiNonSuppExcept, API_UnsupportedFeature, ss.str()); } // @@ -4992,8 +4765,7 @@ PipeInfoList *DeviceProxy::get_pipe_config(std::vector &pipe_string set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute get_pipe_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, API_CommunicationFailed, - desc.str(), "DeviceProxy::get_pipe_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -5007,8 +4779,7 @@ PipeInfoList *DeviceProxy::get_pipe_config(std::vector &pipe_string set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute get_pipe_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, API_CommunicationFailed, - desc.str(), "DeviceProxy::get_pipe_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -5017,8 +4788,7 @@ PipeInfoList *DeviceProxy::get_pipe_config(std::vector &pipe_string TangoSys_OMemStream desc; desc << "Failed to execute get_pipe_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, API_CommunicationFailed, - desc.str(), "DeviceProxy::get_pipe_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } catch (Tango::DevFailed&) { @@ -5068,7 +4838,7 @@ void DeviceProxy::set_pipe_config(PipeInfoList &dev_pipe_list) std::stringstream ss; ss << "Device " << device_name << " too old to use set_pipe_config() call. Please upgrade to Tango 9/IDL5"; - ApiNonSuppExcept::throw_exception(API_UnsupportedFeature, ss.str(), "DeviceProxy::set_pipe_config()"); + TANGO_THROW_API_EXCEPTION(ApiNonSuppExcept, API_UnsupportedFeature, ss.str()); } PipeConfigList pipe_config_list; @@ -5112,8 +4882,7 @@ void DeviceProxy::set_pipe_config(PipeInfoList &dev_pipe_list) TangoSys_OMemStream desc; desc << "Failed to execute set_pipe_config on device " << device_name << std::ends; - DeviceUnlockedExcept::re_throw_exception(e, DEVICE_UNLOCKED_REASON, - desc.str(), "DeviceProxy::set_pipe_config()"); + TANGO_RETHROW_API_EXCEPTION(DeviceUnlockedExcept, e, DEVICE_UNLOCKED_REASON, desc.str()); } else { @@ -5135,10 +4904,7 @@ void DeviceProxy::set_pipe_config(PipeInfoList &dev_pipe_list) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute set_pipe_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::set_pipe_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -5152,10 +4918,7 @@ void DeviceProxy::set_pipe_config(PipeInfoList &dev_pipe_list) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute set_pipe_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::set_pipe_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -5164,10 +4927,7 @@ void DeviceProxy::set_pipe_config(PipeInfoList &dev_pipe_list) TangoSys_OMemStream desc; desc << "Failed to execute set_pipe_config on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::set_pipe_config()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -5222,7 +4982,7 @@ DevicePipe DeviceProxy::read_pipe(const std::string &pipe_name) std::stringstream ss; ss << "Device " << device_name << " too old to use read_pipe() call. Please upgrade to Tango 9/IDL5"; - ApiNonSuppExcept::throw_exception(API_UnsupportedFeature, ss.str(), "DeviceProxy::read_pipe()"); + TANGO_THROW_API_EXCEPTION(ApiNonSuppExcept, API_UnsupportedFeature, ss.str()); } while (ctr < 2) @@ -5243,13 +5003,13 @@ DevicePipe DeviceProxy::read_pipe(const std::string &pipe_name) { std::stringstream desc; desc << "Failed to read_pipe on device " << device_name << ", pipe " << pipe_name; - ApiConnExcept::re_throw_exception(e, API_PipeFailed, desc.str(), "DeviceProxy::read_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_PipeFailed, desc.str()); } catch (Tango::DevFailed &e) { std::stringstream desc; desc << "Failed to read_pipe on device " << device_name << ", pipe " << pipe_name; - Except::re_throw_exception(e, API_PipeFailed, desc.str(), "DeviceProxy::read_pipe()"); + TANGO_RETHROW_EXCEPTION(e, API_PipeFailed, desc.str()); } catch (CORBA::TRANSIENT &trans) { @@ -5266,10 +5026,7 @@ DevicePipe DeviceProxy::read_pipe(const std::string &pipe_name) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to read_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(one, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::read_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -5283,10 +5040,7 @@ DevicePipe DeviceProxy::read_pipe(const std::string &pipe_name) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to read_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(comm, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::read_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -5294,7 +5048,7 @@ DevicePipe DeviceProxy::read_pipe(const std::string &pipe_name) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to read_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(ce, API_CommunicationFailed, desc.str(), "DeviceProxy::read_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -5344,7 +5098,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) std::stringstream ss; ss << "Device " << device_name << " too old to use write_pipe() call. Please upgrade to Tango 9/IDL5"; - ApiNonSuppExcept::throw_exception(API_UnsupportedFeature, ss.str(), "DeviceProxy::write_pipe()"); + TANGO_THROW_API_EXCEPTION(ApiNonSuppExcept, API_UnsupportedFeature, ss.str()); } // @@ -5361,7 +5115,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) DevVarPipeDataEltArray *tmp_ptr = dev_pipe.get_root_blob().get_insert_data(); if (tmp_ptr == nullptr) { - Except::throw_exception(API_PipeNoDataElement, "No data in pipe!", "DeviceProxy::write_pipe()"); + TANGO_THROW_EXCEPTION(API_PipeNoDataElement, "No data in pipe!"); } CORBA::ULong max, len; @@ -5390,7 +5144,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) std::stringstream desc; desc << "Failed to write_pipe on device " << device_name << ", pipe " << dev_pipe.get_name(); - ApiConnExcept::re_throw_exception(e, API_PipeFailed, desc.str(), "DeviceProxy::write_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_PipeFailed, desc.str()); } catch (Tango::DevFailed &e) { @@ -5399,7 +5153,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) std::stringstream desc; desc << "Failed to write_pipe on device " << device_name << ", pipe " << dev_pipe.get_name(); - Except::re_throw_exception(e, API_PipeFailed, desc.str(), "DeviceProxy::write_pipe()"); + TANGO_RETHROW_EXCEPTION(e, API_PipeFailed, desc.str()); } catch (CORBA::TRANSIENT &trans) { @@ -5419,10 +5173,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to write_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(one, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::write_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -5439,10 +5190,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to write_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(comm, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::write_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -5453,7 +5201,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to write_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(ce, API_CommunicationFailed, desc.str(), "DeviceProxy::write_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -5483,7 +5231,7 @@ DevicePipe DeviceProxy::write_read_pipe(DevicePipe &pipe_data) std::stringstream ss; ss << "Device " << device_name << " too old to use write_read_pipe() call. Please upgrade to Tango 9/IDL5"; - ApiNonSuppExcept::throw_exception(API_UnsupportedFeature, ss.str(), "DeviceProxy::write_read_pipe()"); + TANGO_THROW_API_EXCEPTION(ApiNonSuppExcept, API_UnsupportedFeature, ss.str()); } // @@ -5523,13 +5271,13 @@ DevicePipe DeviceProxy::write_read_pipe(DevicePipe &pipe_data) { std::stringstream desc; desc << "Failed to write_read_pipe on device " << device_name << ", pipe " << pipe_data.get_name(); - ApiConnExcept::re_throw_exception(e, API_PipeFailed, desc.str(), "DeviceProxy::write_read_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_PipeFailed, desc.str()); } catch (Tango::DevFailed &e) { std::stringstream desc; desc << "Failed to write_pipe on device " << device_name << ", pipe " << pipe_data.get_name(); - Except::re_throw_exception(e, API_PipeFailed, desc.str(), "DeviceProxy::write_read_pipe()"); + TANGO_RETHROW_EXCEPTION(e, API_PipeFailed, desc.str()); } catch (CORBA::TRANSIENT &trans) { @@ -5546,10 +5294,7 @@ DevicePipe DeviceProxy::write_read_pipe(DevicePipe &pipe_data) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to write_read_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(one, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::write_read_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -5563,10 +5308,7 @@ DevicePipe DeviceProxy::write_read_pipe(DevicePipe &pipe_data) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to write_read_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(comm, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::write_read_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -5574,10 +5316,7 @@ DevicePipe DeviceProxy::write_read_pipe(DevicePipe &pipe_data) set_connection_state(CONNECTION_NOTOK); std::stringstream desc; desc << "Failed to write_read_pipe on device " << device_name; - ApiCommExcept::re_throw_exception(ce, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::write_read_pipe()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -5689,8 +5428,7 @@ std::vector *DeviceProxy::read_attributes(std::vector *DeviceProxy::read_attributes(std::vector *DeviceProxy::read_attributes(std::vector *DeviceProxy::read_attributes(std::vector *DeviceProxy::read_attributes(std::vector &attr_list) TangoSys_OMemStream desc; desc << "Writing attribute(s) on device " << dev_name() << " is not authorized" << std::ends; - NotAllowedExcept::throw_exception((const char *) API_ReadOnlyMode, desc.str(), - (const char *) "DeviceProxy::write_attributes()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } // @@ -6427,13 +6154,11 @@ void DeviceProxy::write_attributes(std::vector &attr_list) if (::strcmp(e.errors[0].reason, DEVICE_UNLOCKED_REASON) == 0) { - DeviceUnlockedExcept::re_throw_exception(e, (const char *) DEVICE_UNLOCKED_REASON, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(DeviceUnlockedExcept, e, DEVICE_UNLOCKED_REASON, desc.str()); } else { - Except::re_throw_exception(e, (const char *) API_AttributeFailed, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, desc.str()); } } catch (CORBA::TRANSIENT &trans) @@ -6451,10 +6176,7 @@ void DeviceProxy::write_attributes(std::vector &attr_list) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attributes()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -6468,10 +6190,7 @@ void DeviceProxy::write_attributes(std::vector &attr_list) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attributes()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -6480,10 +6199,7 @@ void DeviceProxy::write_attributes(std::vector &attr_list) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attributes()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -6659,8 +6375,7 @@ void DeviceProxy::write_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Writing attribute(s) on device " << dev_name() << " is not authorized" << std::ends; - NotAllowedExcept::throw_exception((const char *) API_ReadOnlyMode, desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } // @@ -6702,8 +6417,7 @@ void DeviceProxy::write_attribute(DeviceAttribute &dev_attr) desc << ", attribute "; desc << dev_attr.name; desc << std::ends; - Except::re_throw_exception(ex, (const char *) API_AttributeFailed, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); } catch (Tango::DevFailed &e) @@ -6716,13 +6430,11 @@ void DeviceProxy::write_attribute(DeviceAttribute &dev_attr) if (::strcmp(e.errors[0].reason, DEVICE_UNLOCKED_REASON) == 0) { - DeviceUnlockedExcept::re_throw_exception(e, (const char *) DEVICE_UNLOCKED_REASON, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(DeviceUnlockedExcept, e, DEVICE_UNLOCKED_REASON, desc.str()); } else { - Except::re_throw_exception(e, (const char *) API_AttributeFailed, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, desc.str()); } } catch (CORBA::TRANSIENT &trans) @@ -6740,10 +6452,7 @@ void DeviceProxy::write_attribute(DeviceAttribute &dev_attr) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -6757,10 +6466,7 @@ void DeviceProxy::write_attribute(DeviceAttribute &dev_attr) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -6769,10 +6475,7 @@ void DeviceProxy::write_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -6817,8 +6520,7 @@ void DeviceProxy::write_attribute(const AttributeValueList &attr_val) TangoSys_OMemStream desc; desc << "Writing attribute(s) on device " << dev_name() << " is not authorized" << std::ends; - NotAllowedExcept::throw_exception((const char *) API_ReadOnlyMode, desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } // @@ -6852,8 +6554,7 @@ void DeviceProxy::write_attribute(const AttributeValueList &attr_val) desc << ", attribute "; desc << attr_val[0].name.in(); desc << std::ends; - Except::re_throw_exception(ex, (const char *) API_AttributeFailed, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); } catch (Tango::DevFailed &e) @@ -6866,13 +6567,11 @@ void DeviceProxy::write_attribute(const AttributeValueList &attr_val) if (::strcmp(e.errors[0].reason, DEVICE_UNLOCKED_REASON) == 0) { - DeviceUnlockedExcept::re_throw_exception(e, (const char *) DEVICE_UNLOCKED_REASON, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(DeviceUnlockedExcept, e, DEVICE_UNLOCKED_REASON, desc.str()); } else { - Except::re_throw_exception(e, (const char *) API_AttributeFailed, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, desc.str()); } } catch (CORBA::TRANSIENT &trans) @@ -6890,10 +6589,7 @@ void DeviceProxy::write_attribute(const AttributeValueList &attr_val) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -6907,10 +6603,7 @@ void DeviceProxy::write_attribute(const AttributeValueList &attr_val) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -6919,10 +6612,7 @@ void DeviceProxy::write_attribute(const AttributeValueList &attr_val) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -6951,8 +6641,7 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) desc << attr_val[0].name.in(); desc << ". The device does not support thi stype of data (Bad IDL release)"; desc << std::ends; - Tango::Except::throw_exception((const char *) API_NotSupportedFeature, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, desc.str()); } int ctr = 0; @@ -6983,8 +6672,7 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) TangoSys_OMemStream desc; desc << "Writing attribute(s) on device " << dev_name() << " is not authorized" << std::ends; - NotAllowedExcept::throw_exception((const char *) API_ReadOnlyMode, desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } // @@ -7013,8 +6701,7 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) desc << ", attribute "; desc << attr_val[0].name.in(); desc << std::ends; - Except::re_throw_exception(ex, (const char *) API_AttributeFailed, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); } catch (Tango::DevFailed &e) @@ -7027,13 +6714,11 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) if (::strcmp(e.errors[0].reason, DEVICE_UNLOCKED_REASON) == 0) { - DeviceUnlockedExcept::re_throw_exception(e, (const char *) DEVICE_UNLOCKED_REASON, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(DeviceUnlockedExcept, e, DEVICE_UNLOCKED_REASON, desc.str()); } else { - Except::re_throw_exception(e, (const char *) API_AttributeFailed, - desc.str(), (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, desc.str()); } } catch (CORBA::TRANSIENT &trans) @@ -7051,10 +6736,7 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -7068,10 +6750,7 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -7080,10 +6759,7 @@ void DeviceProxy::write_attribute(const AttributeValueList_4 &attr_val) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -7162,9 +6838,7 @@ std::vector *DeviceProxy::command_history(std::string &cmd_na TangoSys_OMemStream desc; desc << "Device " << device_name; desc << " does not support command_history feature" << std::ends; - ApiNonSuppExcept::throw_exception((const char *) API_UnsupportedFeature, - desc.str(), - (const char *) "DeviceProxy::command_history"); + TANGO_THROW_API_EXCEPTION(ApiNonSuppExcept, API_UnsupportedFeature, desc.str()); } DevCmdHistoryList *hist = NULL; @@ -7205,10 +6879,7 @@ std::vector *DeviceProxy::command_history(std::string &cmd_na set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Command_history failed on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::command_history()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -7222,10 +6893,7 @@ std::vector *DeviceProxy::command_history(std::string &cmd_na set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Command_history failed on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::command_history()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -7234,10 +6902,7 @@ std::vector *DeviceProxy::command_history(std::string &cmd_na TangoSys_OMemStream desc; desc << "Command_history failed on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::command_history()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -7284,9 +6949,7 @@ std::vector *DeviceProxy::attribute_history(std::string TangoSys_OMemStream desc; desc << "Device " << device_name; desc << " does not support attribute_history feature" << std::ends; - ApiNonSuppExcept::throw_exception((const char *) API_UnsupportedFeature, - desc.str(), - (const char *) "DeviceProxy::attribute_history"); + TANGO_THROW_API_EXCEPTION(ApiNonSuppExcept, API_UnsupportedFeature, desc.str()); } DevAttrHistoryList_var hist; @@ -7342,10 +7005,7 @@ std::vector *DeviceProxy::attribute_history(std::string set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::attribute_history()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -7359,10 +7019,7 @@ std::vector *DeviceProxy::attribute_history(std::string set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::attribute_history()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -7370,10 +7027,7 @@ std::vector *DeviceProxy::attribute_history(std::string set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::attribute_history()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -8199,7 +7853,7 @@ int DeviceProxy::subscribe_event(EventType event, CallBack *callback, bool state ss << "Device " << dev_name() << " does not support device interface change event\n"; ss << "Available since Tango release 9 AND for device inheriting from IDL release 5 (Device_5Impl)"; - Tango::Except::throw_exception(API_NotSupportedFeature, ss.str(), "DeviceProxy::subscribe_event()"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, ss.str()); } ApiUtil *api_ptr = ApiUtil::instance(); @@ -8233,7 +7887,7 @@ int DeviceProxy::subscribe_event(EventType event, int event_queue_size, bool sta ss << "Device " << dev_name() << " does not support device interface change event\n"; ss << "Available since Tango release 9 AND for device inheriting from IDL release 5 (Device_5Impl)"; - Tango::Except::throw_exception(API_NotSupportedFeature, ss.str(), "DeviceProxy::subscribe_event()"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, ss.str()); } ApiUtil *api_ptr = ApiUtil::instance(); @@ -8267,10 +7921,7 @@ void DeviceProxy::unsubscribe_event(int event_id) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::unsubscribe_event()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } if (api_ptr->get_zmq_event_consumer()->get_event_system_for_event_id(event_id) == ZMQ) @@ -8285,10 +7936,7 @@ void DeviceProxy::unsubscribe_event(int event_id) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::unsubscribe_event()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } api_ptr->get_notifd_event_consumer()->unsubscribe_event(event_id); } @@ -8316,10 +7964,7 @@ void DeviceProxy::get_events(int event_id, EventDataList &event_list) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } if (api_ptr->get_zmq_event_consumer()->get_event_system_for_event_id(event_id) == ZMQ) @@ -8334,10 +7979,7 @@ void DeviceProxy::get_events(int event_id, EventDataList &event_list) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } api_ptr->get_notifd_event_consumer()->get_events(event_id, event_list); } @@ -8366,7 +8008,7 @@ void DeviceProxy::get_events(int event_id, AttrConfEventDataList &event_list) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception(API_EventConsumer, desc.str(), "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } if (api_ptr->get_zmq_event_consumer()->get_event_system_for_event_id(event_id) == ZMQ) @@ -8381,7 +8023,7 @@ void DeviceProxy::get_events(int event_id, AttrConfEventDataList &event_list) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception(API_EventConsumer, desc.str(), "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } api_ptr->get_notifd_event_consumer()->get_events(event_id, event_list); } @@ -8396,7 +8038,7 @@ void DeviceProxy::get_events(int event_id, DataReadyEventDataList &event_list) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception(API_EventConsumer, desc.str(), "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } if (api_ptr->get_zmq_event_consumer()->get_event_system_for_event_id(event_id) == ZMQ) @@ -8411,7 +8053,7 @@ void DeviceProxy::get_events(int event_id, DataReadyEventDataList &event_list) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception(API_EventConsumer, desc.str(), "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } api_ptr->get_notifd_event_consumer()->get_events(event_id, event_list); } @@ -8425,7 +8067,7 @@ void DeviceProxy::get_events(int event_id, DevIntrChangeEventDataList &event_lis std::stringstream desc; desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; - Tango::Except::throw_exception(API_EventConsumer, desc.str(), "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } if (api_ptr->get_zmq_event_consumer()->get_event_system_for_event_id(event_id) == ZMQ) @@ -8436,7 +8078,7 @@ void DeviceProxy::get_events(int event_id, DevIntrChangeEventDataList &event_lis { std::stringstream desc; desc << "Event Device Interface Change not implemented in old Tango event system (notifd)"; - Tango::Except::throw_exception(API_UnsupportedFeature, desc.str(), "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_UnsupportedFeature, desc.str()); } } @@ -8448,7 +8090,7 @@ void DeviceProxy::get_events(int event_id, PipeEventDataList &event_list) std::stringstream desc; desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; - Tango::Except::throw_exception(API_EventConsumer, desc.str(), "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } if (api_ptr->get_zmq_event_consumer()->get_event_system_for_event_id(event_id) == ZMQ) @@ -8459,7 +8101,7 @@ void DeviceProxy::get_events(int event_id, PipeEventDataList &event_list) { std::stringstream desc; desc << "Pipe event not implemented in old Tango event system (notifd)"; - Tango::Except::throw_exception(API_UnsupportedFeature, desc.str(), "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_UnsupportedFeature, desc.str()); } } @@ -8486,10 +8128,7 @@ void DeviceProxy::get_events(int event_id, CallBack *cb) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } if (api_ptr->get_zmq_event_consumer()->get_event_system_for_event_id(event_id) == ZMQ) @@ -8504,10 +8143,7 @@ void DeviceProxy::get_events(int event_id, CallBack *cb) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::get_events()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } api_ptr->get_notifd_event_consumer()->get_events(event_id, cb); } @@ -8531,10 +8167,7 @@ int DeviceProxy::event_queue_size(int event_id) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::event_queue_size()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } EventConsumer *ev = NULL; @@ -8550,10 +8183,7 @@ int DeviceProxy::event_queue_size(int event_id) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::event_queue_size()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } else { @@ -8582,10 +8212,7 @@ bool DeviceProxy::is_event_queue_empty(int event_id) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::is_event_queue_empty()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } EventConsumer *ev = NULL; @@ -8601,10 +8228,7 @@ bool DeviceProxy::is_event_queue_empty(int event_id) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::is_event_queue_empty()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } else { @@ -8633,10 +8257,7 @@ TimeVal DeviceProxy::get_last_event_date(int event_id) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::get_last_event_date()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } EventConsumer *ev = NULL; @@ -8652,10 +8273,7 @@ TimeVal DeviceProxy::get_last_event_date(int event_id) desc << "Could not find event consumer object, \n"; desc << "probably no event subscription was done before!"; desc << std::ends; - Tango::Except::throw_exception( - (const char *) API_EventConsumer, - desc.str(), - (const char *) "DeviceProxy::get_last_event_date()"); + TANGO_THROW_EXCEPTION(API_EventConsumer, desc.str()); } else { @@ -8721,9 +8339,7 @@ void DeviceProxy::lock(int lock_validity) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::lock"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } // @@ -8735,8 +8351,7 @@ void DeviceProxy::lock(int lock_validity) TangoSys_OMemStream desc; desc << "Lock validity can not be lower than " << MIN_LOCK_VALIDITY << " seconds" << std::ends; - Except::throw_exception((const char *) API_MethodArgument, desc.str(), - (const char *) "DeviceProxy::lock"); + TANGO_THROW_EXCEPTION(API_MethodArgument, desc.str()); } { @@ -8750,8 +8365,7 @@ void DeviceProxy::lock(int lock_validity) desc << "Device " << device_name << " is already locked with another lock validity ("; desc << lock_valid << " sec)" << std::ends; - Except::throw_exception((const char *) API_MethodArgument, desc.str(), - (const char *) "DeviceProxy::lock"); + TANGO_THROW_EXCEPTION(API_MethodArgument, desc.str()); } } } @@ -8844,9 +8458,7 @@ void DeviceProxy::lock(int lock_validity) if ((pos->second.shared->cmd_pending == true) && (interupted == 0)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception((const char *) API_CommandTimedOut, - (const char *) "Locking thread blocked !!!", - (const char *) "DeviceProxy::lock"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Locking thread blocked !!!"); } } pos->second.shared->cmd_pending = true; @@ -8868,9 +8480,7 @@ void DeviceProxy::lock(int lock_validity) if ((pos->second.shared->cmd_pending == true) && (interupted == 0)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception((const char *) API_CommandTimedOut, - (const char *) "Locking thread blocked !!!", - (const char *) "DeviceProxy::lock"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Locking thread blocked !!!"); } } } @@ -8898,9 +8508,7 @@ void DeviceProxy::unlock(bool force) desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::unlock"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } check_connect_adm_device(); @@ -8970,8 +8578,7 @@ void DeviceProxy::unlock(bool force) // TangoSys_OMemStream o; // o << "Can't find the locking thread for device " << device_name << " and admin device " << adm_dev_name << ends; -// Tango::Except::throw_exception((const char *)API_CantFindLockingThread,o.str(), -// (const char *)"DeviceProxy::unlock()"); +// TANGO_THROW_EXCEPTION(API_CantFindLockingThread, o.str()); } else { @@ -8993,9 +8600,7 @@ void DeviceProxy::unlock(bool force) if ((pos->second.shared->cmd_pending == true) && (interupted == 0)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception((const char *) API_CommandTimedOut, - (const char *) "Locking thread blocked !!!", - (const char *) "DeviceProxy::unlock"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Locking thread blocked !!!"); } } pos->second.shared->cmd_pending = true; @@ -9013,9 +8618,7 @@ void DeviceProxy::unlock(bool force) if ((pos->second.shared->cmd_pending == true) && (interupted == 0)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception((const char *) API_CommandTimedOut, - (const char *) "Locking thread blocked !!!", - (const char *) "DeviceProxy::unlock"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Locking thread blocked !!!"); } } } @@ -9045,8 +8648,7 @@ void DeviceProxy::create_locking_thread(ApiUtil *au, DevLong dl) TangoSys_OMemStream o; o << "Can't create the locking thread for device " << device_name << " and admin device " << adm_dev_name << std::ends; - Tango::Except::throw_exception((const char *) API_CantCreateLockingThread, o.str(), - (const char *) "DeviceProxy::create_locking_thread()"); + TANGO_THROW_EXCEPTION(API_CantCreateLockingThread, o.str()); } else { @@ -9290,9 +8892,7 @@ void DeviceProxy::ask_locking_status(std::vector &v_str, std::vecto desc << device_name; desc << " which is a non database device"; - ApiNonDbExcept::throw_exception((const char *) API_NonDatabaseDevice, - desc.str(), - (const char *) "DeviceProxy::locking_status"); + TANGO_THROW_API_EXCEPTION(ApiNonDbExcept, API_NonDatabaseDevice, desc.str()); } check_connect_adm_device(); @@ -9346,16 +8946,12 @@ void DeviceProxy::get_locker_host(std::string &f_addr, std::string &ip_addr) std::string::size_type pos; if ((pos = f_addr.find(':')) == std::string::npos) { - Tango::Except::throw_exception((const char *) API_WrongLockingStatus, - (const char *) "Locker IP address returned by server is unvalid", - (const char *) "DeviceProxy::get_locker_host()"); + TANGO_THROW_EXCEPTION(API_WrongLockingStatus, "Locker IP address returned by server is unvalid"); } pos++; if ((pos = f_addr.find(':', pos)) == std::string::npos) { - Tango::Except::throw_exception((const char *) API_WrongLockingStatus, - (const char *) "Locker IP address returned by server is unvalid", - (const char *) "DeviceProxy::get_locker_host()"); + TANGO_THROW_EXCEPTION(API_WrongLockingStatus, "Locker IP address returned by server is unvalid"); } pos++; @@ -9364,17 +8960,13 @@ void DeviceProxy::get_locker_host(std::string &f_addr, std::string &ip_addr) pos = pos + 3; if ((pos = f_addr.find(':', pos)) == std::string::npos) { - Tango::Except::throw_exception((const char *) API_WrongLockingStatus, - (const char *) "Locker IP address returned by server is unvalid", - (const char *) "DeviceProxy::get_locker_host()"); + TANGO_THROW_EXCEPTION(API_WrongLockingStatus, "Locker IP address returned by server is unvalid"); } pos++; std::string ip_str = f_addr.substr(pos); if ((pos = ip_str.find(']')) == std::string::npos) { - Tango::Except::throw_exception((const char *) API_WrongLockingStatus, - (const char *) "Locker IP address returned by server is unvalid", - (const char *) "DeviceProxy::get_locker_host()"); + TANGO_THROW_EXCEPTION(API_WrongLockingStatus, "Locker IP address returned by server is unvalid"); } ip_addr = ip_str.substr(0, pos); } @@ -9383,9 +8975,7 @@ void DeviceProxy::get_locker_host(std::string &f_addr, std::string &ip_addr) std::string ip_str = f_addr.substr(pos); if ((pos = ip_str.find(':')) == std::string::npos) { - Tango::Except::throw_exception((const char *) API_WrongLockingStatus, - (const char *) "Locker IP address returned by server is unvalid", - (const char *) "DeviceProxy::get_locker_host()"); + TANGO_THROW_EXCEPTION(API_WrongLockingStatus, "Locker IP address returned by server is unvalid"); } ip_addr = ip_str.substr(0, pos); } @@ -9410,9 +9000,7 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Device " << device_name; desc << " does not support write_read_attribute feature" << std::ends; - ApiNonSuppExcept::throw_exception((const char *) API_UnsupportedFeature, - desc.str(), - (const char *) "DeviceProxy::write_read_attribute"); + TANGO_THROW_API_EXCEPTION(ApiNonSuppExcept, API_UnsupportedFeature, desc.str()); } // @@ -9517,8 +9105,7 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Writing attribute(s) on device " << dev_name() << " is not authorized" << std::ends; - NotAllowedExcept::throw_exception((const char *) API_ReadOnlyMode, desc.str(), - (const char *) "DeviceProxy::write_read_attribute()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } // @@ -9556,8 +9143,7 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) desc << ", attribute "; desc << attr_value_list[0].name.in(); desc << std::ends; - Except::re_throw_exception(ex, (const char *) API_AttributeFailed, - desc.str(), (const char *) "DeviceProxy::write_read_attribute()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); } catch (Tango::DevFailed &e) @@ -9570,15 +9156,11 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) if (::strcmp(e.errors[0].reason, DEVICE_UNLOCKED_REASON) == 0) { - DeviceUnlockedExcept::re_throw_exception(e, - (const char *) DEVICE_UNLOCKED_REASON, - desc.str(), - (const char *) "DeviceProxy::write_read_attribute()"); + TANGO_RETHROW_API_EXCEPTION(DeviceUnlockedExcept, e, DEVICE_UNLOCKED_REASON, desc.str()); } else { - Except::re_throw_exception(e, (const char *) API_AttributeFailed, - desc.str(), (const char *) "DeviceProxy::write_read_attribute()"); + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, desc.str()); } } catch (CORBA::TRANSIENT &trans) @@ -9596,10 +9178,7 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_read_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_read_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -9613,10 +9192,7 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_read_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -9625,10 +9201,7 @@ DeviceAttribute DeviceProxy::write_read_attribute(DeviceAttribute &dev_attr) TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char *) API_CommunicationFailed, - desc.str(), - (const char *) "DeviceProxy::write_read_attribute()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -9688,9 +9261,7 @@ std::vector *DeviceProxy::write_read_attributes(std::vector *DeviceProxy::write_read_attributes(std::vector *DeviceProxy::write_read_attributes(std::vector *DeviceProxy::write_read_attributes(std::vector *DeviceProxy::write_read_attributes(std::vector *DeviceProxy::write_read_attributes(std::vector *DeviceProxy::write_read_attributes(std::vector &attr_list, const char } } desc << std::ends; - ApiConnExcept::throw_exception((const char *) API_AttributeFailed, desc.str(), met_name); + ApiConnExcept::throw_exception(API_AttributeFailed, desc.str(), met_name); } } } diff --git a/cppapi/client/devapi_data.cpp b/cppapi/client/devapi_data.cpp index ce5a87269..b7bdd1a75 100644 --- a/cppapi/client/devapi_data.cpp +++ b/cppapi/client/devapi_data.cpp @@ -186,9 +186,7 @@ bool DeviceData::any_is_null() ext->ext_state.set(isempty_flag); if (exceptions_flags.test(isempty_flag)) { - ApiDataExcept::throw_exception((const char *) API_EmptyDeviceData, - (const char *) "Cannot extract, no data in DeviceData object ", - (const char *) "DeviceData::any_is_null"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDeviceData, "Cannot extract, no data in DeviceData object "); } return (true); } @@ -384,9 +382,7 @@ bool DeviceData::operator>>(bool &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a boolean", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a boolean"); } } return ret; @@ -413,9 +409,7 @@ bool DeviceData::operator>>(short &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a short", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a short"); } } return ret; @@ -443,9 +437,7 @@ bool DeviceData::operator>>(unsigned short &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an unsigned short", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an unsigned short"); } } return ret; @@ -472,9 +464,7 @@ bool DeviceData::operator>>(DevLong &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a DevLong (long 32 bits)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a DevLong (long 32 bits)"); } } return ret; @@ -501,9 +491,7 @@ bool DeviceData::operator>>(DevULong &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an DevULong (unsigned long 32 bits)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an DevULong (unsigned long 32 bits)"); } } return ret; @@ -530,9 +518,7 @@ bool DeviceData::operator>>(DevLong64 &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a DevLong64 (64 bits long)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a DevLong64 (64 bits long)"); } } return ret; @@ -559,9 +545,7 @@ bool DeviceData::operator>>(DevULong64 &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a DevULong64 (unsigned 64 bits long)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a DevULong64 (unsigned 64 bits long)"); } } return ret; @@ -588,9 +572,7 @@ bool DeviceData::operator>>(float &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a float", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a float"); } } return ret; @@ -618,9 +600,7 @@ bool DeviceData::operator>>(double &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a double", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a double"); } } return ret; @@ -648,9 +628,7 @@ bool DeviceData::operator>>(std::string &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a string", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a string"); } } else @@ -681,9 +659,7 @@ bool DeviceData::operator>>(const char *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of char", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of char"); } } return ret; @@ -710,9 +686,7 @@ bool DeviceData::operator>>(DevState &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a DevState", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a DevState"); } } return ret; @@ -755,17 +729,13 @@ bool DeviceData::operator>>(std::vector &datum) if (bool_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of boolean", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of boolean"); } return false; @@ -794,9 +764,7 @@ bool DeviceData::operator>>(const DevVarBooleanArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of boolean", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of boolean"); } } return ret; @@ -824,9 +792,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of char", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of char"); } } else @@ -834,9 +800,7 @@ bool DeviceData::operator>>(std::vector &datum) if (char_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -873,9 +837,7 @@ bool DeviceData::operator>>(const DevVarCharArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of char", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of char"); } } return ret; @@ -903,9 +865,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of short", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of short"); } } else @@ -913,9 +873,7 @@ bool DeviceData::operator>>(std::vector &datum) if (short_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -953,9 +911,7 @@ bool DeviceData::operator>>(const DevVarShortArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of short", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of short"); } } return ret; @@ -983,9 +939,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of unsigned short", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of unsigned short"); } } else @@ -993,9 +947,7 @@ bool DeviceData::operator>>(std::vector &datum) if (ushort_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1032,9 +984,7 @@ bool DeviceData::operator>>(const DevVarUShortArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of unusigned short", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of unusigned short"); } } return ret; @@ -1062,9 +1012,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of DevLong (long 32 bits)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of DevLong (long 32 bits)"); } } else @@ -1072,9 +1020,7 @@ bool DeviceData::operator>>(std::vector &datum) if (long_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1111,9 +1057,7 @@ bool DeviceData::operator>>(const DevVarLongArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of long (32 bits)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of long (32 bits)"); } } return ret; @@ -1142,9 +1086,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of DevULong (unsigned long 32 bits)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of DevULong (unsigned long 32 bits)"); } } else @@ -1152,9 +1094,7 @@ bool DeviceData::operator>>(std::vector &datum) if (ulong_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1191,9 +1131,7 @@ bool DeviceData::operator>>(const DevVarULongArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of unsigned long (32 bits)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of unsigned long (32 bits)"); } } return ret; @@ -1222,9 +1160,7 @@ bool DeviceData::operator>>(const DevVarLong64Array *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of long (64 bits)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of long (64 bits)"); } } return ret; @@ -1252,9 +1188,7 @@ bool DeviceData::operator>>(const DevVarULong64Array *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of unsigned long (64 bits)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of unsigned long (64 bits)"); } } return ret; @@ -1282,9 +1216,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of DevLong64 (64 bits long)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of DevLong64 (64 bits long)"); } } else @@ -1292,9 +1224,7 @@ bool DeviceData::operator>>(std::vector &datum) if (ll_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1330,9 +1260,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of DevULong64 (unsigned 64 bits long)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of DevULong64 (unsigned 64 bits long)"); } } else @@ -1340,9 +1268,7 @@ bool DeviceData::operator>>(std::vector &datum) if (ull_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1378,9 +1304,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of float", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of float"); } } else @@ -1388,9 +1312,7 @@ bool DeviceData::operator>>(std::vector &datum) if (float_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1427,9 +1349,7 @@ bool DeviceData::operator>>(const DevVarFloatArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of float", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of float"); } } return ret; @@ -1458,9 +1378,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of double", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of double"); } } else @@ -1468,9 +1386,7 @@ bool DeviceData::operator>>(std::vector &datum) if (double_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1507,9 +1423,7 @@ bool DeviceData::operator>>(const DevVarDoubleArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of double", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of double"); } } return ret; @@ -1538,9 +1452,7 @@ bool DeviceData::operator>>(std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of string", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of string"); } } else @@ -1548,9 +1460,7 @@ bool DeviceData::operator>>(std::vector &datum) if (string_array == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1586,9 +1496,7 @@ bool DeviceData::operator>>(const DevVarStringArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not an array of string", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not an array of string"); } } return ret; @@ -1616,9 +1524,7 @@ bool DeviceData::operator>>(const DevEncoded *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a DevEncoded", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a DevEncoded"); } } return ret; @@ -1647,9 +1553,7 @@ bool DeviceData::operator>>(DevEncoded &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a DevEncoded", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a DevEncoded"); } } else @@ -1657,9 +1561,7 @@ bool DeviceData::operator>>(DevEncoded &datum) if (tmp_enc == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1913,9 +1815,7 @@ bool DeviceData::extract(std::vector &long_datum, std::vectorext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a structure with sequences of string(s) and long(s) (32 bits)", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a structure with sequences of string(s) and long(s) (32 bits)"); } } else @@ -1923,9 +1823,7 @@ bool DeviceData::extract(std::vector &long_datum, std::vectorext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -1967,9 +1865,7 @@ bool DeviceData::operator>>(const DevVarLongStringArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a structure with sequences of string(s) and long(s) (32 bits) ", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a structure with sequences of string(s) and long(s) (32 bits) "); } } return ret; @@ -2025,9 +1921,7 @@ bool DeviceData::extract(std::vector &double_datum, std::vectorext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a boolean", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a boolean"); } } else @@ -2035,9 +1929,7 @@ bool DeviceData::extract(std::vector &double_datum, std::vectorext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -2079,9 +1971,7 @@ bool DeviceData::operator>>(const DevVarDoubleStringArray *&datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a structure with sequences of string(s) and double(s) ", - (const char *) "DeviceData::operator>>"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a structure with sequences of string(s) and double(s) "); } } return ret; @@ -2159,9 +2049,7 @@ bool DeviceData::extract(const char *&str, const unsigned char *&data_ptr, unsig ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a DevEncoded", - (const char *) "DeviceData::extract"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a DevEncoded"); } } else @@ -2169,9 +2057,7 @@ bool DeviceData::extract(const char *&str, const unsigned char *&data_ptr, unsig if (tmp_enc == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::extract"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { @@ -2207,9 +2093,7 @@ bool DeviceData::extract(std::string &str, std::vector &datum) ext->ext_state.set(wrongtype_flag); if (exceptions_flags.test(wrongtype_flag)) { - ApiDataExcept::throw_exception((const char *) API_IncompatibleCmdArgumentType, - (const char *) "Cannot extract, data in DeviceData object is not a DevEncoded", - (const char *) "DeviceData::extract"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleCmdArgumentType, "Cannot extract, data in DeviceData object is not a DevEncoded"); } } else @@ -2217,9 +2101,7 @@ bool DeviceData::extract(std::string &str, std::vector &datum) if (tmp_enc == NULL) { ext->ext_state.set(wrongtype_flag); - ApiDataExcept::throw_exception((const char *) API_IncoherentDevData, - (const char *) "Incoherent data received from server", - (const char *) "DeviceData::extract"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncoherentDevData, "Incoherent data received from server"); } else { diff --git a/cppapi/client/devapi_pipe.cpp b/cppapi/client/devapi_pipe.cpp index 31f446229..553aba081 100644 --- a/cppapi/client/devapi_pipe.cpp +++ b/cppapi/client/devapi_pipe.cpp @@ -405,7 +405,7 @@ std::vector DevicePipeBlob::get_data_elt_names() std::stringstream ss; ss << "You try to get data element name(s) for a blob which has never been received from a device"; - Except::throw_exception(API_PipeWrongArg,ss.str(),"DevicePipeBlob::get_data_elt_names()"); + TANGO_THROW_EXCEPTION(API_PipeWrongArg, ss.str()); } std::vector v_str; @@ -443,7 +443,7 @@ std::string DevicePipeBlob::get_data_elt_name(size_t _ind) std::stringstream ss; ss << "You try to get data element name(s) for a blob which has never been received from a device"; - Except::throw_exception(API_PipeWrongArg,ss.str(),"DevicePipeBlob::get_data_elt_names()"); + TANGO_THROW_EXCEPTION(API_PipeWrongArg, ss.str()); } if (_ind > extract_elt_array->length()) @@ -451,7 +451,7 @@ std::string DevicePipeBlob::get_data_elt_name(size_t _ind) std::stringstream ss; ss << "Given index (" << _ind << ") is above the number of data element in the data blob (" << get_data_elt_nb() << ")"; - Except::throw_exception(API_PipeWrongArg,ss.str(),"DevicePipeBlob::get_data_elt_name()"); + TANGO_THROW_EXCEPTION(API_PipeWrongArg, ss.str()); } std::string tmp((*extract_elt_array)[_ind].name.in()); return tmp; @@ -483,7 +483,7 @@ int DevicePipeBlob::get_data_elt_type(size_t _ind) std::stringstream ss; ss << "You try to get data element name(s) for a blob which has never been received from a device"; - Except::throw_exception(API_PipeWrongArg,ss.str(),"DevicePipeBlob::get_data_elt_type()"); + TANGO_THROW_EXCEPTION(API_PipeWrongArg, ss.str()); } if (_ind > extract_elt_array->length()) @@ -491,7 +491,7 @@ int DevicePipeBlob::get_data_elt_type(size_t _ind) std::stringstream ss; ss << "Given index (" << _ind << ") is above the number of data element in the data blob (" << get_data_elt_nb() << ")"; - Except::throw_exception(API_PipeWrongArg,ss.str(),"DevicePipeBlob::get_data_elt_type()"); + TANGO_THROW_EXCEPTION(API_PipeWrongArg, ss.str()); } // @@ -622,9 +622,7 @@ int DevicePipeBlob::get_data_elt_type(size_t _ind) break; default: - Except::throw_exception(API_PipeWrongArg, - "Unsupported data type in data element! (ATT_NO_DATA, DEVICE_STATE)", - "DevicePipeBlob::get_data_elt_type()"); + TANGO_THROW_EXCEPTION(API_PipeWrongArg, "Unsupported data type in data element! (ATT_NO_DATA, DEVICE_STATE)"); break; } } @@ -659,16 +657,12 @@ size_t DevicePipeBlob::get_extract_ind_from_name(const std::string &_na) if (extract_elt_array == nullptr) { - Except::throw_exception(API_PipeNoDataElement, - "No data element available for extraction", - "DevicePipeBlob::get_extract_ind_from_name()"); + TANGO_THROW_EXCEPTION(API_PipeNoDataElement, "No data element available for extraction"); } if (extract_ctr > 0) { - Except::throw_exception(API_NotSupportedFeature, - "Not supported to mix extraction type (operator >> and operator [])", - "DevicePipeBlob::get_extract_ind_from_name()"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, "Not supported to mix extraction type (operator >> and operator [])"); } for (loop = 0;loop < extract_elt_array->length();loop++) @@ -688,7 +682,7 @@ size_t DevicePipeBlob::get_extract_ind_from_name(const std::string &_na) std::stringstream ss; ss << "Can't get data element with name " << _na; - Except::throw_exception(API_PipeWrongArg,ss.str(),"DevicePipeBlob::get_extract_ind_from_name()"); + TANGO_THROW_EXCEPTION(API_PipeWrongArg, ss.str()); } extract_ctr = -1; @@ -705,16 +699,12 @@ size_t DevicePipeBlob::get_insert_ind_from_name(const std::string &_na) if (insert_elt_array == nullptr) { - Except::throw_exception(API_PipeNoDataElement, - "No data element available for insertion", - "DevicePipeBlob::get_insert_ind_from_name()"); + TANGO_THROW_EXCEPTION(API_PipeNoDataElement, "No data element available for insertion"); } if (insert_ctr > 0) { - Except::throw_exception(API_NotSupportedFeature, - "Not supported to mix insertion type (operator << and operator [])", - "DevicePipeBlob::get_insert_ind_from_name()"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, "Not supported to mix insertion type (operator << and operator [])"); } for (loop = 0;loop < insert_elt_array->length();loop++) @@ -734,7 +724,7 @@ size_t DevicePipeBlob::get_insert_ind_from_name(const std::string &_na) std::stringstream ss; ss << "Can't get data element with name " << _na; - Except::throw_exception(API_PipeWrongArg,ss.str(),"DevicePipeBlob::get_insert_ind_from_name()"); + TANGO_THROW_EXCEPTION(API_PipeWrongArg, ss.str()); } insert_ctr = -1; @@ -842,7 +832,7 @@ void DevicePipeBlob::set_data_elt_names(std::vector &elt_names) desc << ", "; } } - ApiConnExcept::throw_exception(API_PipeDuplicateDEName,desc.str(),"set_data_elt_names"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_PipeDuplicateDEName, desc.str()); } } @@ -2036,7 +2026,7 @@ void DevicePipeBlob::throw_type_except(const std::string &_ty,const std::string ss << "Can't get data element " << extract_ctr << " (numbering starting from 0) into a " << _ty << " data type"; std::string m_name("DevicePipeBlob::"); m_name = m_name + _meth; - ApiDataExcept::throw_exception(API_IncompatibleArgumentType,ss.str(),m_name.c_str()); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleArgumentType, ss.str()); } //+------------------------------------------------------------------------------------------------------------------ @@ -2074,7 +2064,7 @@ void DevicePipeBlob::throw_too_many(const std::string &_meth,bool _extract) extract_delete = false; } - ApiDataExcept::throw_exception(API_PipeWrongArg,ss.str(),m_name.c_str()); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_PipeWrongArg, ss.str()); } //+------------------------------------------------------------------------------------------------------------------ @@ -2102,7 +2092,7 @@ void DevicePipeBlob::throw_is_empty(const std::string &_meth) std::string m_name("DevicePipeBlob::"); m_name = m_name + _meth; - ApiDataExcept::throw_exception(API_EmptyDataElement,"The data element is empty",m_name.c_str()); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_EmptyDataElement, "The data element is empty"); } //+------------------------------------------------------------------------------------------------------------------ @@ -2130,7 +2120,7 @@ void DevicePipeBlob::throw_name_not_set(const std::string &_meth) std::string m_name("DevicePipeBlob::"); m_name = m_name + _meth; - ApiDataExcept::throw_exception(API_PipeNoDataElement,"The blob data element number (or name) not set",m_name.c_str()); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_PipeNoDataElement, "The blob data element number (or name) not set"); } //+------------------------------------------------------------------------------------------------------------------ @@ -2158,8 +2148,7 @@ void DevicePipeBlob::throw_mixing(const std::string &_meth) std::string m_name("DevicePipeBlob::"); m_name = m_name + _meth; - Except::throw_exception(API_NotSupportedFeature, - "Not supported to mix extraction type (operator >> (or <<) and operator [])",m_name.c_str()); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, "Not supported to mix extraction type (operator >> (or <<) and operator [])"); } //+------------------------------------------------------------------------------------------------------------------ diff --git a/cppapi/client/devapi_utils.cpp b/cppapi/client/devapi_utils.cpp index 786788745..eb271fe85 100644 --- a/cppapi/client/devapi_utils.cpp +++ b/cppapi/client/devapi_utils.cpp @@ -58,9 +58,7 @@ void DeviceProxy::from_hist4_2_DataHistory(DevCmdHistory_4_var &hist_4,std::vect if ((hist_4->dims.length() != hist_4->dims_array.length()) || (hist_4->errors.length() != hist_4->errors_array.length())) { - Tango::Except::throw_exception((const char *)API_WrongHistoryDataBuffer, - (const char *)"Data buffer received from server is not valid !", - (const char *)"DeviceProxy::from_hist4_2_DataHistory"); + TANGO_THROW_EXCEPTION(API_WrongHistoryDataBuffer, "Data buffer received from server is not valid !"); } // diff --git a/cppapi/client/devapi_utils.tpp b/cppapi/client/devapi_utils.tpp index 9f9a0c279..44d23d515 100644 --- a/cppapi/client/devapi_utils.tpp +++ b/cppapi/client/devapi_utils.tpp @@ -58,9 +58,7 @@ void DeviceProxy::from_hist_2_AttHistory(T &hist,std::vectorw_dims.length() != hist->w_dims_array.length()) || (hist->errors.length() != hist->errors_array.length())) { - Tango::Except::throw_exception((const char *)API_WrongHistoryDataBuffer, - (const char *)"Data buffer received from server is not valid !", - (const char *)"DeviceProxy::from_hist4_2_AttHistory"); + TANGO_THROW_EXCEPTION(API_WrongHistoryDataBuffer, "Data buffer received from server is not valid !"); } // diff --git a/cppapi/client/event.cpp b/cppapi/client/event.cpp index 65114ecdc..231d91624 100644 --- a/cppapi/client/event.cpp +++ b/cppapi/client/event.cpp @@ -1101,8 +1101,7 @@ int EventConsumer::subscribe_event (DeviceProxy *device, { if ((device == NULL) || (callback == NULL)) { - EventSystemExcept::throw_exception(API_InvalidArgs, - "Device or callback pointer NULL","EventConsumer::subscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_InvalidArgs, "Device or callback pointer NULL"); } return (subscribe_event (device, attribute, event, callback, NULL, filters, stateless)); @@ -1137,9 +1136,7 @@ int EventConsumer::subscribe_event (DeviceProxy *device, { if ((device == NULL) || (event_queue_size < 0)) { - EventSystemExcept::throw_exception(API_InvalidArgs, - "Device pointer is NULL or the event queue size is invalid", - "EventConsumer::subscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_InvalidArgs, "Device pointer is NULL or the event queue size is invalid"); } // create an event queue object @@ -1179,9 +1176,7 @@ int EventConsumer::subscribe_event (DeviceProxy *device, std::string event_name; if (event == QUALITY_EVENT) { - EventSystemExcept::throw_exception(API_InvalidArgs, - "The quality change event does not exist any more. A change event is fired on a quality change!", - "EventConsumer::subscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_InvalidArgs, "The quality change event does not exist any more. A change event is fired on a quality change!"); } else event_name = EventName[event]; @@ -1199,9 +1194,7 @@ int EventConsumer::subscribe_event (DeviceProxy *device, { if (stateless == false) { - EventSystemExcept::throw_exception(API_InvalidArgs, - "When subscribing to event within a event callback, only stateless subscription is allowed", - "EventConsumer::subscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_InvalidArgs, "When subscribing to event within a event callback, only stateless subscription is allowed"); } subscribe_event_id++; @@ -1293,8 +1286,7 @@ int EventConsumer::subscribe_event (DeviceProxy *device, { if ((device == NULL) || (callback == NULL) || (event != INTERFACE_CHANGE_EVENT)) { - EventSystemExcept::throw_exception(API_InvalidArgs, - "Device,callback pointer NULL or unsupported event type","EventConsumer::subscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_InvalidArgs, "Device,callback pointer NULL or unsupported event type"); } std::vector filters; @@ -1309,8 +1301,7 @@ int EventConsumer::subscribe_event (DeviceProxy *device, { if ((device == NULL) || (event != INTERFACE_CHANGE_EVENT)) { - EventSystemExcept::throw_exception(API_InvalidArgs, - "Device NULL or unsupported event type","EventConsumer::subscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_InvalidArgs, "Device NULL or unsupported event type"); } std::vector filters; @@ -1458,7 +1449,7 @@ int EventConsumer::connect_event(DeviceProxy *device, TangoSys_OMemStream o; o << "Can't subscribe to event for device " << device_name << "\n"; o << "Check that device server is running..." << std::ends; - Except::throw_exception(API_CantConnectToDevice,o.str(),"EventConsumer::connect_event()"); + TANGO_THROW_EXCEPTION(API_CantConnectToDevice, o.str()); } } else @@ -1469,7 +1460,7 @@ int EventConsumer::connect_event(DeviceProxy *device, TangoSys_OMemStream o; o << "Can't subscribe to event for device " << device_name << "\n"; o << "Corrupted internal map. Please report bug" << std::ends; - Except::throw_exception(API_BadConfigurationProperty,o.str(),"EventConsumer::connect_event()"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } const EventChannelStruct &evt_ch = evt_it->second; { @@ -1522,8 +1513,7 @@ int EventConsumer::connect_event(DeviceProxy *device, o << "Device server for device " << device_name; o << " is too old to generate event in a multi TANGO_HOST environment. Please, use Tango >= 7.1" << std::ends; - EventSystemExcept::throw_exception(API_DSFailedRegisteringEvent,o.str(), - "EventConsumer::connect_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_DSFailedRegisteringEvent, o.str()); } } } @@ -1536,9 +1526,7 @@ int EventConsumer::connect_event(DeviceProxy *device, if (reason == API_CommandNotFound) throw; else - EventSystemExcept::re_throw_exception(e,API_DSFailedRegisteringEvent, - "Device server send exception while trying to register event", - "EventConsumer::connect_event()"); + TANGO_RETHROW_API_EXCEPTION(EventSystemExcept, e, API_DSFailedRegisteringEvent, "Device server send exception while trying to register event"); } // @@ -1634,9 +1622,7 @@ int EventConsumer::connect_event(DeviceProxy *device, TangoSys_OMemStream o; o << "Failed to connect to event channel for device " << device_name << std::ends; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - o.str(), - (const char*)"EventConsumer::connect_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, o.str()); } if (evt_it == channel_map.end()) @@ -1774,9 +1760,7 @@ int EventConsumer::connect_event(DeviceProxy *device, TangoSys_OMemStream o; o << "Failed to connect to event channel for device " << device_name << "\nCorrupted internal map: event callback already exists. Please report bug!" << std::ends; - EventSystemExcept::throw_exception(API_NotificationServiceFailed, - o.str(), - "EventConsumer::connect_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, o.str()); } iter = ret.first; @@ -1831,9 +1815,7 @@ void EventConsumer::unsubscribe_event(int event_id) { if (event_id == 0) { - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to unsubscribe event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::unsubscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to unsubscribe event, the event id specified does not correspond with any known one"); } std::map::iterator epos; @@ -1928,9 +1910,7 @@ void EventConsumer::unsubscribe_event(int event_id) } catch (...) { - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to unsubscribe event, caught exception while calling remove_filter() or destroy() (hint: check the Notification daemon is running ", - (const char*)"EventConsumer::unsubscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to unsubscribe event, caught exception while calling remove_filter() or destroy() (hint: check the Notification daemon is running "); } } else @@ -1994,9 +1974,7 @@ void EventConsumer::unsubscribe_event(int event_id) } catch (...) { - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to unsubscribe event, caught exception while calling remove_filter() or destroy() on the heartbeat filter (hint: check the Notification daemon is running ", - (const char*)"EventConsumer::unsubscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to unsubscribe event, caught exception while calling remove_filter() or destroy() on the heartbeat filter (hint: check the Notification daemon is running "); } } else @@ -2060,9 +2038,7 @@ void EventConsumer::unsubscribe_event(int event_id) // nothing was found! - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to unsubscribe event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::unsubscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to unsubscribe event, the event id specified does not correspond with any known one"); } @@ -2209,9 +2185,7 @@ void EventConsumer::get_events (int event_id, EventDataList &event_list) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2241,9 +2215,7 @@ void EventConsumer::get_events (int event_id, EventDataList &event_list) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2251,9 +2223,7 @@ void EventConsumer::get_events (int event_id, EventDataList &event_list) // nothing was found! - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to get event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one"); } //+------------------------------------------------------------------------------------------------------------------ @@ -2307,9 +2277,7 @@ void EventConsumer::get_events (int event_id, AttrConfEventDataList &event_list) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2339,9 +2307,7 @@ void EventConsumer::get_events (int event_id, AttrConfEventDataList &event_list) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2349,9 +2315,7 @@ void EventConsumer::get_events (int event_id, AttrConfEventDataList &event_list) // nothing was found! - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to get event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one"); } //+------------------------------------------------------------------------------------------------------------------ @@ -2405,9 +2369,7 @@ void EventConsumer::get_events (int event_id, DataReadyEventDataList &event_list TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2437,9 +2399,7 @@ void EventConsumer::get_events (int event_id, DataReadyEventDataList &event_list TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2447,9 +2407,7 @@ void EventConsumer::get_events (int event_id, DataReadyEventDataList &event_list // nothing was found! - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to get event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one"); } //+------------------------------------------------------------------------------------------------------------------ @@ -2503,8 +2461,7 @@ void EventConsumer::get_events (int event_id, DevIntrChangeEventDataList &event_ TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception(API_EventQueues, - o.str(),"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2534,8 +2491,7 @@ void EventConsumer::get_events (int event_id, DevIntrChangeEventDataList &event_ TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception(API_EventQueues, - o.str(),"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2543,9 +2499,7 @@ void EventConsumer::get_events (int event_id, DevIntrChangeEventDataList &event_ // nothing was found! - EventSystemExcept::throw_exception(API_EventNotFound, - "Failed to get event, the event id specified does not correspond with any known one", - "EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one"); } //+------------------------------------------------------------------------------------------------------------------ @@ -2599,8 +2553,7 @@ void EventConsumer::get_events (int event_id, PipeEventDataList &event_list) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception(API_EventQueues, - o.str(),"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2630,8 +2583,7 @@ void EventConsumer::get_events (int event_id, PipeEventDataList &event_list) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception(API_EventQueues, - o.str(),"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2639,9 +2591,7 @@ void EventConsumer::get_events (int event_id, PipeEventDataList &event_list) // nothing was found! - EventSystemExcept::throw_exception(API_EventNotFound, - "Failed to get event, the event id specified does not correspond with any known one", - "EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one"); } //+------------------------------------------------------------------------------------------------------------------ @@ -2696,9 +2646,7 @@ void EventConsumer::get_events (int event_id, CallBack *cb) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2728,9 +2676,7 @@ void EventConsumer::get_events (int event_id, CallBack *cb) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2738,9 +2684,7 @@ void EventConsumer::get_events (int event_id, CallBack *cb) // nothing was found! - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to get event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one"); } //+------------------------------------------------------------------------------------------------------------------ @@ -2789,9 +2733,7 @@ int EventConsumer::event_queue_size(int event_id) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::event_queue_size()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2821,9 +2763,7 @@ int EventConsumer::event_queue_size(int event_id) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::event_queue_size()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2831,9 +2771,7 @@ int EventConsumer::event_queue_size(int event_id) // nothing was found! - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to get event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::event_queue_size()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one"); // Should never reach here. To make compiler happy @@ -2887,9 +2825,7 @@ bool EventConsumer::is_event_queue_empty(int event_id) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::is_event_queue_empty()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2918,9 +2854,7 @@ bool EventConsumer::is_event_queue_empty(int event_id) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::is_event_queue_empty()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -2928,9 +2862,7 @@ bool EventConsumer::is_event_queue_empty(int event_id) // nothing was found! - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to get event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::is_event_queue_empty()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one"); // Should never reach here. To make compiler happy @@ -2984,9 +2916,7 @@ TimeVal EventConsumer::get_last_event_date(int event_id) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_last_event_date()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -3015,9 +2945,7 @@ TimeVal EventConsumer::get_last_event_date(int event_id) TangoSys_OMemStream o; o << "No event queue specified during subscribe_event()\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventConsumer::get_last_event_date()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -3025,9 +2953,7 @@ TimeVal EventConsumer::get_last_event_date(int event_id) // nothing was found! - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to get event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::get_last_event_date()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to get event, the event id specified does not correspond with any known one"); // Should never reach here. To make compiler happy @@ -3416,9 +3342,7 @@ ChannelType EventConsumer::get_event_system_for_event_id(int event_id) if (event_id == 0) { - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to unsubscribe event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::get_event_system_for_event_id()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to unsubscribe event, the event id specified does not correspond with any known one"); } bool found = false; @@ -3437,9 +3361,7 @@ ChannelType EventConsumer::get_event_system_for_event_id(int event_id) TangoSys_OMemStream o; o << "Can't unsubscribe to event with id " << event_id << "\n"; o << "Corrupted internal map. Please report bug" << std::ends; - Except::throw_exception((const char *)API_BadConfigurationProperty, - o.str(), - (const char *)"EventConsumer::get_event_system_for_event_id()"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } EventChannelStruct &evt_ch = evt_it->second; ret = evt_ch.channel_type; @@ -3473,9 +3395,7 @@ ChannelType EventConsumer::get_event_system_for_event_id(int event_id) if (found == false) { - EventSystemExcept::throw_exception((const char*)API_EventNotFound, - (const char*)"Failed to unsubscribe event, the event id specified does not correspond with any known one", - (const char*)"EventConsumer::get_event_system_for_event_id()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventNotFound, "Failed to unsubscribe event, the event id specified does not correspond with any known one"); } return ret; diff --git a/cppapi/client/eventkeepalive.cpp b/cppapi/client/eventkeepalive.cpp index 1a6ee6c9f..6bffd4d18 100644 --- a/cppapi/client/eventkeepalive.cpp +++ b/cppapi/client/eventkeepalive.cpp @@ -323,15 +323,11 @@ void EventConsumerKeepAliveThread::re_subscribe_event(EvCbIte &epos,EvChanIte &i } catch (CORBA::COMM_FAILURE &) { - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Caught CORBA::COMM_FAILURE exception while creating event filter (check filter)", - (const char*)"EventConsumerKeepAliveThread::re_subscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Caught CORBA::COMM_FAILURE exception while creating event filter (check filter)"); } catch (...) { - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Caught exception while creating event filter (check filter)", - (const char*)"EventConsumerKeepAliveThread::re_subscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Caught exception while creating event filter (check filter)"); } // @@ -380,9 +376,7 @@ void EventConsumerKeepAliveThread::re_subscribe_event(EvCbIte &epos,EvChanIte &i catch (...) { } filter = CosNotifyFilter::Filter::_nil(); - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Caught exception while creating event filter (check filter)", - (const char*)"EventConsumerKeepAliveThread::re_subscribe_event()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Caught exception while creating event filter (check filter)"); } } diff --git a/cppapi/client/eventqueue.cpp b/cppapi/client/eventqueue.cpp index 39ddc4591..0c1072dcb 100644 --- a/cppapi/client/eventqueue.cpp +++ b/cppapi/client/eventqueue.cpp @@ -531,9 +531,7 @@ TimeVal EventQueue::get_last_event_date() TangoSys_OMemStream o; o << "No new events available!\n"; o << "Cannot return any event date" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventQueue::get_last_event_date()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } } } @@ -926,9 +924,7 @@ void EventQueue::get_events(CallBack *cb) TangoSys_OMemStream o; o << "No callback object given!\n"; o << "Cannot return any event data" << std::ends; - EventSystemExcept::throw_exception((const char *)API_EventQueues, - o.str(), - (const char *)"EventQueue::get_events()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventQueues, o.str()); } // diff --git a/cppapi/client/filedatabase.cpp b/cppapi/client/filedatabase.cpp index 96bd77b66..ce4044e40 100644 --- a/cppapi/client/filedatabase.cpp +++ b/cppapi/client/filedatabase.cpp @@ -402,9 +402,7 @@ string FileDatabase :: read_word(ifstream& f) TangoSys_MemStream desc; desc << "File database: Error in file at line " << StartLine; desc << " in file " << filename << "." << ends; - ApiConnExcept::throw_exception((const char *)API_DatabaseFileError, - desc.str(), - (const char *)"FileDatabase::CHECK_LEX"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_DatabaseFileError, desc.str()); } read_char(f); return ret_word; @@ -467,9 +465,7 @@ string FileDatabase:: read_full_word(ifstream& f) TangoSys_MemStream desc; desc << "File database: String too long at line " << StartLine; desc << " in file " << filename << "." << ends; - ApiConnExcept::throw_exception((const char *)API_DatabaseFileError, - desc.str(), - (const char *)"FileDatabase::read_full_word"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_DatabaseFileError, desc.str()); } read_char(f); if (ret_word.length() == 0) @@ -502,9 +498,7 @@ void FileDatabase:: CHECK_LEX(int lt,int le) TangoSys_MemStream desc; desc << "File database: Error in file at line " << StartLine; desc << " in file " << filename << "." << ends; - ApiConnExcept::throw_exception((const char *)API_DatabaseFileError, - desc.str(), - (const char *)"FileDatabase::CHECK_LEX"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_DatabaseFileError, desc.str()); } } @@ -577,9 +571,7 @@ std::string FileDatabase::parse_res_file(const std::string &file_name) { TangoSys_MemStream desc; desc << "FILEDATABASE could not open file " << file_name << "." << ends; - ApiConnExcept::throw_exception((const char *)API_DatabaseFileError, - desc.str(), - (const char *)"FileDatabase::parse_res_file"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_DatabaseFileError, desc.str()); } /* CHECK BEGINING OF CONFIG FILE */ @@ -1987,9 +1979,7 @@ CORBA::Any* FileDatabase :: DbPutClassAttributeProperty(CORBA::Any& send) CORBA::Any* FileDatabase :: DbDeleteClassAttributeProperty(CORBA::Any&) { CORBA::Any* ret = new CORBA::Any; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbDeleteClassAttributeProperty"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2031,9 +2021,7 @@ CORBA::Any* FileDatabase :: DbGetDeviceList(CORBA::Any& send) TangoSys_MemStream desc; desc << "File database: Can't find class " << (*data_in)[1]; desc << " in file " << filename << "." << ends; - ApiConnExcept::throw_exception((const char *)API_DatabaseFileError, - desc.str(), - (const char *)"FileDatabase::DbGetDeviceList"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_DatabaseFileError, desc.str()); } } else @@ -2044,9 +2032,7 @@ CORBA::Any* FileDatabase :: DbGetDeviceList(CORBA::Any& send) TangoSys_MemStream desc; desc << "File database: Can't find device server " << (*data_in)[0]; desc << " in file " << filename << "." << ends; - ApiConnExcept::throw_exception((const char *)API_DatabaseFileError, - desc.str(), - (const char *)"FileDatabase::DbGetDeviceList"); + TANGO_THROW_API_EXCEPTION(ApiConnExcept, API_DatabaseFileError, desc.str()); } } @@ -2113,9 +2099,7 @@ CORBA::Any* FileDatabase :: DbImportDevice(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbImportDevice"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2124,9 +2108,7 @@ CORBA::Any* FileDatabase :: DbImportDevice(CORBA::Any&) CORBA::Any* FileDatabase :: DbExportDevice(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbExportDevice"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2135,9 +2117,7 @@ CORBA::Any* FileDatabase :: DbExportDevice(CORBA::Any&) CORBA::Any* FileDatabase :: DbUnExportDevice(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbUnExportDevice"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2146,9 +2126,7 @@ CORBA::Any* FileDatabase :: DbUnExportDevice(CORBA::Any&) CORBA::Any* FileDatabase :: DbAddDevice(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbAddDevice"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2157,9 +2135,7 @@ CORBA::Any* FileDatabase :: DbAddDevice(CORBA::Any&) CORBA::Any* FileDatabase :: DbDeleteDevice(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbDeleteDevice"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2168,9 +2144,7 @@ CORBA::Any* FileDatabase :: DbDeleteDevice(CORBA::Any&) CORBA::Any* FileDatabase :: DbAddServer(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbAddServer"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2179,9 +2153,7 @@ CORBA::Any* FileDatabase :: DbAddServer(CORBA::Any&) CORBA::Any* FileDatabase :: DbDeleteServer(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbDeleteServer"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2190,9 +2162,7 @@ CORBA::Any* FileDatabase :: DbDeleteServer(CORBA::Any&) CORBA::Any* FileDatabase :: DbExportServer(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbExportServer"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2201,9 +2171,7 @@ CORBA::Any* FileDatabase :: DbExportServer(CORBA::Any&) CORBA::Any* FileDatabase :: DbUnExportServer(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbExportDevice"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2212,9 +2180,7 @@ CORBA::Any* FileDatabase :: DbUnExportServer(CORBA::Any&) CORBA::Any* FileDatabase :: DbGetServerInfo(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"Filedatabase::DbGetServerInfo"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2237,9 +2203,7 @@ CORBA::Any* FileDatabase :: DbGetDeviceMemberList(CORBA::Any&) CORBA::Any* FileDatabase :: DbGetDeviceExportedList(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"DbGetDeviceExportedList"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2300,9 +2264,7 @@ CORBA::Any* FileDatabase :: DbGetProperty(CORBA::Any& send) CORBA::Any* FileDatabase :: DbPutProperty(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"DbPutProperty"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2311,9 +2273,7 @@ CORBA::Any* FileDatabase :: DbDeleteProperty(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"DbDeleteProperty"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2322,9 +2282,7 @@ CORBA::Any* FileDatabase :: DbGetAliasDevice(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"DbGetAliasDevice"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2333,9 +2291,7 @@ CORBA::Any* FileDatabase :: DbGetDeviceAlias(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"DbGetDeviceAlias"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2344,9 +2300,7 @@ CORBA::Any* FileDatabase :: DbGetAttributeAlias(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"DbGetAttributeAlias"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2355,9 +2309,7 @@ CORBA::Any* FileDatabase :: DbGetDeviceAliasList(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"DbGetDeviceAliasList"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } @@ -2366,51 +2318,49 @@ CORBA::Any* FileDatabase :: DbGetAttributeAliasList(CORBA::Any&) { CORBA::Any* ret = NULL; - Tango::Except::throw_exception((const char *)API_NotSupported, - (const char *)"Call to a Filedatabase not implemented.", - (const char *)"DbGetAttributeAliasList"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } CORBA::Any* FileDatabase::DbGetClassPipeProperty(CORBA::Any&) { CORBA::Any* ret = nullptr; - Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbGetClassPipeProperty"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } CORBA::Any* FileDatabase::DbGetDevicePipeProperty(CORBA::Any&) { CORBA::Any* ret = nullptr; - Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbGetDevicePipeProperty"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } CORBA::Any* FileDatabase::DbDeleteClassPipeProperty(CORBA::Any&) { CORBA::Any* ret = nullptr; - Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbDeleteClassPipeProperty"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } CORBA::Any* FileDatabase::DbDeleteDevicePipeProperty(CORBA::Any&) { CORBA::Any* ret = nullptr; - Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbDeleteDevicePipeProperty"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } CORBA::Any* FileDatabase::DbPutClassPipeProperty(CORBA::Any&) { CORBA::Any* ret = nullptr; - Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbPutClassPipeProperty"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } CORBA::Any* FileDatabase::DbPutDevicePipeProperty(CORBA::Any&) { CORBA::Any* ret = nullptr; - Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbPutDevicePipeProperty"); + TANGO_THROW_EXCEPTION(API_NotSupported, "Call to a Filedatabase not implemented."); return ret; } diff --git a/cppapi/client/group.cpp b/cppapi/client/group.cpp index b2255a477..0997a3186 100644 --- a/cppapi/client/group.cpp +++ b/cppapi/client/group.cpp @@ -188,9 +188,7 @@ void GroupElementFactory::parse_name (const std::string& p, std::string &db_host TangoSys_OMemStream desc; desc << protocol; desc << " protocol is an unsupported protocol" << std::ends; - ApiWrongNameExcept::throw_exception((const char*)API_UnsupportedProtocol, - desc.str(), - (const char*)"GroupElementFactory::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_UnsupportedProtocol, desc.str()); } } @@ -202,9 +200,7 @@ void GroupElementFactory::parse_name (const std::string& p, std::string &db_host TangoSys_OMemStream desc; desc << "Wrong device name syntax in " << p << std::ends; - ApiWrongNameExcept::throw_exception((const char *)API_WrongDeviceNameSyntax, - desc.str(), - (const char *)"GroupElementFactory::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } std::string bef_sep = name_wo_prot.substr(0,pos); @@ -221,9 +217,7 @@ void GroupElementFactory::parse_name (const std::string& p, std::string &db_host TangoSys_OMemStream desc; desc << "Wrong device name syntax in " << p << std::ends; - ApiWrongNameExcept::throw_exception((const char *)API_WrongDeviceNameSyntax, - desc.str(), - (const char *)"GroupElementFactory::parse_name()"); + TANGO_THROW_API_EXCEPTION(ApiWrongNameExcept, API_WrongDeviceNameSyntax, desc.str()); } TangoSys_MemStream s; s << db_port_str << std::ends; @@ -1192,9 +1186,7 @@ long Group::command_inout_asynch_i (const std::string& c, const std::vector& d, boo << d.size() << "]" << std::ends; - ApiDataExcept::throw_exception((const char*)API_MethodArgument, - (const char*)desc.str().c_str(), - (const char*)"Group::write_attribute_asynch"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_MethodArgument, desc.str().c_str()); } if (id == -1) { id = next_asynch_request_id(); diff --git a/cppapi/client/group.h b/cppapi/client/group.h index 4aaca0034..82ad7f9bb 100644 --- a/cppapi/client/group.h +++ b/cppapi/client/group.h @@ -1888,9 +1888,7 @@ long Group::command_inout_asynch_i (const std::string& c, /*const*/ std::vector< << d.size() << "]" << std::ends; - ApiDataExcept::throw_exception((const char*)API_MethodArgument, - (const char*)desc.str().c_str(), - (const char*)"Group::command_inout_asynch"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_MethodArgument, desc.str().c_str()); } if (ari == -1) @@ -1962,9 +1960,7 @@ long Group::write_attribute_asynch_i (const std::string& a, /*const*/ std::vecto << d.size() << "]" << std::ends; - ApiDataExcept::throw_exception((const char*)API_MethodArgument, - (const char*)desc.str().c_str(), - (const char*)"Group::write_attribute_asynch"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_MethodArgument, desc.str().c_str()); } if (ari == -1) diff --git a/cppapi/client/helpers/DeviceProxyHelper.h b/cppapi/client/helpers/DeviceProxyHelper.h index 56013ddc3..8651aab1b 100644 --- a/cppapi/client/helpers/DeviceProxyHelper.h +++ b/cppapi/client/helpers/DeviceProxyHelper.h @@ -819,10 +819,7 @@ class AttributeHelper : public virtual HelperBase } default: { - Tango::Except::throw_exception( - static_cast("TANGO_NON_SUPPORTED_FEATURE_ERROR"), - static_cast("This type is not supported"), - static_cast("AttributeHelper::read_attribute_w")); + TANGO_THROW_EXCEPTION("TANGO_NON_SUPPORTED_FEATURE_ERROR", "This type is not supported"); break; } } diff --git a/cppapi/client/notifdeventconsumer.cpp b/cppapi/client/notifdeventconsumer.cpp index 5f43befd7..c27a945a1 100644 --- a/cppapi/client/notifdeventconsumer.cpp +++ b/cppapi/client/notifdeventconsumer.cpp @@ -258,15 +258,11 @@ void NotifdEventConsumer::connect_event_system(std::string &device_name,std::str } catch (CORBA::COMM_FAILURE &) { - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Caught CORBA::COMM_FAILURE exception while creating event filter (check filter)", - (const char*)"NotifdEventConsumer::connect_event_system()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Caught CORBA::COMM_FAILURE exception while creating event filter (check filter)"); } catch (...) { - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Caught exception while creating event filter (check filter)", - (const char*)"NotifdEventConsumer::connect_event_system()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Caught exception while creating event filter (check filter)"); } // @@ -343,9 +339,7 @@ void NotifdEventConsumer::connect_event_system(std::string &device_name,std::str catch (...) { } filter = CosNotifyFilter::Filter::_nil(); - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Caught exception while creating event filter (check filter)", - (const char*)"NotifdEventConsumer::connect_event_system()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Caught exception while creating event filter (check filter)"); } else { @@ -419,9 +413,7 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa o << channel_name; o << " has no event channel defined in the database\n"; o << "Maybe the server is not running or is not linked with Tango release 4.x (or above)... " << std::ends; - Except::throw_exception((const char *)API_NotificationServiceFailed, - o.str(), - (const char *)"NotifdEventConsumer::connect_event_channel"); + TANGO_THROW_EXCEPTION(API_NotificationServiceFailed, o.str()); } received.inout() >>= dev_import_list; @@ -453,9 +445,7 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa o << channel_name; o << " has no event channel\n"; o << "Maybe the server is not running or is not linked with Tango release 4.x (or above)... " << std::ends; - Except::throw_exception((const char *)API_NotificationServiceFailed, - o.str(), - (const char *)"NotifdEventConsumer::connect_event_channel"); + TANGO_THROW_EXCEPTION(API_NotificationServiceFailed, o.str()); } } @@ -479,16 +469,12 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa } catch (...) { - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to narrow EventChannel from notification daemon (hint: make sure the notifd process is running on this host)", - (const char*)"NotifdEventConsumer::connect_event_channel()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to narrow EventChannel from notification daemon (hint: make sure the notifd process is running on this host)"); } } else { - EventSystemExcept::throw_exception((const char*)API_EventChannelNotExported, - (const char*)"Failed to narrow EventChannel (hint: make sure a notifd process is running on the server host)", - (const char*)"NotifdEventConsumer::connect_event_channel()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_EventChannelNotExported, "Failed to narrow EventChannel (hint: make sure a notifd process is running on the server host)"); } // @@ -506,16 +492,12 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa if (CORBA::is_nil(consumerAdmin)) { //cerr << "Could not get CosNotifyChannelAdmin::ConsumerAdmin" << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to get default Consumer admin from notification daemon (hint: make sure the notifd process is running on this host)", - (const char*)"NotifdEventConsumer::connect_event_channel()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to get default Consumer admin from notification daemon (hint: make sure the notifd process is running on this host)"); } } catch (...) { - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to get default Consumer admin from notification daemon (hint: make sure the notifd process is running on this host)", - (const char*)"NotifdEventConsumer::connect_event_channel()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to get default Consumer admin from notification daemon (hint: make sure the notifd process is running on this host)"); } // @@ -533,9 +515,7 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa if (CORBA::is_nil(proxySupplier)) { //cerr << "Could not get CosNotifyChannelAdmin::ProxySupplier" << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to obtain a push supplier from notification daemon (hint: make sure the notifd process is running on this host)", - (const char*)"NotifdEventConsumer::connect_event_channel()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to obtain a push supplier from notification daemon (hint: make sure the notifd process is running on this host)"); } structuredProxyPushSupplier = @@ -544,9 +524,7 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa if (CORBA::is_nil(structuredProxyPushSupplier)) { //cerr << "Tango::NotifdEventConsumer::NotifdEventConsumer() could not get CosNotifyChannelAdmin::StructuredProxyPushSupplier" << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to narrow the push supplier from notification daemon (hint: make sure the notifd process is running on this host)", - (const char*)"NotifdEventConsumer::connect_event_channel()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to narrow the push supplier from notification daemon (hint: make sure the notifd process is running on this host)"); } // @@ -558,9 +536,7 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa } catch(const CosNotifyChannelAdmin::AdminLimitExceeded&) { - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to get PushSupplier from notification daemon due to AdminLimitExceeded (hint: make sure the notifd process is running on this host)", - (const char*)"NotifdEventConsumer::connect_event_channel()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to get PushSupplier from notification daemon due to AdminLimitExceeded (hint: make sure the notifd process is running on this host)"); } // @@ -627,9 +603,7 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa catch (...) { //cerr << "Caught exception obtaining filter object" << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Caught exception while creating heartbeat filter (check filter)", - (const char*)"NotifdEventConsumer::connect_event_channel()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Caught exception while creating heartbeat filter (check filter)"); } // @@ -666,9 +640,7 @@ void NotifdEventConsumer::connect_event_channel(std::string &channel_name,Databa filter = CosNotifyFilter::Filter::_nil(); - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Caught exception while adding constraint for heartbeat (check filter)", - (const char*)"NotifdEventConsumer::connect_event_channel()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Caught exception while adding constraint for heartbeat (check filter)"); } } diff --git a/cppapi/client/proxy_asyn.cpp b/cppapi/client/proxy_asyn.cpp index bd248d2db..9361238ca 100644 --- a/cppapi/client/proxy_asyn.cpp +++ b/cppapi/client/proxy_asyn.cpp @@ -106,8 +106,7 @@ long Connection::command_inout_asynch(const char *command, DeviceData &data_in, desc << "Command_inout_asynch on device " << dev_name() << " for command "; desc << command << " is not authorized" << std::ends; - NotAllowedExcept::throw_exception(API_ReadOnlyMode,desc.str(), - "Connection::command_inout_asynch()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } } @@ -124,8 +123,7 @@ long Connection::command_inout_asynch(const char *command, DeviceData &data_in, TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiConnExcept::re_throw_exception(e,API_CommandFailed, - desc.str(),"Connection::command_inout_asynch()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } // @@ -244,9 +242,7 @@ DeviceData Connection::command_inout_reply(long id) if (req.req_type != TgRequest::CMD_INOUT) { - ApiAsynExcept::throw_exception(API_BadAsynReqType, - "Incompatible request type", - "Connection::command_inout_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynReqType, "Incompatible request type"); } // @@ -259,9 +255,7 @@ DeviceData Connection::command_inout_reply(long id) desc << "Device " << dev_name(); desc << ": Reply for asynchronous call (id = " << id; desc << ") is not yet arrived" << std::ends; - ApiAsynNotThereExcept::throw_exception(API_AsynReplyNotArrived, - desc.str(), - "Connection::command_inout_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } // @@ -367,10 +361,7 @@ DeviceData Connection::command_inout_reply(long id) remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_DeviceTimedOut, - desc.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_DeviceTimedOut, desc.str()); } else { @@ -380,9 +371,7 @@ DeviceData Connection::command_inout_reply(long id) std::stringstream ss; ss << "Failed to execute command_inout_asynch on device " << dev_name(); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,ss.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); } } } @@ -413,10 +402,7 @@ DeviceData Connection::command_inout_reply(long id) remove_asyn_request(id); - Except::re_throw_exception(ex, - API_CommandFailed, - desc.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_EXCEPTION(ex, API_CommandFailed, desc.str()); } @@ -476,10 +462,7 @@ DeviceData Connection::command_inout_reply(long id) remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed, - desc.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, desc.str()); } @@ -526,9 +509,7 @@ DeviceData Connection::command_inout_reply(long id,long call_timeout) if (req.req_type != TgRequest::CMD_INOUT) { - ApiAsynExcept::throw_exception(API_BadAsynReqType, - "Incompatible request type", - "Connection::command_inout_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynReqType, "Incompatible request type"); } // @@ -581,9 +562,7 @@ DeviceData Connection::command_inout_reply(long id,long call_timeout) desc << "Device " << dev_name(); desc << ": Reply for asynchronous call (id = " << id; desc << ") is not yet arrived" << std::ends; - ApiAsynNotThereExcept::throw_exception(API_AsynReplyNotArrived, - desc.str(), - "Connection::command_inout_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } } } @@ -693,10 +672,7 @@ DeviceData Connection::command_inout_reply(long id,long call_timeout) remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_DeviceTimedOut, - desc.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_DeviceTimedOut, desc.str()); } else { @@ -706,9 +682,7 @@ DeviceData Connection::command_inout_reply(long id,long call_timeout) std::stringstream ss; ss << "Failed to execute command_inout_asynch on device " << dev_name(); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,ss.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); } } } @@ -739,9 +713,7 @@ DeviceData Connection::command_inout_reply(long id,long call_timeout) remove_asyn_request(id);; - Except::re_throw_exception(ex, - API_CommandFailed,desc.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_EXCEPTION(ex, API_CommandFailed, desc.str()); } @@ -800,9 +772,7 @@ DeviceData Connection::command_inout_reply(long id,long call_timeout) remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,desc.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, desc.str()); } @@ -845,8 +815,7 @@ long DeviceProxy::read_attributes_asynch(std::vector &attr_names) { TangoSys_OMemStream desc; desc << "Failed to execute read_attributes_asynch on device " << dev_name() << std::ends; - ApiConnExcept::re_throw_exception(e,API_CommandFailed, - desc.str(),"DeviceProxy::read_attributes_asynch()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } // @@ -957,9 +926,7 @@ std::vector *DeviceProxy::read_attributes_reply(long id) if (req.req_type != TgRequest::READ_ATTR) { - ApiAsynExcept::throw_exception(API_BadAsynReqType, - "Incompatible request type", - "Connection::read_attributes_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynReqType, "Incompatible request type"); } // @@ -972,9 +939,7 @@ std::vector *DeviceProxy::read_attributes_reply(long id) desc << "Device " << dev_name(); desc << ": Reply for asynchronous call (id = " << id; desc << ") is not yet arrived" << std::ends; - ApiAsynNotThereExcept::throw_exception(API_AsynReplyNotArrived, - desc.str(), - "DeviceProxy::read_attributes_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } else { @@ -1162,9 +1127,7 @@ DeviceAttribute *DeviceProxy::read_attribute_reply(long id) if (req.req_type != TgRequest::READ_ATTR) { - ApiAsynExcept::throw_exception(API_BadAsynReqType, - "Incompatible request type", - "Connection::read_attribute_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynReqType, "Incompatible request type"); } // @@ -1177,9 +1140,7 @@ DeviceAttribute *DeviceProxy::read_attribute_reply(long id) desc << "Device " << dev_name(); desc << ": Reply for asynchronous call (id = " << id; desc << ") is not yet arrived" << std::ends; - ApiAsynNotThereExcept::throw_exception(API_AsynReplyNotArrived, - desc.str(), - "DeviceProxy::read_attribute_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } else { @@ -1360,9 +1321,7 @@ std::vector *DeviceProxy::read_attributes_reply(long id,long ca if (req.req_type != TgRequest::READ_ATTR) { - ApiAsynExcept::throw_exception(API_BadAsynReqType, - "Incompatible request type", - "Connection::read_attributes_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynReqType, "Incompatible request type"); } // @@ -1415,9 +1374,7 @@ std::vector *DeviceProxy::read_attributes_reply(long id,long ca desc << "Device " << device_name; desc << ": Reply for asynchronous call (id = " << id; desc << ") is not yet arrived" << std::ends; - ApiAsynNotThereExcept::throw_exception(API_AsynReplyNotArrived, - desc.str(), - "DeviceProxy::read_attributes_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } } } @@ -1606,9 +1563,7 @@ DeviceAttribute *DeviceProxy::read_attribute_reply(long id,long call_timeout) if (req.req_type != TgRequest::READ_ATTR) { - ApiAsynExcept::throw_exception(API_BadAsynReqType, - "Incompatible request type", - "Connection::read_attribute_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynReqType, "Incompatible request type"); } // @@ -1661,9 +1616,7 @@ DeviceAttribute *DeviceProxy::read_attribute_reply(long id,long call_timeout) desc << "Device " << device_name; desc << ": Reply for asynchronous call (id = " << id; desc << ") is not yet arrived" << std::ends; - ApiAsynNotThereExcept::throw_exception(API_AsynReplyNotArrived, - desc.str(), - "DeviceProxy::read_attribute_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } } } @@ -1883,7 +1836,7 @@ void DeviceProxy::read_attr_except(CORBA::Request_ptr req,long id,read_attr_type desc << std::ends; remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess,API_DeviceTimedOut,desc.str(),meth.c_str()); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_DeviceTimedOut, desc.str()); } else { @@ -1892,7 +1845,7 @@ void DeviceProxy::read_attr_except(CORBA::Request_ptr req,long id,read_attr_type std::stringstream ss; ss << "Failed to execute read_attribute_asynch on device " << device_name; - ApiCommExcept::re_throw_exception(cb_excep_mess,API_CommunicationFailed,ss.str(),meth.c_str()); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); } } } @@ -1929,13 +1882,9 @@ void DeviceProxy::read_attr_except(CORBA::Request_ptr req,long id,read_attr_type remove_asyn_request(id); if (type == SIMPLE) - Except::re_throw_exception(ex, - API_AttributeFailed,desc.str(), - "DeviceProxy::read_attribute_reply()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); else - Except::re_throw_exception(ex, - API_AttributeFailed,desc.str(), - "DeviceProxy::read_attributes_reply()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); } @@ -1991,13 +1940,9 @@ void DeviceProxy::read_attr_except(CORBA::Request_ptr req,long id,read_attr_type remove_asyn_request(id); if (type == SIMPLE) - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,desc.str(), - "DeviceProxy::read_attribute_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, desc.str()); else - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,desc.str(), - "DeviceProxy::read_attributes_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, desc.str()); } } @@ -2028,8 +1973,7 @@ long DeviceProxy::write_attributes_asynch(std::vector &attr_lis TangoSys_OMemStream desc; desc << "Writing attribute(s) on device " << dev_name() << " is not authorized" << std::ends; - NotAllowedExcept::throw_exception(API_ReadOnlyMode,desc.str(), - "DeviceProxy::write_attributes_asynch()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } // @@ -2044,8 +1988,7 @@ long DeviceProxy::write_attributes_asynch(std::vector &attr_lis { TangoSys_OMemStream desc; desc << "Failed to execute write_attributes_asynch on device " << dev_name() << std::ends; - ApiConnExcept::re_throw_exception(e,API_CommandFailed, - desc.str(),"DeviceProxy::write_attributes_asynch()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } // @@ -2117,8 +2060,7 @@ long DeviceProxy::write_attribute_asynch(DeviceAttribute &attr) TangoSys_OMemStream desc; desc << "Writing attribute(s) on device " << dev_name() << " is not authorized" << std::ends; - NotAllowedExcept::throw_exception(API_ReadOnlyMode,desc.str(), - "DeviceProxy::write_attribute_asynch()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } // @@ -2133,8 +2075,7 @@ long DeviceProxy::write_attribute_asynch(DeviceAttribute &attr) { TangoSys_OMemStream desc; desc << "Failed to execute write_attributes_asynch on device " << dev_name() << std::ends; - ApiConnExcept::re_throw_exception(e,API_CommandFailed, - desc.str(),"DeviceProxy::write_attribute_asynch()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } // @@ -2224,9 +2165,7 @@ void DeviceProxy::write_attributes_reply(long id,long call_timeout) if ((req.req_type == TgRequest::CMD_INOUT) || (req.req_type == TgRequest::READ_ATTR)) { - ApiAsynExcept::throw_exception(API_BadAsynReqType, - "Incompatible request type", - "Connection::write_attributes_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynReqType, "Incompatible request type"); } // @@ -2279,9 +2218,7 @@ void DeviceProxy::write_attributes_reply(long id,long call_timeout) desc << "Device " << device_name; desc << ": Reply for asynchronous call (id = " << id; desc << ") is not yet arrived" << std::ends; - ApiAsynNotThereExcept::throw_exception(API_AsynReplyNotArrived, - desc.str(), - "DeviceProxy::write_attributes_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } } } @@ -2370,9 +2307,7 @@ void DeviceProxy::write_attributes_reply(long id) if ((req.req_type == TgRequest::CMD_INOUT) || (req.req_type == TgRequest::READ_ATTR)) { - ApiAsynExcept::throw_exception(API_BadAsynReqType, - "Incompatible request type", - "Connection::write_attributes_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynExcept, API_BadAsynReqType, "Incompatible request type"); } // @@ -2385,9 +2320,7 @@ void DeviceProxy::write_attributes_reply(long id) desc << "Device " << dev_name(); desc << ": Reply for asynchronous call (id = " << id; desc << ") is not yet arrived" << std::ends; - ApiAsynNotThereExcept::throw_exception(API_AsynReplyNotArrived, - desc.str(), - "DeviceProxy::write_attributes_reply"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } else { @@ -2534,10 +2467,7 @@ void DeviceProxy::write_attr_except(CORBA::Request_ptr req,long id,TgRequest::Re } remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_DeviceTimedOut, - desc.str(), - "DeviceProxy::write_attributes_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_DeviceTimedOut, desc.str()); } else { @@ -2546,8 +2476,7 @@ void DeviceProxy::write_attr_except(CORBA::Request_ptr req,long id,TgRequest::Re std::stringstream ss; ss << "Failed to execute write_attribute_asynch on device " << device_name; - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,ss.str(),"DeviceProxy::write_attributes_reply"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); } } } @@ -2621,17 +2550,13 @@ void DeviceProxy::write_attr_except(CORBA::Request_ptr req,long id,TgRequest::Re if (version < 3) { - Except::re_throw_exception(ex,API_AttributeFailed, - desc.str(), - "DeviceProxy::write_attributes_reply()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); } else { if (serv_ex != NULL) { - Except::re_throw_exception(ex,API_AttributeFailed, - desc.str(), - "DeviceProxy::write_attributes_reply()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); } if (req_type == TgRequest::WRITE_ATTR) @@ -2647,8 +2572,7 @@ void DeviceProxy::write_attr_except(CORBA::Request_ptr req,long id,TgRequest::Re // Tango::DevFailed ex(m_ex.errors[0].err_list); - Except::re_throw_exception(ex,API_AttributeFailed, - desc.str(),"DeviceProxy::write_attributes_reply()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); } } @@ -2722,9 +2646,7 @@ void DeviceProxy::write_attr_except(CORBA::Request_ptr req,long id,TgRequest::Re remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,desc.str(), - "DeviceProxy::write_attributes_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, desc.str()); } } @@ -2781,10 +2703,7 @@ void DeviceProxy::retrieve_read_args(TgRequest &req,std::vector &at } desc << std::ends; - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::redo_simpl_call()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, desc.str()); } } @@ -2886,10 +2805,7 @@ void DeviceProxy::redo_synch_write_call(TgRequest &req) TangoSys_OMemStream desc; desc << "Failed to redo the call synchronously on device " << device_name << std::ends; - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::redo_synch_write_call()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, desc.str()); } // @@ -2936,10 +2852,7 @@ DeviceData Connection::redo_synch_cmd(TgRequest &req) TangoSys_OMemStream desc; desc << "Failed to redo the call synchronously on device " << dev_name() << std::ends; - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed, - desc.str(), - "DeviceProxy::redo_synch_write_call()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, desc.str()); } // @@ -3029,18 +2942,14 @@ void Connection::omni420_timeout(int id,char *cb_excep_mess) if (need_reconnect == false) { ss << "Timeout (" << timeout << " mS) exceeded on device " << dev_name(); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_DeviceTimedOut,ss.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_DeviceTimedOut, ss.str()); } else { set_connection_state(CONNECTION_NOTOK); ss << "Failed to execute command_inout_asynch on device " << dev_name(); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,ss.str(), - "Connection::command_inout_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); } } @@ -3075,8 +2984,7 @@ DeviceData Connection::omni420_except(int id,char *cb_excep_mess,TgRequest &req) remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,ss.str(),"Connection::command_inout_reply"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); DeviceData dummy; return dummy; @@ -3115,16 +3023,14 @@ void DeviceProxy::omni420_timeout_attr(int id,char *cb_excep_mess,read_attr_type if (need_reconnect == false) { ss << "Timeout (" << timeout << " mS) exceeded on device " << dev_name(); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_DeviceTimedOut,ss.str(),meth.c_str()); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_DeviceTimedOut, ss.str()); } else { set_connection_state(CONNECTION_NOTOK); ss << "Failed to execute command_inout_asynch on device " << dev_name(); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,ss.str(),meth.c_str()); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); } } @@ -3153,8 +3059,7 @@ void DeviceProxy::omni420_except_attr(int id,char *cb_excep_mess,read_attr_type else meth = "DeviceProxy::read_attributes_reply()"; - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,ss.str(),meth.c_str()); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); } void DeviceProxy::omni420_timeout_wattr(int id,char *cb_excep_mess) @@ -3184,16 +3089,14 @@ void DeviceProxy::omni420_timeout_wattr(int id,char *cb_excep_mess) if (need_reconnect == false) { ss << "Timeout (" << timeout << " mS) exceeded on device " << dev_name(); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_DeviceTimedOut,ss.str(),"DeviceProxy::write_attributes_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_DeviceTimedOut, ss.str()); } else { set_connection_state(CONNECTION_NOTOK); ss << "Failed to execute write_attribute_asynch on device " << dev_name(); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,ss.str(),"DeviceProxy::write_attributes_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); } } @@ -3216,8 +3119,7 @@ void DeviceProxy::omni420_except_wattr(int id,char *cb_excep_mess) remove_asyn_request(id); - ApiCommExcept::re_throw_exception(cb_excep_mess, - API_CommunicationFailed,ss.str(),"DeviceProxy::write_attributes_reply()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, cb_excep_mess, API_CommunicationFailed, ss.str()); } } // End of tango namespace diff --git a/cppapi/client/proxy_asyn_cb.cpp b/cppapi/client/proxy_asyn_cb.cpp index c6d40eba7..46e5d3bc8 100644 --- a/cppapi/client/proxy_asyn_cb.cpp +++ b/cppapi/client/proxy_asyn_cb.cpp @@ -74,8 +74,7 @@ void Connection::command_inout_asynch(const char *command, DeviceData &data_in, TangoSys_OMemStream desc; desc << "Failed to execute command_inout on device " << dev_name(); desc << ", command " << command << std::ends; - ApiConnExcept::re_throw_exception(e,(const char*)API_CommandFailed, - desc.str(), (const char*)"Connection::command_inout_asynch()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } // @@ -1031,9 +1030,7 @@ void Connection::get_asynch_replies(long call_timeout) { TangoSys_OMemStream desc; desc << "Still some reply(ies) for asynchronous callback call(s) to be received" << std::ends; - ApiAsynNotThereExcept::throw_exception((const char *)API_AsynReplyNotArrived, - desc.str(), - (const char *)"Connection::get_asynch_replies"); + TANGO_THROW_API_EXCEPTION(ApiAsynNotThereExcept, API_AsynReplyNotArrived, desc.str()); } } else @@ -1115,8 +1112,7 @@ void DeviceProxy::read_attributes_asynch(std::vector &attr_names,Ca { TangoSys_OMemStream desc; desc << "Failed to execute read_attributes_asynch on device " << dev_name() << std::ends; - ApiConnExcept::re_throw_exception(e,(const char*)API_CommandFailed, - desc.str(), (const char*)"DeviceProxy::read_attributes_asynch()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } // @@ -1232,8 +1228,7 @@ void DeviceProxy::write_attributes_asynch(std::vector &attr_lis { TangoSys_OMemStream desc; desc << "Failed to execute read_attributes_asynch on device " << dev_name() << std::ends; - ApiConnExcept::re_throw_exception(e,(const char*)API_CommandFailed, - desc.str(), (const char*)"DeviceProxy::write_attributes_asynch()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } // @@ -1334,8 +1329,7 @@ void DeviceProxy::write_attribute_asynch(DeviceAttribute &attr,CallBack &cb) { TangoSys_OMemStream desc; desc << "Failed to execute read_attributes_asynch on device " << dev_name() << std::ends; - ApiConnExcept::re_throw_exception(e,(const char*)API_CommandFailed, - desc.str(), (const char*)"DeviceProxy::write_attributes_asynch()"); + TANGO_RETHROW_API_EXCEPTION(ApiConnExcept, e, API_CommandFailed, desc.str()); } // diff --git a/cppapi/client/zmqeventconsumer.cpp b/cppapi/client/zmqeventconsumer.cpp index adee3f93a..ee2fbf972 100644 --- a/cppapi/client/zmqeventconsumer.cpp +++ b/cppapi/client/zmqeventconsumer.cpp @@ -1007,9 +1007,7 @@ bool ZmqEventConsumer::process_ctrl(zmq::message_t &received_ctrl,zmq::pollitem_ if (poll_nb == MAX_SOCKET_SUB) { - Except::throw_exception((const char *)API_InternalError, - (const char *)"Array to store sockets for zmq poll() call is already full", - (const char *)"ZmqEventConsumer::process_control"); + TANGO_THROW_EXCEPTION(API_InternalError, "Array to store sockets for zmq poll() call is already full"); } // @@ -1054,9 +1052,7 @@ bool ZmqEventConsumer::process_ctrl(zmq::message_t &received_ctrl,zmq::pollitem_ delete tmp_sock; print_error_message("Error while inserting pair in map!"); - Except::throw_exception((const char *)API_InternalError, - (const char *)"Error while inserting pair in map", - (const char *)"ZmqEventConsumer::process_control"); + TANGO_THROW_EXCEPTION(API_InternalError, "Error while inserting pair in map"); } // @@ -1282,7 +1278,7 @@ void ZmqEventConsumer::connect_event_channel(std::string &channel_name,TANGO_UNU o << "Failed to create connection to event channel!\n"; o << "Impossible to create a network connection to any of the event endpoints returned by server"; - Except::throw_exception(API_ZmqFailed,o.str(),"ZmqEventConsumer::connect_event_channel"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } } @@ -1376,7 +1372,7 @@ void ZmqEventConsumer::connect_event_channel(std::string &channel_name,TANGO_UNU o << "ZMQ error code = " << e.num() << "\n"; o << "ZMQ message: " << e.what() << std::ends; - Except::throw_exception(API_ZmqFailed,o.str(),"ZmqEventConsumer::connect_event_channel"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } // @@ -1395,7 +1391,7 @@ void ZmqEventConsumer::connect_event_channel(std::string &channel_name,TANGO_UNU o << "Error while trying to connect or subscribe the heartbeat ZMQ socket to the new publisher\n"; o << "ZMQ message: " << err_mess << std::ends; - Except::throw_exception(API_ZmqFailed,o.str(),"ZmqEventConsumer::connect_event_channel"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } // @@ -1505,9 +1501,7 @@ void ZmqEventConsumer::disconnect_event_channel(std::string &channel_name,std::s o << "Error while communicating with the ZMQ main thread\n"; o << "ZMQ message: " << e.what() << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"ZmqEventConsumer::disconnect_event_channel"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } // @@ -1526,9 +1520,7 @@ void ZmqEventConsumer::disconnect_event_channel(std::string &channel_name,std::s o << "Error while trying to unsubscribe the heartbeat ZMQ socket from the channel heartbeat publisher\n"; o << "ZMQ message: " << err_mess << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"ZmqEventConsumer::disconnect_event_channel"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } } @@ -1598,9 +1590,7 @@ void ZmqEventConsumer::disconnect_event(std::string &event_name,std::string &end o << "Error while communicating with the ZMQ main thread\n"; o << "ZMQ message: " << e.what() << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"ZmqEventConsumer::disconnect_event"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } // @@ -1619,9 +1609,7 @@ void ZmqEventConsumer::disconnect_event(std::string &event_name,std::string &end o << "Error while trying to unsubscribe the heartbeat ZMQ socket from the channel heartbeat publisher\n"; o << "ZMQ message: " << err_mess << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"ZmqEventConsumer::disconnect_event"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } } @@ -1764,7 +1752,7 @@ void ZmqEventConsumer::connect_event_system(TANGO_UNUSED(std::string &device_nam o << "Error while communicating with the ZMQ main thread\n"; o << "ZMQ message: " << e.what() << std::ends; - Except::throw_exception(API_ZmqFailed,o.str(),"ZmqEventConsumer::connect_event_system"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } // @@ -1783,7 +1771,7 @@ void ZmqEventConsumer::connect_event_system(TANGO_UNUSED(std::string &device_nam o << "Error while trying to connect or subscribe the event ZMQ socket to the new publisher\n"; o << "ZMQ message: " << err_mess << std::ends; - Except::throw_exception(API_ZmqFailed,o.str(),"ZmqEventConsumer::connect_event_system"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } } @@ -3142,9 +3130,7 @@ void ZmqEventConsumer::zmq_specific(DeviceData &dd,std::string &adm_name,DeviceP { if (zmq_major != 3 || zmq_minor != 1 || zmq_patch != 0) { - Except::throw_exception((const char *)API_UnsupportedFeature, - (const char *)"Incompatibility between ZMQ releases between client and server!", - (const char *)"EventConsumer::connect_event"); + TANGO_THROW_EXCEPTION(API_UnsupportedFeature, "Incompatibility between ZMQ releases between client and server!"); } } @@ -3152,9 +3138,7 @@ void ZmqEventConsumer::zmq_specific(DeviceData &dd,std::string &adm_name,DeviceP { if (ds_zmq_release != 0 && ds_zmq_release != 310) { - Except::throw_exception((const char *)API_UnsupportedFeature, - (const char *)"Incompatibility between ZMQ releases between client and server!", - (const char *)"EventConsumer::connect_event"); + TANGO_THROW_EXCEPTION(API_UnsupportedFeature, "Incompatibility between ZMQ releases between client and server!"); } } @@ -3173,9 +3157,7 @@ void ZmqEventConsumer::zmq_specific(DeviceData &dd,std::string &adm_name,DeviceP o << " is configured to use multicasting"; o << "\nMulticast event(s) not available with this ZMQ release" << std::ends; - Except::throw_exception((const char *)API_UnsupportedFeature, - o.str(), - (const char *)"EventConsumer::connect_event"); + TANGO_THROW_EXCEPTION(API_UnsupportedFeature, o.str()); } } } @@ -3479,9 +3461,7 @@ ReceivedFromAdmin ZmqEventConsumer::initialize_received_from_admin(const Tango:: ReceivedFromAdmin result; if (dvlsa->lvalue.length() == 0) { - EventSystemExcept::throw_exception(API_NotSupported, - "Server did not send its tango lib version. The server is possibly too old. The event system is not initialized!", - "ZmqEventConsumer::initialize_received_from_admin()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotSupported, "Server did not send its tango lib version. The server is possibly too old. The event system is not initialized!"); } long server_tango_lib_ver = dvlsa->lvalue[0]; @@ -3517,18 +3497,14 @@ ReceivedFromAdmin ZmqEventConsumer::initialize_received_from_admin(const Tango:: if (result.event_name.empty()) { - EventSystemExcept::throw_exception(API_NotSupported, - "Server did not send the event name. The server is possibly too old. The event system is not initialized!", - "ZmqEventConsumer::initialize_received_from_admin()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotSupported, "Server did not send the event name. The server is possibly too old. The event system is not initialized!"); } cout4 << "received_from_admin.event_name = " << result.event_name << std::endl; if (result.channel_name.empty()) { - EventSystemExcept::throw_exception(API_NotSupported, - "Server did not send the channel name. The server is possibly too old. The event system is not initialized!", - "ZmqEventConsumer::initialize_received_from_admin()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotSupported, "Server did not send the channel name. The server is possibly too old. The event system is not initialized!"); } cout4 << "received_from_admin.channel_name = " << result.channel_name << std::endl; return result; @@ -3995,9 +3971,7 @@ DelayEvent::DelayEvent(EventConsumer *ec):released(false),eve_con(NULL) o << "Error while communicating with the ZMQ main thread\n"; o << "ZMQ message: " << e.what() << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"DelayEvent::DelayEvent"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } // @@ -4018,9 +3992,7 @@ DelayEvent::DelayEvent(EventConsumer *ec):released(false),eve_con(NULL) o << "Error while asking the ZMQ thread to delay events\n"; o << "ZMQ message: " << err_mess << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"DelayEvent::DelayEvent"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } } } @@ -4075,9 +4047,7 @@ void DelayEvent::release() o << "Error while communicating with the ZMQ main thread\n"; o << "ZMQ message: " << e.what() << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"DelayEvent::release"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } // @@ -4096,9 +4066,7 @@ void DelayEvent::release() o << "Error while trying to ask the ZMQ thread to release events\n"; o << "ZMQ message: " << err_mess << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"DelayEvent::release"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } } } diff --git a/cppapi/server/attrdesc.cpp b/cppapi/server/attrdesc.cpp index 0dbb38688..4d8aa3b45 100644 --- a/cppapi/server/attrdesc.cpp +++ b/cppapi/server/attrdesc.cpp @@ -77,9 +77,7 @@ fire_dr_event(false),ext(new AttrExt),cl_name("Attr") o << "Attribute : " << name << ": "; o << " Associated attribute is not supported" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"Attr::Attr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if ((writable == Tango::READ_WITH_WRITE) && (assoc_name == AssocWritNotSpec)) @@ -89,9 +87,7 @@ fire_dr_event(false),ext(new AttrExt),cl_name("Attr") o << "Attribute : " << name << ": "; o << " Associated attribute not defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"Attr::Attr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if (writable == READ_WRITE) @@ -124,9 +120,7 @@ poll_period(0),ext(new AttrExt) o << "Attribute : " << name << ": "; o << " Associated attribute is not supported" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"Attr::Attr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if ((writable == Tango::READ_WITH_WRITE) && (assoc_name == AssocWritNotSpec)) @@ -136,9 +130,7 @@ poll_period(0),ext(new AttrExt) o << "Attribute : " << name << ": "; o << " Associated attribute not defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"Attr::Attr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if (writable == READ_WRITE) @@ -217,9 +209,7 @@ void Attr::check_type() o << "Attribute : " << name << ": "; o << " Data type is not supported" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"Attr::check_type"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } } @@ -460,7 +450,7 @@ void Attr::set_default_properties(UserDefaultAttrProp &prop_list) if(ranges.test(delta_val) ^ ranges.test(delta_t)) { std::string err_msg = "Just one of the user default properties : delta_val or delta_t is set. Both or none of the values have to be set"; - Except::throw_exception(API_IncoherentValues,err_msg,"Attr::set_default_properties()"); + TANGO_THROW_EXCEPTION(API_IncoherentValues, err_msg); } } @@ -625,13 +615,13 @@ void Attr::validate_def_change_prop(const std::string &val, const char * prop) void Attr::throw_incoherent_def_prop(const char* min, const char* max) { std::string err_msg = "User default property " + std::string(min) + " for attribute : " + get_name() + " is greater then or equal " + std::string(max); - Except::throw_exception(API_IncoherentValues,err_msg,"Attr::set_default_properties()"); + TANGO_THROW_EXCEPTION(API_IncoherentValues, err_msg); } void Attr::throw_invalid_def_prop(const char* prop, const char* type) { std::string err_msg = "User default property " + std::string(prop) + " for attribute : " + get_name() + " is defined in unsupported format. Expected " + std::string(type); - Except::throw_exception(API_IncompatibleAttrDataType,err_msg,"Attr::set_default_properties()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg); } //+------------------------------------------------------------------------------------------------------------------- @@ -654,9 +644,7 @@ void Attr::set_memorized() o << "Attribute : " << name; o << " is not scalar and can not be memorized" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"Attr::set_memorized"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if ((type == DEV_STATE) || (type == DEV_ENCODED)) @@ -666,9 +654,7 @@ void Attr::set_memorized() o << "Attribute : " << name; o << " can not be memorized" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"Attr::set_memorized"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if ((writable == READ) || (writable == READ_WITH_WRITE)) @@ -678,9 +664,7 @@ void Attr::set_memorized() o << "Attribute : " << name; o << " is not writable and therefore can not be memorized" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"Attr::set_memorized"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } mem = true; @@ -709,9 +693,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,long x) o << "Attribute : " << name << ": "; o << " Maximum x dim. wrongly defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"SpectrumAttr::SpectrumAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if (type == DEV_ENCODED) @@ -721,8 +703,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,long x) o << "Attribute: " << name << ": "; o << "DevEncode data type allowed only for SCALAR attribute" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined,o.str(), - (const char *)"SpectrumAttr::SpectrumAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } max_x = x; } @@ -738,9 +719,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,Tango::AttrWriteTy o << "Attribute : " << name << ": "; o << " Maximum x dim. wrongly defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"SpectrumAttr::SpectrumAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if (type == DEV_ENCODED) @@ -750,8 +729,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,Tango::AttrWriteTy o << "Attribute: " << name << ": "; o << "DevEncode data type allowed only for SCALAR attribute" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined,o.str(), - (const char *)"SpectrumAttr::SpectrumAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } max_x = x; } @@ -767,9 +745,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,long x,DispLevel l o << "Attribute : " << name << ": "; o << " Maximum x dim. wrongly defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"SpectrumAttr::SpectrumAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if (type == DEV_ENCODED) @@ -779,8 +755,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,long x,DispLevel l o << "Attribute: " << name << ": "; o << "DevEncode data type allowed only for SCALAR attribute" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined,o.str(), - (const char *)"SpectrumAttr::SpectrumAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } max_x = x; } @@ -796,9 +771,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,Tango::AttrWriteTy o << "Attribute : " << name << ": "; o << " Maximum x dim. wrongly defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"SpectrumAttr::SpectrumAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } if (type == DEV_ENCODED) @@ -808,8 +781,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,Tango::AttrWriteTy o << "Attribute: " << name << ": "; o << "DevEncode data type allowed only for SCALAR attribute" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined,o.str(), - (const char *)"SpectrumAttr::SpectrumAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } max_x = x; } @@ -840,9 +812,7 @@ ImageAttr::ImageAttr(const char *att_name,long att_type,long x,long y) o << "Attribute : " << name << ": "; o << " Maximum y dim. wrongly defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"ImageAttr::ImageAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } max_y = y; } @@ -859,9 +829,7 @@ ImageAttr::ImageAttr(const char *att_name,long att_type,Tango::AttrWriteType w_t o << "Attribute : " << name << ": "; o << " Maximum y dim. wrongly defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"ImageAttr::ImageAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } max_y = y; } @@ -878,9 +846,7 @@ ImageAttr::ImageAttr(const char *att_name,long att_type,long x, o << "Attribute : " << name << ": "; o << " Maximum y dim. wrongly defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"ImageAttr::ImageAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } max_y = y; } @@ -897,9 +863,7 @@ ImageAttr::ImageAttr(const char *att_name,long att_type,Tango::AttrWriteType w_t o << "Attribute : " << name << ": "; o << " Maximum y dim. wrongly defined" << std::ends; - Except::throw_exception((const char *)API_AttrWrongDefined, - o.str(), - (const char *)"ImageAttr::ImageAttr"); + TANGO_THROW_EXCEPTION(API_AttrWrongDefined, o.str()); } max_y = y; } diff --git a/cppapi/server/attrgetsetprop.cpp b/cppapi/server/attrgetsetprop.cpp index ae5457ccf..e363938c2 100644 --- a/cppapi/server/attrgetsetprop.cpp +++ b/cppapi/server/attrgetsetprop.cpp @@ -143,7 +143,7 @@ void Attribute::get_properties(Tango::AttributeConfig_3 &conf) desc = desc + get_name() + " is a forwarded attribute and its root device ("; desc = desc + fwd->get_fwd_dev_name(); desc = desc + ") is not yet available"; - Tango::Except::throw_exception(API_AttrConfig,desc,"Attribute::get_properties"); + TANGO_THROW_EXCEPTION(API_AttrConfig, desc); } // @@ -2361,7 +2361,7 @@ void Attribute::set_prop_5_specific(const AttributeConfig_5 &conf,std::string &d ss << "Device " << dev_name << "- Attribute : " << name; ss << "- No value defined for the property enum_labels"; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_prop_5_specific()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } if (from_ds == false) @@ -2377,7 +2377,7 @@ void Attribute::set_prop_5_specific(const AttributeConfig_5 &conf,std::string &d ss << "Device " << dev_name << "-> Attribute : " << name; ss << "\nIt's not supported to change enumeration labels number from outside the Tango device class code"; - Except::throw_exception(API_NotSupportedFeature,ss.str(),"Attribute::set_prop_5_specific()"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, ss.str()); } } } @@ -2419,7 +2419,7 @@ void Attribute::set_prop_5_specific(const AttributeConfig_5 &conf,std::string &d ss << "Device " << dev_name << "-> Attribute : " << name; ss << "\nNo enumeration label(s) default library value for attribute of the Tango::DEV_ENUM data type"; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_prop_5_specific()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } else if (strlen(conf.enum_labels[0]) == 0) { @@ -2431,7 +2431,7 @@ void Attribute::set_prop_5_specific(const AttributeConfig_5 &conf,std::string &d ss << "Device " << dev_name << "-> Attribute : " << name; ss << "\nNo enumeration labels default library value for attribute of the Tango::DEV_ENUM data type"; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_prop_5_specific()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } else { @@ -2455,7 +2455,7 @@ void Attribute::set_prop_5_specific(const AttributeConfig_5 &conf,std::string &d ss << "Device " << dev_name << "-> Attribute : " << name; ss << "\nNo enumeration labels default library value for attribute of the Tango::DEV_ENUM data type"; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_prop_5_specific()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } else { diff --git a/cppapi/server/attribute.cpp b/cppapi/server/attribute.cpp index 5a51cd58d..598b9cb6c 100644 --- a/cppapi/server/attribute.cpp +++ b/cppapi/server/attribute.cpp @@ -1157,9 +1157,7 @@ void Attribute::init_opt_prop(std::vector &prop_list,std::string & o << "RDS alarm properties (delta_t and delta_val) are not correctly defined for attribute " << name; o << " in device " << dev_name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp, - o.str(), - (const char *)"Attribute::init_opt_prop()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } } catch(DevFailed &e) @@ -1260,7 +1258,7 @@ void Attribute::build_check_enum_labels(std::string &labs) ss << "Enumeration for attribute " << name << " has two similar labels ("; ss << v_s[loop - 1] << ", " << v_s[loop] << ")"; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::build_check_enum_labels"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } } } @@ -1349,9 +1347,7 @@ void Attribute::throw_err_format(const char *prop_name,const std::string &dev_na o << "Device " << dev_name << "-> Attribute : " << name; o << "\nThe property " << prop_name << " is defined in an unsupported format" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp, - o.str(), - (const char *)origin); + Except::throw_exception(API_AttrOptProp, o.str(), origin); } @@ -1375,9 +1371,7 @@ void Attribute::throw_incoherent_val_err(const char *min_prop,const char *max_pr o << "Device " << dev_name << "-> Attribute : " << name; o << "\nValue of " << min_prop << " is greater than or equal to " << max_prop << std::ends; - Except::throw_exception((const char *)API_IncoherentValues, - o.str(), - (const char *)origin); + Except::throw_exception(API_IncoherentValues, o.str(), origin); } //+------------------------------------------------------------------------- @@ -1399,9 +1393,7 @@ void Attribute::throw_err_data_type(const char *prop_name,const std::string &dev o << "Device " << dev_name << "-> Attribute : " << name; o << "\nThe property " << prop_name << " is not settable for the attribute data type" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp, - o.str(), - (const char *)origin); + Except::throw_exception(API_AttrOptProp, o.str(), origin); } //+------------------------------------------------------------------------- @@ -1428,9 +1420,7 @@ void Attribute::throw_min_max_value(std::string &dev_name,std::string &memorized else o << "above"; o << " the new limit!!" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp, - o.str(), - (const char *)"Attribute::throw_min_max_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } //+------------------------------------------------------------------------- @@ -1573,7 +1563,7 @@ std::string &Attribute::get_attr_value(std::vector &prop_list,con TangoSys_OMemStream o; o << "Property " << prop_name << " is missing for attribute " << name << std::ends; - Except::throw_exception(API_AttrOptProp,o.str(),"Attribute::get_attr_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } return pos->get_value(); @@ -1609,7 +1599,7 @@ long Attribute::get_lg_attr_value(std::vector &prop_list,const ch TangoSys_OMemStream o; o << "Property " << prop_name << " is missing for attribute " << name << std::ends; - Except::throw_exception(API_AttrOptProp,o.str(),"Attribute::get_attr_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } pos->convert(prop_name); @@ -1705,8 +1695,7 @@ bool Attribute::check_alarm() TangoSys_OMemStream o; o << "No alarm defined for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrNoAlarm,o.str(), - (const char *)"Attribute::check_alarm()"); + TANGO_THROW_EXCEPTION(API_AttrNoAlarm, o.str()); } // @@ -3965,7 +3954,7 @@ void Attribute::fire_change_event(DevFailed *except) o << " has not been updated. Can't send change event\n"; o << "Set the attribute value (using set_value(...) method) before!" << std::ends; - Except::throw_exception(API_AttrValueNotSet,o.str(),"Attribute::fire_change_event()"); + TANGO_THROW_EXCEPTION(API_AttrValueNotSet, o.str()); } } } @@ -3987,8 +3976,7 @@ void Attribute::fire_change_event(DevFailed *except) } catch (std::bad_alloc &) { - Except::throw_exception(API_MemoryAllocation, - "Can't allocate memory in server","Attribute::fire_change_event()"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -4389,8 +4377,7 @@ void Attribute::fire_archive_event(DevFailed *except) o << " has not been updated. Can't send archive event\n"; o << "Set the attribute value (using set_value(...) method) before!" << std::ends; - Except::throw_exception((const char *)API_AttrValueNotSet,o.str(), - (const char *)"Attribute::fire_archive_event()"); + TANGO_THROW_EXCEPTION(API_AttrValueNotSet, o.str()); } } } @@ -4411,8 +4398,7 @@ void Attribute::fire_archive_event(DevFailed *except) } catch (std::bad_alloc &) { - Except::throw_exception(API_MemoryAllocation, - "Can't allocate memory in server","Attribute::fire_archive_event()"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -4788,7 +4774,7 @@ void Attribute::fire_event(std::vector &filt_names,std::vector &filt_names,std::vectorget_serial_model() != Tango::BY_DEVICE) { - Except::throw_exception((const char *)API_AttrNotAllowed, - (const char *)"Attribute serial model by user is not allowed when the process is not in BY_DEVICE serialization model", - (const char *)"Attribute::set_attr_serial_model"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, "Attribute serial model by user is not allowed when the process is not in BY_DEVICE serialization model"); } } @@ -5332,7 +5316,7 @@ DeviceClass *Attribute::get_att_device_class(std::string &dev_name) o << "Device " << dev_name << "-> Attribute : " << name; o << "\nCan't retrieve device class!" << std::ends; - Except::throw_exception(API_CantRetrieveClass,o.str(),"Attribute::set_properties()"); + TANGO_THROW_EXCEPTION(API_CantRetrieveClass, o.str()); } } diff --git a/cppapi/server/attribute.h b/cppapi/server/attribute.h index 37d9dd51d..3a95423f7 100644 --- a/cppapi/server/attribute.h +++ b/cppapi/server/attribute.h @@ -2545,8 +2545,7 @@ inline void Attribute::throw_hard_coded_prop(const char *prop_name) TangoSys_OMemStream desc; desc << "Attribute property " << prop_name << " is not changeable at run time" << std::ends; - Except::throw_exception((const char *)API_AttrNotAllowed,desc.str(), - (const char *)"Attribute::check_hard_coded_properties()"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, desc.str()); } //+------------------------------------------------------------------------------------------------------------------- @@ -2616,7 +2615,7 @@ inline void Attribute::throw_startup_exception(const char* origin) err_msg += "\nHint : Check also class level attribute properties"; } - Except::throw_exception(API_AttrConfig,err_msg,origin); + Except::throw_exception(API_AttrConfig, err_msg, origin); } } @@ -2775,7 +2774,7 @@ inline void Attribute::set_att_conf_event_sub(int cl_lib) { \ std::stringstream o; \ o << "Data pointer for attribute " << B << " is NULL!"; \ - Except::throw_exception(API_AttrOptProp,o.str(),"Attribute::set_value()"); \ + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); \ } \ else \ (void)0 diff --git a/cppapi/server/attribute.tpp b/cppapi/server/attribute.tpp index b39a8a218..75788ca4b 100644 --- a/cppapi/server/attribute.tpp +++ b/cppapi/server/attribute.tpp @@ -185,9 +185,7 @@ void Attribute::set_min_alarm(const T &new_min_alarm) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - (const char *) err_msg.c_str(), - (const char *) "Attribute::set_min_alarm()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } // @@ -349,9 +347,7 @@ void Attribute::get_min_alarm(T &min_al) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - (const char *) err_msg.c_str(), - (const char *) "Attribute::get_min_alarm()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } else if ((data_type == Tango::DEV_STRING) || (data_type == Tango::DEV_BOOLEAN) || @@ -360,16 +356,12 @@ void Attribute::get_min_alarm(T &min_al) { std::string err_msg = "Minimum alarm has no meaning for the attribute's (" + name + ") data type : " + ranges_type2const::str; - Except::throw_exception((const char *) API_AttrOptProp, - err_msg.c_str(), - (const char *) "Attribute::get_min_alarm()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, err_msg.c_str()); } if (!alarm_conf[min_level]) { - Except::throw_exception((const char *) API_AttrNotAllowed, - (const char *) "Minimum alarm not defined for this attribute", - (const char *) "Attribute::get_min_alarm()"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, "Minimum alarm not defined for this attribute"); } memcpy((void *) &min_al, (void *) &min_alarm, sizeof(T)); @@ -409,9 +401,7 @@ void Attribute::set_max_alarm(const T &new_max_alarm) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - (const char *) err_msg.c_str(), - (const char *) "Attribute::set_max_alarm()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } // @@ -574,7 +564,7 @@ void Attribute::get_max_alarm(T &max_al) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception(API_IncompatibleAttrDataType, err_msg.c_str(), "Attribute::get_max_alarm()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } else if ((data_type == Tango::DEV_STRING) || (data_type == Tango::DEV_BOOLEAN) || @@ -583,14 +573,12 @@ void Attribute::get_max_alarm(T &max_al) { std::string err_msg = "Maximum alarm has no meaning for the attribute's (" + name + ") data type : " + ranges_type2const::str; - Except::throw_exception(API_AttrOptProp, err_msg.c_str(), "Attribute::get_max_alarm()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, err_msg.c_str()); } if (!alarm_conf[max_level]) { - Except::throw_exception(API_AttrNotAllowed, - "Maximum alarm not defined for this attribute", - "Attribute::get_max_alarm()"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, "Maximum alarm not defined for this attribute"); } memcpy((void *) &max_al, (void *) &max_alarm, sizeof(T)); @@ -631,7 +619,7 @@ void Attribute::set_min_warning(const T &new_min_warning) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception(API_IncompatibleAttrDataType, err_msg.c_str(), "Attribute::set_min_warning()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } // @@ -794,7 +782,7 @@ void Attribute::get_min_warning(T &min_war) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception(API_IncompatibleAttrDataType, err_msg.c_str(), "Attribute::get_min_warning()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } else if ((data_type == Tango::DEV_STRING) || (data_type == Tango::DEV_BOOLEAN) || @@ -803,14 +791,12 @@ void Attribute::get_min_warning(T &min_war) { std::string err_msg = "Minimum warning has no meaning for the attribute's (" + name + ") data type : " + ranges_type2const::str; - Except::throw_exception(API_AttrOptProp, err_msg.c_str(), "Attribute::get_min_warning()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, err_msg.c_str()); } if (!alarm_conf[min_warn]) { - Except::throw_exception(API_AttrNotAllowed, - "Minimum warning not defined for this attribute", - "Attribute::get_min_warning()"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, "Minimum warning not defined for this attribute"); } memcpy((void *) &min_war, (void *) &min_warning, sizeof(T)); @@ -850,7 +836,7 @@ void Attribute::set_max_warning(const T &new_max_warning) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception(API_IncompatibleAttrDataType, err_msg.c_str(), "Attribute::set_max_warning()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } // @@ -1012,7 +998,7 @@ void Attribute::get_max_warning(T &max_war) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception(API_IncompatibleAttrDataType, err_msg.c_str(), "Attribute::get_max_warning()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } else if ((data_type == Tango::DEV_STRING) || (data_type == Tango::DEV_BOOLEAN) || @@ -1021,14 +1007,12 @@ void Attribute::get_max_warning(T &max_war) { std::string err_msg = "Maximum warning has no meaning for the attribute's (" + name + ") data type : " + ranges_type2const::str; - Except::throw_exception(API_AttrOptProp, err_msg.c_str(), "Attribute::get_max_warning()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, err_msg.c_str()); } if (!alarm_conf[max_warn]) { - Except::throw_exception(API_AttrNotAllowed, - "Maximum warning not defined for this attribute", - "Attribute::get_max_warning()"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, "Maximum warning not defined for this attribute"); } memcpy((void *) &max_war, (void *) &max_warning, sizeof(T)); @@ -1062,7 +1046,7 @@ void Attribute::get_properties(Tango::MultiAttrProp &props) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception(API_IncompatibleAttrDataType, err_msg.c_str(), "Attribute::get_properties()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } // @@ -1130,7 +1114,7 @@ void Attribute::set_properties(Tango::MultiAttrProp &props) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception(API_IncompatibleAttrDataType, err_msg.c_str(), "Attribute::set_properties()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } // @@ -1323,7 +1307,7 @@ void Attribute::set_upd_properties(const T &conf, std::string &dev_name, bool fr o << "Device " << dev_name << "-> Attribute : " << name; o << "\nDatabase error occurred whilst setting attribute properties. The database may be corrupted." << std::ends; - Except::throw_exception(API_CorruptedDatabase, o.str(), "Attribute::set_upd_properties()"); + TANGO_THROW_EXCEPTION(API_CorruptedDatabase, o.str()); } throw; diff --git a/cppapi/server/attribute_spec.tpp b/cppapi/server/attribute_spec.tpp index 59a781672..3160a8713 100644 --- a/cppapi/server/attribute_spec.tpp +++ b/cppapi/server/attribute_spec.tpp @@ -67,9 +67,7 @@ template <> inline void Attribute::set_min_alarm(const Tango::DevEncoded &) { std::string err_msg = "Attribute properties cannot be set with Tango::DevEncoded data type"; - Except::throw_exception((const char *)API_MethodArgument, - (const char *)err_msg.c_str(), - (const char *)"Attribute::set_min_alarm()"); + TANGO_THROW_EXCEPTION(API_MethodArgument, err_msg.c_str()); } template <> @@ -260,9 +258,7 @@ template <> inline void Attribute::set_max_alarm(const Tango::DevEncoded &) { std::string err_msg = "Attribute properties cannot be set with Tango::DevEncoded data type"; - Except::throw_exception((const char *)API_MethodArgument, - (const char *)err_msg.c_str(), - (const char *)"Attribute::set_max_alarm()"); + TANGO_THROW_EXCEPTION(API_MethodArgument, err_msg.c_str()); } template <> @@ -453,9 +449,7 @@ template <> inline void Attribute::set_min_warning(const Tango::DevEncoded &) { std::string err_msg = "Attribute properties cannot be set with Tango::DevEncoded data type"; - Except::throw_exception((const char *)API_MethodArgument, - (const char *)err_msg.c_str(), - (const char *)"Attribute::set_min_warning()"); + TANGO_THROW_EXCEPTION(API_MethodArgument, err_msg.c_str()); } template <> @@ -646,9 +640,7 @@ template <> inline void Attribute::set_max_warning(const Tango::DevEncoded &) { std::string err_msg = "Attribute properties cannot be set with Tango::DevEncoded data type"; - Except::throw_exception((const char *)API_MethodArgument, - (const char *)err_msg.c_str(), - (const char *)"Attribute::set_max_warning()"); + TANGO_THROW_EXCEPTION(API_MethodArgument, err_msg.c_str()); } template <> diff --git a/cppapi/server/attrprop.h b/cppapi/server/attrprop.h index bf9a5d9cc..507e4483e 100644 --- a/cppapi/server/attrprop.h +++ b/cppapi/server/attrprop.h @@ -163,7 +163,7 @@ class AttrProp if(is_value == false) { std::string err_msg = "Numeric representation of the property's value (" + str + ") has not been set"; - Tango::Except::throw_exception(API_AttrPropValueNotSet,err_msg,"AttrProp::get_val",Tango::ERR); + TANGO_THROW_EXCEPTION(API_AttrPropValueNotSet, err_msg); } return val; } @@ -413,7 +413,7 @@ class DoubleAttrProp if(is_value == false) { std::string err_msg = "Numeric representation of the property's value (" + str + ") has not been set"; - Tango::Except::throw_exception(API_AttrPropValueNotSet,err_msg,"AttrProp::get_val",Tango::ERR); + TANGO_THROW_EXCEPTION(API_AttrPropValueNotSet, err_msg); } return val; } diff --git a/cppapi/server/attrsetval.cpp b/cppapi/server/attrsetval.cpp index c672ca407..00be84797 100644 --- a/cppapi/server/attrsetval.cpp +++ b/cppapi/server/attrsetval.cpp @@ -83,7 +83,7 @@ void Attribute::set_value(Tango::DevShort *p_data,long x,long y,bool release) std::stringstream ss; ss << "Invalid data type for attribute " << name; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } // @@ -97,7 +97,7 @@ void Attribute::set_value(Tango::DevShort *p_data,long x,long y,bool release) std::stringstream ss; ss << "Data size for attribute " << name << " exceeds given limit"; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } // @@ -131,7 +131,7 @@ void Attribute::set_value(Tango::DevShort *p_data,long x,long y,bool release) std::stringstream ss; ss << "Attribute " << name << " data type is enum but no enum labels are defined!"; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } int max_val = enum_labels.size() - 1; @@ -145,7 +145,7 @@ void Attribute::set_value(Tango::DevShort *p_data,long x,long y,bool release) ss << "Wrong value for attribute " << name; ss << ". Element " << i << " (value = " << p_data[i] << ") is negative or above the limit defined by the enum (" << max_val << ")."; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } } } @@ -223,9 +223,7 @@ void Attribute::set_value(Tango::DevLong *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp, - o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -239,8 +237,7 @@ void Attribute::set_value(Tango::DevLong *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -337,9 +334,7 @@ void Attribute::set_value(Tango::DevLong64 *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp, - o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -353,8 +348,7 @@ void Attribute::set_value(Tango::DevLong64 *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -451,8 +445,7 @@ void Attribute::set_value(Tango::DevFloat *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -466,8 +459,7 @@ void Attribute::set_value(Tango::DevFloat *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -563,8 +555,7 @@ void Attribute::set_value(Tango::DevDouble *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -578,8 +569,7 @@ void Attribute::set_value(Tango::DevDouble *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -675,8 +665,7 @@ void Attribute::set_value(Tango::DevString *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -690,8 +679,7 @@ void Attribute::set_value(Tango::DevString *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -815,8 +803,7 @@ void Attribute::set_value(Tango::DevUShort *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -830,8 +817,7 @@ void Attribute::set_value(Tango::DevUShort *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -928,8 +914,7 @@ void Attribute::set_value(Tango::DevBoolean *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -943,8 +928,7 @@ void Attribute::set_value(Tango::DevBoolean *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -1042,8 +1026,7 @@ void Attribute::set_value(Tango::DevUChar *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -1057,8 +1040,7 @@ void Attribute::set_value(Tango::DevUChar *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -1153,9 +1135,7 @@ void Attribute::set_value(Tango::DevULong *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp, - o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -1169,8 +1149,7 @@ void Attribute::set_value(Tango::DevULong *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -1266,9 +1245,7 @@ void Attribute::set_value(Tango::DevULong64 *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp, - o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -1282,8 +1259,7 @@ void Attribute::set_value(Tango::DevULong64 *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -1379,9 +1355,7 @@ void Attribute::set_value(Tango::DevState *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp, - o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -1395,8 +1369,7 @@ void Attribute::set_value(Tango::DevState *p_data,long x,long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } @@ -1493,8 +1466,7 @@ void Attribute::set_value(Tango::DevEncoded *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -1508,8 +1480,7 @@ void Attribute::set_value(Tango::DevEncoded *p_data,long x, long y,bool release) TangoSys_OMemStream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -1588,8 +1559,7 @@ void Attribute::set_value(Tango::DevString *p_data_str,Tango::DevUChar *p_data,l { TangoSys_OMemStream o; o << "Data pointer for attribute " << name << " is NULL!" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } if (release == false) @@ -1622,16 +1592,14 @@ void Attribute::set_value(Tango::EncodedAttribute *attr) { TangoSys_OMemStream o; o << "DevEncoded format for attribute " << name << " not specified" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } if( size==0 || !d ) { TangoSys_OMemStream o; o << "DevEncoded data for attribute " << name << " not specified" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } set_value(f,d,size,false); diff --git a/cppapi/server/attrsetval.tpp b/cppapi/server/attrsetval.tpp index c68417a87..17f09afd2 100644 --- a/cppapi/server/attrsetval.tpp +++ b/cppapi/server/attrsetval.tpp @@ -74,7 +74,7 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) std::stringstream o; o << "Invalid data type for attribute " << name << std::ends; - Except::throw_exception(API_AttrOptProp,o.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } bool short_enum = std::is_same::type>::value; @@ -88,7 +88,7 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) ss << "Invalid enumeration type. Supported types are C++11 scoped enum with short as underlying data type\n"; ss << "or old enum"; - Except::throw_exception(API_IncompatibleArgumentType,ss.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleArgumentType, ss.str()); } // @@ -98,9 +98,7 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) if (std::is_enum::value == false) { SAFE_DELETE(enum_ptr); - Except::throw_exception(API_IncompatibleArgumentType, - "The input argument data type is not an enumeration", - "Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleArgumentType, "The input argument data type is not an enumeration"); } // @@ -114,7 +112,7 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) std::stringstream ss; ss << "Attribute " << name << " data type is enum but no enum labels are defined!"; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } // @@ -132,7 +130,7 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) std::stringstream ss; ss << "Invalid enumeration type. Requested enum type is " << att.get_enum_type(); - Except::throw_exception(API_IncompatibleArgumentType,ss.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleArgumentType, ss.str()); } // @@ -146,7 +144,7 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) std::stringstream o; o << "Data size for attribute " << name << " exceeds given limit" << std::ends; - Except::throw_exception(API_AttrOptProp,o.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } // @@ -195,7 +193,7 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) ss << ". Element " << i << " (value = " << loc_enum_ptr[i] << ") is negative or above the limit defined by the enum (" << max_val << ")."; delete [] loc_enum_ptr; - Except::throw_exception(API_AttrOptProp,ss.str(),"Attribute::set_value()"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } } diff --git a/cppapi/server/basiccommand.cpp b/cppapi/server/basiccommand.cpp index d4c54e24c..3e25ed7ca 100644 --- a/cppapi/server/basiccommand.cpp +++ b/cppapi/server/basiccommand.cpp @@ -87,9 +87,7 @@ CORBA::Any *DevStatusCmd::execute(DeviceImpl *device, TANGO_UNUSED(const CORBA:: } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DevStatus::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } try @@ -151,9 +149,7 @@ CORBA::Any *DevStateCmd::execute(DeviceImpl *device, TANGO_UNUSED(const CORBA::A } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DevStatus::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } try @@ -293,9 +289,7 @@ CORBA::Any *DevInitCmd::execute(DeviceImpl *device, TANGO_UNUSED(const CORBA::An dc->set_memorized_values(false,loop,true); else { - Tango::Except::throw_exception((const char *)API_DeviceNotFound, - (const char *)"Can't find new device in device list", - (const char *)"DevInitCmd::execute()"); + TANGO_THROW_EXCEPTION(API_DeviceNotFound, "Can't find new device in device list"); } } @@ -314,8 +308,7 @@ CORBA::Any *DevInitCmd::execute(DeviceImpl *device, TANGO_UNUSED(const CORBA::An o << "\nDevice server adm. device name = dserver/"; o << tg->get_ds_name().c_str() << std::ends; - Except::re_throw_exception(e,(const char *)API_InitThrowsException,o.str(), - (const char *)"DevInitCmd::execute()"); + TANGO_RETHROW_EXCEPTION(e, API_InitThrowsException, o.str()); } // diff --git a/cppapi/server/blackbox.cpp b/cppapi/server/blackbox.cpp index ffeb358e7..aa635787a 100644 --- a/cppapi/server/blackbox.cpp +++ b/cppapi/server/blackbox.cpp @@ -1835,17 +1835,13 @@ Tango::DevVarStringArray *BlackBox::read(long wanted_elt) { sync.unlock(); - Except::throw_exception((const char *) API_BlackBoxArgument, - (const char *) "Argument to read black box out of range", - (const char *) "BlackBox::read"); + TANGO_THROW_EXCEPTION(API_BlackBoxArgument, "Argument to read black box out of range"); } if (nb_elt == 0) { sync.unlock(); - Except::throw_exception((const char *) API_BlackBoxEmpty, - (const char *) "Nothing stored yet in black-box", - (const char *) "BlackBox::read"); + TANGO_THROW_EXCEPTION(API_BlackBoxEmpty, "Nothing stored yet in black-box"); } // @@ -1898,9 +1894,7 @@ Tango::DevVarStringArray *BlackBox::read(long wanted_elt) { sync.unlock(); - Except::throw_exception((const char *) API_MemoryAllocation, - (const char *) "Can't allocate memory in server", - (const char *) "BlackBox::read"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // diff --git a/cppapi/server/classattribute.cpp b/cppapi/server/classattribute.cpp index 0d316e1c5..610b7c5ab 100644 --- a/cppapi/server/classattribute.cpp +++ b/cppapi/server/classattribute.cpp @@ -124,9 +124,7 @@ void AttrProperty::convert(const char *prop_name) { std::stringstream ss; ss << "Can't convert property value for property " << prop_name; - Except::throw_exception(API_AttrOptProp, - ss.str(), - "AttrProperty::convert"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, ss.str()); } } @@ -232,9 +230,7 @@ void MultiClassAttribute::init_class_attribute(std::string &class_name,long base TangoSys_OMemStream o; o << "Can't get class attribute properties for class " << class_name << std::ends; - Except::re_throw_exception(e,(const char *)API_DatabaseAccess, - o.str(), - (const char *)"MultiClassAttribute::init_class_attribute"); + TANGO_RETHROW_EXCEPTION(e, API_DatabaseAccess, o.str()); } // @@ -286,9 +282,7 @@ void MultiClassAttribute::init_class_attribute(std::string &class_name,long base TangoSys_OMemStream o; o << "Attribute " << attr_name << " not found in class attribute(s)" << std::ends; - Except::throw_exception((const char *)API_AttrNotFound, - o.str(), - (const char *)"MultiClassAttribute::init_class_attribute"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, o.str()); } // @@ -343,8 +337,7 @@ Attr &MultiClassAttribute::get_attr(std::string &attr_name) TangoSys_OMemStream o; o << "Attribute " << attr_name << " not found in class attribute(s)" << std::ends; - Except::throw_exception((const char *)API_AttrOptProp,o.str(), - (const char *)"MultiClassAttribute::get_attr"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str()); } return *(*pos); diff --git a/cppapi/server/classpipe.cpp b/cppapi/server/classpipe.cpp index 7b89cc556..a6eca9798 100644 --- a/cppapi/server/classpipe.cpp +++ b/cppapi/server/classpipe.cpp @@ -133,8 +133,7 @@ void MultiClassPipe::init_class_pipe(DeviceClass *cl_ptr) std::stringstream ss; ss << "Can't get class pipe properties for class " << class_name; - Except::re_throw_exception(e,API_DatabaseAccess,ss.str(), - "MultiClassPipe::init_class_pipe"); + TANGO_RETHROW_EXCEPTION(e, API_DatabaseAccess, ss.str()); } // @@ -206,7 +205,7 @@ std::vector &MultiClassPipe::get_prop_list(const std::strin std::stringstream ss; ss << "Pipe " << pipe_name << " not found in class pipe(s) properties" << std::ends; - Except::throw_exception(API_PipeNotFound,ss.str(),"MultiClassPipe::get_prop_list"); + TANGO_THROW_EXCEPTION(API_PipeNotFound, ss.str()); } return ite->second; diff --git a/cppapi/server/command.cpp b/cppapi/server/command.cpp index 3351aa944..e36e0dfba 100644 --- a/cppapi/server/command.cpp +++ b/cppapi/server/command.cpp @@ -159,9 +159,7 @@ namespace Tango { TangoSys_OMemStream o; o << "Incompatible command argument type, expected type is : Tango::" << type << std::ends; - Except::throw_exception((const char *) API_IncompatibleCmdArgumentType, - o.str(), - (const char *) "Command::extract()"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, o.str()); } void Command::extract(const CORBA::Any &in, Tango::DevBoolean &data) { @@ -308,9 +306,7 @@ namespace Tango { any_ptr = new CORBA::Any(); } catch (std::bad_alloc &) { - Except::throw_exception((const char *) API_MemoryAllocation, - (const char *) "Can't allocate memory in server", - (const char *) "Command::alloc_any()"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } } @@ -903,8 +899,7 @@ namespace Tango { TangoSys_OMemStream o; o << "Command " << name << " defined with an unsupported type" << std::ends; - Except::throw_exception((const char *) API_CmdArgumentTypeNotSupported, - o.str(), (const char *) "TemplCommand::set_type"); + TANGO_THROW_EXCEPTION(API_CmdArgumentTypeNotSupported, o.str()); } } diff --git a/cppapi/server/coutbuf.cpp b/cppapi/server/coutbuf.cpp index 593978ee2..5ab1de1ab 100644 --- a/cppapi/server/coutbuf.cpp +++ b/cppapi/server/coutbuf.cpp @@ -151,9 +151,7 @@ void CoutBuf::CreateWin(LPCSTR svc_name) if (!hWndDebug) { - Except::throw_exception((LPCSTR)API_NtDebugWindowError, - (LPCSTR)"Can't create debug window", - (LPCSTR)"CoutBuf::CoutBuf"); + TANGO_THROW_EXCEPTION((LPCSTR)API_NtDebugWindowError, (LPCSTR)"Can't create debug window"); } DbgWin = hWndDebug; } diff --git a/cppapi/server/dev_poll.cpp b/cppapi/server/dev_poll.cpp index 38e8f7adc..fd7416512 100644 --- a/cppapi/server/dev_poll.cpp +++ b/cppapi/server/dev_poll.cpp @@ -436,9 +436,7 @@ void DeviceImpl::poll_object(const std::string &obj_name,int period,PollObjType if (tg->is_svr_shutting_down() == true) { - Except::throw_exception((const char *)API_NotSupported, - (const char *)"It's not supported to start polling on any device cmd/attr while the device is shutting down", - (const char *)"DeviceImpl::poll_object"); + TANGO_THROW_EXCEPTION(API_NotSupported, "It's not supported to start polling on any device cmd/attr while the device is shutting down"); } if (tg->is_svr_starting() == true) @@ -453,8 +451,7 @@ void DeviceImpl::poll_object(const std::string &obj_name,int period,PollObjType { TangoSys_OMemStream o; o << period << " is below the min authorized period (" << MIN_POLL_PERIOD << " mS)" << std::ends; - Except::throw_exception((const char *)API_NotSupported,o.str(), - (const char *)"DeviceImpl::poll_object"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } // diff --git a/cppapi/server/device.cpp b/cppapi/server/device.cpp index 848cf9a9d..f3ee215f4 100644 --- a/cppapi/server/device.cpp +++ b/cppapi/server/device.cpp @@ -258,8 +258,7 @@ void DeviceImpl::stop_polling(bool with_db_upd) { TangoSys_OMemStream o; o << "Can't find a polling thread for device " << device_name << std::ends; - Except::throw_exception((const char *) API_PollingThreadNotFound, o.str(), - (const char *) "DeviImpl::stop_polling"); + TANGO_THROW_EXCEPTION(API_PollingThreadNotFound, o.str()); } th_info = tg->get_polling_thread_info_by_id(poll_th_id); @@ -290,9 +289,7 @@ void DeviceImpl::stop_polling(bool with_db_upd) if ((shared_cmd.cmd_pending == true) && (interupted == false)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception((const char *) API_CommandTimedOut, - (const char *) "Polling thread blocked !!", - (const char *) "DeviceImpl::stop_polling"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked !!"); } } @@ -314,8 +311,7 @@ void DeviceImpl::stop_polling(bool with_db_upd) { TangoSys_OMemStream o; o << "Can't find entry for device " << device_name << " in polling threads pool configuration !" << std::ends; - Except::throw_exception((const char *) API_PolledDeviceNotInPoolConf, o.str(), - (const char *) "DeviceImpl::stop_polling"); + TANGO_THROW_EXCEPTION(API_PolledDeviceNotInPoolConf, o.str()); } std::vector &pool_conf = tg->get_poll_pool_conf(); @@ -556,9 +552,7 @@ void DeviceImpl::get_dev_system_resource() TangoSys_OMemStream o; o << "Database error while trying to retrieve device prperties for device " << device_name.c_str() << std::ends; - Except::throw_exception((const char *) API_DatabaseAccess, - o.str(), - (const char *) "DeviceImpl::get_dev_system_resource"); + TANGO_THROW_EXCEPTION(API_DatabaseAccess, o.str()); } if (db_data[0].is_empty() == false) @@ -610,9 +604,7 @@ void DeviceImpl::get_dev_system_resource() cmd_poll_ring_depth.clear(); TangoSys_OMemStream o; o << "System property cmd_poll_ring_depth for device " << device_name << " has wrong syntax" << std::ends; - Except::throw_exception((const char *) API_BadConfigurationProperty, - o.str(), - (const char *) "DeviceImpl::get_dev_system_resource()"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } for (unsigned int i = 0; i < nb_prop; i = i + 2) { @@ -631,9 +623,7 @@ void DeviceImpl::get_dev_system_resource() attr_poll_ring_depth.clear(); TangoSys_OMemStream o; o << "System property attr_poll_ring_depth for device " << device_name << " has wrong syntax" << std::ends; - Except::throw_exception((const char *) API_BadConfigurationProperty, - o.str(), - (const char *) "DeviceImpl::get_dev_system_resource()"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } for (unsigned int i = 0; i < nb_prop; i = i + 2) { @@ -662,9 +652,7 @@ void DeviceImpl::get_dev_system_resource() cmd_min_poll_period.clear(); TangoSys_OMemStream o; o << "System property cmd_min_poll_period for device " << device_name << " has wrong syntax" << std::ends; - Except::throw_exception((const char *) API_BadConfigurationProperty, - o.str(), - (const char *) "DeviceImpl::get_dev_system_resource()"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } for (unsigned int i = 0; i < nb_prop; i = i + 2) { @@ -684,9 +672,7 @@ void DeviceImpl::get_dev_system_resource() attr_min_poll_period.clear(); TangoSys_OMemStream o; o << "System property attr_min_poll_period for device " << device_name << " has wrong syntax" << std::ends; - Except::throw_exception((const char *) API_BadConfigurationProperty, - o.str(), - (const char *) "DeviceImpl::get_dev_system_resource()"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } for (unsigned int i = 0; i < nb_prop; i = i + 2) { @@ -821,8 +807,7 @@ void DeviceImpl::check_command_exists(const std::string &cmd_name) { TangoSys_OMemStream o; o << "Command " << cmd_name << " cannot be polled because it needs input value" << std::ends; - Except::throw_exception((const char *) API_IncompatibleCmdArgumentType, - o.str(), (const char *) "DeviceImpl::check_command_exists"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, o.str()); } return; } @@ -830,8 +815,7 @@ void DeviceImpl::check_command_exists(const std::string &cmd_name) TangoSys_OMemStream o; o << "Command " << cmd_name << " not found" << std::ends; - Except::throw_exception((const char *) API_CommandNotFound, o.str(), - (const char *) "DeviceImpl::check_command_exists"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } //+------------------------------------------------------------------------- @@ -860,8 +844,7 @@ Command *DeviceImpl::get_command(const std::string &cmd_name) TangoSys_OMemStream o; o << "Command " << cmd_name << " not found" << std::ends; - Except::throw_exception((const char *) API_CommandNotFound, o.str(), - (const char *) "DeviceImpl::get_command"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); // // This piece of code is added for VC++ compiler. As they advice, I have try to @@ -907,8 +890,7 @@ std::vector::iterator DeviceImpl::get_polled_obj_by_type_name( TangoSys_OMemStream o; o << obj_name << " not found in list of polled object" << std::ends; - Except::throw_exception((const char *) API_PollObjNotFound, o.str(), - (const char *) "DeviceImpl::get_polled_obj_by_type_name"); + TANGO_THROW_EXCEPTION(API_PollObjNotFound, o.str()); } //+----------------------------------------------------------------------------------------------------------------- @@ -966,9 +948,7 @@ long DeviceImpl::get_cmd_poll_ring_depth(std::string &cmd_name) TangoSys_OMemStream o; o << "System property cmd_poll_ring_depth for device " << device_name << " has wrong syntax" << std::ends; - Except::throw_exception((const char *) API_BadConfigurationProperty, - o.str(), - (const char *) "DeviceImpl::get_poll_ring_depth()"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } break; } @@ -1057,9 +1037,7 @@ long DeviceImpl::get_attr_poll_ring_depth(std::string &attr_name) TangoSys_OMemStream o; o << "System property attr_poll_ring_depth for device " << device_name << " has wrong syntax" << std::ends; - Except::throw_exception((const char *) API_BadConfigurationProperty, - o.str(), - (const char *) "DeviceImpl::get_poll_ring_depth()"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } break; } @@ -1254,8 +1232,7 @@ Tango::DevState DeviceImpl::dev_state() o << " has not been updated"; o << "Hint: Did the server follow Tango V5 attribute reading framework ?" << std::ends; - Except::throw_exception((const char *) API_AttrValueNotSet, o.str(), - (const char *) "DeviceImpl::dev_state"); + TANGO_THROW_EXCEPTION(API_AttrValueNotSet, o.str()); } } } @@ -1984,9 +1961,7 @@ Tango::DevCmdInfoList *DeviceImpl::command_list_query() } catch (std::bad_alloc &) { - Except::throw_exception((const char *) API_MemoryAllocation, - (const char *) "Can't allocate memory in server", - (const char *) "DeviceImpl::command_list_query"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -2033,9 +2008,7 @@ Tango::DevCmdInfo *DeviceImpl::command_query(const char *command) } catch (std::bad_alloc &) { - Except::throw_exception((const char *) API_MemoryAllocation, - (const char *) "Can't allocate memory in server", - (const char *) "DeviceImpl::command_query"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -2086,9 +2059,7 @@ Tango::DevCmdInfo *DeviceImpl::command_query(const char *command) TangoSys_OMemStream o; o << "Command " << command << " not found" << std::ends; - Except::throw_exception((const char *) API_CommandNotFound, - o.str(), - (const char *) "DeviceImpl::command_query"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } // @@ -2131,9 +2102,7 @@ Tango::DevInfo *DeviceImpl::info() } catch (std::bad_alloc &) { - Except::throw_exception((const char *) API_MemoryAllocation, - (const char *) "Can't allocate memory in server", - (const char *) "DeviceImpl::info"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -2317,9 +2286,7 @@ Tango::AttributeConfigList *DeviceImpl::get_attribute_config(const Tango::DevVar } catch (std::bad_alloc &) { - Except::throw_exception((const char *) API_MemoryAllocation, - (const char *) "Can't allocate memory in server", - (const char *) "DeviceImpl::get_attribute_config"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -2403,9 +2370,7 @@ void DeviceImpl::set_attribute_config(const Tango::AttributeConfigList &new_conf long nb_dev_attr = dev_attr->get_attr_nb(); if (nb_dev_attr == 0) { - Except::throw_exception((const char *) API_AttrNotFound, - (const char *) "The device does not have any attribute", - (const char *) "DeviceImpl::set_attribute_config"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, "The device does not have any attribute"); } // @@ -2424,9 +2389,7 @@ void DeviceImpl::set_attribute_config(const Tango::AttributeConfigList &new_conf std::transform(tmp_name.begin(), tmp_name.end(), tmp_name.begin(), ::tolower); if ((tmp_name == "state") || (tmp_name == "status")) { - Except::throw_exception((const char *) API_AttrNotFound, - (const char *) "Cannot set config for attribute state or status", - (const char *) "DeviceImpl::set_attribute_config"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, "Cannot set config for attribute state or status"); } Attribute &attr = dev_attr->get_attr_by_name(new_conf[i].name); @@ -2586,9 +2549,7 @@ Tango::AttributeValueList *DeviceImpl::read_attributes(const Tango::DevVarString if (nb_dev_attr == 0) { - Except::throw_exception((const char *) API_AttrNotFound, - (const char *) "The device does not have any attribute", - (const char *) "DeviceImpl::read_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, "The device does not have any attribute"); } if (vers >= 3) { @@ -2658,9 +2619,7 @@ Tango::AttributeValueList *DeviceImpl::read_attributes(const Tango::DevVarString o << "Client too old to get data for attribute " << real_names[i].in(); o << ".\nPlease, use a client linked with Tango V5"; o << " and a device inheriting from Device_3Impl" << std::ends; - Except::throw_exception((const char *) API_NotSupportedFeature, - o.str(), - (const char *) "DeviceImpl::read_attributes"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } att.set_value_flag(false); att.get_when().tv_sec = 0; @@ -2678,9 +2637,7 @@ Tango::AttributeValueList *DeviceImpl::read_attributes(const Tango::DevVarString o << "Client too old to get data for attribute " << real_names[i].in(); o << ".\nPlease, use a client linked with Tango V5"; o << " and a device inheriting from Device_3Impl" << std::ends; - Except::throw_exception((const char *) API_NotSupportedFeature, - o.str(), - (const char *) "DeviceImpl::read_attributes"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } } else @@ -2733,9 +2690,7 @@ Tango::AttributeValueList *DeviceImpl::read_attributes(const Tango::DevVarString o << "It is not possible to read state/status as attributes with your\n"; o << "Tango software release. Please, re-link with Tango V5." << std::ends; - Except::throw_exception((const char *) API_NotSupportedFeature, - o.str(), - (const char *) "Device_Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } if (attr_vect[idx]->is_allowed(this, Tango::READ_REQ) == false) @@ -2745,9 +2700,7 @@ Tango::AttributeValueList *DeviceImpl::read_attributes(const Tango::DevVarString o << "It is currently not allowed to read attribute "; o << att.get_name() << std::ends; - Except::throw_exception((const char *) API_AttrNotAllowed, - o.str(), - (const char *) "Device_Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, o.str()); } attr_vect[idx]->read(this, att); } @@ -2778,9 +2731,7 @@ Tango::AttributeValueList *DeviceImpl::read_attributes(const Tango::DevVarString } catch (std::bad_alloc &) { - Except::throw_exception((const char *) API_MemoryAllocation, - (const char *) "Can't allocate memory in server", - (const char *) "DeviceImpl::read_attributes"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -2832,9 +2783,7 @@ Tango::AttributeValueList *DeviceImpl::read_attributes(const Tango::DevVarString o << " has not been updated" << std::ends; } - Except::throw_exception((const char *) API_AttrValueNotSet, - o.str(), - (const char *) "DeviceImpl::read_attributes"); + TANGO_THROW_EXCEPTION(API_AttrValueNotSet, o.str()); } else { @@ -3040,9 +2989,7 @@ void DeviceImpl::write_attributes(const Tango::AttributeValueList &values) long nb_dev_attr = dev_attr->get_attr_nb(); if (nb_dev_attr == 0) { - Except::throw_exception((const char *) API_AttrNotFound, - (const char *) "The device does not have any attribute", - (const char *) "DeviceImpl::write_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, "The device does not have any attribute"); } // @@ -3073,9 +3020,7 @@ void DeviceImpl::write_attributes(const Tango::AttributeValueList &values) o << dev_attr->get_attr_by_ind(updated_attr[i]).get_name(); o << " is not writable" << std::ends; - Except::throw_exception((const char *) API_AttrNotWritable, - o.str(), - (const char *) "DeviceImpl::write_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotWritable, o.str()); } } @@ -3138,9 +3083,7 @@ void DeviceImpl::write_attributes(const Tango::AttributeValueList &values) o << ". The device state is " << Tango::DevStateName[get_state()] << std::ends; - Except::throw_exception((const char *) API_AttrNotAllowed, - o.str(), - (const char *) "Device_Impl::write_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, o.str()); } attr_vect[att.get_attr_idx()]->write(this, att); att.copy_data(values[i].value); @@ -3162,9 +3105,7 @@ void DeviceImpl::write_attributes(const Tango::AttributeValueList &values) } catch (Tango::DevFailed &e) { - Except::re_throw_exception(e, (const char *) API_AttrNotAllowed, - (const char *) "Failed to store memorized attribute value in db", - (const char *) "Device_Impl::write_attributes"); + TANGO_RETHROW_EXCEPTION(e, API_AttrNotAllowed, "Failed to store memorized attribute value in db"); } } } @@ -3249,9 +3190,7 @@ void DeviceImpl::add_attribute(Tango::Attr *new_attr) << " already exists for your device but with other definition"; o << "\n(data type, data format or data write type)" << std::ends; - Except::throw_exception((const char *) API_AttrNotFound, - o.str(), - (const char *) "DeviceImpl::add_attribute"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, o.str()); } if (already_there == true) @@ -3331,9 +3270,7 @@ void DeviceImpl::add_attribute(Tango::Attr *new_attr) << " already exists for your device class but with other definition"; o << "\n(data type, data format or data write type)" << std::ends; - Except::throw_exception((const char *) API_AttrNotFound, - o.str(), - (const char *) "DeviceImpl::add_attribute"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, o.str()); } } @@ -3420,9 +3357,7 @@ void DeviceImpl::remove_attribute(Tango::Attr *rem_attr, bool free_it, bool clea o << "Attribute " << attr_name << " is not defined as attribute for your device."; o << "\nCan't remove it" << std::ends; - Except::throw_exception((const char *) API_AttrNotFound, - o.str(), - (const char *) "DeviceImpl::remove_attribute"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, o.str()); } // @@ -3628,9 +3563,7 @@ void DeviceImpl::remove_attribute(std::string &rem_attr_name, bool free_it, bool o << "Attribute " << rem_attr_name << " is not defined as attribute for your device."; o << "\nCan't remove it" << std::ends; - Except::re_throw_exception(e, (const char *) API_AttrNotFound, - o.str(), - (const char *) "DeviceImpl::remove_attribute"); + TANGO_RETHROW_EXCEPTION(e, API_AttrNotFound, o.str()); } } @@ -3709,7 +3642,7 @@ void DeviceImpl::add_command(Tango::Command *new_cmd, bool device_level) << " already exists for your device but with other definition"; o << "\n(command input data type or command output data type)" << std::ends; - Except::throw_exception(API_CommandNotFound, o.str(), "DeviceImpl::add_command"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } if (already_there == true) @@ -3815,7 +3748,7 @@ void DeviceImpl::remove_command(Tango::Command *rem_cmd, bool free_it, bool clea o << "Command " << cmd_name << " is not defined as command for your device."; o << "\nCan't remove it" << std::ends; - Except::throw_exception(API_CommandNotFound, o.str(), "DeviceImpl::remove_command"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } } @@ -3976,7 +3909,7 @@ void DeviceImpl::remove_command(const std::string &rem_cmd_name, bool free_it, b o << "Command " << rem_cmd_name << " is not defined as a command for your device."; o << "\nCan't remove it" << std::ends; - Except::re_throw_exception(e, API_CommandNotFound, o.str(), "DeviceImpl::remove_command"); + TANGO_RETHROW_EXCEPTION(e, API_CommandNotFound, o.str()); } } @@ -4080,9 +4013,7 @@ void DeviceImpl::init_cmd_poll_ext_trig(std::string cmd_name) TangoSys_OMemStream o; o << "State and status are handled as attributes for the polling" << std::ends; - Except::throw_exception((const char *) API_CommandNotFound, - o.str(), - (const char *) "DeviceImpl::init_poll_ext_trig"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } // @@ -4617,8 +4548,7 @@ void DeviceImpl::lock(client_addr *cl, int validity) { TangoSys_OMemStream o; o << "Device " << get_name() << " is already locked by another client" << std::ends; - Except::throw_exception((const char *) API_DeviceLocked, o.str(), - (const char *) "Device_Impl::lock"); + TANGO_THROW_EXCEPTION(API_DeviceLocked, o.str()); } } else @@ -4682,8 +4612,7 @@ void DeviceImpl::relock(client_addr *cl) TangoSys_OMemStream o; o << get_name() << ": "; o << "Device " << get_name() << " is already locked by another client" << std::ends; - Except::throw_exception((const char *) API_DeviceLocked, o.str(), - (const char *) "Device_Impl::relock"); + TANGO_THROW_EXCEPTION(API_DeviceLocked, o.str()); } device_locked = true; @@ -4694,8 +4623,7 @@ void DeviceImpl::relock(client_addr *cl) TangoSys_OMemStream o; o << get_name() << ": "; o << "Device " << get_name() << " is not locked. Can't re-lock it" << std::ends; - Except::throw_exception((const char *) API_DeviceNotLocked, o.str(), - (const char *) "Device_Impl::relock"); + TANGO_THROW_EXCEPTION(API_DeviceNotLocked, o.str()); } } else @@ -4703,8 +4631,7 @@ void DeviceImpl::relock(client_addr *cl) TangoSys_OMemStream o; o << get_name() << ": "; o << "Device " << get_name() << " is not locked. Can't re-lock it" << std::ends; - Except::throw_exception((const char *) API_DeviceNotLocked, o.str(), - (const char *) "Device_Impl::relock"); + TANGO_THROW_EXCEPTION(API_DeviceNotLocked, o.str()); } } @@ -4742,8 +4669,7 @@ Tango::DevLong DeviceImpl::unlock(bool forced) { TangoSys_OMemStream o; o << "Device " << get_name() << " is locked by another client, can't unlock it" << std::ends; - Except::throw_exception((const char *) API_DeviceLocked, o.str(), - (const char *) "Device_Impl::unlock"); + TANGO_THROW_EXCEPTION(API_DeviceLocked, o.str()); } } } @@ -5022,7 +4948,7 @@ void DeviceImpl::check_lock(const char *meth, const char *cmd) TangoSys_OMemStream o2; o << "Device " << get_name() << " has been unlocked by an administrative client!!!" << std::ends; o2 << "Device_Impl::" << meth << std::ends; - Except::throw_exception((const char *) DEVICE_UNLOCKED_REASON, o.str(), o2.str()); + Except::throw_exception(DEVICE_UNLOCKED_REASON, o.str(), o2.str()); } delete old_locker_client; old_locker_client = NULL; @@ -5050,7 +4976,7 @@ void DeviceImpl::throw_locked_exception(const char *meth) TangoSys_OMemStream o2; o << "Device " << get_name() << " is locked by another client" << std::ends; o2 << "Device_Impl::" << meth << std::ends; - Except::throw_exception((const char *) API_DeviceLocked, o.str(), o2.str()); + Except::throw_exception(API_DeviceLocked, o.str(), o2.str()); } //+------------------------------------------------------------------------------------------------------------------ @@ -5815,7 +5741,7 @@ bool DeviceImpl::is_there_subscriber(const std::string &att_name, EventType even break; default: - Except::throw_exception(API_UnsupportedFeature, "Unsupported event type", "Device::get_cmd_by_name"); + TANGO_THROW_EXCEPTION(API_UnsupportedFeature, "Unsupported event type"); break; } @@ -5971,7 +5897,7 @@ Command &DeviceImpl::get_local_cmd_by_name(const std::string &cmd_name) TangoSys_OMemStream o; o << cmd_name << " command not found" << std::ends; - Except::throw_exception(API_CommandNotFound, o.str(), "Device::get_cmd_by_name"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } return *(*pos); @@ -6007,9 +5933,7 @@ void DeviceImpl::remove_local_command(const std::string &cmd_name) TangoSys_OMemStream o; o << cmd_name << " command not found" << std::ends; - Except::throw_exception((const char *) API_CommandNotFound, - o.str(), - (const char *) "DeviceImpl::remove_local_command"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } command_list.erase(pos); @@ -6137,8 +6061,7 @@ void DeviceImpl::push_dev_intr(bool ev_client) if ((devintr_shared.cmd_pending == true) && (interupted == 0)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception(API_CommandTimedOut, "Device interface change event thread blocked !!!", - "DeviceImpl::push_dev_intr"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Device interface change event thread blocked !!!"); } } } @@ -6212,7 +6135,7 @@ void DeviceImpl::end_pipe_config() std::stringstream ss; ss << "Can't get device pipe properties for device " << device_name << std::ends; - Except::throw_exception(API_DatabaseAccess, ss.str(), "DeviceImpl::end_pipe_config"); + TANGO_THROW_EXCEPTION(API_DatabaseAccess, ss.str()); } // diff --git a/cppapi/server/device_2.cpp b/cppapi/server/device_2.cpp index 77fbea2da..aa4081f43 100644 --- a/cppapi/server/device_2.cpp +++ b/cppapi/server/device_2.cpp @@ -232,9 +232,7 @@ CORBA::Any *Device_2Impl::command_inout_2(const char *in_cmd, { TangoSys_OMemStream o; o << "Command " << in_cmd << " not polled" << std::ends; - Except::throw_exception((const char *)API_CmdNotPolled, - o.str(), - (const char *)"Device_2Impl::command_inout"); + TANGO_THROW_EXCEPTION(API_CmdNotPolled, o.str()); } /* @@ -259,9 +257,7 @@ CORBA::Any *Device_2Impl::command_inout_2(const char *in_cmd, { TangoSys_OMemStream o; o << "Command " << in_cmd << " not polled" << std::ends; - Except::throw_exception((const char *)API_CmdNotPolled, - o.str(), - (const char *)"Device_2Impl::command_inout"); + TANGO_THROW_EXCEPTION(API_CmdNotPolled, o.str()); } else { @@ -322,9 +318,7 @@ CORBA::Any *Device_2Impl::command_inout_2(const char *in_cmd, { TangoSys_OMemStream o; o << "No data available in cache for command " << in_cmd << std::ends; - Except::throw_exception((const char *)API_NoDataYet, - o.str(), - (const char *)"Device_2Impl::command_inout"); + TANGO_THROW_EXCEPTION(API_NoDataYet, o.str()); } // @@ -353,9 +347,7 @@ CORBA::Any *Device_2Impl::command_inout_2(const char *in_cmd, TangoSys_OMemStream o; o << "Data in cache for command " << in_cmd; o << " not updated any more" << std::ends; - Except::throw_exception((const char *)API_NotUpdatedAnyMore, - o.str(), - (const char *)"Device_2Impl::command_inout"); + TANGO_THROW_EXCEPTION(API_NotUpdatedAnyMore, o.str()); } } } @@ -602,9 +594,7 @@ Tango::AttributeValueList* Device_2Impl::read_attributes_2(const Tango::DevVarSt { TangoSys_OMemStream o; o << "Attribute " << real_names[non_polled[i]] << " not polled" << std::ends; - Except::throw_exception((const char *)API_AttrNotPolled, - o.str(), - (const char *)"Device_2Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotPolled, o.str()); } else { @@ -624,9 +614,7 @@ Tango::AttributeValueList* Device_2Impl::read_attributes_2(const Tango::DevVarSt { TangoSys_OMemStream o; o << "Attribute " << real_names[non_polled[i]] << " not polled" << std::ends; - Except::throw_exception((const char *)API_AttrNotPolled, - o.str(), - (const char *)"Device_2Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotPolled, o.str()); } } } @@ -686,9 +674,7 @@ Tango::AttributeValueList* Device_2Impl::read_attributes_2(const Tango::DevVarSt catch (std::bad_alloc &) { back = NULL; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DeviceImpl_2::read_attributes"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -727,9 +713,7 @@ Tango::AttributeValueList* Device_2Impl::read_attributes_2(const Tango::DevVarSt TangoSys_OMemStream o; o << "No data available in cache for attribute " << real_names[i] << std::ends; - Except::throw_exception((const char *)API_NoDataYet, - o.str(), - (const char *)"Device_2Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_NoDataYet, o.str()); } // @@ -761,9 +745,7 @@ Tango::AttributeValueList* Device_2Impl::read_attributes_2(const Tango::DevVarSt TangoSys_OMemStream o; o << "Data in cache for attribute " << real_names[i]; o << " not updated any more" << std::ends; - Except::throw_exception((const char *)API_NotUpdatedAnyMore, - o.str(), - (const char *)"Device_2Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_NotUpdatedAnyMore, o.str()); } } @@ -798,9 +780,7 @@ Tango::AttributeValueList* Device_2Impl::read_attributes_2(const Tango::DevVarSt o << "Client too old to get data for attribute " << real_names[i].in(); o << ".\nPlease, use a client linked with Tango V5"; o << " and a device inheriting from Device_3Impl" << std::ends; - Except::throw_exception((const char *)API_NotSupportedFeature, - o.str(), - (const char *)"Device_2Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } } @@ -834,9 +814,7 @@ Tango::AttributeValueList* Device_2Impl::read_attributes_2(const Tango::DevVarSt TangoSys_OMemStream o; o << "Data type for attribute " << real_names[i] << " is DEV_ENCODED."; o << " It's not possible to retrieve this data type through the interface you are using (IDL V2)" << std::ends; - Except::throw_exception((const char *)API_NotSupportedFeature, - o.str(), - (const char *)"Device_2Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } Polled_2_Live(type,att_val_4.value,(*back)[i].value); @@ -861,9 +839,7 @@ Tango::AttributeValueList* Device_2Impl::read_attributes_2(const Tango::DevVarSt TangoSys_OMemStream o; o << "Data type for attribute " << real_names[i] << " is DEV_ENCODED."; o << " It's not possible to retrieve this data type through the interface you are using (IDL V2)" << std::ends; - Except::throw_exception((const char *)API_NotSupportedFeature, - o.str(), - (const char *)"Device_2Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } Polled_2_Live(type,att_val_3.value,(*back)[i].value); @@ -889,9 +865,7 @@ Tango::AttributeValueList* Device_2Impl::read_attributes_2(const Tango::DevVarSt TangoSys_OMemStream o; o << "Data type for attribute " << real_names[i] << " is DEV_ENCODED."; o << " It's not possible to retrieve this data type through the interface you are using (IDL V2)" << std::ends; - Except::throw_exception((const char *)API_NotSupportedFeature, - o.str(), - (const char *)"Device_2Impl::read_attributes"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } Polled_2_Live(type,att_val.value,(*back)[i].value); @@ -1059,9 +1033,7 @@ Tango::DevCmdInfoList_2 *Device_2Impl::command_list_query_2() } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_2Impl::command_list_query_2"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -1113,9 +1085,7 @@ Tango::DevCmdInfo_2 *Device_2Impl::command_query_2(const char *command) } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_2Impl::command_query_2"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -1182,9 +1152,7 @@ Tango::DevCmdInfo_2 *Device_2Impl::command_query_2(const char *command) TangoSys_OMemStream o; o << "Command " << command << " not found" << std::ends; - Except::throw_exception((const char *)API_CommandNotFound, - o.str(), - (const char *)"Device_2Impl::command_query_2"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } // @@ -1276,9 +1244,7 @@ Tango::AttributeConfigList_2 *Device_2Impl::get_attribute_config_2(const Tango:: } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_2Impl::get_attribute_config_2"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -1401,9 +1367,7 @@ Tango::DevCmdHistoryList *Device_2Impl::command_inout_history_2(const char* comm { TangoSys_OMemStream o; o << "Command " << cmd_str << " not polled" << std::ends; - Except::throw_exception((const char *)API_CmdNotPolled, - o.str(), - (const char *)"Device_2Impl::command_inout_history_2"); + TANGO_THROW_EXCEPTION(API_CmdNotPolled, o.str()); } // @@ -1414,9 +1378,7 @@ Tango::DevCmdHistoryList *Device_2Impl::command_inout_history_2(const char* comm { TangoSys_OMemStream o; o << "No data available in cache for command " << cmd_str << std::ends; - Except::throw_exception((const char *)API_NoDataYet, - o.str(), - (const char *)"Device_2Impl::command_inout_history_2"); + TANGO_THROW_EXCEPTION(API_NoDataYet, o.str()); } // @@ -1438,9 +1400,7 @@ Tango::DevCmdHistoryList *Device_2Impl::command_inout_history_2(const char* comm } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_2Impl::command_inout_history_2"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -1460,9 +1420,7 @@ Tango::DevCmdHistoryList *Device_2Impl::command_inout_history_2(const char* comm } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_2Impl::command_inout_history_2"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } if (status_cmd == true) @@ -1576,9 +1534,7 @@ Tango::DevAttrHistoryList *Device_2Impl::read_attribute_history_2(const char* na { TangoSys_OMemStream o; o << "Attribute " << attr_str << " not polled" << std::ends; - Except::throw_exception((const char *)API_AttrNotPolled, - o.str(), - (const char *)"Device_2Impl::read_attribute_history_2"); + TANGO_THROW_EXCEPTION(API_AttrNotPolled, o.str()); } // @@ -1589,9 +1545,7 @@ Tango::DevAttrHistoryList *Device_2Impl::read_attribute_history_2(const char* na { TangoSys_OMemStream o; o << "No data available in cache for attribute " << attr_str << std::ends; - Except::throw_exception((const char *)API_NoDataYet, - o.str(), - (const char *)"Device_2Impl::read_attribute_history_2"); + TANGO_THROW_EXCEPTION(API_NoDataYet, o.str()); } // @@ -1618,9 +1572,7 @@ Tango::DevAttrHistoryList *Device_2Impl::read_attribute_history_2(const char* na } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_2Impl::read_attribute_history_2"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // diff --git a/cppapi/server/device_3.cpp b/cppapi/server/device_3.cpp index 5933b67dc..7f6a75a31 100644 --- a/cppapi/server/device_3.cpp +++ b/cppapi/server/device_3.cpp @@ -178,9 +178,7 @@ Tango::AttributeValueList_3* Device_3Impl::read_attributes_3(const Tango::DevVar } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_3Impl::read_attributes_3"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -507,9 +505,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam o << "It is currently not allowed to read attribute "; o << att.get_name() << std::ends; - Except::throw_exception((const char *)API_AttrNotAllowed, - o.str(), - (const char *)"Device_3Impl::read_attributes_no_except"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, o.str()); } // @@ -544,8 +540,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam TangoSys_OMemStream o; o << "Attribute " << w_att.get_name() << " is a memorized attribute."; o << " It failed during the write call of the device startup sequence"; - Tango::Except::re_throw_exception(df,API_MemAttFailedDuringInit,o.str(), - "Device_3::read_attributes_no_except"); + TANGO_RETHROW_EXCEPTION(df, API_MemAttFailedDuringInit, o.str()); } // @@ -649,8 +644,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam TangoSys_OMemStream o; o << "Attribute " << w_att.get_name() << " is a memorized attribute."; o << " It failed during the write call of the device startup sequence"; - Tango::Except::re_throw_exception(df,API_MemAttFailedDuringInit,o.str(), - "Device_3::read_attributes_no_except"); + TANGO_RETHROW_EXCEPTION(df, API_MemAttFailedDuringInit, o.str()); } else { @@ -1461,9 +1455,7 @@ void Device_3Impl::write_attributes_34(const Tango::AttributeValueList *values_3 unsigned long nb_dev_attr = dev_attr->get_attr_nb(); if (nb_dev_attr == 0) { - Except::throw_exception((const char *)API_AttrNotFound, - (const char *)"The device does not have any attribute", - (const char *)"DeviceImpl::write_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, "The device does not have any attribute"); } unsigned long nb_failed = 0; @@ -1539,9 +1531,7 @@ void Device_3Impl::write_attributes_34(const Tango::AttributeValueList *values_3 o << " is not writable" << std::ends; updated_attr.pop_back(); - Except::throw_exception((const char *)API_AttrNotWritable, - o.str(), - (const char *)"DeviceImpl::write_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotWritable, o.str()); } if (att.get_data_format() != Tango::SCALAR) @@ -1571,9 +1561,7 @@ void Device_3Impl::write_attributes_34(const Tango::AttributeValueList *values_3 o << std::ends; updated_attr.pop_back(); - Except::throw_exception((const char *)API_WAttrOutsideLimit, - o.str(), - (const char *)"DeviceImpl::write_attributes"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } @@ -1689,9 +1677,7 @@ void Device_3Impl::write_attributes_34(const Tango::AttributeValueList *values_3 o << ". The device state is " << Tango::DevStateName[get_state()] << std::ends; - Except::throw_exception((const char *)API_AttrNotAllowed, - o.str(), - (const char *)"Device_3Impl::write_attributes"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, o.str()); } attr_vect[att.get_attr_idx()]->write(this,att); @@ -1967,9 +1953,7 @@ Tango::DevAttrHistoryList_3 *Device_3Impl::read_attribute_history_3(const char* { TangoSys_OMemStream o; o << "Attribute " << attr_str << " not polled" << std::ends; - Except::throw_exception((const char *)API_AttrNotPolled, - o.str(), - (const char *)"Device_3Impl::read_attribute_history_3"); + TANGO_THROW_EXCEPTION(API_AttrNotPolled, o.str()); } // @@ -1980,9 +1964,7 @@ Tango::DevAttrHistoryList_3 *Device_3Impl::read_attribute_history_3(const char* { TangoSys_OMemStream o; o << "No data available in cache for attribute " << attr_str << std::ends; - Except::throw_exception((const char *)API_NoDataYet, - o.str(), - (const char *)"Device_3Impl::read_attribute_history_3"); + TANGO_THROW_EXCEPTION(API_NoDataYet, o.str()); } // @@ -2004,9 +1986,7 @@ Tango::DevAttrHistoryList_3 *Device_3Impl::read_attribute_history_3(const char* } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_3Impl::read_attribute_history_3"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -2052,9 +2032,7 @@ Tango::DevInfo_3 *Device_3Impl::info_3() } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_3Impl::info_3"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -2185,9 +2163,7 @@ Tango::AttributeConfigList_3 *Device_3Impl::get_attribute_config_3(const Tango:: } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_3Impl::get_attribute_config_3"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -2474,9 +2450,7 @@ void Device_3Impl::get_attr_props(const char *attr_name,std::vectorget_attr_nb(); if (nb_dev_attr == 0) { - Except::throw_exception((const char *)API_AttrNotFound, - (const char *)"The device does not have any attribute", - (const char *)"Device_3Impl::set_attribute_config_3_local"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, "The device does not have any attribute"); } // diff --git a/cppapi/server/device_4.cpp b/cppapi/server/device_4.cpp index 458c9a4fe..61dce2d71 100644 --- a/cppapi/server/device_4.cpp +++ b/cppapi/server/device_4.cpp @@ -176,7 +176,7 @@ Tango::DevAttrHistory_4 *Device_4Impl::read_attribute_history_4(const char* name { TangoSys_OMemStream o; o << "Attribute " << attr_str << " not polled" << std::ends; - Except::throw_exception(API_AttrNotPolled,o.str(),"Device_4Impl::read_attribute_history_4"); + TANGO_THROW_EXCEPTION(API_AttrNotPolled, o.str()); } // @@ -187,7 +187,7 @@ Tango::DevAttrHistory_4 *Device_4Impl::read_attribute_history_4(const char* name { TangoSys_OMemStream o; o << "No data available in cache for attribute " << attr_str << std::ends; - Except::throw_exception(API_NoDataYet,o.str(),"Device_4Impl::read_attribute_history_4"); + TANGO_THROW_EXCEPTION(API_NoDataYet, o.str()); } // @@ -209,9 +209,7 @@ Tango::DevAttrHistory_4 *Device_4Impl::read_attribute_history_4(const char* name } catch (std::bad_alloc &) { - Except::throw_exception(API_MemoryAllocation, - "Can't allocate memory in server", - "Device_4Impl::read_attribute_history_4"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -320,9 +318,7 @@ Tango::DevCmdHistory_4 *Device_4Impl::command_inout_history_4(const char* comman { TangoSys_OMemStream o; o << "Command " << cmd_str << " not polled" << std::ends; - Except::throw_exception((const char *)API_CmdNotPolled, - o.str(), - (const char *)"Device_4Impl::command_inout_history_4"); + TANGO_THROW_EXCEPTION(API_CmdNotPolled, o.str()); } // @@ -333,9 +329,7 @@ Tango::DevCmdHistory_4 *Device_4Impl::command_inout_history_4(const char* comman { TangoSys_OMemStream o; o << "No data available in cache for command " << cmd_str << std::ends; - Except::throw_exception((const char *)API_NoDataYet, - o.str(), - (const char *)"Device_4Impl::command_inout_history_4"); + TANGO_THROW_EXCEPTION(API_NoDataYet, o.str()); } // @@ -357,9 +351,7 @@ Tango::DevCmdHistory_4 *Device_4Impl::command_inout_history_4(const char* comman } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_4Impl::command_inout_history_4"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -379,9 +371,7 @@ Tango::DevCmdHistory_4 *Device_4Impl::command_inout_history_4(const char* comman } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_4Impl::command_inout_history_4"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } if (status_cmd == true) @@ -565,9 +555,7 @@ Tango::AttributeValueList_4* Device_4Impl::read_attributes_4(const Tango::DevVar } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_4Impl::read_attributes_4"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -888,8 +876,7 @@ Tango::AttributeValueList_4* Device_4Impl::write_read_attributes_4(const Tango:: TangoSys_OMemStream o; o << "Attribute " << values[0].name << " is not a READ_WRITE or READ_WITH_WRITE attribute" << std::ends; - Except::throw_exception((const char *)API_AttrNotWritable,o.str(), - (const char *)"Device_4Impl::write_read_attribute_4"); + TANGO_THROW_EXCEPTION(API_AttrNotWritable, o.str()); } Tango::AttributeValueList_4 *read_val_ptr; diff --git a/cppapi/server/device_5.cpp b/cppapi/server/device_5.cpp index 25c5811fd..139e3138c 100644 --- a/cppapi/server/device_5.cpp +++ b/cppapi/server/device_5.cpp @@ -181,8 +181,7 @@ Tango::AttributeValueList_5* Device_5Impl::read_attributes_5(const Tango::DevVar } catch (std::bad_alloc &) { - Except::throw_exception(API_MemoryAllocation,"Can't allocate memory in server", - "Device_5Impl::read_attributes_5"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -582,9 +581,7 @@ Tango::AttributeConfigList_5 *Device_5Impl::get_attribute_config_5(const Tango:: } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_5Impl::get_attribute_config_5"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -746,7 +743,7 @@ Tango::DevAttrHistory_5 *Device_5Impl::read_attribute_history_5(const char* name { TangoSys_OMemStream o; o << "Attribute " << attr_str << " not polled" << std::ends; - Except::throw_exception(API_AttrNotPolled,o.str(),"Device_5Impl::read_attribute_history_5"); + TANGO_THROW_EXCEPTION(API_AttrNotPolled, o.str()); } // @@ -764,7 +761,7 @@ Tango::DevAttrHistory_5 *Device_5Impl::read_attribute_history_5(const char* name { std::stringstream ss; ss << "Reading history for attribute " << attr_str << " on device " << get_name() << " failed!"; - Tango::Except::re_throw_exception(e,API_AttributeFailed,ss.str(),"Device_5Impl::read_attribute_history_5"); + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, ss.str()); } } else @@ -778,7 +775,7 @@ Tango::DevAttrHistory_5 *Device_5Impl::read_attribute_history_5(const char* name { TangoSys_OMemStream o; o << "No data available in cache for attribute " << attr_str << std::ends; - Except::throw_exception(API_NoDataYet,o.str(),"Device_5Impl::read_attribute_history_5"); + TANGO_THROW_EXCEPTION(API_NoDataYet, o.str()); } // @@ -800,9 +797,7 @@ Tango::DevAttrHistory_5 *Device_5Impl::read_attribute_history_5(const char* name } catch (std::bad_alloc &) { - Except::throw_exception(API_MemoryAllocation, - "Can't allocate memory in server", - "Device_5Impl::read_attribute_history_5"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -883,9 +878,7 @@ Tango::PipeConfigList *Device_5Impl::get_pipe_config_5(const Tango::DevVarString } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Device_5Impl::get_pipe_config_5"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -983,7 +976,7 @@ void Device_5Impl::set_pipe_config_5(const Tango::PipeConfigList& new_conf, size_t dev_nb_pipe = device_class->get_pipe_list(device_name_lower).size(); if (dev_nb_pipe == 0) { - Except::throw_exception(API_PipeNotFound,"The device does not have any pipe","Device_5Impl::set_pipe_config_5"); + TANGO_THROW_EXCEPTION(API_PipeNotFound, "The device does not have any pipe"); } // @@ -1094,8 +1087,7 @@ Tango::DevPipeData *Device_5Impl::read_pipe_5(const char* name,const Tango::Clnt } catch (std::bad_alloc &) { - Except::throw_exception(API_MemoryAllocation,"Can't allocate memory in server", - "Device_5Impl::read_pipe_5"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -1113,7 +1105,7 @@ Tango::DevPipeData *Device_5Impl::read_pipe_5(const char* name,const Tango::Clnt std::stringstream o; o << "It is currently not allowed to read pipe " << name; - Except::throw_exception(API_PipeNotAllowed,o.str(),"Device_5Impl::read_pipe_5"); + TANGO_THROW_EXCEPTION(API_PipeNotAllowed, o.str()); } // @@ -1193,7 +1185,7 @@ Tango::DevPipeData *Device_5Impl::read_pipe_5(const char* name,const Tango::Clnt std::stringstream o; o << "Value for pipe " << pipe_name << " has not been updated"; - Except::throw_exception(API_PipeValueNotSet,o.str(),"Device_5Impl::read_pipe_5"); + TANGO_THROW_EXCEPTION(API_PipeValueNotSet, o.str()); } // @@ -1325,7 +1317,7 @@ void Device_5Impl::write_pipe_5(const Tango::DevPipeData &pi_value, const Tango: std::stringstream o; o << "Pipe " << pipe_name << " is not writable"; - Except::throw_exception(API_PipeNotWritable,o.str(),"Device_5Impl::write_pipe_5"); + TANGO_THROW_EXCEPTION(API_PipeNotWritable, o.str()); } WPipe &pi = static_cast(tmp_pi); @@ -1345,7 +1337,7 @@ void Device_5Impl::write_pipe_5(const Tango::DevPipeData &pi_value, const Tango: std::stringstream o; o << "It is currently not allowed to write pipe " << pipe_name; - Except::throw_exception(API_PipeNotAllowed,o.str(),"Device_5Impl::write_pipe_5"); + TANGO_THROW_EXCEPTION(API_PipeNotAllowed, o.str()); } // diff --git a/cppapi/server/deviceclass.cpp b/cppapi/server/deviceclass.cpp index 654e55310..290c455ae 100644 --- a/cppapi/server/deviceclass.cpp +++ b/cppapi/server/deviceclass.cpp @@ -176,9 +176,7 @@ void DeviceClass::get_class_system_resource() TangoSys_OMemStream o; o << "Database error while trying to retrieve properties for class " << name.c_str() << std::ends; - Except::throw_exception((const char *)API_DatabaseAccess, - o.str(), - (const char *)"DeviceClass::get_class_system_resource"); + TANGO_THROW_EXCEPTION(API_DatabaseAccess, o.str()); } if (db_data[1].is_empty() == false) @@ -208,9 +206,7 @@ void DeviceClass::get_class_system_resource() TangoSys_OMemStream o; o << "Database error while trying to retrieve properties for class " << name.c_str() << std::ends; - Except::throw_exception((const char *)API_DatabaseAccess, - o.str(), - (const char *)"DeviceClass::get_class_system_resource"); + TANGO_THROW_EXCEPTION(API_DatabaseAccess, o.str()); } if (db_data[0].is_empty() == true) @@ -672,9 +668,7 @@ void DeviceClass::throw_mem_value(DeviceImpl *dev,Attribute &att) o << dev->get_name(); o << ") is in an incorrect format !" << std::ends; - Except::throw_exception((const char *)API_AttrWrongMemValue, - o.str(), - (const char *)"DeviceClass::set_memorized_values"); + TANGO_THROW_EXCEPTION(API_AttrWrongMemValue, o.str()); } //-------------------------------------------------------------------------------------------------------------------- @@ -1017,9 +1011,7 @@ void DeviceClass::export_device(DeviceImpl *dev,const char *corba_obj_name) { TangoSys_OMemStream o; o << "Cant get CORBA reference Id for device " << dev->get_name() << std::ends; - Except::throw_exception((const char *)API_CantGetDevObjectId, - o.str(), - (const char *)"DeviceClass::export_device"); + TANGO_THROW_EXCEPTION(API_CantGetDevObjectId, o.str()); } dev->set_obj_id(oid); } @@ -1046,9 +1038,7 @@ void DeviceClass::export_device(DeviceImpl *dev,const char *corba_obj_name) { TangoSys_OMemStream o; o << "Can't get CORBA reference Id for device " << dev->get_name() << std::ends; - Except::throw_exception((const char *)API_CantGetDevObjectId, - o.str(), - (const char *)"DeviceClass::export_device"); + TANGO_THROW_EXCEPTION(API_CantGetDevObjectId, o.str()); } d = dev->_this(); @@ -1178,9 +1168,7 @@ CORBA::Any *DeviceClass::command_handler(DeviceImpl *device,std::string &command { TangoSys_OMemStream o; o << "Command " << command << " not allowed when the device is in " << Tango::DevStateName[device->get_state()] << " state" << std::ends; - Except::throw_exception((const char *)API_CommandNotAllowed, - o.str(), - (const char *)"DeviceClass::command_handler"); + TANGO_THROW_EXCEPTION(API_CommandNotAllowed, o.str()); } // @@ -1219,9 +1207,7 @@ CORBA::Any *DeviceClass::command_handler(DeviceImpl *device,std::string &command { TangoSys_OMemStream o; o << "Command " << command << " not allowed when the device is in " << Tango::DevStateName[device->get_state()] << " state" << std::ends; - Except::throw_exception((const char *)API_CommandNotAllowed, - o.str(), - (const char *)"DeviceClass::command_handler"); + TANGO_THROW_EXCEPTION(API_CommandNotAllowed, o.str()); } // @@ -1242,9 +1228,7 @@ CORBA::Any *DeviceClass::command_handler(DeviceImpl *device,std::string &command TangoSys_OMemStream o; o << "Command " << command << " not found" << std::ends; - Except::throw_exception((const char *)API_CommandNotFound, - o.str(), - (const char *)"DeviceClass::command_handler"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } } @@ -1297,9 +1281,7 @@ void DeviceClass::add_wiz_dev_prop(std::string &p_name,std::string &desc,std::st TangoSys_OMemStream o; o << "Device property " << p_name; o << " for class " << name << " is already defined in the wizard" << std::ends; - Except::throw_exception((const char *)API_WizardConfError, - o.str(), - (const char *)"DeviceClass::add_wiz_dev_prop"); + TANGO_THROW_EXCEPTION(API_WizardConfError, o.str()); } // @@ -1363,9 +1345,7 @@ void DeviceClass::add_wiz_class_prop(std::string &p_name,std::string &desc,std:: TangoSys_OMemStream o; o << "Class property " << p_name; o << " for class " << name << " is already defined in the wizard" << std::ends; - Except::throw_exception((const char *)API_WizardConfError, - o.str(), - (const char *)"DeviceClass::add_wiz_dev_prop"); + TANGO_THROW_EXCEPTION(API_WizardConfError, o.str()); } // @@ -1417,8 +1397,7 @@ void DeviceClass::device_destroyer(const std::string &dev_name) TangoSys_OMemStream o; o << "Device " << dev_name << " not in Tango class device list!" << std::ends; - Tango::Except::throw_exception((const char *)API_CantDestroyDevice,o.str(), - (const char *)"DeviceClass::device_destroyer"); + TANGO_THROW_EXCEPTION(API_CantDestroyDevice, o.str()); } // @@ -1545,9 +1524,7 @@ Command &DeviceClass::get_cmd_by_name(const std::string &cmd_name) TangoSys_OMemStream o; o << cmd_name << " command not found" << std::ends; - Except::throw_exception((const char *)API_CommandNotFound, - o.str(), - (const char *)"DeviceClass::get_cmd_by_name"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } return *(*pos); @@ -1577,7 +1554,7 @@ Pipe &DeviceClass::get_pipe_by_name(const std::string &pipe_name,const std::stri TangoSys_OMemStream o; o << dev_name << " device not found in pipe map" << std::ends; - Except::throw_exception(API_PipeNotFound,o.str(),"DeviceClass::get_pipe_by_name"); + TANGO_THROW_EXCEPTION(API_PipeNotFound, o.str()); } std::vector::iterator pos; @@ -1598,7 +1575,7 @@ Pipe &DeviceClass::get_pipe_by_name(const std::string &pipe_name,const std::stri TangoSys_OMemStream o; o << pipe_name << " pipe not found" << std::ends; - Except::throw_exception(API_PipeNotFound,o.str(),"DeviceClass::get_pipe_by_name"); + TANGO_THROW_EXCEPTION(API_PipeNotFound, o.str()); } return *(*pos); @@ -1636,9 +1613,7 @@ void DeviceClass::remove_command(const std::string &cmd_name) TangoSys_OMemStream o; o << cmd_name << " command not found" << std::ends; - Except::throw_exception((const char *)API_CommandNotFound, - o.str(), - (const char *)"DeviceClass::get_cmd_by_name"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } command_list.erase(pos); @@ -1749,7 +1724,7 @@ std::vector &DeviceClass::get_pipe_list(const std::string &dev_name) TangoSys_OMemStream o; o << dev_name << " device not found in pipe map" << std::ends; - Except::throw_exception(API_PipeNotFound,o.str(),"DeviceClass::get_pipe_list"); + TANGO_THROW_EXCEPTION(API_PipeNotFound, o.str()); } return ite->second; diff --git a/cppapi/server/dserver.cpp b/cppapi/server/dserver.cpp index d12fad183..e24ac5a92 100644 --- a/cppapi/server/dserver.cpp +++ b/cppapi/server/dserver.cpp @@ -235,9 +235,7 @@ void DServer::init_device() TangoSys_OMemStream o; o << "Database error while trying to retrieve device list for class " << class_list[i]->get_name().c_str() << std::ends; - Except::throw_exception((const char *)API_DatabaseAccess, - o.str(), - (const char *)"Dserver::init_device"); + TANGO_THROW_EXCEPTION(API_DatabaseAccess, o.str()); } long nb_dev = na.size(); @@ -396,9 +394,7 @@ void DServer::init_device() } Tango::Util::instance()->set_svr_shutting_down(true); - Except::throw_exception((const char *)API_MemoryAllocation, - o.str(), - (const char *)"DServer::init_device"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, o.str()); } catch (Tango::NamedDevFailedList &) { @@ -672,9 +668,7 @@ Tango::DevVarStringArray *DServer::query_class() } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DServer::query_class"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } return(ret); @@ -719,9 +713,7 @@ Tango::DevVarStringArray *DServer::query_device() } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DServer::query_device"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } int nb_dev = vs.size(); @@ -829,9 +821,7 @@ void DServer::restart(std::string &d_name) cout3 << "Device " << d_name << " not found in server !" << std::endl; TangoSys_OMemStream o; o << "Device " << d_name << " not found" << std::ends; - Except::throw_exception((const char *)API_DeviceNotFound, - o.str(), - (const char *)"Dserver::restart()"); + TANGO_THROW_EXCEPTION(API_DeviceNotFound, o.str()); } DeviceImpl *dev_to_del = *ite; @@ -972,7 +962,7 @@ void DServer::restart(std::string &d_name) ss << "init_device() method for device " << d_name << " throws DevFailed exception."; ss << "\nDevice not available any more. Please fix exception reason"; - Tango::Except::re_throw_exception(e,API_InitThrowsException,ss.str(),"Dserver::restart()"); + TANGO_RETHROW_EXCEPTION(e, API_InitThrowsException, ss.str()); } catch (...) { @@ -982,7 +972,7 @@ void DServer::restart(std::string &d_name) ss << "init_device() method for device " << d_name << " throws an unknown exception."; ss << "\nDevice not available any more. Please fix exception reason"; - Tango::Except::throw_exception(API_InitThrowsException,ss.str(),"Dserver::restart()"); + TANGO_THROW_EXCEPTION(API_InitThrowsException, ss.str()); } // @@ -1056,9 +1046,7 @@ void DServer::restart(std::string &d_name) cout3 << "Not able to find the new device" << std::endl; TangoSys_OMemStream o; o << "Not able to find the new device" << std::ends; - Except::throw_exception((const char *)API_DeviceNotFound, - o.str(), - (const char *)"Dserver::restart()"); + TANGO_THROW_EXCEPTION(API_DeviceNotFound, o.str()); } // @@ -1312,8 +1300,7 @@ Tango::DevVarStringArray *DServer::query_class_prop(std::string &class_name) { TangoSys_OMemStream o; o << "Class " << class_name << " not found in device server" << std::ends; - Except::throw_exception((const char *)API_ClassNotFound,o.str(), - (const char *)"DServer::query_class_prop"); + TANGO_THROW_EXCEPTION(API_ClassNotFound, o.str()); } @@ -1336,9 +1323,7 @@ Tango::DevVarStringArray *DServer::query_class_prop(std::string &class_name) } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DServer::query_class_prop"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } return(ret); @@ -1383,8 +1368,7 @@ Tango::DevVarStringArray *DServer::query_dev_prop(std::string &class_name) { TangoSys_OMemStream o; o << "Class " << class_name << " not found in device server" << std::ends; - Except::throw_exception((const char *)API_ClassNotFound,o.str(), - (const char *)"DServer::query_dev_prop"); + TANGO_THROW_EXCEPTION(API_ClassNotFound, o.str()); } @@ -1407,9 +1391,7 @@ Tango::DevVarStringArray *DServer::query_dev_prop(std::string &class_name) } catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DServer::query_dev_prop"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } return(ret); @@ -1494,8 +1476,7 @@ void DServer::create_cpp_class(const char *cl_name,const char *par_name) o << "Trying to load shared library " << lib_name << " failed. It returns error: " << str << std::ends; ::LocalFree((HLOCAL)str); - Except::throw_exception((const char *)API_ClassNotFound,o.str(), - (const char *)"DServer::create_cpp_class"); + TANGO_THROW_EXCEPTION(API_ClassNotFound, o.str()); } cout4 << "GetModuleHandle is a success" << std::endl; @@ -1512,8 +1493,7 @@ void DServer::create_cpp_class(const char *cl_name,const char *par_name) TangoSys_OMemStream o; o << "Class " << cl_name << " does not have the C creator function (_create__class)" << std::ends; - Except::throw_exception((const char *)API_ClassNotFound,o.str(), - (const char *)"DServer::create_cpp_class"); + TANGO_THROW_EXCEPTION(API_ClassNotFound, o.str()); } cout4 << "GetProcAddress is a success" << std::endl; @@ -1528,8 +1508,7 @@ void DServer::create_cpp_class(const char *cl_name,const char *par_name) TangoSys_OMemStream o; o << "Trying to load shared library " << lib_name << " failed. It returns error: " << dlerror() << std::ends; - Except::throw_exception((const char *)API_ClassNotFound,o.str(), - (const char *)"DServer::create_cpp_class"); + TANGO_THROW_EXCEPTION(API_ClassNotFound, o.str()); } cout4 << "dlopen is a success" << std::endl; @@ -1548,8 +1527,7 @@ void DServer::create_cpp_class(const char *cl_name,const char *par_name) TangoSys_OMemStream o; o << "Class " << cl_name << " does not have the C creator function (_create__class)" << std::ends; - Except::throw_exception((const char *)API_ClassNotFound,o.str(), - (const char *)"DServer::create_cpp_class"); + TANGO_THROW_EXCEPTION(API_ClassNotFound, o.str()); } cout4 << "dlsym is a success" << std::endl; @@ -1598,9 +1576,7 @@ void DServer::get_dev_prop(Tango::Util *tg) TangoSys_OMemStream o; o << "Database error while trying to retrieve device properties for device " << device_name.c_str() << std::ends; - Except::throw_exception((const char *)API_DatabaseAccess, - o.str(), - (const char *)"DServer::get_dev_prop"); + TANGO_THROW_EXCEPTION(API_DatabaseAccess, o.str()); } // @@ -1700,7 +1676,8 @@ void DServer::check_lock_owner(DeviceImpl *dev,const char *cmd_name,const char * o << "Device " << dev_name << " is locked by another client."; o << " Your request is not allowed while a device is locked." << std::ends; v << "DServer::" << cmd_name << std::ends; - Except::throw_exception((const char *)API_DeviceLocked,o.str(),v.str()); + Except::throw_exception(API_DeviceLocked, o.str(), v.str()); + } } else @@ -1709,7 +1686,8 @@ void DServer::check_lock_owner(DeviceImpl *dev,const char *cmd_name,const char * o << "Device " << dev_name << " is locked by another client."; o << " Your request is not allowed while a device is locked." << std::ends; v << "DServer::" << cmd_name << std::ends; - Except::throw_exception((const char *)API_DeviceLocked,o.str(),v.str()); + Except::throw_exception(API_DeviceLocked, o.str(), v.str()); + } } } diff --git a/cppapi/server/dserverclass.cpp b/cppapi/server/dserverclass.cpp index c8e32a528..3ca547a0d 100644 --- a/cppapi/server/dserverclass.cpp +++ b/cppapi/server/dserverclass.cpp @@ -89,9 +89,7 @@ CORBA::Any *DevRestartCmd::execute(DeviceImpl *device, const CORBA::Any &in_any) const char *tmp_name; if ((in_any >>= tmp_name) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : string", - (const char *)"DevRestartCmd::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : string"); } std::string d_name(tmp_name); cout4 << "Received string = " << d_name << std::endl; @@ -204,9 +202,7 @@ CORBA::Any *DevQueryClassCmd::execute(DeviceImpl *device,TANGO_UNUSED(const CORB { cout3 << "Bad allocation while in DevQueryClassCmd::execute()" << std::endl; delete ret; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DevQueryClassCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ret; @@ -264,9 +260,7 @@ CORBA::Any *DevQueryDeviceCmd::execute(DeviceImpl *device,TANGO_UNUSED(const COR { cout3 << "Bad allocation while in DevQueryDeviceCmd::execute()" << std::endl; delete ret; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DevQueryDeviceCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ret; @@ -323,9 +317,7 @@ CORBA::Any *DevQuerySubDeviceCmd::execute(DeviceImpl *device,TANGO_UNUSED(const { cout3 << "Bad allocation while in DevQuerySubDeviceCmd::execute()" << std::endl; delete ret; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DevQuerySubDeviceCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ret; @@ -412,9 +404,7 @@ CORBA::Any *DevSetTraceLevelCmd::execute(TANGO_UNUSED(DeviceImpl *device),TANGO_ cout4 << "DevSetTraceLevelCmd::execute(): arrived" << std::endl; #ifdef TANGO_HAS_LOG4TANGO - Except::throw_exception((const char *)API_DeprecatedCommand, - (const char *)"SetTraceLevel is no more supported, please use SetLoggingLevel", - (const char *)"DevSetTraceLevelCmd::execute"); + TANGO_THROW_EXCEPTION(API_DeprecatedCommand, "SetTraceLevel is no more supported, please use SetLoggingLevel"); // // Make the compiler happy // @@ -432,9 +422,7 @@ CORBA::Any *DevSetTraceLevelCmd::execute(TANGO_UNUSED(DeviceImpl *device),TANGO_ if ((in_any >>= new_level) == false) { cout3 << "DevSetTraceLevelCmd::execute() --> Wrong argument type" << std::endl; - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : long", - (const char *)"DevSetTraceLevelCmd::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : long"); } // @@ -486,9 +474,7 @@ CORBA::Any *DevGetTraceLevelCmd::execute(TANGO_UNUSED(DeviceImpl *device),TANGO_ #ifdef TANGO_HAS_LOG4TANGO - Except::throw_exception((const char *)API_DeprecatedCommand, - (const char *)"GetTraceLevel is no more supported, please use GetLoggingLevel", - (const char *)"DevGetTraceLevelCmd::execute"); + TANGO_THROW_EXCEPTION(API_DeprecatedCommand, "GetTraceLevel is no more supported, please use GetLoggingLevel"); // // Make the compiler happy @@ -550,9 +536,7 @@ CORBA::Any *DevGetTraceOutputCmd::execute(TANGO_UNUSED(DeviceImpl *device),TANGO cout4 << "DevGetTraceOutputCmd::execute(): arrived" << std::endl; #ifdef TANGO_HAS_LOG4TANGO - Except::throw_exception((const char *)API_DeprecatedCommand, - (const char *)"GetTraceOutput is no more supported, please use GetLoggingTarget", - (const char *)"DevGetTraceOutputCmd::execute"); + TANGO_THROW_EXCEPTION(API_DeprecatedCommand, "GetTraceOutput is no more supported, please use GetLoggingTarget"); // // Make the compiler happy // @@ -615,9 +599,7 @@ CORBA::Any *DevSetTraceOutputCmd::execute(TANGO_UNUSED(DeviceImpl *device),TANGO #ifdef TANGO_HAS_LOG4TANGO - Except::throw_exception((const char *)API_DeprecatedCommand, - (const char *)"SetTraceOutput is no more supported, please use AddLoggingTarget", - (const char *)"DevSetTraceOutputCmd::execute"); + TANGO_THROW_EXCEPTION(API_DeprecatedCommand, "SetTraceOutput is no more supported, please use AddLoggingTarget"); // // Make the compiler happy // @@ -634,9 +616,7 @@ CORBA::Any *DevSetTraceOutputCmd::execute(TANGO_UNUSED(DeviceImpl *device),TANGO const char *in_file_ptr; if ((in_any >>= in_file_ptr) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : string", - (const char *)"DevSetTraceOutputCmd::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : string"); } std::string in_file(in_file_ptr); cout4 << "Received string = " << in_file << std::endl; @@ -679,9 +659,7 @@ CORBA::Any *DevSetTraceOutputCmd::execute(TANGO_UNUSED(DeviceImpl *device),TANGO TangoSys_OMemStream o; o << "Impossible to open file " << in_file << std::ends; - Except::throw_exception((const char *)API_CannotOpenFile, - o.str(), - (const char *)"DevSetTraceoutput::execute"); + TANGO_THROW_EXCEPTION(API_CannotOpenFile, o.str()); } } @@ -736,9 +714,7 @@ CORBA::Any *QueryWizardClassPropertyCmd::execute(DeviceImpl *device,const CORBA: const char *tmp_name; if ((in_any >>= tmp_name) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : string", - (const char *)"QueryWizardClassPropertyCmd::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : string"); } std::string class_name(tmp_name); @@ -760,9 +736,7 @@ CORBA::Any *QueryWizardClassPropertyCmd::execute(DeviceImpl *device,const CORBA: { cout3 << "Bad allocation while in QueryWizardClassPropertyCmd::execute()" << std::endl; delete ret; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"QueryWizardClassPropertyCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ret; @@ -813,9 +787,7 @@ CORBA::Any *QueryWizardDevPropertyCmd::execute(DeviceImpl *device,const CORBA::A const char *tmp_name; if ((in_any >>= tmp_name) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : string", - (const char *)"QueryWizardDevPropertyCmd::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : string"); } std::string class_name(tmp_name); @@ -837,9 +809,7 @@ CORBA::Any *QueryWizardDevPropertyCmd::execute(DeviceImpl *device,const CORBA::A { cout3 << "Bad allocation while in QueryWizardDevPropertyCmd::execute()" << std::endl; delete ret; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"QueryWizardDevPropertyCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ret; @@ -891,9 +861,7 @@ CORBA::Any *QueryEventChannelIORCmd::execute(TANGO_UNUSED(DeviceImpl *device),TA { cout3 << "Try to retrieve DS event channel while NotifdEventSupplier object is not yet created" << std::endl; - Except::throw_exception((const char *)API_EventSupplierNotConstructed, - (const char *)"Try to retrieve DS event channel while EventSupplier object is not created", - (const char *)"QueryEventChannelIORCmd::execute"); + TANGO_THROW_EXCEPTION(API_EventSupplierNotConstructed, "Try to retrieve DS event channel while EventSupplier object is not created"); } else { @@ -911,9 +879,7 @@ CORBA::Any *QueryEventChannelIORCmd::execute(TANGO_UNUSED(DeviceImpl *device),TA catch (std::bad_alloc &) { cout3 << "Bad allocation while in QueryEventChannelIORCmd::execute()" << std::endl; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"QueryEventChannelIORCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ior.c_str(); } @@ -1087,9 +1053,7 @@ CORBA::Any *UnLockDeviceCmd::execute(DeviceImpl *device,const CORBA::Any &in_any catch (std::bad_alloc &) { cout3 << "Bad allocation while in UnLockDeviceCmd::execute()" << std::endl; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"UnLockDeviceCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ret; @@ -1155,9 +1119,7 @@ CORBA::Any *DevLockStatusCmd::execute(DeviceImpl *device,const CORBA::Any &in_an catch (std::bad_alloc &) { cout3 << "Bad allocation while in DevLockStatusCmd::execute()" << std::endl; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"DevLockStatusCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ret; @@ -1261,9 +1223,7 @@ CORBA::Any *EventSubscriptionChangeCmd::execute(Tango::DeviceImpl *device,const catch (std::bad_alloc &) { cout3 << "Bad allocation while in EventSubscriptionChangeCmd::execute()" << std::endl; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"EventSubscriptionChangeCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ret; @@ -1381,9 +1341,7 @@ CORBA::Any *ZmqEventSubscriptionChangeCmd::execute(Tango::DeviceImpl *device,con catch (std::bad_alloc &) { cout3 << "Bad allocation while in ZmqEventSubscriptionChangeCmd::execute()" << std::endl; - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"ZmqEventSubscriptionChangeCmd::execute"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } (*out_any) <<= ret; @@ -1470,8 +1428,7 @@ CORBA::Any *EventConfirmSubscriptionCmd::execute(Tango::DeviceImpl *device,const TangoSys_OMemStream o; o << "The device server is shutting down! You can no longer subscribe for events" << std::ends; - Except::throw_exception((const char *) API_ShutdownInProgress, o.str(), - (const char *) "DServer::event_confirm_subscription"); + TANGO_THROW_EXCEPTION(API_ShutdownInProgress, o.str()); } // // Extract the input string array @@ -1490,8 +1447,7 @@ CORBA::Any *EventConfirmSubscriptionCmd::execute(Tango::DeviceImpl *device,const o << "Wrong number of input arguments: 3 needed per event: device name, attribute/pipe name and event name" << std::endl; - Except::throw_exception((const char *) API_WrongNumberOfArgs, o.str(), - (const char *) "DServer::event_confirm_subscription"); + TANGO_THROW_EXCEPTION(API_WrongNumberOfArgs, o.str()); } // @@ -1604,9 +1560,7 @@ DServerClass *DServerClass::instance() if (_instance == NULL) { std::cerr << "Class DServer is not initialised!" << std::endl; - Except::throw_exception((const char *)API_DServerClassNotInitialised, - (const char *)"The DServerClass is not yet initialised, please wait!", - (const char *)"DServerClass::instance"); + TANGO_THROW_EXCEPTION(API_DServerClassNotInitialised, "The DServerClass is not yet initialised, please wait!"); //exit(-1); } return _instance; diff --git a/cppapi/server/dserverlock.cpp b/cppapi/server/dserverlock.cpp index 3a11e0582..a2c8bc3d2 100644 --- a/cppapi/server/dserverlock.cpp +++ b/cppapi/server/dserverlock.cpp @@ -73,18 +73,14 @@ void DServer::lock_device(const Tango::DevVarLongStringArray *in_data) Tango::client_addr *cl = get_client_ident(); if (cl == NULL) { - Except::throw_exception((const char*)API_CantGetClientIdent, - (const char*)"Cannot retrieve client identification", - (const char*)"DServer::lock_device"); + TANGO_THROW_EXCEPTION(API_CantGetClientIdent, "Cannot retrieve client identification"); } cout4 << "Client identification = " << *cl << std::endl; if (cl->client_ident == false) { - Except::throw_exception((const char*)API_ClientTooOld, - (const char*)"Your client cannot lock devices. You are using a too old Tango release. Please, update to tango V7 or more", - (const char*)"DServer::lock_device"); + TANGO_THROW_EXCEPTION(API_ClientTooOld, "Your client cannot lock devices. You are using a too old Tango release. Please, update to tango V7 or more"); } // @@ -105,9 +101,7 @@ void DServer::lock_device(const Tango::DevVarLongStringArray *in_data) if (d_name_lower == local_dev_name) { - Except::throw_exception((const char *)API_DeviceUnlockable, - (const char *)"Impossible to lock device server administration device", - (const char *)"DServer::lock_device"); + TANGO_THROW_EXCEPTION(API_DeviceUnlockable, "Impossible to lock device server administration device"); } // @@ -124,9 +118,7 @@ void DServer::lock_device(const Tango::DevVarLongStringArray *in_data) std::string &cl_name = the_dev->get_device_class()->get_name(); if (::strcmp(cl_name.c_str(),DATABASE_CLASS) == 0) { - Except::throw_exception((const char *)API_DeviceUnlockable, - (const char *)"Impossible to lock database device", - (const char *)"DServer::lock_device"); + TANGO_THROW_EXCEPTION(API_DeviceUnlockable, "Impossible to lock database device"); } // @@ -161,18 +153,14 @@ Tango::DevLong DServer::un_lock_device(const Tango::DevVarLongStringArray *in_da Tango::client_addr *cl = get_client_ident(); if (cl == NULL) { - Except::throw_exception((const char*)API_CantGetClientIdent, - (const char*)"Cannot retrieve client identification", - (const char*)"DServer::un_lock_device"); + TANGO_THROW_EXCEPTION(API_CantGetClientIdent, "Cannot retrieve client identification"); } cout4 << "Client identification = " << *cl << std::endl; if ((cl->client_ident == false) && (in_data->lvalue[0] == 0)) { - Except::throw_exception((const char*)API_ClientTooOld, - (const char*)"Your client cannot un-lock devices. You are using a too old Tango release. Please, update to tango V7 or more", - (const char*)"DServer::un_lock_device"); + TANGO_THROW_EXCEPTION(API_ClientTooOld, "Your client cannot un-lock devices. You are using a too old Tango release. Please, update to tango V7 or more"); } // @@ -229,18 +217,14 @@ void DServer::re_lock_devices(const Tango::DevVarStringArray *dev_name_list) Tango::client_addr *cl = get_client_ident(); if (cl == NULL) { - Except::throw_exception((const char*)API_CantGetClientIdent, - (const char*)"Cannot retrieve client identification", - (const char*)"DServer::re_lock_devices"); + TANGO_THROW_EXCEPTION(API_CantGetClientIdent, "Cannot retrieve client identification"); } cout4 << "Client identification = " << *cl << std::endl; if (cl->client_ident == false) { - Except::throw_exception((const char*)API_ClientTooOld, - (const char*)"Your client cannot re_lock devices. You are using a too old Tango release. Please, update to tango V7 or more", - (const char*)"DServer::re_lock_devices"); + TANGO_THROW_EXCEPTION(API_ClientTooOld, "Your client cannot re_lock devices. You are using a too old Tango release. Please, update to tango V7 or more"); } // diff --git a/cppapi/server/dserverpoll.cpp b/cppapi/server/dserverpoll.cpp index 3b1dc3b71..f02be2fc4 100644 --- a/cppapi/server/dserverpoll.cpp +++ b/cppapi/server/dserverpoll.cpp @@ -85,7 +85,7 @@ Tango::DevVarStringArray *DServer::polled_device() } catch (std::bad_alloc &) { - Except::throw_exception(API_MemoryAllocation,"Can't allocate memory in server","DServer::polled_device"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -596,9 +596,7 @@ void DServer::add_obj_polling(const Tango::DevVarLongStringArray *argin,bool wit if ((argin->svalue.length() != 3) || (argin->lvalue.length() != 1)) { - Except::throw_exception(API_WrongNumberOfArgs, - "Incorrect number of inout arguments", - "DServer::add_obj_polling"); + TANGO_THROW_EXCEPTION(API_WrongNumberOfArgs, "Incorrect number of inout arguments"); } // @@ -616,7 +614,7 @@ void DServer::add_obj_polling(const Tango::DevVarLongStringArray *argin,bool wit TangoSys_OMemStream o; o << "Device " << (argin->svalue)[0] << " not found" << std::ends; - Except::re_throw_exception(e,API_DeviceNotFound,o.str(),"DServer::add_obj_polling"); + TANGO_RETHROW_EXCEPTION(e, API_DeviceNotFound, o.str()); } // @@ -659,7 +657,7 @@ void DServer::add_obj_polling(const Tango::DevVarLongStringArray *argin,bool wit { TangoSys_OMemStream o; o << "Object type " << obj_type << " not supported" << std::ends; - Except::throw_exception(API_NotSupported,o.str(),"DServer::add_obj_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } // @@ -672,7 +670,7 @@ void DServer::add_obj_polling(const Tango::DevVarLongStringArray *argin,bool wit { TangoSys_OMemStream o; o << "It's not possible to poll the Init command!" << std::ends; - Except::throw_exception(API_NotSupported,o.str(),"DServer::add_obj_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } // @@ -703,7 +701,7 @@ void DServer::add_obj_polling(const Tango::DevVarLongStringArray *argin,bool wit else o << "Attribute "; o << obj_name << " already polled" << std::ends; - Except::throw_exception(API_AlreadyPolled,o.str(),"DServer::add_obj_polling"); + TANGO_THROW_EXCEPTION(API_AlreadyPolled, o.str()); } } } @@ -717,7 +715,7 @@ void DServer::add_obj_polling(const Tango::DevVarLongStringArray *argin,bool wit { TangoSys_OMemStream o; o << (argin->lvalue)[0] << " is below the min authorized period (" << MIN_POLL_PERIOD << " mS)" << std::ends; - Except::throw_exception(API_NotSupported,o.str(),"DServer::add_obj_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } // @@ -741,7 +739,7 @@ void DServer::add_obj_polling(const Tango::DevVarLongStringArray *argin,bool wit ss << "Polling has to be done on the root attribute ("; ss << fwd->get_fwd_dev_name() << "/" << fwd->get_fwd_att_name() << ")"; - Except::throw_exception(API_NotSupportedFeature,ss.str(),"DServer::add_obj_polling"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, ss.str()); } // @@ -840,9 +838,7 @@ void DServer::add_obj_polling(const Tango::DevVarLongStringArray *argin,bool wit mon.signal(); } - Except::throw_exception(API_CommandTimedOut, - "Polling thread blocked !!!", - "DServer::add_obj_polling"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked !!!"); } } } @@ -1066,9 +1062,7 @@ void DServer::upd_obj_polling_period(const Tango::DevVarLongStringArray *argin,b if ((argin->svalue.length() != 3) || (argin->lvalue.length() != 1)) { - Except::throw_exception(API_WrongNumberOfArgs, - "Incorrect number of inout arguments", - "DServer::upd_obj_polling_period"); + TANGO_THROW_EXCEPTION(API_WrongNumberOfArgs, "Incorrect number of inout arguments"); } // @@ -1086,7 +1080,7 @@ void DServer::upd_obj_polling_period(const Tango::DevVarLongStringArray *argin,b TangoSys_OMemStream o; o << "Device " << (argin->svalue)[0] << " not found" << std::ends; - Except::re_throw_exception(e,API_DeviceNotFound,o.str(),"DServer::upd_obj_polling_period"); + TANGO_RETHROW_EXCEPTION(e, API_DeviceNotFound, o.str()); } // @@ -1098,7 +1092,7 @@ void DServer::upd_obj_polling_period(const Tango::DevVarLongStringArray *argin,b TangoSys_OMemStream o; o << "Device " << (argin->svalue)[0] << " is not polled" << std::ends; - Except::throw_exception(API_DeviceNotPolled,o.str(),"DServer::upd_obj_polling_period"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -1143,7 +1137,7 @@ void DServer::upd_obj_polling_period(const Tango::DevVarLongStringArray *argin,b { TangoSys_OMemStream o; o << "Object type " << obj_type << " not supported" << std::ends; - Except::throw_exception(API_NotSupported,o.str(),"DServer::upd_obj_polling_period"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } std::vector::iterator ite = dev->get_polled_obj_by_type_name(type,obj_name); @@ -1173,8 +1167,7 @@ void DServer::upd_obj_polling_period(const Tango::DevVarLongStringArray *argin,b o << " (device " << (argin->svalue)[0] << ") "; o << " is externally triggered. Remove and add object to change its polling period"; o << std::ends; - Except::throw_exception((const char *)API_NotSupported,o.str(), - (const char *)"DServer::upd_obj_polling_period"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); }*/ // @@ -1185,7 +1178,7 @@ void DServer::upd_obj_polling_period(const Tango::DevVarLongStringArray *argin,b { TangoSys_OMemStream o; o << (argin->lvalue)[0] << " is below the min authorized period (" << MIN_POLL_PERIOD << " mS)" << std::ends; - Except::throw_exception(API_NotSupported,o.str(),"DServer::upd_obj_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } // @@ -1199,7 +1192,7 @@ void DServer::upd_obj_polling_period(const Tango::DevVarLongStringArray *argin,b { TangoSys_OMemStream o; o << "Can't find a polling thread for device " << (argin->svalue)[0] << std::ends; - Except::throw_exception(API_NotSupported,o.str(),"DServer::upd_obj_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } th_info = tg->get_polling_thread_info_by_id(poll_th_id); @@ -1343,9 +1336,7 @@ void DServer::rem_obj_polling(const Tango::DevVarStringArray *argin,bool with_db if (argin->length() != 3) { - Except::throw_exception(API_WrongNumberOfArgs, - "Incorrect number of inout arguments", - "DServer::rem_obj_polling"); + TANGO_THROW_EXCEPTION(API_WrongNumberOfArgs, "Incorrect number of inout arguments"); } // @@ -1363,7 +1354,7 @@ void DServer::rem_obj_polling(const Tango::DevVarStringArray *argin,bool with_db TangoSys_OMemStream o; o << "Device " << (*argin)[0] << " not found" << std::ends; - Except::re_throw_exception(e,API_DeviceNotFound,o.str(),"DServer::rem_obj_polling"); + TANGO_RETHROW_EXCEPTION(e, API_DeviceNotFound, o.str()); } // @@ -1375,7 +1366,7 @@ void DServer::rem_obj_polling(const Tango::DevVarStringArray *argin,bool with_db TangoSys_OMemStream o; o << "Device " << (*argin)[0] << " is not polled" << std::ends; - Except::throw_exception(API_DeviceNotPolled,o.str(),"DServer::rem_obj_polling"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -1417,7 +1408,7 @@ void DServer::rem_obj_polling(const Tango::DevVarStringArray *argin,bool with_db { TangoSys_OMemStream o; o << "Object type " << obj_type << " not supported" << std::ends; - Except::throw_exception(API_NotSupported,o.str(),"DServer::rem_obj_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } std::vector::iterator ite = dev->get_polled_obj_by_type_name(type,obj_name); @@ -1438,7 +1429,7 @@ void DServer::rem_obj_polling(const Tango::DevVarStringArray *argin,bool with_db { TangoSys_OMemStream o; o << "Can't find a polling thread for device " << (*argin)[0] << std::ends; - Except::throw_exception(API_NotSupported,o.str(),"DServer::rem_obj_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } cout4 << "Thread in charge of device " << (*argin)[0] << " is thread " << poll_th_id << std::endl; @@ -1494,9 +1485,7 @@ void DServer::rem_obj_polling(const Tango::DevVarStringArray *argin,bool with_db if ((shared_cmd.cmd_pending == true) && (interupted == false)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception(API_CommandTimedOut, - "Polling thread blocked !!!", - "DServer::rem_obj_polling"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked !!!"); } } } @@ -1662,7 +1651,7 @@ void DServer::rem_obj_polling(const Tango::DevVarStringArray *argin,bool with_db { TangoSys_OMemStream o; o << "Can't find entry for device " << (*argin)[0] << " in polling threads pool configuration !"<< std::ends; - Except::throw_exception(API_NotSupported,o.str(),"DServer::rem_obj_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } std::vector &pool_conf = tg->get_poll_pool_conf(); @@ -1815,9 +1804,7 @@ void DServer::stop_polling() if ((shared_cmd.cmd_pending == true) && (interupted == false)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception(API_CommandTimedOut, - "Polling thread blocked !!!", - "DServer::stop_polling"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked !!!"); } } } @@ -1881,9 +1868,7 @@ void DServer::start_polling() if ((shared_cmd.cmd_pending == true) && (interupted == false)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception(API_CommandTimedOut, - "Polling thread blocked !!!", - "DServer::start_polling"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked !!!"); } } } @@ -1921,9 +1906,7 @@ void DServer::start_polling(PollingThreadInfo *th_info) if ((shared_cmd.cmd_pending == true) && (interupted == false)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception(API_CommandTimedOut, - "Polling thread blocked while trying to start thread polling!!!", - "DServer::start_polling"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked while trying to start thread polling!!!"); } } } @@ -1981,9 +1964,7 @@ void DServer::add_event_heartbeat() if ((shared_cmd.cmd_pending == true) && (interupted == false)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception(API_CommandTimedOut, - "Polling thread blocked !!!", - "DServer::add_event_heartbeat"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked !!!"); } } } @@ -2043,9 +2024,7 @@ void DServer::rem_event_heartbeat() if ((shared_cmd.cmd_pending == true) && (interupted == false)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception(API_CommandTimedOut, - "Polling thread blocked !!!", - "DServer::rem_event_heartbeat"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked !!!"); } } } @@ -2100,7 +2079,7 @@ void DServer::check_upd_authorized(DeviceImpl *dev,int upd,PollObjType obj_type, else o << "attr_min_poll_period"; o << " for device " << dev->get_name() << " has wrong syntax" << std::ends; - Except::throw_exception(API_BadConfigurationProperty,o.str(),"DServer::check_upd_uthorized()"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } } else @@ -2121,7 +2100,7 @@ void DServer::check_upd_authorized(DeviceImpl *dev,int upd,PollObjType obj_type, else o << "attribute "; o << obj_name << " is below the min authorized (" << min_upd << ")" << std::ends; - Except::throw_exception(API_MethodArgument,o.str(),"DServer::check_upd_authorized"); + TANGO_THROW_EXCEPTION(API_MethodArgument, o.str()); } } diff --git a/cppapi/server/dserversignal.cpp b/cppapi/server/dserversignal.cpp index d055245c8..3274517c7 100644 --- a/cppapi/server/dserversignal.cpp +++ b/cppapi/server/dserversignal.cpp @@ -264,9 +264,7 @@ void DServerSignal::register_class_signal(long signo,bool handler,DeviceClass *c { TangoSys_OMemStream o; o << "Signal number " << signo << " out of range" << std::ends; - Except::throw_exception((const char *)API_SignalOutOfRange, - o.str(), - (const char *)"DServerSignal::register_class_signal"); + TANGO_THROW_EXCEPTION(API_SignalOutOfRange, o.str()); } #ifndef _TG_WINDOWS_ @@ -274,9 +272,7 @@ void DServerSignal::register_class_signal(long signo,bool handler,DeviceClass *c { TangoSys_OMemStream o; o << "Signal " << sig_name[signo] << "is not authorized using your own handler" << std::ends; - Except::throw_exception((const char *)API_SignalOutOfRange, - o.str(), - (const char *)"DServerSignal::register_class_signal"); + TANGO_THROW_EXCEPTION(API_SignalOutOfRange, o.str()); } #endif @@ -371,9 +367,7 @@ void DServerSignal::register_dev_signal(long signo,bool handler,DeviceImpl *dev_ { TangoSys_OMemStream o; o << "Signal number " << signo << " out of range" << std::ends; - Except::throw_exception((const char *)API_SignalOutOfRange, - o.str(), - (const char *)"DServerSignal::register_dev_signal"); + TANGO_THROW_EXCEPTION(API_SignalOutOfRange, o.str()); } #ifndef _TG_WINDOWS_ @@ -381,9 +375,7 @@ void DServerSignal::register_dev_signal(long signo,bool handler,DeviceImpl *dev_ { TangoSys_OMemStream o; o << "Signal " << sig_name[signo] << "is not authorized using your own handler" << std::ends; - Except::throw_exception((const char *)API_SignalOutOfRange, - o.str(), - (const char *)"DServerSignal::register_class_signal"); + TANGO_THROW_EXCEPTION(API_SignalOutOfRange, o.str()); } #endif @@ -474,9 +466,7 @@ void DServerSignal::unregister_class_signal(long signo,DeviceClass *cl_ptr) { TangoSys_OMemStream o; o << "Signal number " << signo << " out of range" << std::ends; - Except::throw_exception((const char *)API_SignalOutOfRange, - o.str(), - (const char *)"DServerSignal::register_proc_signal"); + TANGO_THROW_EXCEPTION(API_SignalOutOfRange, o.str()); } // @@ -529,9 +519,7 @@ void DServerSignal::unregister_dev_signal(long signo,DeviceImpl *dev_ptr) { TangoSys_OMemStream o; o << "Signal number " << signo << " out of range" << std::ends; - Except::throw_exception((const char *)API_SignalOutOfRange, - o.str(), - (const char *)"DServerSignal::register_proc_signal"); + TANGO_THROW_EXCEPTION(API_SignalOutOfRange, o.str()); } // @@ -681,9 +669,7 @@ void DServerSignal::register_handler(long signo,bool handler) { TangoSys_OMemStream o; o << "Can't install signal " << signo << ". OS error = " << errno << std::ends; - Except::throw_exception((const char *)API_CantInstallSignal, - o.str(), - (const char *)"DServerSignal::register_handler"); + TANGO_THROW_EXCEPTION(API_CantInstallSignal, o.str()); } #else if (handler == true) @@ -696,9 +682,7 @@ void DServerSignal::register_handler(long signo,bool handler) { TangoSys_OMemStream o; o << "Can't install signal " << signo << ". OS error = " << errno << std::ends; - Except::throw_exception((const char *)API_CantInstallSignal, - o.str(), - (const char *)"DServerSignal::register_handler"); + TANGO_THROW_EXCEPTION(API_CantInstallSignal, o.str()); } struct sigaction sa; @@ -711,9 +695,7 @@ void DServerSignal::register_handler(long signo,bool handler) { TangoSys_OMemStream o; o << "Can't install signal " << signo << ". OS error = " << errno << std::ends; - Except::throw_exception((const char *)API_CantInstallSignal, - o.str(), - (const char *)"DServerSignal::register_handler"); + TANGO_THROW_EXCEPTION(API_CantInstallSignal, o.str()); } } else @@ -758,9 +740,7 @@ void DServerSignal::unregister_handler(long signo) { TangoSys_OMemStream o; o << "Can't install signal " << signo << ". OS error = " << errno << std::ends; - Except::throw_exception((const char *)API_CantInstallSignal, - o.str(), - (const char *)"DServerSignal::register_handler"); + TANGO_THROW_EXCEPTION(API_CantInstallSignal, o.str()); } #else if (reg_sig[signo].own_handler == true) @@ -775,9 +755,7 @@ void DServerSignal::unregister_handler(long signo) { TangoSys_OMemStream o; o << "Can't install signal " << signo << ". OS error = " << errno << std::ends; - Except::throw_exception((const char *)API_CantInstallSignal, - o.str(), - (const char *)"DServerSignal::register_handler"); + TANGO_THROW_EXCEPTION(API_CantInstallSignal, o.str()); } } else diff --git a/cppapi/server/encoded_attribute.cpp b/cppapi/server/encoded_attribute.cpp index e5a9f22d5..4a9be0fe2 100644 --- a/cppapi/server/encoded_attribute.cpp +++ b/cppapi/server/encoded_attribute.cpp @@ -226,17 +226,13 @@ void EncodedAttribute::decode_rgb32(DeviceAttribute *attr,int *width,int *height { if (attr->is_empty()) { - Except::throw_exception((const char *)API_WrongFormat, - (const char *)"Attribute contains no data", - (const char *)"EncodedAttribute::decode_gray8"); + TANGO_THROW_EXCEPTION(API_WrongFormat, "Attribute contains no data"); } DevVarEncodedArray_var &encDataSeq = attr->get_Encoded_data(); if (encDataSeq.operator->() == NULL) { - ApiDataExcept::throw_exception((const char*)API_IncompatibleAttrArgumentType, - (const char*)"Cannot extract, data in DeviceAttribute object is not DevEncoded", - (const char*)"EncodedAttribute::decode_gray8"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleAttrArgumentType, "Cannot extract, data in DeviceAttribute object is not DevEncoded"); } std::string local_format(encDataSeq.in()[0].encoded_format); @@ -246,9 +242,7 @@ void EncodedAttribute::decode_rgb32(DeviceAttribute *attr,int *width,int *height if( !isRGB && !isJPEG ) { - Except::throw_exception((const char *)API_WrongFormat, - (const char *)"Not a color format", - (const char *)"EncodedAttribute::decode_rgb32"); + TANGO_THROW_EXCEPTION(API_WrongFormat, "Not a color format"); } unsigned char *rawBuff = NULL; @@ -303,17 +297,13 @@ void EncodedAttribute::decode_rgb32(DeviceAttribute *attr,int *width,int *height { TangoSys_OMemStream o; o << jpeg_get_error_msg(err); - Except::throw_exception((const char *)API_DecodeErr, - o.str(), - (const char *)"EncodedAttribute::decode_rgb32"); + TANGO_THROW_EXCEPTION(API_DecodeErr, o.str()); } if( jFormat==JPEG_GRAY_FORMAT ) { // Should not happen - Except::throw_exception((const char *)API_WrongFormat, - (const char *)"Not a color format", - (const char *)"EncodedAttribute::decode_rgb32"); + TANGO_THROW_EXCEPTION(API_WrongFormat, "Not a color format"); } return; @@ -327,17 +317,13 @@ void EncodedAttribute::decode_gray8(DeviceAttribute *attr,int *width,int *height if (attr->is_empty()) { - Except::throw_exception((const char *)API_WrongFormat, - (const char *)"Attribute contains no data", - (const char *)"EncodedAttribute::decode_gray8"); + TANGO_THROW_EXCEPTION(API_WrongFormat, "Attribute contains no data"); } DevVarEncodedArray_var &encDataSeq = attr->get_Encoded_data(); if (encDataSeq.operator->() == NULL) { - ApiDataExcept::throw_exception((const char*)API_IncompatibleAttrArgumentType, - (const char*)"Cannot extract, data in DeviceAttribute object is not DevEncoded", - (const char*)"EncodedAttribute::decode_gray8"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleAttrArgumentType, "Cannot extract, data in DeviceAttribute object is not DevEncoded"); } std::string local_format(encDataSeq.in()[0].encoded_format); @@ -347,9 +333,7 @@ void EncodedAttribute::decode_gray8(DeviceAttribute *attr,int *width,int *height if( !isGrey && !isJPEG ) { - Except::throw_exception((const char *)API_WrongFormat, - (const char *)"Not a grayscale 8bit format", - (const char *)"EncodedAttribute::decode_gray8"); + TANGO_THROW_EXCEPTION(API_WrongFormat, "Not a grayscale 8bit format"); } unsigned char *rawBuff = NULL; @@ -391,18 +375,14 @@ void EncodedAttribute::decode_gray8(DeviceAttribute *attr,int *width,int *height { TangoSys_OMemStream o; o << jpeg_get_error_msg(err); - Except::throw_exception((const char *)API_DecodeErr, - o.str(), - (const char *)"EncodedAttribute::decode_gray8"); + TANGO_THROW_EXCEPTION(API_DecodeErr, o.str()); } if( jFormat!=JPEG_GRAY_FORMAT ) { // Should not happen - Except::throw_exception((const char *)API_WrongFormat, - (const char *)"Not a grayscale 8bit format", - (const char *)"EncodedAttribute::decode_gray8"); + TANGO_THROW_EXCEPTION(API_WrongFormat, "Not a grayscale 8bit format"); } return; @@ -417,17 +397,13 @@ void EncodedAttribute::decode_gray16(DeviceAttribute *attr,int *width,int *heigh if (attr->is_empty()) { - Except::throw_exception((const char *)API_WrongFormat, - (const char *)"Attribute contains no data", - (const char *)"EncodedAttribute::decode_gray16"); + TANGO_THROW_EXCEPTION(API_WrongFormat, "Attribute contains no data"); } DevVarEncodedArray_var &encDataSeq = attr->get_Encoded_data(); if (encDataSeq.operator->() == NULL) { - ApiDataExcept::throw_exception((const char*)API_IncompatibleAttrArgumentType, - (const char*)"Cannot extract, data in DeviceAttribute object is not DevEncoded", - (const char*)"EncodedAttribute::decode_gray16"); + TANGO_THROW_API_EXCEPTION(ApiDataExcept, API_IncompatibleAttrArgumentType, "Cannot extract, data in DeviceAttribute object is not DevEncoded"); } std::string local_format(encDataSeq.in()[0].encoded_format); @@ -436,9 +412,7 @@ void EncodedAttribute::decode_gray16(DeviceAttribute *attr,int *width,int *heigh if( !isGrey ) { - Except::throw_exception((const char *)API_WrongFormat, - (const char *)"Not a grayscale 16 bits format", - (const char *)"EncodedAttribute::decode_gray16"); + TANGO_THROW_EXCEPTION(API_WrongFormat, "Not a grayscale 16 bits format"); } unsigned char *rawBuff = NULL; diff --git a/cppapi/server/eventcmds.cpp b/cppapi/server/eventcmds.cpp index 48226dc7a..17ee1fe27 100644 --- a/cppapi/server/eventcmds.cpp +++ b/cppapi/server/eventcmds.cpp @@ -58,9 +58,7 @@ DevLong DServer::event_subscription_change(const Tango::DevVarStringArray *argin TangoSys_OMemStream o; o << "Not enough input arguments, needs 4 i.e. device name, attribute name, action, event name" << std::ends; - Except::throw_exception((const char *)API_WrongNumberOfArgs, - o.str(), - (const char *)"DServer::event_subscription_change"); + TANGO_THROW_EXCEPTION(API_WrongNumberOfArgs, o.str()); } std::string dev_name, attr_name, action, event, attr_name_lower; @@ -85,9 +83,7 @@ DevLong DServer::event_subscription_change(const Tango::DevVarStringArray *argin TangoSys_OMemStream o; o << "The device server is shutting down! You can no longer subscribe for events" << std::ends; - Except::throw_exception((const char *)API_ShutdownInProgress, - o.str(), - (const char *)"DServer::event_subscription_change"); + TANGO_THROW_EXCEPTION(API_ShutdownInProgress, o.str()); } // @@ -196,8 +192,7 @@ void DServer::event_subscription(std::string &dev_name,std::string &obj_name,std { TangoSys_OMemStream o; o << "Device " << dev_name << " not found" << std::ends; - Except::re_throw_exception(e,(const char *)API_DeviceNotFound,o.str(), - (const char *)"DServer::event_subscription"); + TANGO_RETHROW_EXCEPTION(e, API_DeviceNotFound, o.str()); } } @@ -220,8 +215,7 @@ void DServer::event_subscription(std::string &dev_name,std::string &obj_name,std ss << "The attribute " << obj_name << " is a forwarded attribute."; ss << "\nIt is not supported to subscribe events from forwarded attribute using Tango < 9. Please update!!"; - Except::throw_exception(API_NotSupportedFeature, - ss.str(),"DServer::event_subscription"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, ss.str()); } } else @@ -232,8 +226,7 @@ void DServer::event_subscription(std::string &dev_name,std::string &obj_name,std ss << "The attribute " << obj_name << " is a forwarded attribute."; ss << "\nIt is not supported to subscribe events from forwarded attribute using Tango < 9. Please update!!"; - Except::throw_exception(API_NotSupportedFeature, - ss.str(),"DServer::event_subscription"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, ss.str()); } } @@ -278,9 +271,7 @@ void DServer::event_subscription(std::string &dev_name,std::string &obj_name,std o << obj_name; o << " is not data ready event enabled" << std::ends; - Except::throw_exception(API_AttributeNotDataReadyEnabled, - o.str(), - "DServer::event_subscription"); + TANGO_THROW_EXCEPTION(API_AttributeNotDataReadyEnabled, o.str()); } cout4 << "DServer::event_subscription(): update data_ready subscription\n"; @@ -305,8 +296,7 @@ void DServer::event_subscription(std::string &dev_name,std::string &obj_name,std { if (attribute.is_fwd_att() == false && attribute.is_change_event() == false) { - Except::throw_exception(API_AttributePollingNotStarted,o.str(), - "DServer::event_subscription"); + TANGO_THROW_EXCEPTION(API_AttributePollingNotStarted, o.str()); } } else @@ -315,14 +305,13 @@ void DServer::event_subscription(std::string &dev_name,std::string &obj_name,std { if (attribute.is_fwd_att() == false && attribute.is_archive_event() == false) { - Except::throw_exception(API_AttributePollingNotStarted,o.str(), - "DServer::event_subscription"); + TANGO_THROW_EXCEPTION(API_AttributePollingNotStarted, o.str()); } } else { if (attribute.is_fwd_att() == false) - Except::throw_exception(API_AttributePollingNotStarted,o.str(),"DServer::event_subscription"); + TANGO_THROW_EXCEPTION(API_AttributePollingNotStarted, o.str()); } } } @@ -356,8 +345,7 @@ void DServer::event_subscription(std::string &dev_name,std::string &obj_name,std o << obj_name; o << " are not set" << std::ends; - Except::throw_exception(API_EventPropertiesNotSet, - o.str(),"DServer::event_subscription"); + TANGO_THROW_EXCEPTION(API_EventPropertiesNotSet, o.str()); } } } @@ -433,8 +421,7 @@ void DServer::event_subscription(std::string &dev_name,std::string &obj_name,std o << obj_name; o << " are not set" << std::ends; - Except::throw_exception(API_EventPropertiesNotSet, - o.str(),"DServer::event_subscription"); + TANGO_THROW_EXCEPTION(API_EventPropertiesNotSet, o.str()); } } } @@ -498,8 +485,7 @@ void DServer::event_subscription(std::string &dev_name,std::string &obj_name,std o << zmq_major << "." << zmq_minor << "." << zmq_patch; o << "\nMulticast event(s) not available with this ZMQ release" << std::ends; - Except::throw_exception(API_UnsupportedFeature, - o.str(),"DServer::event_subscription"); + TANGO_THROW_EXCEPTION(API_UnsupportedFeature, o.str()); } std::string::size_type start,end; @@ -669,9 +655,7 @@ DevVarLongStringArray *DServer::zmq_event_subscription_change(const Tango::DevVa TangoSys_OMemStream o; o << "Not enough input arguments, needs at least 4 i.e. device name, attribute/pipe name, action, event name, " << std::ends; - Except::throw_exception((const char *)API_WrongNumberOfArgs, - o.str(), - (const char *)"DServer::zmq_event_subscription_change"); + TANGO_THROW_EXCEPTION(API_WrongNumberOfArgs, o.str()); } Tango::Util *tg = Tango::Util::instance(); @@ -686,9 +670,7 @@ DevVarLongStringArray *DServer::zmq_event_subscription_change(const Tango::DevVa TangoSys_OMemStream o; o << "Not enough input arguments, needs 4 i.e. device name, attribute/pipe name, action, event name" << std::ends; - Except::throw_exception((const char *)API_WrongNumberOfArgs, - o.str(), - (const char *)"DServer::zmq_event_subscription_change"); + TANGO_THROW_EXCEPTION(API_WrongNumberOfArgs, o.str()); } // @@ -784,7 +766,7 @@ DevVarLongStringArray *DServer::zmq_event_subscription_change(const Tango::DevVa std::stringstream ss; ss << "The event type you sent (" << event << ") is not valid event type"; - Except::throw_exception(API_WrongNumberOfArgs,ss.str(),"DServer::zmq_event_subscription_change"); + TANGO_THROW_EXCEPTION(API_WrongNumberOfArgs, ss.str()); } bool intr_change = false; @@ -860,9 +842,7 @@ DevVarLongStringArray *DServer::zmq_event_subscription_change(const Tango::DevVa TangoSys_OMemStream o; o << "The device server is shutting down! You can no longer subscribe for events" << std::ends; - Except::throw_exception((const char *)API_ShutdownInProgress, - o.str(), - (const char *)"DServer::zmq_event_subscription_change"); + TANGO_THROW_EXCEPTION(API_ShutdownInProgress, o.str()); } // @@ -892,8 +872,7 @@ DevVarLongStringArray *DServer::zmq_event_subscription_change(const Tango::DevVa { TangoSys_OMemStream o; o << "Device " << dev_name << " not found" << std::ends; - Except::re_throw_exception(e,(const char *)API_DeviceNotFound,o.str(), - (const char *)"DServer::event_subscription"); + TANGO_RETHROW_EXCEPTION(e, API_DeviceNotFound, o.str()); } long idl_vers = dev->get_dev_idl_version(); @@ -903,9 +882,7 @@ DevVarLongStringArray *DServer::zmq_event_subscription_change(const Tango::DevVa o << "Device " << dev_name << " too old to use ZMQ event (it does not implement IDL 4)"; o << "\nSimulate a CommandNotFound exception to move to notifd event system" << std::ends; - Except::throw_exception((const char *)API_CommandNotFound, - o.str(), - (const char *)"DServer::zmq_event_subscription_change"); + TANGO_THROW_EXCEPTION(API_CommandNotFound, o.str()); } if (client_release > idl_vers) @@ -1162,8 +1139,7 @@ void DServer::event_confirm_subscription(const Tango::DevVarStringArray *argin) { TangoSys_OMemStream o; o << "Device " << dev_name << " not found" << std::ends; - Except::re_throw_exception(e,(const char *)API_DeviceNotFound,o.str(), - (const char *)"DServer::event_confirm_subscription"); + TANGO_RETHROW_EXCEPTION(e, API_DeviceNotFound, o.str()); } old_dev = dev_name; diff --git a/cppapi/server/fwdattrdesc.cpp b/cppapi/server/fwdattrdesc.cpp index 308adc048..ffa15ef31 100644 --- a/cppapi/server/fwdattrdesc.cpp +++ b/cppapi/server/fwdattrdesc.cpp @@ -316,7 +316,7 @@ void FwdAttr::read(DeviceImpl *dev,Attribute &attr) desc = desc + name + " is a forwarded attribute and its root device ("; desc = desc + fwd_dev_name; desc = desc + ") is not yet available"; - Tango::Except::throw_exception(API_AttrConfig,desc,"FwdAttr::read"); + TANGO_THROW_EXCEPTION(API_AttrConfig, desc); } // @@ -335,7 +335,7 @@ void FwdAttr::read(DeviceImpl *dev,Attribute &attr) std::string desc("Attribute "); desc = desc + name + " is a forwarded attribute.\n"; desc = desc + "Check device status to get more info"; - Tango::Except::re_throw_exception(e,API_AttrConfig,desc,"FwdAttr::read()"); + TANGO_RETHROW_EXCEPTION(e, API_AttrConfig, desc); } // @@ -414,7 +414,7 @@ void FwdAttr::read(DeviceImpl *dev,Attribute &attr) { std::stringstream ss; ss << "Reading root attribute " << fwd_root_att << " on device " << fwd_dev_name << " failed!"; - Tango::Except::re_throw_exception(e,API_AttributeFailed,ss.str(),"FwdAttr::read"); + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, ss.str()); } } @@ -447,7 +447,7 @@ void FwdAttr::write(TANGO_UNUSED(DeviceImpl *dev),WAttribute &attr) desc = desc + name + " is a forwarded attribute and its root device ("; desc = desc + fwd_dev_name; desc = desc + ") is not yet available"; - Tango::Except::throw_exception(API_AttrConfig,desc,"FwdAttr::write"); + TANGO_THROW_EXCEPTION(API_AttrConfig, desc); } // @@ -466,7 +466,7 @@ void FwdAttr::write(TANGO_UNUSED(DeviceImpl *dev),WAttribute &attr) std::string desc("Attribute "); desc = desc + name + " is a forwarded attribute.\n"; desc = desc + "Check device status to get more info"; - Tango::Except::re_throw_exception(e,API_AttrConfig,desc,"FwdAttr::write()"); + TANGO_RETHROW_EXCEPTION(e, API_AttrConfig, desc); } // @@ -556,7 +556,7 @@ void FwdAttr::write(TANGO_UNUSED(DeviceImpl *dev),WAttribute &attr) { std::stringstream ss; ss << "Writing root attribute " << fwd_root_att << " on device " << fwd_dev_name << " failed!"; - Tango::Except::re_throw_exception(e,API_AttributeFailed,ss.str(),"FwdAttr::write"); + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, ss.str()); } } @@ -698,8 +698,7 @@ std::string &FwdAttr::get_label_from_default_properties() if (ctr == nb_prop) { - Except::throw_exception(API_AttrOptProp,"Property label not defined in list", - "FwdAttr::get_label_from_default_properties"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, "Property label not defined in list"); } return user_default_properties[ctr].get_value(); diff --git a/cppapi/server/fwdattribute.cpp b/cppapi/server/fwdattribute.cpp index 5ca015c7a..fda2e9349 100644 --- a/cppapi/server/fwdattribute.cpp +++ b/cppapi/server/fwdattribute.cpp @@ -615,7 +615,7 @@ void FwdAttribute::upd_att_config_base(const char *new_label) desc = desc + name + " is a forwarded attribute and its root device ("; desc = desc + fwd_dev_name; desc = desc + ") is not yet available"; - Tango::Except::throw_exception(API_AttrConfig,desc,"FwdAttribute::upd_att_config_base"); + TANGO_THROW_EXCEPTION(API_AttrConfig, desc); } // @@ -937,8 +937,7 @@ DevAttrHistory_5 *FwdAttribute::read_root_att_history(long n) dp->set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << get_fwd_dev_name() << std::ends; - ApiCommExcept::re_throw_exception(one,API_CommunicationFailed, - desc.str(),"FwdAttribute::read_root_att_history()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -952,8 +951,7 @@ DevAttrHistory_5 *FwdAttribute::read_root_att_history(long n) dp->set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << get_fwd_dev_name() << std::ends; - ApiCommExcept::re_throw_exception(comm,API_CommunicationFailed, - desc.str(),"FwdAttribute::read_root_att_history()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -961,8 +959,7 @@ DevAttrHistory_5 *FwdAttribute::read_root_att_history(long n) dp->set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Attribute_history failed on device " << get_fwd_dev_name() << std::ends; - ApiCommExcept::re_throw_exception(ce,API_CommunicationFailed, - desc.str(),"FwdAttribute::read_root_att_history()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } @@ -1042,8 +1039,7 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis TangoSys_OMemStream desc; desc << "Writing attribute(s) on device " << get_fwd_dev_name() << " is not authorized" << std::ends; - NotAllowedExcept::throw_exception((const char *)API_ReadOnlyMode,desc.str(), - (const char *)"FwdAttribute::write_read_root_att()"); + TANGO_THROW_API_EXCEPTION(NotAllowedExcept, API_ReadOnlyMode, desc.str()); } // @@ -1072,8 +1068,7 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis desc << ", attribute "; desc << values[0].name.in(); desc << std::ends; - Except::re_throw_exception(ex,(const char*)API_AttributeFailed, - desc.str(), (const char*)"FwdAttribute::write_read_root_att()"); + TANGO_RETHROW_EXCEPTION(ex, API_AttributeFailed, desc.str()); } catch (Tango::DevFailed &e) @@ -1085,11 +1080,9 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis desc << std::ends; if (::strcmp(e.errors[0].reason,DEVICE_UNLOCKED_REASON) == 0) - DeviceUnlockedExcept::re_throw_exception(e,(const char*)DEVICE_UNLOCKED_REASON, - desc.str(), (const char*)"FwdAttribute::write_read_root_att()"); + TANGO_RETHROW_API_EXCEPTION(DeviceUnlockedExcept, e, DEVICE_UNLOCKED_REASON, desc.str()); else - Except::re_throw_exception(e,(const char*)API_AttributeFailed, - desc.str(), (const char*)"FwdAttribute::write_read_root_att()"); + TANGO_RETHROW_EXCEPTION(e, API_AttributeFailed, desc.str()); } catch (CORBA::TRANSIENT &trans) { @@ -1106,10 +1099,7 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis dp->set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_read_attribute on device " << get_fwd_dev_name() << std::ends; - ApiCommExcept::re_throw_exception(one, - (const char*)API_CommunicationFailed, - desc.str(), - (const char*)"FwdAttribute::write_read_root_att()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, one, API_CommunicationFailed, desc.str()); } } catch (CORBA::COMM_FAILURE &comm) @@ -1123,10 +1113,7 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis dp->set_connection_state(CONNECTION_NOTOK); TangoSys_OMemStream desc; desc << "Failed to execute write_attribute on device " << get_fwd_dev_name() << std::ends; - ApiCommExcept::re_throw_exception(comm, - (const char*)API_CommunicationFailed, - desc.str(), - (const char*)"FwdAttribute::write_read_root_att"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, comm, API_CommunicationFailed, desc.str()); } } catch (CORBA::SystemException &ce) @@ -1135,10 +1122,7 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis TangoSys_OMemStream desc; desc << "Failed to execute write_attributes on device " << get_fwd_dev_name() << std::ends; - ApiCommExcept::re_throw_exception(ce, - (const char*)API_CommunicationFailed, - desc.str(), - (const char*)"FwdAttribute::write_read_root_att()"); + TANGO_RETHROW_API_EXCEPTION(ApiCommExcept, ce, API_CommunicationFailed, desc.str()); } } diff --git a/cppapi/server/logcmds.cpp b/cppapi/server/logcmds.cpp index d8a547764..141ad0550 100644 --- a/cppapi/server/logcmds.cpp +++ b/cppapi/server/logcmds.cpp @@ -116,9 +116,7 @@ CORBA::Any *AddLoggingTarget::execute (DeviceImpl *device, const CORBA::Any &in_ const DevVarStringArray *targets; if ((in_any >>= targets) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : DevVarStringArray", - (const char *)"AddLoggingTarget::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : DevVarStringArray"); } // @@ -168,9 +166,7 @@ CORBA::Any *RemoveLoggingTarget::execute (DeviceImpl *device, const CORBA::Any & const DevVarStringArray *targets; if ((in_any >>= targets) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : DevVarStringArray", - (const char *)"RemoveLoggingTarget::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : DevVarStringArray"); } // @@ -222,9 +218,7 @@ CORBA::Any *GetLoggingTarget::execute (DeviceImpl *device, const CORBA::Any &in_ const char* tmp_str; if ((in_any >>= tmp_str) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : DevString", - (const char *)"GetLoggingTarget::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : DevString"); } // @@ -268,9 +262,7 @@ CORBA::Any *SetLoggingLevel::execute (DeviceImpl *device, const CORBA::Any &in_a const DevVarLongStringArray *argin; if ((in_any >>= argin) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : DevVarLongStringArray", - (const char *)"SetLoggingLevel::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : DevVarLongStringArray"); } // @@ -321,9 +313,7 @@ CORBA::Any *GetLoggingLevel::execute (DeviceImpl *device, const CORBA::Any &in_a const DevVarStringArray *argin; if ((in_any >>= argin) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : DevVarStringArray", - (const char *)"GetLoggingLevel::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : DevVarStringArray"); } // diff --git a/cppapi/server/logging.cpp b/cppapi/server/logging.cpp index 7999762af..1670a6c1f 100644 --- a/cppapi/server/logging.cpp +++ b/cppapi/server/logging.cpp @@ -261,9 +261,7 @@ void Logging::add_logging_target (const Tango::DevVarStringArray *argin) // N x [device-name, target-type::target-name] expected // The length of the input sequence must be a multiple of 2 if ((argin->length() % 2) != 0) { - Except::throw_exception((const char *)API_MethodArgument, - (const char *)"Incorrect number of inout arguments", - (const char *)"Logging::add_logging_target"); + TANGO_THROW_EXCEPTION(API_MethodArgument, "Incorrect number of inout arguments"); } // device name pattern std::string pattern; @@ -281,8 +279,7 @@ void Logging::add_logging_target (const Tango::DevVarStringArray *argin) if (dl.empty()) { TangoSys_OMemStream o; o << "No device name matching pattern <" << pattern << ">" << std::ends; - Except::throw_exception((const char *)API_DeviceNotFound,o.str(), - (const char *)"Logging::add_logging_target"); + TANGO_THROW_EXCEPTION(API_DeviceNotFound, o.str()); } // Check that none of the concerned device(s) is locked by another client DServer *adm_dev = Util::instance()->get_dserver_device(); @@ -301,8 +298,7 @@ void Logging::add_logging_target (const Tango::DevVarStringArray *argin) catch (std::exception& e) { TangoSys_OMemStream o; o << "std::exception caught [" << e.what() << "]" << std::ends; - Except::throw_exception((const char *)API_InternalError, o.str(), - (const char *)"Logging::add_logging_target"); + TANGO_THROW_EXCEPTION(API_InternalError, o.str()); } } @@ -361,8 +357,7 @@ void Logging::add_logging_target(log4tango::Logger* logger, if (throw_exception) { TangoSys_OMemStream o; o << "Invalid logging target type specified (" << ltg_type_str << ")" << std::ends; - Except::throw_exception((const char *)API_MethodArgument, o.str(), - (const char *)"DeviceImpl::add_logging_target"); + TANGO_THROW_EXCEPTION(API_MethodArgument, o.str()); } return; } @@ -394,8 +389,7 @@ void Logging::add_logging_target(log4tango::Logger* logger, if (throw_exception) { TangoSys_OMemStream o; o << "Device target name must be specified (no default value)" << std::ends; - Except::throw_exception((const char *)API_MethodArgument, o.str(), - (const char *)"DeviceImpl::add_logging_target"); + TANGO_THROW_EXCEPTION(API_MethodArgument, o.str()); } return; } @@ -415,8 +409,7 @@ void Logging::add_logging_target(log4tango::Logger* logger, if (throw_exception) { TangoSys_OMemStream o; o << "Out of memory error" << std::ends; - Except::throw_exception((const char *)API_MemoryAllocation, o.str(), - (const char *)"DeviceImpl::add_logging_target"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, o.str()); } break; } @@ -427,8 +420,7 @@ void Logging::add_logging_target(log4tango::Logger* logger, if (throw_exception) { TangoSys_OMemStream o; o << "Out of memory error" << std::ends; - Except::throw_exception((const char *)API_MemoryAllocation, o.str(), - (const char *)"DeviceImpl::add_logging_target"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, o.str()); } break; } @@ -438,8 +430,7 @@ void Logging::add_logging_target(log4tango::Logger* logger, if (throw_exception) { TangoSys_OMemStream o; o << "Could not open logging file " << full_file_name << std::ends; - Except::throw_exception((const char *)API_CannotOpenFile, o.str(), - (const char *)"DeviceImpl::add_logging_target"); + TANGO_THROW_EXCEPTION(API_CannotOpenFile, o.str()); } break; } @@ -450,8 +441,7 @@ void Logging::add_logging_target(log4tango::Logger* logger, if (throw_exception) { TangoSys_OMemStream o; o << "Out of memory error" << std::ends; - Except::throw_exception((const char *)API_MemoryAllocation, o.str(), - (const char *)"DeviceImpl::add_logging_target"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, o.str()); } break; } @@ -463,8 +453,7 @@ void Logging::add_logging_target(log4tango::Logger* logger, if (throw_exception) { TangoSys_OMemStream o; o << "Out of memory error" << std::ends; - Except::throw_exception((const char *)API_MemoryAllocation, o.str(), - (const char *)"DeviceImpl::add_logging_target"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, o.str()); } break; } @@ -474,8 +463,7 @@ void Logging::add_logging_target(log4tango::Logger* logger, if (throw_exception) { TangoSys_OMemStream o; o << "Could not connect to log consumer " << ltg_name_str << std::ends; - Except::throw_exception((const char *)API_ConnectionFailed, o.str(), - (const char *)"DeviceImpl::add_logging_target"); + TANGO_THROW_EXCEPTION(API_ConnectionFailed, o.str()); } break; } @@ -497,9 +485,7 @@ void Logging::add_logging_target(log4tango::Logger* logger, if (throw_exception) { TangoSys_OMemStream o; o << "std::exception caught [" << e.what() << "]" << std::ends; - Except::throw_exception((const char *)API_StdException, - o.str(), - (const char *)"Logging::add_logging_target"); + TANGO_THROW_EXCEPTION(API_StdException, o.str()); } } } @@ -522,9 +508,7 @@ void Logging::remove_logging_target (const Tango::DevVarStringArray *argin) // N x [device-name, target-type, target-name] expected // The length of the input sequence must a multiple of 3 if ((argin->length() % 2) != 0) { - Except::throw_exception((const char *)API_WrongNumberOfArgs, - (const char *)"Incorrect number of inout arguments", - (const char *)"Logging::remove_logging_target"); + TANGO_THROW_EXCEPTION(API_WrongNumberOfArgs, "Incorrect number of inout arguments"); } // a logger log4tango::Logger* logger; @@ -554,8 +538,7 @@ void Logging::remove_logging_target (const Tango::DevVarStringArray *argin) if (dl.empty()) { TangoSys_OMemStream o; o << "No device name matching pattern <" << pattern << ">" << std::ends; - Except::throw_exception((const char *)API_DeviceNotFound,o.str(), - (const char *)"Logging::remove_logging_target"); + TANGO_THROW_EXCEPTION(API_DeviceNotFound, o.str()); } // Check that none of the concerned device(s) is locked by another client DServer *adm_dev = Util::instance()->get_dserver_device(); @@ -582,8 +565,7 @@ void Logging::remove_logging_target (const Tango::DevVarStringArray *argin) else { TangoSys_OMemStream o; o << "Logging target type <" << tg_type_str << "> not supported" << std::ends; - Except::throw_exception((const char *)API_MethodArgument, o.str(), - (const char *)"Logging::remove_logging_target"); + TANGO_THROW_EXCEPTION(API_MethodArgument, o.str()); } // do we have to remove all targets? remove_all_targets = (tg_name == "*") ? 1 : 0; @@ -594,8 +576,7 @@ void Logging::remove_logging_target (const Tango::DevVarStringArray *argin) if (logger == 0) { TangoSys_OMemStream o; o << "Internal error (got a NULL logger)" << std::ends; - Except::throw_exception((const char *)API_InternalError, o.str(), - (const char *)"Logging::remove_logging_target"); + TANGO_THROW_EXCEPTION(API_InternalError, o.str()); } // CASE I: remove ONE target of type if (remove_all_targets == 0) { @@ -649,9 +630,7 @@ void Logging::remove_logging_target (const Tango::DevVarStringArray *argin) catch (std::exception& e) { TangoSys_OMemStream o; o << "std::exception caught [" << e.what() << "]" << std::ends; - Except::throw_exception((const char *)API_StdException, - o.str(), - (const char *)"Logging::remove_logging_target"); + TANGO_THROW_EXCEPTION(API_StdException, o.str()); } } @@ -674,18 +653,14 @@ Tango::DevVarStringArray* Logging::get_logging_target (const std::string& dev_na catch (Tango::DevFailed &e) { TangoSys_OMemStream o; o << "Device " << dev_name << " not found" << std::ends; - Except::re_throw_exception(e, - (const char *)API_DeviceNotFound, - o.str(), - (const char *)"Logging::get_logging_target"); + TANGO_RETHROW_EXCEPTION(e, API_DeviceNotFound, o.str()); } // get device's logger log4tango::Logger *logger = dev->get_logger(); if (logger == 0) { TangoSys_OMemStream o; o << "Could not instantiate logger (out of memory error)" << std::ends; - Except::throw_exception((const char *)API_MemoryAllocation, o.str(), - (const char *)"Logging::get_logging_target"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, o.str()); } // get logger's appender list log4tango::AppenderList al = logger->get_all_appenders(); @@ -693,9 +668,7 @@ Tango::DevVarStringArray* Logging::get_logging_target (const std::string& dev_na ret = new Tango::DevVarStringArray(al.size()); if (ret == 0) { TangoSys_OMemStream o; - Except::throw_exception((const char *)API_MemoryAllocation, - "Out of memory error (DevVarStringArray allocation failed)", - (const char *)"Logging::get_logging_target"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Out of memory error (DevVarStringArray allocation failed)"); } // set CORBA::sequence size to its max size ret->length(al.size()); @@ -710,8 +683,7 @@ Tango::DevVarStringArray* Logging::get_logging_target (const std::string& dev_na catch (std::exception& e) { TangoSys_OMemStream o; o << "std::exception caught [" << e.what() << "]" << std::ends; - Except::throw_exception((const char *)API_StdException, - o.str(),(const char *)"Logging::get_logging_target"); + TANGO_THROW_EXCEPTION(API_StdException, o.str()); } return ret; } @@ -732,10 +704,8 @@ void Logging::set_logging_level (const DevVarLongStringArray *argin) cout4 << "Input long = " << argin->lvalue[i] << std::endl; // check input if (argin->svalue.length() != argin->lvalue.length()) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type,\ - long and string arrays must have the same length", - (const char *)"Logging::set_logging_level"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type,\ + long and string arrays must have the same length"); } // the device name wildcard std::string pattern; @@ -747,10 +717,8 @@ void Logging::set_logging_level (const DevVarLongStringArray *argin) for (i = 0; i < argin->svalue.length(); i++) { // check logging level if (argin->lvalue[i] < Tango::LOG_OFF || argin->lvalue[i] > Tango::LOG_DEBUG) { - Except::throw_exception((const char *)API_MethodArgument, - (const char *)"Invalid argument for command,\ - logging level out of range", - (const char *)"Logging::set_logging_level"); + TANGO_THROW_EXCEPTION(API_MethodArgument, "Invalid argument for command,\ + logging level out of range"); } // get ith wilcard pattern = argin->svalue[i]; @@ -769,9 +737,7 @@ void Logging::set_logging_level (const DevVarLongStringArray *argin) logger = dl[j]->get_logger(); if (logger == 0) { //--TODO::change the following message - Except::throw_exception((const char *)API_MemoryAllocation, - "out of memory error", - (const char *)"Logging::set_logging_level"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "out of memory error"); } // map TANGO level to log4tango level log4tango::Level::Value log4tango_level = @@ -786,8 +752,7 @@ void Logging::set_logging_level (const DevVarLongStringArray *argin) catch (std::exception& e) { TangoSys_OMemStream o; o << "std::exception caught [" << e.what() << "]" << std::ends; - Except::throw_exception((const char *)API_StdException, - o.str(), (const char *)"Logging::set_logging_level"); + TANGO_THROW_EXCEPTION(API_StdException, o.str()); } } @@ -808,9 +773,7 @@ DevVarLongStringArray* Logging::get_logging_level (const DevVarStringArray *argi ret = new Tango::DevVarLongStringArray; if (ret == 0) { TangoSys_OMemStream o; - Except::throw_exception((const char *)API_MemoryAllocation, - "out of memory error", - (const char *)"Logging::get_logging_level"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "out of memory error"); } // a TANGO logging level Tango::LogLevel tango_level; @@ -835,9 +798,7 @@ DevVarLongStringArray* Logging::get_logging_level (const DevVarStringArray *argi TangoSys_OMemStream o; //--TODO: change the following message o << "out of memory error" << std::ends; - Except::throw_exception((const char *)API_MemoryAllocation, - "out of memory error", - (const char *)"Logging::get_logging_level"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "out of memory error"); } // map log4tango level to TANGO log level tango_level = Logging::log4tango_to_tango_level(logger->get_level()); @@ -855,8 +816,7 @@ DevVarLongStringArray* Logging::get_logging_level (const DevVarStringArray *argi catch (std::exception& e) { TangoSys_OMemStream o; o << "std::exception caught [" << e.what() << "]" << std::ends; - Except::throw_exception((const char *)API_StdException, - o.str(),(const char *)"Logging::get_logging_level"); + TANGO_THROW_EXCEPTION(API_StdException, o.str()); } return ret; } @@ -988,8 +948,7 @@ log4tango::Level::Value Logging::tango_to_log4tango_level (Tango::LogLevel tango if (throw_exception == true) { TangoSys_OMemStream o; o << "Invalid logging level specified" << std::ends; - Except::throw_exception((const char *)API_MethodArgument, - o.str(),(const char *)"Logging::tango_to_log4tango_level"); + TANGO_THROW_EXCEPTION(API_MethodArgument, o.str()); } log4tango_level = log4tango::Level::WARN; break; @@ -1020,8 +979,7 @@ log4tango::Level::Value Logging::tango_to_log4tango_level (const std::string& ta if (throw_exception == true) { TangoSys_OMemStream o; o << "Invalid logging level specified" << std::ends; - Except::throw_exception((const char *)API_MethodArgument, - o.str(),(const char *)"Logging::tango_to_log4tango_level"); + TANGO_THROW_EXCEPTION(API_MethodArgument, o.str()); } log4tango_level = log4tango::Level::WARN; } diff --git a/cppapi/server/multiattribute.cpp b/cppapi/server/multiattribute.cpp index 8603986ee..4d22e850f 100644 --- a/cppapi/server/multiattribute.cpp +++ b/cppapi/server/multiattribute.cpp @@ -142,9 +142,7 @@ MultiAttribute::MultiAttribute(std::string &dev_name,DeviceClass *dev_class_ptr, TangoSys_OMemStream o; o << "Can't get device attribute properties for device " << dev_name << std::ends; - Except::throw_exception((const char *)API_DatabaseAccess, - o.str(), - (const char *)"MultiAttribute::MultiAttribute"); + TANGO_THROW_EXCEPTION(API_DatabaseAccess, o.str()); } } @@ -574,10 +572,7 @@ void MultiAttribute::check_associated(long index, std::string &dev_name) o << "\nProperty writable_attr_name for attribute " << attribute.get_name(); o << " is set to " << assoc_name; o << ", but this attribute does not exist" << std::ends; - Except::throw_exception( - API_AttrOptProp, - o.str().c_str(), - "MultiAttribute::check_associated"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str().c_str()); } Attribute& assoc_attribute = *attr_list[assoc_index]; @@ -590,10 +585,7 @@ void MultiAttribute::check_associated(long index, std::string &dev_name) o << "\nProperty writable_attr_name for attribute " << attribute.get_name(); o << " is set to " << assoc_name; o << ", but this attribute is not writable" << std::ends; - Except::throw_exception( - API_AttrOptProp, - o.str().c_str(), - "MultiAttribute::check_associated"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str().c_str()); } if (attribute.get_data_type() != assoc_attribute.get_data_type()) @@ -603,10 +595,7 @@ void MultiAttribute::check_associated(long index, std::string &dev_name) o << "\nProperty writable_attr_name for attribute " << attribute.get_name(); o << " is set to " << assoc_name; o << ", but these two attributes do not support the same data type" << std::ends; - Except::throw_exception( - API_AttrOptProp, - o.str().c_str(), - "MultiAttribute::check_associated"); + TANGO_THROW_EXCEPTION(API_AttrOptProp, o.str().c_str()); } attribute.set_assoc_ind(assoc_index); @@ -653,7 +642,7 @@ void MultiAttribute::check_idl_release(DeviceImpl *dev) ss << "Attribute " << attr_list[i]->get_name() << " has a DEV_ENUM data type.\n"; ss << "This is supported oonly for device inheriting from IDL 5 or more"; - Except::throw_exception(API_NotSupportedFeature,ss.str(),"MultiAttribute::check_idl_release()"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, ss.str()); } catch (Tango::DevFailed &e) { @@ -737,9 +726,7 @@ void MultiAttribute::add_attribute(std::string &dev_name,DeviceClass *dev_class_ TangoSys_OMemStream o; o << "Can't get device attribute properties for device " << dev_name << std::ends; - Except::re_throw_exception(e,(const char *)API_DatabaseAccess, - o.str(), - (const char *)"MultiAttribute::add_attribute"); + TANGO_RETHROW_EXCEPTION(e, API_DatabaseAccess, o.str()); } } @@ -1172,9 +1159,7 @@ Attribute &MultiAttribute::get_attr_by_name(const char *attr_name) TangoSys_OMemStream o; o << attr_name << " attribute not found" << std::ends; - Except::throw_exception((const char *)API_AttrNotFound, - o.str(), - (const char *)"MultiAttribute::get_attr_by_name"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, o.str()); } return *attr; } @@ -1211,9 +1196,7 @@ WAttribute &MultiAttribute::get_w_attr_by_name(const char *attr_name) TangoSys_OMemStream o; o << attr_name << " writable attribute not found" << std::ends; - Except::throw_exception((const char *)API_AttrNotFound, - o.str(), - (const char *)"MultiAttribute::get_w_attr_by_name"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, o.str()); } if ((attr->get_writable() != Tango::WRITE) && @@ -1223,9 +1206,7 @@ WAttribute &MultiAttribute::get_w_attr_by_name(const char *attr_name) TangoSys_OMemStream o; o << attr_name << " writable attribute not found" << std::ends; - Except::throw_exception((const char *)API_AttrNotFound, - o.str(), - (const char *)"MultiAttribute::get_w_attr_by_name"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, o.str()); } return static_cast(*attr); } @@ -1263,9 +1244,7 @@ long MultiAttribute::get_attr_ind_by_name(const char *attr_name) TangoSys_OMemStream o; o << attr_name << " attribute not found" << std::ends; - Except::throw_exception((const char *)API_AttrNotFound, - o.str(), - (const char *)"MultiAttribute::get_attr_ind_by_name"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, o.str()); } return i; } diff --git a/cppapi/server/notifdeventsupplier.cpp b/cppapi/server/notifdeventsupplier.cpp index bfdb18e39..5106b20dd 100644 --- a/cppapi/server/notifdeventsupplier.cpp +++ b/cppapi/server/notifdeventsupplier.cpp @@ -248,9 +248,7 @@ void NotifdEventSupplier::connect_to_notifd(NotifService &ns,CORBA::ORB_var &_or cout4 << "Failed to import EventChannelFactory " << factory_name << " from the Tango database" << std::endl; } - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to import the EventChannelFactory from the Tango database", - (const char*)"NotifdEventSupplier::create()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to import the EventChannelFactory from the Tango database"); } if (tg->get_db_cache() == NULL) @@ -274,9 +272,7 @@ void NotifdEventSupplier::connect_to_notifd(NotifService &ns,CORBA::ORB_var &_or cout4 << "Notifd event will not be generated" << std::endl; } - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to import the EventChannelFactory from the Device Server property file", - (const char*)"NotifdEventSupplier::create()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to import the EventChannelFactory from the Device Server property file"); } @@ -296,7 +292,7 @@ void NotifdEventSupplier::connect_to_notifd(NotifService &ns,CORBA::ORB_var &_or if (Util::_FileDb == false) { if ((dev_import_list->lvalue)[0] == 0) - Tango::Except::throw_exception("aaa","bbb","ccc"); + TANGO_THROW_EXCEPTION("aaa", "bbb"); } #endif /* _TG_WINDOWS_ */ @@ -315,9 +311,7 @@ void NotifdEventSupplier::connect_to_notifd(NotifService &ns,CORBA::ORB_var &_or if(CORBA::is_nil(_eventChannelFactory)) { std::cerr << factory_name << " is not an EventChannelFactory " << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to import the EventChannelFactory from the Tango database", - (const char*)"NotifdEventSupplier::create()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to import the EventChannelFactory from the Tango database"); } } catch (...) @@ -350,9 +344,7 @@ void NotifdEventSupplier::connect_to_notifd(NotifService &ns,CORBA::ORB_var &_or cout4 << "Failed to narrow the EventChannelFactory - Notifd events will not be generated (hint: start the notifd daemon on this host)" << std::endl; } - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to narrow the EventChannelFactory, make sure the notifd process is running on this host", - (const char*)"NotifdEventSupplier::create()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to narrow the EventChannelFactory, make sure the notifd process is running on this host"); } // @@ -521,16 +513,12 @@ void NotifdEventSupplier::connect_to_notifd(NotifService &ns,CORBA::ORB_var &_or catch(const CosNotification::UnsupportedQoS&) { std::cerr << "Failed to create event channel - events will not be generated (hint: start the notifd daemon on this host)" << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to create a new EventChannel, make sure the notifd process is running on this host", - (const char*)"NotifdEventSupplier::create()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to create a new EventChannel, make sure the notifd process is running on this host"); } catch(const CosNotification::UnsupportedAdmin&) { std::cerr << "Failed to create event channel - events will not be generated (hint: start the notifd daemon on this host)" << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to create a new EventChannel, make sure the notifd process is running on this host", - (const char*)"NotifdEventSupplier::create()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to create a new EventChannel, make sure the notifd process is running on this host"); } } else @@ -552,9 +540,7 @@ void NotifdEventSupplier::connect_to_notifd(NotifService &ns,CORBA::ORB_var &_or if (CORBA::is_nil(_supplierAdmin)) { std::cerr << "Could not get CosNotifyChannelAdmin::SupplierAdmin" << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to get the default supplier admin from the notification daemon (hint: make sure the notifd process is running on this host)", - (const char*)"NotifdEventSupplier::create()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to get the default supplier admin from the notification daemon (hint: make sure the notifd process is running on this host)"); } // @@ -607,17 +593,13 @@ void NotifdEventSupplier::connect_to_notifd(NotifService &ns,CORBA::ORB_var &_or if (CORBA::is_nil(_proxyConsumer)) { std::cerr << "Could not get CosNotifyChannelAdmin::ProxyConsumer" << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to obtain a Notification push consumer, make sure the notifd process is running on this host", - (const char*)"NotifdEventSupplier::create()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to obtain a Notification push consumer, make sure the notifd process is running on this host"); } } catch(const CosNotifyChannelAdmin::AdminLimitExceeded&) { std::cerr << "Failed to get push consumer from notification daemon - events will not be generated (hint: start the notifd daemon on this host)" << std::endl; - EventSystemExcept::throw_exception((const char*)API_NotificationServiceFailed, - (const char*)"Failed to get push consumer from notification daemon (hint: make sure the notifd process is running on this host)", - (const char*)"NotifdEventSupplier::create()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_NotificationServiceFailed, "Failed to get push consumer from notification daemon (hint: make sure the notifd process is running on this host)"); } CosNotifyChannelAdmin::StructuredProxyPushConsumer_var @@ -929,7 +911,7 @@ void NotifdEventSupplier::push_event(DeviceImpl *device_impl,std::string event_t str = str + ("Please, re-compile your client with at least Tango 8"); std::cerr << str << std::endl; - Except::throw_exception(API_NotSupported,str,"NotifdEventSupplier::push_event"); + TANGO_THROW_EXCEPTION(API_NotSupported, str); } else if (attr_value.attr_conf_2 != NULL) struct_event.remainder_of_body <<= (*attr_value.attr_conf_2); diff --git a/cppapi/server/ntservice.cpp b/cppapi/server/ntservice.cpp index 195a53199..5f3ad1cbd 100644 --- a/cppapi/server/ntservice.cpp +++ b/cppapi/server/ntservice.cpp @@ -132,9 +132,7 @@ NTEventLogger::NTEventLogger(const char* service, DWORD eventId) eventSource_ = ::RegisterEventSource(NULL, service); if(eventSource_ == 0) { - Except::throw_exception((const char *)API_DatabaseAccess, - (const char *)"RegisterEventsource failed", - (const char *)"NTEventLogger::NTEventLogger"); + TANGO_THROW_EXCEPTION(API_DatabaseAccess, "RegisterEventsource failed"); } } diff --git a/cppapi/server/pipe.cpp b/cppapi/server/pipe.cpp index 18a7adbab..b99254412 100644 --- a/cppapi/server/pipe.cpp +++ b/cppapi/server/pipe.cpp @@ -184,7 +184,7 @@ void Pipe::set_upd_properties(const PipeConfig &new_conf,DeviceImpl *dev) o << "Device " << dev->get_name() << "-> Pipe : " << name; o << "\nDatabase error occurred whilst setting pipe properties. The database may be corrupted." << std::ends; - Except::throw_exception(API_CorruptedDatabase,o.str(),"Pipe::set_upd_properties()"); + TANGO_THROW_EXCEPTION(API_CorruptedDatabase, o.str()); } throw; @@ -379,12 +379,12 @@ void Pipe::set_properties(const Tango::PipeConfig &conf,DeviceImpl *dev,std::vec std::transform(user_pipe_name.begin(),user_pipe_name.end(),user_pipe_name.begin(),::tolower); if (user_pipe_name != lower_name) { - Except::throw_exception(API_AttrNotAllowed,"Pipe name is not changeable at run time","Pipe::set_properties()"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, "Pipe name is not changeable at run time"); } if (conf.writable != writable) { - Except::throw_exception(API_AttrNotAllowed,"Pipe writable property is not changeable at run time","Pipe::set_properties()"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, "Pipe writable property is not changeable at run time"); } // @@ -668,9 +668,7 @@ void Pipe::set_pipe_serial_model(PipeSerialModel ser_model) Tango::Util *tg = Tango::Util::instance(); if (tg->get_serial_model() != Tango::BY_DEVICE) { - Except::throw_exception(API_PipeNotAllowed, - "Pipe serial model by user is not allowed when the process is not in BY_DEVICE serialization model", - "Pipe::set_pipe_serial_model"); + TANGO_THROW_EXCEPTION(API_PipeNotAllowed, "Pipe serial model by user is not allowed when the process is not in BY_DEVICE serialization model"); } } @@ -838,7 +836,7 @@ void Pipe::fire_event(DeviceImpl *dev,DevicePipeBlob *p_data,struct timeval &t,b DevVarPipeDataEltArray *tmp_ptr = p_data->get_insert_data(); if (tmp_ptr == nullptr) { - Except::throw_exception(API_PipeNoDataElement,"No data in DevicePipeBlob!","Pipe::fire_event()"); + TANGO_THROW_EXCEPTION(API_PipeNoDataElement, "No data in DevicePipeBlob!"); } CORBA::ULong max,len; diff --git a/cppapi/server/pipe.h b/cppapi/server/pipe.h index 46b92534a..b5a46c78c 100644 --- a/cppapi/server/pipe.h +++ b/cppapi/server/pipe.h @@ -461,7 +461,7 @@ Pipe &operator<<(Pipe &, DataElement &); { \ std::stringstream o; \ o << "Data pointer for pipe " << B << ", data element " << C << " is NULL!"; \ - Except::throw_exception(API_PipeOptProp,o.str(),"Pipe::set_value()"); \ + TANGO_THROW_EXCEPTION(API_PipeOptProp, o.str()); \ } \ else \ (void)0 diff --git a/cppapi/server/pollcmds.cpp b/cppapi/server/pollcmds.cpp index 2374a847d..cc562884b 100644 --- a/cppapi/server/pollcmds.cpp +++ b/cppapi/server/pollcmds.cpp @@ -125,9 +125,7 @@ CORBA::Any *DevPollStatusCmd::execute(DeviceImpl *device, const CORBA::Any &in_a const char *tmp_name; if ((in_any >>= tmp_name) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : string", - (const char *)"DevPollStatusCmd::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : string"); } std::string d_name(tmp_name); cout4 << "Received string = " << d_name << std::endl; @@ -178,9 +176,7 @@ CORBA::Any *AddObjPollingCmd::execute(DeviceImpl *device, const CORBA::Any &in_a const DevVarLongStringArray *tmp_data; if ((in_any >>= tmp_data) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : DevVarLongStringArray", - (const char *)"AddObjPollingCmd::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : DevVarLongStringArray"); } // @@ -236,9 +232,7 @@ CORBA::Any *UpdObjPollingPeriodCmd::execute(DeviceImpl *device, const CORBA::Any const DevVarLongStringArray *tmp_data; if ((in_any >>= tmp_data) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : DevVarLongStringArray", - (const char *)"UpdObjPollingPeriodCmd::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : DevVarLongStringArray"); } // @@ -294,9 +288,7 @@ CORBA::Any *RemObjPollingCmd::execute(DeviceImpl *device, const CORBA::Any &in_a const DevVarStringArray *tmp_data; if ((in_any >>= tmp_data) == false) { - Except::throw_exception((const char *)API_IncompatibleCmdArgumentType, - (const char *)"Imcompatible command argument type, expected type is : DevVarStringArray", - (const char *)"RemObjPollingCmd::execute"); + TANGO_THROW_EXCEPTION(API_IncompatibleCmdArgumentType, "Imcompatible command argument type, expected type is : DevVarStringArray"); } // diff --git a/cppapi/server/pollext.h b/cppapi/server/pollext.h index 73336d4f6..a81e14149 100644 --- a/cppapi/server/pollext.h +++ b/cppapi/server/pollext.h @@ -64,9 +64,7 @@ namespace Tango #define __CHECK_DIM() \ if ((x == 0) || (y == 0)) \ { \ - Except::throw_exception((const char *)API_AttrOptProp, \ - (const char *)"X or Y dimension cannot be 0 for image attribute", \ - (const char *)"AttrData::AttrData"); \ + TANGO_THROW_EXCEPTION(API_AttrOptProp, "X or Y dimension cannot be 0 for image attribute"); \ } \ else \ (void)0 @@ -74,9 +72,7 @@ namespace Tango #define __CHECK_DIM_X() \ if (x == 0) \ { \ - Except::throw_exception((const char *)API_AttrOptProp, \ - (const char *)"X dimension cannot be 0 for spectrum or image attribute", \ - (const char *)"AttrData::AttrData"); \ + TANGO_THROW_EXCEPTION(API_AttrOptProp, "X dimension cannot be 0 for spectrum or image attribute"); \ } \ else \ (void)0 diff --git a/cppapi/server/pollring.cpp b/cppapi/server/pollring.cpp index a7e99201f..f39c92e53 100644 --- a/cppapi/server/pollring.cpp +++ b/cppapi/server/pollring.cpp @@ -362,9 +362,7 @@ void PollRing::get_delta_t(std::vector &res,long nb) if (nb_elt < 2) { - Except::throw_exception((const char *)API_PollRingBufferEmpty, - (const char *)"Not enough data stored yet in polling ring buffer", - (const char *)"PollRing::get_delta_t"); + TANGO_THROW_EXCEPTION(API_PollRingBufferEmpty, "Not enough data stored yet in polling ring buffer"); } // diff --git a/cppapi/server/rootattreg.cpp b/cppapi/server/rootattreg.cpp index ba46fc563..8f88c953a 100644 --- a/cppapi/server/rootattreg.cpp +++ b/cppapi/server/rootattreg.cpp @@ -472,7 +472,7 @@ void RootAttRegistry::RootAttConfCallBack::remove_att(std::string &root_att_name std::string desc("Root attribute "); desc = desc + root_att_name + " not found in class map!"; - Except::throw_exception(API_AttrNotFound,desc,"RootAttConfCallBack::remove_att"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, desc); } } @@ -503,7 +503,7 @@ void RootAttRegistry::RootAttConfCallBack::clear_attrdesc(std::string &root_att_ std::string desc("Root attribute "); desc = desc + root_att_name + " not found in class map!"; - Except::throw_exception(API_AttrNotFound,desc,"RootAttConfCallBack::clear_attrdesc"); + TANGO_THROW_EXCEPTION(API_AttrNotFound, desc); } } @@ -692,7 +692,7 @@ void RootAttRegistry::add_root_att(std::string &device_name,std::string &att_nam std::string desc("The root device "); desc = desc + device_name + " is not defined in database"; - Except::throw_exception(API_AttrNotAllowed,desc,"RootAttRegistry::add_root_att"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, desc); } int idl_vers = the_dev->get_idl_version(); if (idl_vers > 0 && idl_vers < MIN_IDL_CONF5) @@ -702,7 +702,7 @@ void RootAttRegistry::add_root_att(std::string &device_name,std::string &att_nam std::string desc("The root device "); desc = desc + device_name + " is too old to support forwarded attribute. It requires IDL >= 5"; - Except::throw_exception(API_AttrNotAllowed,desc,"RootAttRegistry::add_root_att"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, desc); } dps.insert({device_name,the_dev}); } @@ -759,7 +759,7 @@ void RootAttRegistry::add_root_att(std::string &device_name,std::string &att_nam map_event_id.insert({a_name,event_id}); cbp.update_err_kind(a_name,attdesc->get_err_kind()); - Tango::Except::re_throw_exception(e,API_DummyException,"nothing","RootAttRegistry::add_root_att"); + TANGO_RETHROW_EXCEPTION(e, API_DummyException, "nothing"); } } else @@ -772,7 +772,7 @@ void RootAttRegistry::add_root_att(std::string &device_name,std::string &att_nam std::string desc("It's not supported to have in the same device server process two times the same root attribute ("); desc = desc + a_name + ")"; - Except::throw_exception(API_AttrNotAllowed,desc,"RootAttRegistry::add_root_att"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, desc); } } } @@ -892,7 +892,7 @@ DeviceProxy *RootAttRegistry::get_root_att_dp(std::string &device_name) { std::stringstream ss; ss << device_name << " not registered in map of root attribute devices!"; - Except::throw_exception(API_FwdAttrInconsistency,ss.str(),"RootAttRegistry::get_root_att_dp"); + TANGO_THROW_EXCEPTION(API_FwdAttrInconsistency, ss.str()); } return ite->second; @@ -923,7 +923,7 @@ std::string RootAttRegistry::RootAttConfCallBack::get_local_att_name(const std:: { std::stringstream ss; ss << root_name << " not registered in map of root attribute!"; - Except::throw_exception(API_FwdAttrInconsistency,ss.str(),"RootAttRegistry::get_local_att_name"); + TANGO_THROW_EXCEPTION(API_FwdAttrInconsistency, ss.str()); } std::string loc_name = ite->second.local_name + '/' + ite->second.local_att_name; @@ -955,7 +955,7 @@ DeviceImpl *RootAttRegistry::RootAttConfCallBack::get_local_dev(std::string &loc { std::stringstream ss; ss << local_dev_name << " not registered in map of local device!"; - Except::throw_exception(API_FwdAttrInconsistency,ss.str(),"RootAttRegistry::get_local_dev"); + TANGO_THROW_EXCEPTION(API_FwdAttrInconsistency, ss.str()); } return ite->second; } @@ -988,7 +988,7 @@ void RootAttRegistry::RootAttConfCallBack::update_label(std::string &root_name,s { std::stringstream ss; ss << root_name << " not registered in map of root attribute!"; - Except::throw_exception(API_FwdAttrInconsistency,ss.str(),"RootAttRegistry::update_label"); + TANGO_THROW_EXCEPTION(API_FwdAttrInconsistency, ss.str()); } } @@ -1190,7 +1190,7 @@ void RootAttRegistry::unsubscribe_user_event(std::string &dev_name,std::string & { std::stringstream ss; ss << f_ev_name << " not found in map of user event on root attribute!"; - Except::throw_exception(API_FwdAttrInconsistency,ss.str(),"RootAttRegistry::unsubscribe_user_event"); + TANGO_THROW_EXCEPTION(API_FwdAttrInconsistency, ss.str()); } // diff --git a/cppapi/server/subdev_diag.cpp b/cppapi/server/subdev_diag.cpp index bc64883e6..d214f151c 100644 --- a/cppapi/server/subdev_diag.cpp +++ b/cppapi/server/subdev_diag.cpp @@ -283,9 +283,7 @@ Tango::DevVarStringArray *SubDevDiag::get_sub_devices() catch (std::bad_alloc &) { - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"SubDevDiag::get_sub_devices"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // Should never reach here. To make compiler happy diff --git a/cppapi/server/tango_monitor.h b/cppapi/server/tango_monitor.h index 6d679e58b..bb669ce24 100644 --- a/cppapi/server/tango_monitor.h +++ b/cppapi/server/tango_monitor.h @@ -138,9 +138,7 @@ inline void TangoMonitor::get_monitor() if (interupted == false) { cout4 << "TIME OUT for thread " << th->id() << std::endl; - Except::throw_exception((const char *)API_CommandTimedOut, - (const char *)"Not able to acquire serialization (dev, class or process) monitor", - (const char *)"TangoMonitor::get_monitor"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Not able to acquire serialization (dev, class or process) monitor"); } } locking_thread = th; diff --git a/cppapi/server/utils.cpp b/cppapi/server/utils.cpp index cb4645864..d87522d95 100644 --- a/cppapi/server/utils.cpp +++ b/cppapi/server/utils.cpp @@ -139,9 +139,7 @@ Util *Util::instance(bool exit) Util::print_err_message("Tango is not initialised !!!\nExiting"); else { - Except::throw_exception((const char*)API_UtilSingletonNotCreated, - (const char*)"Util singleton not created", - (const char*)"Util::instance"); + TANGO_THROW_EXCEPTION(API_UtilSingletonNotCreated, "Util singleton not created"); } } return _instance; @@ -1657,9 +1655,7 @@ void Util::server_already_running() TangoSys_OMemStream o; o << "Database error while trying to import " << dev_name << std::ends; - Except::throw_exception((const char *)API_DatabaseAccess, - o.str(), - (const char *)"Util::server_already_running"); + TANGO_THROW_EXCEPTION(API_DatabaseAccess, o.str()); } } @@ -2147,9 +2143,7 @@ std::vector &Util::get_device_list_by_class(const std::string &cla if (cl_list_ptr == NULL) { - Except::throw_exception((const char *)API_DeviceNotFound, - (const char *)"It's too early to call this method. Devices are not created yet!", - (const char *)"Util::get_device_list_by_class()"); + TANGO_THROW_EXCEPTION(API_DeviceNotFound, "It's too early to call this method. Devices are not created yet!"); } // @@ -2191,9 +2185,7 @@ std::vector &Util::get_device_list_by_class(const std::string &cla { TangoSys_OMemStream o; o << "Class " << class_name << " not found" << std::ends; - Except::throw_exception((const char *)API_ClassNotFound, - o.str(), - (const char *)"Util::get_device_list_by_class()"); + TANGO_THROW_EXCEPTION(API_ClassNotFound, o.str()); } return tmp_cl_list[i]->get_device_list(); @@ -2275,9 +2267,7 @@ DeviceImpl *Util::get_device_by_name(const std::string &dev_name) { TangoSys_OMemStream o; o << "Device " << dev_name << " not found" << std::ends; - Except::throw_exception((const char *)API_DeviceNotFound, - o.str(), - (const char *)"Util::get_device_by_name()"); + TANGO_THROW_EXCEPTION(API_DeviceNotFound, o.str()); } return ret_ptr; @@ -2598,9 +2588,7 @@ void Util::print_err_message(const char *err_mess,TANGO_UNUSED(Tango::MessBoxTyp MessageBox((HWND)NULL,err_mess,MessBoxTitle,MB_ICONINFORMATION); break; } - Except::throw_exception((const char *)API_StartupSequence, - (const char *)"Error in device server startup sequence", - (const char *)"Util::print_err_mess"); + TANGO_THROW_EXCEPTION(API_StartupSequence, "Error in device server startup sequence"); } else { @@ -2739,7 +2727,7 @@ void Util::validate_cmd_line_classes() { std::stringstream ss; ss << "Class name " << pos->first << " used on command line device declaration but this class is not embedded in DS process"; - Except::throw_exception(API_WrongCmdLineArgs,ss.str(),"Util::validate_cmd_line_classes"); + TANGO_THROW_EXCEPTION(API_WrongCmdLineArgs, ss.str()); } } } @@ -2771,7 +2759,7 @@ void Util::tango_host_from_fqan(std::string &fqan,std::string &tg_host) { std::stringstream ss; ss << "The provided fqan (" << fqan << ") is not a valid Tango attribute name" << std::endl; - Except::throw_exception(API_InvalidArgs,ss.str(),"Util::tango_host_from_fqan"); + TANGO_THROW_EXCEPTION(API_InvalidArgs, ss.str()); } std::string::size_type pos = lower_fqan.find('/',8); @@ -2966,7 +2954,7 @@ void Util::check_end_point_specified(int argc,char *argv[]) { std::stringstream ss; ss << "Can't open omniORB configuration file (" << fname << ") to check endPoint option" << std::endl; - Except::throw_exception(API_InvalidArgs,ss.str(),"Util::check_end_point_specified"); + TANGO_THROW_EXCEPTION(API_InvalidArgs, ss.str()); } } } diff --git a/cppapi/server/utils.h b/cppapi/server/utils.h index b3636b744..32ce7e1ae 100644 --- a/cppapi/server/utils.h +++ b/cppapi/server/utils.h @@ -1192,9 +1192,7 @@ inline CORBA::Any *return_empty_any(const char *cmd) TangoSys_MemStream o; o << cmd << "::execute"; - Tango::Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - o.str()); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } return(out_any); @@ -1209,9 +1207,7 @@ inline DbDevice *DeviceImpl::get_db_device() desc_mess << device_name; desc_mess << " which is a non database device"; - Except::throw_exception((const char *)API_NonDatabaseDevice, - desc_mess.str(), - (const char *)"DeviceImpl::get_db_device"); + TANGO_THROW_EXCEPTION(API_NonDatabaseDevice, desc_mess.str()); } return db_dev; diff --git a/cppapi/server/utils.tpp b/cppapi/server/utils.tpp index bc0fd3884..0f56e4764 100644 --- a/cppapi/server/utils.tpp +++ b/cppapi/server/utils.tpp @@ -63,7 +63,7 @@ void Util::fill_attr_polling_buffer(DeviceImpl *dev,std::string &att_name,AttrHi TangoSys_OMemStream o; o << "Device " << dev->get_name() << " is not polled" << std::ends; - Except::throw_exception(API_DeviceNotPolled,o.str(),"Util::fill_attr_polling_buffer"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -95,7 +95,7 @@ void Util::fill_attr_polling_buffer(DeviceImpl *dev,std::string &att_name,AttrHi o << "Attribute " << att_name; o << " of device " << dev->get_name() << " is WRITE only" << std::ends; - Except::throw_exception(API_DeviceNotPolled,o.str(),"Util::fill_attr_polling_buffer"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -115,7 +115,7 @@ void Util::fill_attr_polling_buffer(DeviceImpl *dev,std::string &att_name,AttrHi o << " is not a READ_WRITE attribute. You can't set the attribute written part."; o << "It is defined for record number " << i + 1 << std::ends; - Except::throw_exception(API_NotSupportedFeature,o.str(),"Util::fill_attr_polling_buffer"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } } } @@ -133,7 +133,7 @@ void Util::fill_attr_polling_buffer(DeviceImpl *dev,std::string &att_name,AttrHi o << " is of type DEV_ENCODED. Your device supports only IDL V3."; o << " DEV_ENCODED data type is supported starting with IDL V4" << std::ends; - Except::throw_exception(API_NotSupportedFeature,o.str(),"Util::fill_attr_polling_buffer"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } // @@ -155,7 +155,7 @@ void Util::fill_attr_polling_buffer(DeviceImpl *dev,std::string &att_name,AttrHi o << " is of type DEV_ENCODED. Only Scalar attribute are supported for DEV_ENCODED"; o << "It is defined for record number " << i + 1 << std::ends; - Except::throw_exception(API_NotSupportedFeature,o.str(),"Util::fill_attr_polling_buffer"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } } } @@ -170,7 +170,7 @@ void Util::fill_attr_polling_buffer(DeviceImpl *dev,std::string &att_name,AttrHi o << "The device " << dev->get_name() << " is too old to support this feature. "; o << "Please update your device to IDL 3 or more" << std::ends; - Except::throw_exception(API_NotSupportedFeature,o.str(),"Util::fill_attr_polling_buffer"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, o.str()); } // @@ -187,7 +187,7 @@ void Util::fill_attr_polling_buffer(DeviceImpl *dev,std::string &att_name,AttrHi o << " is only " << nb_poll; o << " which is less than " << nb_elt << "!" << std::ends; - Except::throw_exception(API_DeviceNotPolled,o.str(),"Util::fill_attr_polling_buffer"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -228,9 +228,7 @@ void Util::fill_attr_polling_buffer(DeviceImpl *dev,std::string &att_name,AttrHi catch (std::bad_alloc &) { dev->get_poll_monitor().rel_monitor(); - Except::throw_exception(API_MemoryAllocation, - "Can't allocate memory in server", - "Util::fill_attr_polling_buffer"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } } else @@ -263,8 +261,7 @@ void Util::fill_attr_polling_buffer(DeviceImpl *dev,std::string &att_name,AttrHi catch (std::bad_alloc &) { dev->get_poll_monitor().rel_monitor(); - Except::throw_exception(API_MemoryAllocation, - "Can't allocate memory in server","Util::fill_attr_polling_buffer"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -499,8 +496,7 @@ void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name,CmdHist TangoSys_OMemStream o; o << "Device " << dev->get_name() << " is not polled" << std::ends; - Except::throw_exception((const char *)API_DeviceNotPolled,o.str(), - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -527,8 +523,7 @@ void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name,CmdHist o << " is only " << nb_poll; o << " which is less than " << nb_elt << "!" << std::ends; - Except::throw_exception((const char *)API_DeviceNotPolled,o.str(), - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -566,9 +561,7 @@ void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name,CmdHist catch (std::bad_alloc &) { dev->get_poll_monitor().rel_monitor(); - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } } else @@ -585,9 +578,7 @@ void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name,CmdHist catch (std::bad_alloc &) { dev->get_poll_monitor().rel_monitor(); - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // diff --git a/cppapi/server/utils_polling.cpp b/cppapi/server/utils_polling.cpp index 4bec37383..eeb875b6e 100644 --- a/cppapi/server/utils_polling.cpp +++ b/cppapi/server/utils_polling.cpp @@ -114,18 +114,14 @@ void Util::polling_configure() { TangoSys_OMemStream o; o << "System property polled_cmd for device " << dev_list[j]->get_name() << " has wrong syntax" << std::ends; - Except::throw_exception((const char *)API_BadConfigurationProperty, - o.str(), - (const char *)"Util::polling_configure"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } if ((poll_attr_list.size() % 2) == 1) { TangoSys_OMemStream o; o << "System property polled_attr for device " << dev_list[j]->get_name() << " has wrong syntax" << std::ends; - Except::throw_exception((const char *)API_BadConfigurationProperty, - o.str(), - (const char *)"Util::polling_configure"); + TANGO_THROW_EXCEPTION(API_BadConfigurationProperty, o.str()); } // @@ -317,9 +313,7 @@ void Util::polling_configure() else o << ", attr = "; o << poll_ths[loop]->v_poll_cmd[cmd_loop]->svalue[2].in() << std::ends; - Except::re_throw_exception(e,(const char *)API_BadConfigurationProperty, - o.str(), - (const char *)"Util::polling_configure"); + TANGO_RETHROW_EXCEPTION(e, API_BadConfigurationProperty, o.str()); } } @@ -374,9 +368,7 @@ void Util::polling_configure() o << "Error when configuring polling for device " << v_poll_cmd_fwd[loop]->svalue[0].in(); o << ", attr = "; o << v_poll_cmd_fwd[loop]->svalue[2].in() << std::ends; - Except::re_throw_exception(e,(const char *)API_BadConfigurationProperty, - o.str(), - (const char *)"Util::polling_configure"); + TANGO_RETHROW_EXCEPTION(e, API_BadConfigurationProperty, o.str()); } } } @@ -452,8 +444,7 @@ void Util::trigger_attr_polling(Tango::DeviceImpl *dev,const std::string &name) TangoSys_OMemStream o; o << "Device " << dev->get_name() << " is not polled" << std::ends; - Except::throw_exception((const char *)API_DeviceNotPolled,o.str(), - (const char *)"Util::trigger_attr_polling"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -479,8 +470,7 @@ void Util::trigger_attr_polling(Tango::DeviceImpl *dev,const std::string &name) o << " (device " << dev->get_name() << ") "; o << " is not externally triggered."; o << std::ends; - Except::throw_exception((const char *)API_NotSupported,o.str(), - (const char *)"Util::trigger_attr_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } // @@ -494,8 +484,7 @@ void Util::trigger_attr_polling(Tango::DeviceImpl *dev,const std::string &name) { TangoSys_OMemStream o; o << "Can't find a polling thread for device " << dev->get_name() << std::ends; - Except::throw_exception((const char *)API_NotSupported,o.str(), - (const char *)"Util::trigger_cmd_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } th_info = get_polling_thread_info_by_id(poll_th_id); @@ -571,9 +560,7 @@ void Util::trigger_attr_polling(Tango::DeviceImpl *dev,const std::string &name) if ((shared_cmd.trigger == true) && (interupted == 0)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception((const char *)API_CommandTimedOut, - (const char *)"Polling thread blocked !!!", - (const char *)"Util::trigger_attr_polling"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked !!!"); } } } @@ -610,8 +597,7 @@ void Util::trigger_cmd_polling(Tango::DeviceImpl *dev,const std::string &name) TangoSys_OMemStream o; o << "Device " << dev->get_name() << " is not polled" << std::ends; - Except::throw_exception((const char *)API_DeviceNotPolled,o.str(), - (const char *)"Util::trigger_cmd_polling"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -637,8 +623,7 @@ void Util::trigger_cmd_polling(Tango::DeviceImpl *dev,const std::string &name) o << " (device " << dev->get_name() << ") "; o << " is not externally triggered."; o << std::ends; - Except::throw_exception((const char *)API_NotSupported,o.str(), - (const char *)"Util::trigger_cmd_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } // @@ -652,8 +637,7 @@ void Util::trigger_cmd_polling(Tango::DeviceImpl *dev,const std::string &name) { TangoSys_OMemStream o; o << "Can't find a polling thread for device " << dev->get_name() << std::ends; - Except::throw_exception((const char *)API_NotSupported,o.str(), - (const char *)"Util::trigger_cmd_polling"); + TANGO_THROW_EXCEPTION(API_NotSupported, o.str()); } th_info = get_polling_thread_info_by_id(poll_th_id); @@ -729,9 +713,7 @@ void Util::trigger_cmd_polling(Tango::DeviceImpl *dev,const std::string &name) if ((shared_cmd.trigger == true) && (interupted == 0)) { cout4 << "TIME OUT" << std::endl; - Except::throw_exception((const char *)API_CommandTimedOut, - (const char *)"Polling thread blocked !!!", - (const char *)"Util::trigger_cmd_polling"); + TANGO_THROW_EXCEPTION(API_CommandTimedOut, "Polling thread blocked !!!"); } } } @@ -771,8 +753,7 @@ void Util::clean_attr_polled_prop() o << "Polling properties for attribute " << polled_dyn_attr_names[loop] << " on device " << dyn_att_dev_name; o << " not found device in polled attribute list!" << std::ends; - Except::throw_exception((const char *)API_MethodArgument,o.str(), - (const char *)"Util::clean_attr_polling_prop"); + TANGO_THROW_EXCEPTION(API_MethodArgument, o.str()); } } @@ -819,8 +800,7 @@ void Util::clean_cmd_polled_prop() o << "Polling properties for command " << polled_dyn_cmd_names[loop] << " on device " << dyn_cmd_dev_name; o << " not found device in polled command list!" << std::ends; - Except::throw_exception((const char *)API_MethodArgument,o.str(), - (const char *)"Util::clean_cmd_polling_prop"); + TANGO_THROW_EXCEPTION(API_MethodArgument, o.str()); } } @@ -1030,8 +1010,7 @@ int Util::create_poll_thread(const char *dev_name,bool startup,bool polling_9,in o << "Device " << dev_name << " should be polled by the thread already polling " << d_name; o << " but this device is not defined in the polled device map!!" << std::ends; - Except::throw_exception((const char *)API_PolledDeviceNotInPoolMap,o.str(), - (const char *)"Util::create_poll_thread"); + TANGO_THROW_EXCEPTION(API_PolledDeviceNotInPoolMap, o.str()); } ind = get_dev_entry_in_pool_conf(d_name); @@ -1044,8 +1023,7 @@ int Util::create_poll_thread(const char *dev_name,bool startup,bool polling_9,in o << "Device " << dev_name << " should be polled by the thread already polling " << d_name; o << " but this device is not defined in the pool configuration!!" << std::ends; - Except::throw_exception((const char *)API_PolledDeviceNotInPoolConf,o.str(), - (const char *)"Util::create_poll_thread"); + TANGO_THROW_EXCEPTION(API_PolledDeviceNotInPoolConf, o.str()); } // @@ -1209,8 +1187,7 @@ PollingThreadInfo *Util::get_polling_thread_info_by_id(int th_id) o << "There is no polling thread with ID = " << th_id << " in the polling threads pool"<< std::ends; - Except::throw_exception((const char *)API_PollingThreadNotFound,o.str(), - (const char *)"Util::get_polling_thread_info_by_id"); + TANGO_THROW_EXCEPTION(API_PollingThreadNotFound, o.str()); } return ret_ptr; @@ -1970,8 +1947,7 @@ void Util::remove_polling_thread_info_by_id(int th_id) o << "There is no polling thread with ID = " << th_id << " in the polling threads pool"<< std::ends; - Except::throw_exception((const char *)API_PollingThreadNotFound,o.str(), - (const char *)"Util::remove_polling_thread_info_by_id"); + TANGO_THROW_EXCEPTION(API_PollingThreadNotFound, o.str()); } return; diff --git a/cppapi/server/utils_spec.tpp b/cppapi/server/utils_spec.tpp index 6ff284c4a..fc9a6e195 100644 --- a/cppapi/server/utils_spec.tpp +++ b/cppapi/server/utils_spec.tpp @@ -68,8 +68,7 @@ inline void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name, TangoSys_OMemStream o; o << "Device " << dev->get_name() << " is not polled" << std::ends; - Except::throw_exception((const char *)API_DeviceNotPolled,o.str(), - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -96,8 +95,7 @@ inline void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name, o << " is only " << nb_poll; o << " which is less than " << nb_elt << "!" << std::ends; - Except::throw_exception((const char *)API_DeviceNotPolled,o.str(), - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -135,9 +133,7 @@ inline void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name, catch (std::bad_alloc &) { dev->get_poll_monitor().rel_monitor(); - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } } else @@ -154,9 +150,7 @@ inline void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name, catch (std::bad_alloc &) { dev->get_poll_monitor().rel_monitor(); - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // @@ -212,8 +206,7 @@ inline void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name, TangoSys_OMemStream o; o << "Device " << dev->get_name() << " is not polled" << std::ends; - Except::throw_exception((const char *)API_DeviceNotPolled,o.str(), - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -240,8 +233,7 @@ inline void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name, o << " is only " << nb_poll; o << " which is less than " << nb_elt << "!" << std::ends; - Except::throw_exception((const char *)API_DeviceNotPolled,o.str(), - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_DeviceNotPolled, o.str()); } // @@ -279,9 +271,7 @@ inline void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name, catch (std::bad_alloc &) { dev->get_poll_monitor().rel_monitor(); - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } } else @@ -298,9 +288,7 @@ inline void Util::fill_cmd_polling_buffer(DeviceImpl *dev,std::string &cmd_name, catch (std::bad_alloc &) { dev->get_poll_monitor().rel_monitor(); - Except::throw_exception((const char *)API_MemoryAllocation, - (const char *)"Can't allocate memory in server", - (const char *)"Util::fill_cmd_polling_buffer"); + TANGO_THROW_EXCEPTION(API_MemoryAllocation, "Can't allocate memory in server"); } // diff --git a/cppapi/server/w32win.cpp b/cppapi/server/w32win.cpp index 6196282e9..f0df98fb8 100644 --- a/cppapi/server/w32win.cpp +++ b/cppapi/server/w32win.cpp @@ -98,9 +98,7 @@ void W32Win::RegisterTangoClass(HINSTANCE hInstance) ATOM at = RegisterClass(&wc); if (at == 0) { - Except::throw_exception((LPCSTR)API_NtDebugWindowError, - (LPCSTR)"Can't register class for server main output window", - (LPCSTR)"W32Win::RegisterTangoClass"); + TANGO_THROW_EXCEPTION((LPCSTR)API_NtDebugWindowError, (LPCSTR)"Can't register class for server main output window"); } } @@ -127,9 +125,7 @@ void W32Win::InitInstance(HINSTANCE hInstance, int nCmdShow) if (!hWnd) { - Except::throw_exception((LPCSTR)API_NtDebugWindowError, - (LPCSTR)"Can't create main device server window", - (LPCSTR)"W32Win::InitInstance"); + TANGO_THROW_EXCEPTION((LPCSTR)API_NtDebugWindowError, (LPCSTR)"Can't create main device server window"); } win = hWnd; diff --git a/cppapi/server/w_attribute.cpp b/cppapi/server/w_attribute.cpp index e3d6ee960..34ec59fa5 100644 --- a/cppapi/server/w_attribute.cpp +++ b/cppapi/server/w_attribute.cpp @@ -373,9 +373,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarShortArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = sh_ptr->length(); check_length(nb_data, x, y); @@ -396,9 +394,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -412,9 +408,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -450,9 +444,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarLongArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = lg_ptr->length(); check_length(nb_data, x, y); @@ -473,9 +465,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -489,9 +479,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -528,9 +516,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarLong64Array (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = lg64_ptr->length(); check_length(nb_data, x, y); @@ -551,9 +537,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -567,9 +551,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -605,9 +587,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarDoubleArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = db_ptr->length(); check_length(nb_data, x, y); @@ -633,9 +613,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is a NaN or INF value (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } @@ -647,9 +625,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } @@ -661,9 +637,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -698,9 +672,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarStringArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = string_ptr->length(); check_length(nb_data, x, y); @@ -738,9 +710,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarFloatArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = fl_ptr->length(); check_length(nb_data, x, y); @@ -766,9 +736,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is a NaN or INF value (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } @@ -780,9 +748,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } @@ -794,9 +760,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -832,9 +796,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarUShortArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = ush_ptr->length(); check_length(nb_data, x, y); @@ -855,9 +817,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -871,9 +831,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -909,9 +867,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarCharArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = uch_ptr->length(); check_length(nb_data, x, y); @@ -932,9 +888,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -948,9 +902,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -985,9 +937,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarULongArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = ulo_ptr->length(); check_length(nb_data, x, y); @@ -1008,9 +958,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -1024,9 +972,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -1061,9 +1007,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarULong64Array (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = ulg64_ptr->length(); check_length(nb_data, x, y); @@ -1084,9 +1028,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -1100,9 +1042,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -1137,9 +1077,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarBooleanArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = boo_ptr->length(); check_length(nb_data, x, y); @@ -1172,9 +1110,7 @@ void WAttribute::check_written_value(const CORBA::Any &any, unsigned long x, uns o << "Incompatible attribute type, expected type is : Tango::DevVarStateArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } nb_data = sta_ptr->length(); check_length(nb_data, x, y); @@ -1230,9 +1166,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarShortArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarShortArray &sh_seq = att_union.short_att_value(); @@ -1279,7 +1213,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig ss << " is negative or above the maximun authorized (" << max_val << ") for at least element " << i; - Except::throw_exception(API_WAttrOutsideLimit, ss.str(), "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, ss.str()); } } } @@ -1298,9 +1232,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarLongArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarLongArray &lg_seq = att_union.long_att_value(); nb_data = lg_seq.length(); @@ -1344,9 +1276,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarLong64Array (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarLong64Array &lg64_seq = att_union.long64_att_value(); nb_data = lg64_seq.length(); @@ -1389,9 +1319,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarDoubleArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarDoubleArray &db_seq = att_union.double_att_value(); nb_data = db_seq.length(); @@ -1418,9 +1346,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Set value for attribute " << name; o << " is a NaN or INF value (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } @@ -1432,9 +1358,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } @@ -1446,9 +1370,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -1482,9 +1404,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarStringArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarStringArray &string_seq = att_union.string_att_value(); nb_data = string_seq.length(); @@ -1522,9 +1442,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarFloatArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarFloatArray &fl_seq = att_union.float_att_value(); nb_data = fl_seq.length(); @@ -1551,9 +1469,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Set value for attribute " << name; o << " is a NaN or INF value (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } @@ -1565,9 +1481,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } @@ -1579,9 +1493,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -1615,9 +1527,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarUShortArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarUShortArray &ush_seq = att_union.ushort_att_value(); nb_data = ush_seq.length(); @@ -1660,9 +1570,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarCharArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarCharArray &uch_seq = att_union.uchar_att_value(); nb_data = uch_seq.length(); @@ -1705,9 +1613,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarULongArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarULongArray &ulo_seq = att_union.ulong_att_value(); nb_data = ulo_seq.length(); @@ -1750,9 +1656,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarULong64Array (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarULong64Array &ulo64_seq = att_union.ulong64_att_value(); nb_data = ulo64_seq.length(); @@ -1795,9 +1699,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarStateArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarStateArray &sta_seq = att_union.state_att_value(); nb_data = sta_seq.length(); @@ -1837,9 +1739,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarBooleanArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarBooleanArray &boo_seq = att_union.bool_att_value(); nb_data = boo_seq.length(); @@ -1869,9 +1769,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Incompatible attribute type, expected type is : Tango::DevVarEncodedArray (even for single value)" << std::ends; - Except::throw_exception((const char *) API_IncompatibleAttrDataType, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, o.str()); } const Tango::DevVarEncodedArray &enc_seq = att_union.encoded_att_value(); @@ -1898,9 +1796,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -1918,9 +1814,7 @@ void WAttribute::check_written_value(const Tango::AttrValUnion &att_union, unsig o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *) API_WAttrOutsideLimit, - o.str(), - (const char *) "WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -2590,9 +2484,7 @@ void WAttribute::set_write_value(Tango::DevEncoded *, TANGO_UNUSED(long x), TANG // Should never be called // - Tango::Except::throw_exception((const char *) API_NotSupportedFeature, - (const char *) "This is a not supported call in case of DevEncoded attribute", - (const char *) "Wattribute::set_write_value()"); + TANGO_THROW_EXCEPTION(API_NotSupportedFeature, "This is a not supported call in case of DevEncoded attribute"); } //+------------------------------------------------------------------------- diff --git a/cppapi/server/w_attribute.h b/cppapi/server/w_attribute.h index 7f90ee442..7a340d1e8 100644 --- a/cppapi/server/w_attribute.h +++ b/cppapi/server/w_attribute.h @@ -871,7 +871,7 @@ class WAttribute:public Attribute inline void check_length(const unsigned int nb_data, unsigned long x, unsigned long y) { if ((!y && nb_data != x ) || (y && nb_data != (x * y))) - Except::throw_exception(API_AttrIncorrectDataNumber,"Incorrect data number","WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_AttrIncorrectDataNumber, "Incorrect data number"); } template void check_min_max(const unsigned int,const T1 &,const T2 &,const T2 &); diff --git a/cppapi/server/w_attribute.tpp b/cppapi/server/w_attribute.tpp index 348c9321e..2e8b4c1c5 100644 --- a/cppapi/server/w_attribute.tpp +++ b/cppapi/server/w_attribute.tpp @@ -68,9 +68,7 @@ void WAttribute::set_min_value(const T &new_min_value) (data_type != ranges_type2const::enu)) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception((const char *)API_IncompatibleAttrDataType, - (const char *)err_msg.c_str(), - (const char *)"WAttribute::set_min_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } // @@ -230,16 +228,12 @@ void WAttribute::get_min_value(T &min_val) (data_type != ranges_type2const::enu)) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception((const char *)API_IncompatibleAttrDataType, - (const char *)err_msg.c_str(), - (const char *)"WAttribute::get_min_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } if (check_min_value == false) { - Except::throw_exception((const char *)API_AttrNotAllowed, - (const char *)"Minimum value not defined for this attribute", - (const char *)"WAttribute::get_min_value()"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, "Minimum value not defined for this attribute"); } memcpy((void *)&min_val,(void *)&min_value,sizeof(T)); @@ -278,9 +272,7 @@ void WAttribute::set_max_value(const T &new_max_value) (data_type != ranges_type2const::enu)) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception((const char *)API_IncompatibleAttrDataType, - (const char *)err_msg.c_str(), - (const char *)"WAttribute::set_max_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } // @@ -440,16 +432,12 @@ void WAttribute::get_max_value(T &max_val) (data_type != ranges_type2const::enu)) { std::string err_msg = "Attribute (" + name + ") data type does not match the type provided : " + ranges_type2const::str; - Except::throw_exception((const char *)API_IncompatibleAttrDataType, - (const char *)err_msg.c_str(), - (const char *)"WAttribute::get_max_value()"); + TANGO_THROW_EXCEPTION(API_IncompatibleAttrDataType, err_msg.c_str()); } if (check_max_value == false) { - Except::throw_exception((const char *)API_AttrNotAllowed, - (const char *)"Maximum value not defined for this attribute", - (const char *)"WAttribute::get_max_value()"); + TANGO_THROW_EXCEPTION(API_AttrNotAllowed, "Maximum value not defined for this attribute"); } memcpy((void *)&max_val,(void *)&max_value,sizeof(T)); @@ -487,7 +475,7 @@ void WAttribute::check_min_max(const unsigned int nb_data,const T1 &seq, const T o << "Set value for attribute " << name; o << " is below the minimum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *)API_WAttrOutsideLimit,o.str(),"WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } @@ -501,7 +489,7 @@ void WAttribute::check_min_max(const unsigned int nb_data,const T1 &seq, const T o << "Set value for attribute " << name; o << " is above the maximum authorized (at least element " << i << ")" << std::ends; - Except::throw_exception((const char *)API_WAttrOutsideLimit,o.str(),"WAttribute::check_written_value()"); + TANGO_THROW_EXCEPTION(API_WAttrOutsideLimit, o.str()); } } } diff --git a/cppapi/server/w_attribute_spec.tpp b/cppapi/server/w_attribute_spec.tpp index 39e76b8bb..4fcbb9cb3 100644 --- a/cppapi/server/w_attribute_spec.tpp +++ b/cppapi/server/w_attribute_spec.tpp @@ -55,9 +55,7 @@ template <> inline void WAttribute::set_min_value(const Tango::DevEncoded &) { std::string err_msg = "Attribute properties cannot be set with Tango::DevEncoded data type"; - Except::throw_exception((const char *)API_MethodArgument, - (const char *)err_msg.c_str(), - (const char *)"WAttribute::set_min_value()"); + TANGO_THROW_EXCEPTION(API_MethodArgument, err_msg.c_str()); } template <> @@ -249,9 +247,7 @@ template <> inline void WAttribute::set_max_value(const Tango::DevEncoded &) { std::string err_msg = "Attribute properties cannot be set with Tango::DevEncoded data type"; - Except::throw_exception((const char *)API_MethodArgument, - (const char *)err_msg.c_str(), - (const char *)"WAttribute::set_max_value()"); + TANGO_THROW_EXCEPTION(API_MethodArgument, err_msg.c_str()); } template <> diff --git a/cppapi/server/w_attrsetval.tpp b/cppapi/server/w_attrsetval.tpp index 429fda3b4..55b28b4c1 100644 --- a/cppapi/server/w_attrsetval.tpp +++ b/cppapi/server/w_attrsetval.tpp @@ -115,7 +115,7 @@ void WAttribute::check_type(T &TANGO_UNUSED(dummy), const std::string &origin) ss << "Invalid enumeration type. Supported types are C++11 scoped enum with short as underlying data type\n"; ss << "or old enum"; - Except::throw_exception(API_IncompatibleArgumentType,ss.str(),origin); + Except::throw_exception(API_IncompatibleArgumentType, ss.str(), origin); } // @@ -124,8 +124,7 @@ void WAttribute::check_type(T &TANGO_UNUSED(dummy), const std::string &origin) if (std::is_enum::value == false) { - Except::throw_exception(API_IncompatibleArgumentType, - "The input argument data type is not an enumeration",origin); + Except::throw_exception(API_IncompatibleArgumentType, "The input argument data type is not an enumeration", origin); } Tango::DeviceClass *dev_class; @@ -154,7 +153,7 @@ void WAttribute::check_type(T &TANGO_UNUSED(dummy), const std::string &origin) { std::stringstream ss; ss << "Invalid enumeration type. Requested enum type is " << att.get_enum_type(); - Except::throw_exception(API_IncompatibleArgumentType,ss.str(),origin); + Except::throw_exception(API_IncompatibleArgumentType, ss.str(), origin); } } diff --git a/cppapi/server/zmqeventsupplier.cpp b/cppapi/server/zmqeventsupplier.cpp index b36ab44a8..c20b98122 100644 --- a/cppapi/server/zmqeventsupplier.cpp +++ b/cppapi/server/zmqeventsupplier.cpp @@ -154,7 +154,7 @@ name_specified(false),double_send(0),double_send_heartbeat(false) std::stringstream ss; ss << "Can't convert " << specified_addr << " to IP address"; - EventSystemExcept::throw_exception(API_ZmqInitFailed,ss.str(),"ZmqEventSupplier::ZmqEventSupplier()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_ZmqInitFailed, ss.str()); } } else @@ -400,9 +400,7 @@ void ZmqEventSupplier::tango_bind(zmq::socket_t *sock,std::string &endpoint) } catch(...) { - EventSystemExcept::throw_exception((const char*)API_ZmqInitFailed, - (const char*)"Can't bind the ZMQ socket!", - (const char*)"ZmqEventSupplier::tango_bind()"); + TANGO_THROW_API_EXCEPTION(EventSystemExcept, API_ZmqInitFailed, "Can't bind the ZMQ socket!"); } } @@ -606,9 +604,7 @@ void ZmqEventSupplier::create_mcast_event_socket(std::string &mcast_data,std::st o << "Can't insert multicast transport parameter for event "; o << ev_name << " in EventSupplier instance" << std::ends; - Except::throw_exception((const char *)API_InternalError, - o.str(), - (const char *)"ZmqEventSupplier::create_mcast_event_socket"); + TANGO_THROW_EXCEPTION(API_InternalError, o.str()); } } } @@ -693,9 +689,7 @@ void ZmqEventSupplier::create_mcast_socket(std::string &mcast_data,int rate,Mcas o << ms.endpoint; o << "\nZmq error: " << zmq_strerror(zmq_errno()) << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"ZmqEventSupplier::create_mcast_event_socket"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } // @@ -782,7 +776,7 @@ void ZmqEventSupplier::init_event_cptr(std::string &event_name) o << "Can't insert event counter for event "; o << event_name << " in EventSupplier instance" << std::ends; - Except::throw_exception(API_InternalError,o.str(),"ZmqEventSupplier::init_event_cptr"); + TANGO_THROW_EXCEPTION(API_InternalError, o.str()); } } } @@ -935,9 +929,7 @@ void ZmqEventSupplier::push_heartbeat_event() else o << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"ZmqEventSupplier::push_heartbeat_event"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } } } @@ -1554,9 +1546,7 @@ void ZmqEventSupplier::push_event(DeviceImpl *device_impl,std::string event_type else o << std::ends; - Except::throw_exception((const char *)API_ZmqFailed, - o.str(), - (const char *)"ZmqEventSupplier::push_event"); + TANGO_THROW_EXCEPTION(API_ZmqFailed, o.str()); } } From e38d58992220dbf03c2510660f9e8473afa150a4 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Tue, 14 Jul 2020 16:03:17 +0200 Subject: [PATCH 12/13] Correct exception origin match in cxx_write_attr_hard --- cpp_test_suite/new_tests/cxx_write_attr_hard.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp_test_suite/new_tests/cxx_write_attr_hard.cpp b/cpp_test_suite/new_tests/cxx_write_attr_hard.cpp index 5d249e78c..7e1fe9b66 100644 --- a/cpp_test_suite/new_tests/cxx_write_attr_hard.cpp +++ b/cpp_test_suite/new_tests/cxx_write_attr_hard.cpp @@ -132,17 +132,17 @@ class WriteAttrHardware: public CxxTest::TestSuite TS_ASSERT(string(e.err_list[0].name) == att1_name && e.err_list[0].idx_in_call == 0 && string(e.err_list[0].err_stack[0].reason.in()) == "DevTest_WriteAttrHardware" - && string(e.err_list[0].err_stack[0].origin.in()) == "DevTest::write_attr_hardware" + && string(e.err_list[0].err_stack[0].origin.in()).find("DevTest::write_attr_hardware") != std::string::npos && e.err_list[0].err_stack[0].severity == Tango::ERR && string(e.err_list[1].name) == att2_name && e.err_list[1].idx_in_call == 1 && string(e.err_list[1].err_stack[0].reason.in()) == "DevTest_WriteAttrHardware" - && string(e.err_list[1].err_stack[0].origin.in()) == "DevTest::write_attr_hardware" + && string(e.err_list[1].err_stack[0].origin.in()).find("DevTest::write_attr_hardware") != std::string::npos && e.err_list[1].err_stack[0].severity == Tango::ERR && string(e.err_list[2].name) == att3_name && e.err_list[2].idx_in_call == 2 && string(e.err_list[2].err_stack[0].reason.in()) == "DevTest_WriteAttrHardware" - && string(e.err_list[2].err_stack[0].origin.in()) == "DevTest::write_attr_hardware" + && string(e.err_list[2].err_stack[0].origin.in()).find("DevTest::write_attr_hardware") != std::string::npos && e.err_list[2].err_stack[0].severity == Tango::ERR)); TS_ASSERT_THROWS_NOTHING(read_after = device->read_attributes(vs)); From de8891966f7d65a392f373fffb8cfbc4834dac7f Mon Sep 17 00:00:00 2001 From: mliszcz Date: Thu, 13 Aug 2020 16:33:07 +0200 Subject: [PATCH 13/13] Rename BOOST_CURRENT_FUNCTION to TANGO_CURRENT_FUNCTION This is needed to avoid conflicts during compilation of device servers where boost/current_function.hpp is also included. --- cppapi/server/tango_current_function.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/cppapi/server/tango_current_function.h b/cppapi/server/tango_current_function.h index 6f1c69dfe..aed98d8a5 100644 --- a/cppapi/server/tango_current_function.h +++ b/cppapi/server/tango_current_function.h @@ -4,25 +4,23 @@ // Adapted from: https://www.boost.org/doc/libs/1_73_0/boost/current_function.hpp // #if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__) || defined(__clang__) -# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ +# define TANGO_CURRENT_FUNCTION __PRETTY_FUNCTION__ #elif defined(__DMC__) && (__DMC__ >= 0x810) -# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ +# define TANGO_CURRENT_FUNCTION __PRETTY_FUNCTION__ #elif defined(__FUNCSIG__) -# define BOOST_CURRENT_FUNCTION __FUNCSIG__ +# define TANGO_CURRENT_FUNCTION __FUNCSIG__ #elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) -# define BOOST_CURRENT_FUNCTION __FUNCTION__ +# define TANGO_CURRENT_FUNCTION __FUNCTION__ #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) -# define BOOST_CURRENT_FUNCTION __FUNC__ +# define TANGO_CURRENT_FUNCTION __FUNC__ #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) -# define BOOST_CURRENT_FUNCTION __func__ +# define TANGO_CURRENT_FUNCTION __func__ #elif defined(__cplusplus) && (__cplusplus >= 201103) -# define BOOST_CURRENT_FUNCTION __func__ +# define TANGO_CURRENT_FUNCTION __func__ #else -# define BOOST_CURRENT_FUNCTION "(unknown)" +# define TANGO_CURRENT_FUNCTION "(unknown)" #endif -#define TANGO_CURRENT_FUNCTION BOOST_CURRENT_FUNCTION - #define TANGO_QUOTE_(s) #s #define TANGO_QUOTE(s) TANGO_QUOTE_(s) #define TANGO_FILE_AND_LINE __FILE__ ":" TANGO_QUOTE(__LINE__)