diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2017-09-05 13:31:49 +0200 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2017-09-05 13:31:49 +0200 |
commit | 1cdfec588f4c562f9df8c9daedcad88c99040fc4 (patch) | |
tree | 44c031bbcf9bb03f1985da81df267f1011431985 | |
parent | 564f8735931b2a13401b4c966894633fcb664e82 (diff) | |
download | ATCD-1cdfec588f4c562f9df8c9daedcad88c99040fc4.tar.gz |
Extended TAO_IDL with a new -Gsd which enabled the generation of two additional static operations for each interface. _desc_repository_id to retrieve the repository id as string, second _desc_interface_name to return the interface name. Both can be useful in template meta programming use cases where we want to use the repository id or interface name of a specific type.
* ACE/tests/Reactor_Exceptions_Test.cpp:
* TAO/TAO_IDL/be/be_global.cpp:
* TAO/TAO_IDL/be/be_util.cpp:
* TAO/TAO_IDL/be/be_visitor_argument/argument.cpp:
* TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp:
* TAO/TAO_IDL/be_include/be_global.h:
* TAO/docs/compiler.html:
* TAO/tests/IDL_Test/IDL_Test.mpc:
* TAO/tests/IDL_Test/main.cpp:
-rw-r--r-- | ACE/tests/Reactor_Exceptions_Test.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_global.cpp | 21 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_util.cpp | 5 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_argument/argument.cpp | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp | 19 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_global.h | 10 | ||||
-rw-r--r-- | TAO/docs/compiler.html | 8 | ||||
-rw-r--r-- | TAO/tests/IDL_Test/IDL_Test.mpc | 3 | ||||
-rw-r--r-- | TAO/tests/IDL_Test/main.cpp | 64 |
9 files changed, 106 insertions, 29 deletions
diff --git a/ACE/tests/Reactor_Exceptions_Test.cpp b/ACE/tests/Reactor_Exceptions_Test.cpp index d239604d560..d14b1df3d28 100644 --- a/ACE/tests/Reactor_Exceptions_Test.cpp +++ b/ACE/tests/Reactor_Exceptions_Test.cpp @@ -18,8 +18,6 @@ #include "ace/Thread_Manager.h" #include "ace/Select_Reactor.h" - - // Just need a simple exception class. class Except {}; diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp index 13c5855223e..41c14dc6714 100644 --- a/TAO/TAO_IDL/be/be_global.cpp +++ b/TAO/TAO_IDL/be/be_global.cpp @@ -136,6 +136,7 @@ BE_GlobalData::BE_GlobalData (void) use_clonable_in_args_ (false), gen_template_export_ (false), gen_ostream_operators_ (false), + gen_static_desc_operations_ (false), gen_custom_ending_ (true), gen_unique_guards_ (true), gen_ciao_svnt_ (false), @@ -1362,6 +1363,19 @@ BE_GlobalData::gen_ostream_operators (bool val) this->gen_ostream_operators_ = val; } + +bool +BE_GlobalData::gen_static_desc_operations (void) const +{ + return this->gen_static_desc_operations_; +} + +void +BE_GlobalData::gen_static_desc_operations (bool val) +{ + this->gen_static_desc_operations_ = val; +} + const char* BE_GlobalData::anyop_header_ending (void) const { @@ -3215,6 +3229,13 @@ BE_GlobalData::parse_args (long &i, char **av) break; } + else if (av[i][2] == 's' && av[i][3] == 'd') + { + // Generate static description operations + be_global->gen_static_desc_operations (true); + + break; + } else if (av[i][2] == 'e' && av[i][3] == 'x') { // CIAO executor impl code generation. diff --git a/TAO/TAO_IDL/be/be_util.cpp b/TAO/TAO_IDL/be/be_util.cpp index 3aaccc09ad8..de20ddce5ea 100644 --- a/TAO/TAO_IDL/be/be_util.cpp +++ b/TAO/TAO_IDL/be/be_util.cpp @@ -677,6 +677,11 @@ be_util::usage (void) )); ACE_DEBUG (( LM_DEBUG, + ACE_TEXT (" -Gsd\t\t\tgenerate static description operations which can ") + ACE_TEXT ("be useful for template programming (not generated by default)\n") + )); + ACE_DEBUG (( + LM_DEBUG, ACE_TEXT (" -Gse\t\t\tgenerate explicit export of sequence's ") ACE_TEXT ("template base class (not generated by default)\n") )); diff --git a/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp index ea5955e6c97..f345289f030 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp @@ -152,7 +152,8 @@ be_visitor_args::gen_pd_arg (be_predefined_type *node, switch (pt) { case AST_PredefinedType::PT_any: - *os << any_deref; // No break. + *os << any_deref; + // fallthrough case AST_PredefinedType::PT_pseudo: case AST_PredefinedType::PT_object: *os << lname << var_call; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp index 056a4ab73d8..13ede2228e1 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -153,6 +153,25 @@ be_visitor_interface_ch::visit_interface (be_interface *node) *os << "virtual const char* _interface_repository_id " << "(void) const;"; + if (be_global->gen_static_desc_operations ()) + { + *os << be_nl << "static const char* _desc_repository_id (void)" + << be_nl + << "{" << be_idt_nl + << "return \"" << node->repoID () + << "\";" << be_uidt_nl + << "}" + << be_nl; + + *os << be_nl << "static const char* _desc_interface_name (void)" + << be_nl + << "{" << be_idt_nl + << "return \"" << node->local_name() + << "\";" << be_uidt_nl + << "}" + << be_nl; + } + // The virtual marshal method, to prevent marshal of local interfaces. *os << be_nl << "virtual ::CORBA::Boolean marshal " diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h index c89047f56e5..a84c642cf7d 100644 --- a/TAO/TAO_IDL/be_include/be_global.h +++ b/TAO/TAO_IDL/be_include/be_global.h @@ -586,6 +586,13 @@ public: /// Set the gen_ostream_operators_ member. void gen_ostream_operators (bool val); + /// Get the gen_static_desc_operations_ member. + bool gen_static_desc_operations (void) const; + + /// Set the gen_static_desc_operations_ member. + void gen_static_desc_operations (bool val); + + /** * Set the directory where all the IDL-Compiler-Generated files are * to be kept. Default is current directory from which the @@ -1250,6 +1257,9 @@ private: /// debugging or logging. bool gen_ostream_operators_; + /// Generate static description operations for each interface + bool gen_static_desc_operations_; + /** * True by default, but a command line option can turn this off so * custom ending will not be applied to files in $TAO_ROOT/, diff --git a/TAO/docs/compiler.html b/TAO/docs/compiler.html index f09fb39b97a..bd50cd5ba8b 100644 --- a/TAO/docs/compiler.html +++ b/TAO/docs/compiler.html @@ -908,6 +908,14 @@ also receives other options that are specific to it.<p> or a valuetype never are - neither case is affected by this option.</td> </tr> + <tr><a name="Gsd"> + <td><tt>-Gsd</tt></td> + + <td>Generate static description operations</td> + <td>Generate static description operations to retrieve the repository id + or interface name as string. Can be useful for template programming</td> + </tr> + <tr><a name="Gse"> <td><tt>-Gse</tt></td> diff --git a/TAO/tests/IDL_Test/IDL_Test.mpc b/TAO/tests/IDL_Test/IDL_Test.mpc index 7f439bb428c..8ef9a6b2d1e 100644 --- a/TAO/tests/IDL_Test/IDL_Test.mpc +++ b/TAO/tests/IDL_Test/IDL_Test.mpc @@ -6,7 +6,8 @@ project(*IDL): taoserver, messaging, gen_ostream { idlflags += -Wb,stub_export_macro=TAO_IDL_TEST_STUB_Export \ -Wb,stub_export_include=TAO_IDL_TEST_stub_export.h \ -Wb,skel_export_macro=TAO_IDL_TEST_STUB_Export \ - -Wb,skel_export_include=TAO_IDL_TEST_stub_export.h + -Wb,skel_export_include=TAO_IDL_TEST_stub_export.h \ + -Gsd IDL_Files { idlflags += -Gxhst diff --git a/TAO/tests/IDL_Test/main.cpp b/TAO/tests/IDL_Test/main.cpp index b79a728883e..1fd8c57b4ef 100644 --- a/TAO/tests/IDL_Test/main.cpp +++ b/TAO/tests/IDL_Test/main.cpp @@ -90,7 +90,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (test_ull != AAA) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Generated value of unsigned") ACE_TEXT (" long long AAA in constants.idl") ACE_TEXT (" is incorrect\n"))); @@ -101,7 +101,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (test_nll != NAAA) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Generated value of signed") ACE_TEXT (" long long NAAA in constants.idl") ACE_TEXT (" is incorrect\n"))); @@ -112,7 +112,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (test_pll != PAAA) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Generated value of signed") ACE_TEXT (" long long PAAA in constants.idl") ACE_TEXT (" is incorrect\n"))); @@ -142,7 +142,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:anvil.com/hello:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'hello'\n")); } @@ -155,7 +155,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:anvil.com/goodbye:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'goodbye'\n")); } @@ -168,7 +168,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:hammer.com/salutation/sayonara:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'sayonara'\n")); } @@ -187,7 +187,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:anvil.com/ciao:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'ciao'\n")); } @@ -200,7 +200,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:anvil.com/aloha:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'aloha'\n")); } @@ -212,7 +212,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:gleep_prefix/gleep/schmooze:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'schmooze'\n")); } @@ -222,7 +222,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:gleep_prefix/gleep/schmeer:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'schmeer'\n")); } @@ -232,7 +232,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:gleep_prefix/gleep/schlemiel:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'schlemiel'\n")); } @@ -242,7 +242,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:gleep_prefix/gleep/spilkis:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'spilkis'\n")); } @@ -252,7 +252,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "ABRA:cadabra/hocus/pocus:1.23")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'schmuck'\n")); } @@ -262,9 +262,23 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:floop_prefix/gleep/floop/schmendrick:524.23")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'schmendrick'\n")); } + if (ACE_OS::strcmp (gleep::floop::schmendrick::_desc_repository_id (), + "IDL:floop_prefix/gleep/floop/schmendrick:524.23")) + { + ++error_count; + ACE_ERROR ((LM_ERROR, + "error in _desc_repository_id 'schmendrick'\n")); + } + if (ACE_OS::strcmp (gleep::floop::schmendrick::_desc_interface_name (), + "schmendrick")) + { + ++error_count; + ACE_ERROR ((LM_ERROR, + "error in _desc_interface_name 'schmendrick'\n")); + } schlemazel_i s_schlemazel; @@ -274,7 +288,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) )) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'schlemazel'\n")); } @@ -284,7 +298,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) "IDL:gleep_prefix/gleep/schmegegging:1.0")) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "pragma prefix error in object 'schmegegging'\n")); } @@ -303,7 +317,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (!x._is_a (base[i])) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "something_handler::_is_a should return true for %C\n", base[i])); } @@ -312,7 +326,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (!dynamic_cast<POA_bug_1985_c::d::AMI_somethingHandler*> (&x)) { ++error_count; - ACE_DEBUG( (LM_DEBUG, + ACE_ERROR( (LM_ERROR, "mismatch in downcast for %C\n", base[0])); } @@ -320,7 +334,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (!dynamic_cast<POA_bug_1985_a::b::AMI_somethingHandler*> (&x)) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "mismatch in downcast for %C\n", base[1])); } @@ -328,7 +342,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (!dynamic_cast<POA_Messaging::ReplyHandler*> (&x)) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "mismatch in downcast for %C\n", base[2])); } @@ -349,7 +363,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if ((any1 >>= outfield) == 0) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "error in extraction of " "duplicate case label value\n")); } @@ -359,7 +373,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (ACE_OS::strcmp (str, "duplicate case label test string") != 0) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "error - corruption of " "duplicate case label value\n")); } @@ -370,7 +384,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if ((any1 >>= outfield) == 0) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "error in extraction of " "default case label value\n")); } @@ -380,7 +394,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (ACE_OS::strcmp (str, "default case test string") != 0) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "error - corruption of " "default case label value\n")); } @@ -388,7 +402,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) if (SignedGen::val != -3) { ++error_count; - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, "error - signed integer literal " "generated as unsigned\n")); } |