Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / DynAny_Test / data.cpp
blob4aae2c73161d353ba682af2d33c78f5358119967
1 //=============================================================================
2 /**
3 * @file data.cpp
5 * Implementation file for the class containing test constants.
7 * @author Jeff Parsons <parsons@cs.wustl.edu>
8 */
9 //=============================================================================
12 #include "data.h"
13 #include "tao/AnyTypeCode/TypeCode.h"
14 #include "tao/PortableServer/PortableServer.h"
15 #include "ace/Log_Msg.h"
17 Data::Data (CORBA::ORB_var orb)
18 : m_bool1 (1), m_bool2 (0),
19 m_octet1 (8), m_octet2 (0),
20 m_char1 ('z'), m_char2 (0),
21 m_short1 (-5), m_short2 (0),
22 m_long1 (-123456), m_long2 (0),
23 m_ushort1 (5), m_ushort2 (0),
24 m_ulong1 (123456), m_ulong2 (0),
25 m_float1 (0.142857f), m_float2 (0.0f),
26 m_double1 (3.14159), m_double2 (0.0),
27 m_ulonglong1 (654321), m_ulonglong2 (0),
28 m_string1 (CORBA::string_dup ("upchuck")), m_string2 (0),
30 m_typecode1 (CORBA::TypeCode::_duplicate (CORBA::_tc_long)),
31 m_typecode2 (CORBA::TypeCode::_duplicate (CORBA::_tc_null)),
33 m_wchar1 (666), m_wchar2 (0),
34 orb_ (orb)
36 ACE_CDR_LONG_DOUBLE_ASSIGNMENT (m_longdouble1, 88888888888.8888);
37 ACE_CDR_LONG_DOUBLE_ASSIGNMENT (m_longdouble2, 99999999999.9999);
39 try
41 m_shortseq1.length (3UL);
42 m_shortseq1[0UL] = 0;
43 m_shortseq1[1UL] = 1;
44 m_shortseq1[2UL] = 2;
46 labels[0] = "type boolean";
47 labels[1] = "type octet";
48 labels[2] = "type char";
49 labels[3] = "type short";
50 labels[4] = "type long",
51 labels[5] = "type ushort";
52 labels[6] = "type ulong";
53 labels[7] = "type float";
54 labels[8] = "type double";
55 labels[9] = "type longlong";
56 labels[10] = "type ulonglong";
57 labels[11] = "type string";
58 labels[12] = "type typecode";
59 labels[13] = "type wchar";
60 labels[14] = "type any";
61 labels[15] = "type objref";
62 labels[16] = "type short sequence";
63 labels[17] = "type longdouble";
64 labels[18] = "type enum";
65 labels[19] = "typedef'd enum in struct";
68 // Getting the RootPOA so we can generate object references.
69 CORBA::Object_var obj =
70 this->orb_->resolve_initial_references ("RootPOA");
73 if (CORBA::is_nil (obj.in ()))
75 ACE_ERROR ((LM_ERROR,
76 "(%P|%t) Unable to get root poa reference.\n"));
79 // Get the POA_var object from Object_var.
80 PortableServer::POA_var root_poa =
81 PortableServer::POA::_narrow (obj.in ());
84 // Generate values for the member variables.
85 this->m_objref1 =
86 root_poa->create_reference ("foo");
89 this->m_objref2 =
90 root_poa->create_reference ("foo");
92 // Clean up after the POA
93 root_poa->destroy (true, true);
95 catch (const CORBA::Exception& ex)
97 ex._tao_print_exception ("Exception in ORB/POA init\n");
101 Data::~Data ()
103 CORBA::string_free (m_string1);
104 CORBA::string_free (m_string2);
105 CORBA::release (m_typecode1);
106 CORBA::release (m_typecode2);