diff options
Diffstat (limited to 'TAO/interop-tests/AnyTypeCode/tao')
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.cpp | 16 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.h | 13 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.cpp | 18 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.h | 15 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/Client.cpp | 210 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/Demo.mpc | 47 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/Demo_i.cpp | 178 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/Demo_i.h | 56 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.cpp | 8 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.h | 11 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.cpp | 18 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.h | 15 | ||||
-rw-r--r-- | TAO/interop-tests/AnyTypeCode/tao/Server.cpp | 92 |
13 files changed, 697 insertions, 0 deletions
diff --git a/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.cpp b/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.cpp new file mode 100644 index 00000000000..c68408811fb --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.cpp @@ -0,0 +1,16 @@ +#include "BaseValueFactory.h" +#include "BaseValueImpl.h" + +CORBA::ValueBase* +Demo_BaseValueFactory::create_for_unmarshal() +{ + return new Demo_BaseValueImpl(); +} + +Demo::BaseValue* +Demo_BaseValueFactory::create(const char *str) +{ + Demo_BaseValueImpl *baseValueImpl = new Demo_BaseValueImpl(); + baseValueImpl->str(str); + return baseValueImpl; +} diff --git a/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.h b/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.h new file mode 100644 index 00000000000..6b9793f4e3d --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.h @@ -0,0 +1,13 @@ +#ifndef BASEVALUEFACTORY_H +#define BASEVALUEFACTORY_H + +#include "DemoC.h" + +class Demo_BaseValueFactory : public virtual Demo::BaseValue_init +{ +public: + virtual CORBA::ValueBase* create_for_unmarshal(); + virtual Demo::BaseValue* create(const char * str); +}; + +#endif diff --git a/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.cpp b/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.cpp new file mode 100644 index 00000000000..5acd1250be5 --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.cpp @@ -0,0 +1,18 @@ +#include "BaseValueImpl.h" + +Demo_BaseValueImpl::Demo_BaseValueImpl() +{ +} + +Demo_BaseValueImpl::~Demo_BaseValueImpl() +{ +} + +CORBA::ValueBase* +Demo_BaseValueImpl::_copy_value() +{ + Demo_BaseValueImpl *baseValueImpl = new Demo_BaseValueImpl (); + baseValueImpl->str (str ()); + return baseValueImpl; +} + diff --git a/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.h b/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.h new file mode 100644 index 00000000000..1beaf291d5d --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.h @@ -0,0 +1,15 @@ +#ifndef BASEVALUEIMPL_H +#define BASEVALUEIMPL_H + +#include "DemoC.h" + +class Demo_BaseValueImpl : public virtual OBV_Demo::BaseValue, + public virtual CORBA::DefaultValueRefCountBase +{ +public: + Demo_BaseValueImpl(); + virtual ~Demo_BaseValueImpl(); + virtual CORBA::ValueBase* _copy_value(); +}; + +#endif diff --git a/TAO/interop-tests/AnyTypeCode/tao/Client.cpp b/TAO/interop-tests/AnyTypeCode/tao/Client.cpp new file mode 100644 index 00000000000..61868de4fb6 --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/Client.cpp @@ -0,0 +1,210 @@ +// $Id$ + +#include "DemoC.h" +#include "BaseValueImpl.h" +#include "NestedValueImpl.h" + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_stdio.h" +#include "ace/Get_Opt.h" + +void unionWithBar1 (CORBA::Any& any) +{ + Demo::BaseUnion bar1; + bar1.str (CORBA::string_dup ("Bar 1")); + Demo::NestedUnion any_union; + any_union.bar1 (bar1); + + any <<= any_union; +} + +void unionWithBar2 (CORBA::Any& any) +{ + Demo::BaseUnion bar2; + bar2.l (9765625); + Demo::NestedUnion any_union; + any_union.bar2 (bar2); + + any <<= any_union; +} + +void unionWithDefaultBar (CORBA::Any& any) +{ + Demo::BaseUnion defaultBar; + defaultBar.s (1024); + Demo::NestedUnion any_union; + any_union.defaultBar (defaultBar); + + any <<= any_union; +} + +const ACE_TCHAR *ior_str = ACE_TEXT ("file://test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior_str = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("usage: %s ") + ACE_TEXT ("-k <ior>") + ACE_TEXT ("\n"), + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + Demo::ATC_Test_var test; + CORBA::ORB_var orb; + try + { + orb = CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) == -1) + { + return -1; + } + CORBA::Object_var obj = + orb->string_to_object (ACE_TEXT_ALWAYS_CHAR (ior_str)); + if (CORBA::is_nil (obj.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%P could not get ATC_Test IOR.\n")), + -1); + } + + test = Demo::ATC_Test::_narrow (obj.in ()); + if (CORBA::is_nil (test.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%P narrow failed.\n")), + -1); + } + } + catch (CORBA::Exception& ex) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%P initialization caught %s.\n"), ex._name()), + -1); + } + + CORBA::Any any; + CORBA::String_var str; + + // union tests + try + { + unionWithBar1 (any); + str = test->do_union (any); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P Union test 1 returned %s\n"), str.in())); + + unionWithBar2 (any); + str = test->do_union (any); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P Union test 2 returned %s\n"), str.in())); + + unionWithDefaultBar (any); + str = test->do_union (any); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P Union test 3 returned %s\n"), str.in())); + } + catch (CORBA::Exception& ex) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%P Union test caught %s.\n"), ex._name())); + } + + // valuetype tests + try + { + Demo_BaseValueImpl* foo1 = new Demo_BaseValueImpl(); + foo1->str(CORBA::string_dup("BaseValue 1")); + + Demo_BaseValueImpl* foo2 = new Demo_BaseValueImpl(); + foo2->str(CORBA::string_dup("BaseValue 2")); + + Demo_NestedValueImpl* bar = new Demo_NestedValueImpl(); + bar->foo1(foo1); + bar->foo2(foo2); + + any <<= bar; + + str = test->do_value (any); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P Valuetype test returned %s\n"), + str.in())); + } + catch (CORBA::Exception& ex) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%P Valuetype test caught %s.\n"), ex._name())); + } + + // struct tests + try + { + + Demo::BaseStruct foo1; + foo1.str = CORBA::string_dup("BaseStruct 1"); + + Demo::BaseStruct foo2; + foo2.str = CORBA::string_dup("BaseStruct 2"); + + Demo::BaseStruct foo3; + foo3.str = CORBA::string_dup("BaseStruct 3"); + + Demo::NestedStruct bar; + bar.foo1 = foo1; + bar.foo2 = foo2; + bar.foo3 = foo3; + + Demo::BaseStruct innerBaseStruct1; + innerBaseStruct1.str = CORBA::string_dup("Inner BaseStruct 1"); + + Demo::BaseStruct innerBaseStruct2; + innerBaseStruct2.str = CORBA::string_dup("Inner BaseStruct 2"); + + Demo::BaseStruct innerBaseStruct3; + innerBaseStruct3.str = CORBA::string_dup("Inner BaseStruct 3"); + + Demo::NestedStruct innerBar; + innerBar.foo1 = innerBaseStruct1; + innerBar.foo2 = innerBaseStruct2; + innerBar.foo3 = innerBaseStruct3; + + Demo::NestedSeq bars; + bars.length(1); + bars[0] = innerBar; + + bar.bars = bars; + + any <<= bar; + + str = test->do_struct (any); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P struct test returned %s\n"), + str.in())); + } + catch (CORBA::Exception& ex) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%P struct test caught %s.\n"), ex._name())); + } + + test->shutdown (); + + return 0; +} diff --git a/TAO/interop-tests/AnyTypeCode/tao/Demo.mpc b/TAO/interop-tests/AnyTypeCode/tao/Demo.mpc new file mode 100644 index 00000000000..977459875a1 --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/Demo.mpc @@ -0,0 +1,47 @@ +project(*idl): taoidldefaults, valuetype { + idlflags -= -Sa -St + IDL_Files { + ../idl/Demo.idl + } + + Modify_Custom(IDL) { + output_follows_input = 0 + } + + custom_only = 1 +} + +project(*Server): taoserver, valuetype, avoids_minimum_corba { + exename=Server + after += *idl + Source_Files { + Demo_i.cpp + BaseValueFactory.cpp + NestedValueFactory.cpp + BaseValueImpl.cpp + NestedValueImpl.cpp + Server.cpp + } + Source_Files { + DemoC.cpp + DemoS.cpp + } + IDL_Files { + } +} + +project(*Client): taoclient, valuetype, avoids_minimum_corba { + exename=Client + after += *idl + libs += TAO_AnyTypeCode + Source_Files { + Client.cpp + BaseValueImpl.cpp + NestedValueImpl.cpp + } + Source_Files { + DemoC.cpp + } + IDL_Files { + } +} diff --git a/TAO/interop-tests/AnyTypeCode/tao/Demo_i.cpp b/TAO/interop-tests/AnyTypeCode/tao/Demo_i.cpp new file mode 100644 index 00000000000..9f7c928b53b --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/Demo_i.cpp @@ -0,0 +1,178 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.1.4 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1673 + +#include "Demo_i.h" +#include "ace/Log_Msg.h" + +// Implementation skeleton constructor +ATC_Test_i::ATC_Test_i (void) +{ +} + +// Implementation skeleton destructor +ATC_Test_i::~ATC_Test_i (void) +{ +} + +char * +ATC_Test_i::do_union (const ::CORBA::Any & a) +{ + Demo::NestedUnion *any_union; + const char *result = "do_union called"; + if (a >>= any_union) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_union went well\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P: The discriminator is %d\n"), + any_union->_d ())); + switch ( any_union->_d ()) + { + case 1: + { + Demo::BaseUnion bar1 = any_union->bar1 (); + if (bar1._d () == 1) + { + result = bar1.str (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P: bar1 has str = %s\n"), + result)); + } + } + break; + case 2: + { + Demo::BaseUnion bar2 = any_union->bar2 (); + if (bar2._d () == 2) + { + CORBA::Long l = bar2.l (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P: bar1 has l = %d\n"), + l)); + result = "bar2 has l"; + } + } + break; + default: + { + Demo::BaseUnion defaultBar = any_union->defaultBar (); + if (defaultBar._d () != 1 && defaultBar._d () != 2) + { + CORBA::Short s = defaultBar.s (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P: bar1 has s = %d\n"), + s)); + result = "defaultBar has s"; + } + } + break; + } + } + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_union failed\n"))); + } + return CORBA::string_dup (result); +} + +char * +ATC_Test_i::do_struct (const ::CORBA::Any & a) +{ + Demo::NestedStruct *bar; + const char *result = "do_struct called"; + if (a >>= bar) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_struct went well\n"))); + Demo::BaseStruct foo1 = bar->foo1; + Demo::BaseStruct foo2 = bar->foo2; + Demo::BaseStruct foo3 = bar->foo3; + Demo::NestedSeq bars = bar->bars; + if (bars.length () > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P: bars[0].foo1.str = %s\n"), + bars[0].foo1.str.in())); + } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P: foo1.str = %s, foo2.str = %s, ") + ACE_TEXT ("foo3.str = %s, bars.length() = %d\n"), + foo1.str.in (), foo2.str.in (), foo3.str.in (), bars.length ())); + + if (bars.length() > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P: returning %s\n"), + bars[bars.length() - 1].foo3.str.in ())); + return CORBA::string_dup(bars[bars.length() - 1].foo3.str); + } + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P: bars.length = 0, returning %s\n"), + foo3.str.in())); + return CORBA::string_dup(foo3.str); + } + } + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_struct failed\n"))); + } + return CORBA::string_dup (result); +} + +char * +ATC_Test_i::do_value (const ::CORBA::Any & a) +{ + Demo::NestedValue *bar; + const char *result = "do_value called"; + if (a >>= bar) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_value went well\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: returning %s\n"), + bar->foo2()->str() )); + return CORBA::string_dup(bar->foo2()->str()); + } + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_value failed\n"))); + } + return CORBA::string_dup (result); +} + +void +ATC_Test_i::shutdown (void) +{ + int argc = 0; + ACE_TCHAR **argv = 0; + + CORBA::ORB_var def_orb = CORBA::ORB_init (argc, argv); + def_orb->shutdown (false); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%P: shutdown called \n"))); +} diff --git a/TAO/interop-tests/AnyTypeCode/tao/Demo_i.h b/TAO/interop-tests/AnyTypeCode/tao/Demo_i.h new file mode 100644 index 00000000000..8ba3e17bae7 --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/Demo_i.h @@ -0,0 +1,56 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.1.4 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1616 + +#ifndef DEMOI_I6ARGD_H_ +#define DEMOI_I6ARGD_H_ + +#include "DemoS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class ATC_Test_i : public virtual POA_Demo::ATC_Test +{ +public: + ATC_Test_i (void); + + virtual ~ATC_Test_i (void); + + virtual char * do_union (const ::CORBA::Any & a); + virtual char * do_struct (const ::CORBA::Any & a); + virtual char * do_value (const ::CORBA::Any & a); + + virtual void shutdown (void); + +}; + + +#endif /* DEMOI_H_ */ diff --git a/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.cpp b/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.cpp new file mode 100644 index 00000000000..1eee8431332 --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.cpp @@ -0,0 +1,8 @@ +#include "NestedValueFactory.h" +#include "NestedValueImpl.h" + +CORBA::ValueBase* +Demo_NestedValueFactory::create_for_unmarshal (void) +{ + return new Demo_NestedValueImpl (); +} diff --git a/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.h b/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.h new file mode 100644 index 00000000000..c28a0c8faa7 --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.h @@ -0,0 +1,11 @@ +#ifndef NESTEDVALUEFACTORY_H +#define NESTEDVALUEFACTORY_H + +#include "DemoC.h" + +class Demo_NestedValueFactory : public virtual CORBA::ValueFactoryBase +{ + virtual CORBA::ValueBase* create_for_unmarshal(); +}; + +#endif diff --git a/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.cpp b/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.cpp new file mode 100644 index 00000000000..0ae211131d8 --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.cpp @@ -0,0 +1,18 @@ +#include "NestedValueImpl.h" + +Demo_NestedValueImpl::Demo_NestedValueImpl (void) +{ +} + +Demo_NestedValueImpl::~Demo_NestedValueImpl (void) +{ +} + +CORBA::ValueBase* +Demo_NestedValueImpl::_copy_value (void) +{ + Demo_NestedValueImpl *nestedValueImpl = new Demo_NestedValueImpl(); + nestedValueImpl->foo1 (foo1 ()); + nestedValueImpl->foo2 (foo2 ()); + return nestedValueImpl; +} diff --git a/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.h b/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.h new file mode 100644 index 00000000000..8f2bb0ad3db --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.h @@ -0,0 +1,15 @@ +#ifndef NESTEDVALUE_H +#define NESTEDVALUE_H + +#include "DemoC.h" + +class Demo_NestedValueImpl : public virtual OBV_Demo::NestedValue, + public virtual CORBA::DefaultValueRefCountBase +{ +public: + Demo_NestedValueImpl (void); + ~Demo_NestedValueImpl (void); + virtual CORBA::ValueBase* _copy_value (void); +}; + +#endif diff --git a/TAO/interop-tests/AnyTypeCode/tao/Server.cpp b/TAO/interop-tests/AnyTypeCode/tao/Server.cpp new file mode 100644 index 00000000000..88b76be5ea2 --- /dev/null +++ b/TAO/interop-tests/AnyTypeCode/tao/Server.cpp @@ -0,0 +1,92 @@ +// $Id$ + +#include "Demo_i.h" +#include "BaseValueFactory.h" +#include "NestedValueFactory.h" + +#include "ace/Log_Msg.h" +#include "ace/Get_Opt.h" +#include "ace/OS_NS_stdio.h" + +const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("usage: %s ") + ACE_TEXT ("-o <iorfile>") + ACE_TEXT ("\n"), + argv [0]), + -1); + } + // Indicates successful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + if (parse_args (argc, argv) == -1) + { + return -1; + } + + CORBA::ValueFactoryBase_var vf = new Demo_BaseValueFactory(); + CORBA::String_var repId = Demo::_tc_BaseValue->id(); + orb->register_value_factory(repId.in(), vf.in()); + + vf = new Demo_NestedValueFactory(); + repId = Demo::_tc_NestedValue->id(); + orb->register_value_factory(repId.in(), vf.in()); + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow (obj.in ()); + PortableServer::POAManager_var mgr = poa->the_POAManager (); + mgr->activate (); + + PortableServer::Servant_var<ATC_Test_i> servant = new ATC_Test_i (); + PortableServer::ObjectId_var oid = poa->activate_object (servant.in ()); + obj = poa->id_to_reference (oid.in ()); + CORBA::String_var ior = orb->object_to_string (obj.in ()); + + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%P Cannot write IOR file: %s\n"), + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + ACE_DEBUG ( (LM_DEBUG, + ACE_TEXT ("%P IOR written to file %C\n"), + ior_output_file)); + + orb->run (); + orb->destroy (); + return 0; + } + catch (CORBA::Exception& ex) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%P Union test server caught %s.\n"), ex._name()), + -1); + } + return 1; +} |