-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tests/idl4/bitset/foo.cpp: * tests/idl4/bitset/foo.h: * tests/idl4/bitset/server.cpp: Added. * ridlbe/c++11/templates/cli/hdr/bitset.erb: * tests/idl4/bitset/client.cpp: * tests/idl4/bitset/run_test.pl: * tests/idl4/bitset/test.mpc:
- Loading branch information
1 parent
5f0d3ff
commit 0ca98e5
Showing
7 changed files
with
349 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* @file foo.cpp | ||
* @author Johnny Willemsen | ||
* | ||
* @copyright Copyright (c) Remedy IT Expertise BV | ||
*/ | ||
#include "foo.h" | ||
|
||
#include "testlib/taox11_testlog.h" | ||
|
||
Foo::Foo (IDL::traits<CORBA::ORB>::ref_type orb, | ||
IDL::traits<PortableServer::POA>::ref_type poa) | ||
: orb_ (std::move(orb)) | ||
, poa_ (std::move(poa)) | ||
{ | ||
} | ||
|
||
MyBitset1 | ||
Foo::test_mybitset1 (const MyBitset1 & sin, MyBitset1 & sinout, MyBitset1 & sout) | ||
{ | ||
sout = sin; | ||
sinout = sin; | ||
MyBitset1 sret = sin; | ||
return sret; | ||
} | ||
|
||
MyBitset2 | ||
Foo::test_mybitset2 (const MyBitset2 & sin, MyBitset2 & sinout, MyBitset2 & sout) | ||
{ | ||
sout = sin; | ||
sinout = sin; | ||
MyBitset2 sret = sin; | ||
return sret; | ||
} | ||
|
||
MyBitset3 | ||
Foo::test_mybitset3 (const MyBitset3 & sin, MyBitset3 & sinout, MyBitset3 & sout) | ||
{ | ||
sout = sin; | ||
sinout = sin; | ||
MyBitset3 sret = sin; | ||
return sret; | ||
} | ||
|
||
MyBitset4 | ||
Foo::test_mybitset4 (const MyBitset4 & sin, MyBitset4 & sinout, MyBitset4 & sout) | ||
{ | ||
sout = sin; | ||
sinout = sin; | ||
MyBitset4 sret = sin; | ||
return sret; | ||
} | ||
|
||
void | ||
Foo::shutdown () | ||
{ | ||
this->orb_->shutdown (false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @file foo.h | ||
* @author Johnny Willemsen | ||
* | ||
* @copyright Copyright (c) Remedy IT Expertise BV | ||
*/ | ||
#ifndef FOO_H | ||
#define FOO_H | ||
|
||
#include "testS.h" | ||
|
||
class Foo final | ||
: public virtual CORBA::servant_traits<Test::Foo>::base_type | ||
{ | ||
public: | ||
/// Constructor | ||
Foo (IDL::traits<CORBA::ORB>::ref_type orb, | ||
IDL::traits<PortableServer::POA>::ref_type poa); | ||
|
||
// = The skeleton methods | ||
MyBitset1 test_mybitset1 (const MyBitset1 & sin, MyBitset1 & sinout, MyBitset1 & sout) override; | ||
MyBitset2 test_mybitset2 (const MyBitset2 & sin, MyBitset2 & sinout, MyBitset2 & sout) override; | ||
MyBitset3 test_mybitset3 (const MyBitset3 & sin, MyBitset3 & sinout, MyBitset3 & sout) override; | ||
MyBitset4 test_mybitset4 (const MyBitset4 & sin, MyBitset4 & sinout, MyBitset4 & sout) override; | ||
|
||
void shutdown () override; | ||
|
||
private: | ||
/// Use an ORB reference shutdown the server. | ||
IDL::traits<CORBA::ORB>::ref_type orb_; | ||
/// Use a POA reference to activate the references to | ||
// the template module interface. | ||
IDL::traits<PortableServer::POA>::ref_type poa_; | ||
}; | ||
|
||
#endif /* FOO_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/** | ||
* @file server.cpp | ||
* @author Johnny Willemsen | ||
* | ||
* @copyright Copyright (c) Remedy IT Expertise BV | ||
*/ | ||
|
||
#include "foo.h" | ||
#include "testlib/taox11_testlog.h" | ||
#include <fstream> | ||
|
||
int | ||
main(int argc, ACE_TCHAR *argv[]) | ||
{ | ||
try | ||
{ | ||
IDL::traits<CORBA::ORB>::ref_type _orb = CORBA::ORB_init (argc, argv); | ||
|
||
if (_orb == nullptr) | ||
{ | ||
TAOX11_TEST_ERROR << "ERROR: CORBA::ORB_init (argc, argv) returned null ORB." << std::endl; | ||
return 1; | ||
} | ||
|
||
IDL::traits<CORBA::Object>::ref_type obj = _orb->resolve_initial_references ("RootPOA"); | ||
|
||
if (!obj) | ||
{ | ||
TAOX11_TEST_ERROR << "ERROR: resolve_initial_references (\"RootPOA\") returned null reference." << std::endl; | ||
return 1; | ||
} | ||
|
||
TAOX11_TEST_DEBUG << "retrieved RootPOA object reference" << std::endl; | ||
|
||
IDL::traits<PortableServer::POA>::ref_type root_poa = IDL::traits<PortableServer::POA>::narrow (obj); | ||
|
||
if (!root_poa) | ||
{ | ||
TAOX11_TEST_ERROR << "ERROR: IDL::traits<PortableServer::POA>::narrow (obj) returned null object." << std::endl; | ||
return 1; | ||
} | ||
|
||
TAOX11_TEST_DEBUG << "narrowed POA interface" << std::endl; | ||
|
||
IDL::traits<PortableServer::POAManager>::ref_type poaman = root_poa->the_POAManager (); | ||
|
||
if (!poaman) | ||
{ | ||
TAOX11_TEST_ERROR << "ERROR: root_poa->the_POAManager () returned null object." << std::endl; | ||
return 1; | ||
} | ||
|
||
CORBA::servant_traits<Test::Foo>::ref_type foo_impl = CORBA::make_reference<Foo> (_orb, root_poa); | ||
|
||
TAOX11_TEST_DEBUG << "created Foo servant" << std::endl; | ||
|
||
PortableServer::ObjectId id = root_poa->activate_object (foo_impl); | ||
|
||
TAOX11_TEST_DEBUG << "activated Foo servant" << std::endl; | ||
|
||
IDL::traits<CORBA::Object>::ref_type foo_obj = root_poa->id_to_reference (id); | ||
|
||
if (foo_obj == nullptr) | ||
{ | ||
TAOX11_TEST_ERROR << "ERROR: root_poa->id_to_reference (id) returned null reference." << std::endl; | ||
return 1; | ||
} | ||
|
||
IDL::traits<Test::Foo>::ref_type foo = IDL::traits<Test::Foo>::narrow (foo_obj); | ||
|
||
if (foo == nullptr) | ||
{ | ||
TAOX11_TEST_ERROR << "ERROR: IDL::traits<Test::Foo>::narrow (foo_obj) returned null reference." << std::endl; | ||
return 1; | ||
} | ||
|
||
std::string ior = _orb->object_to_string (foo); | ||
|
||
// Output the IOR to the <ior_output_file> | ||
std::ofstream fos("test.ior"); | ||
if (!fos) | ||
{ | ||
TAOX11_TEST_ERROR << "ERROR: failed to open file 'test.ior'" << std::endl; | ||
return 1; | ||
} | ||
fos << ior; | ||
fos.close (); | ||
|
||
TAOX11_TEST_DEBUG << "IOR for Foo servant written to 'test.ior' : " << ior << std::endl; | ||
|
||
poaman->activate (); | ||
|
||
TAOX11_TEST_DEBUG << "starting event loop" << std::endl; | ||
|
||
_orb->run (); | ||
|
||
TAOX11_TEST_DEBUG << "event loop finished" << std::endl; | ||
|
||
root_poa->destroy (true, true); | ||
|
||
_orb->destroy (); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
TAOX11_TEST_ERROR << "exception caught: " << e << std::endl; | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.