summaryrefslogtreecommitdiff
path: root/TAO/CIAO/docs/tutorial/Hello/hello_exec.cpp
blob: 6a43ad843d84ad7e97efdfa099ff1634f7d01d53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// $Id$

#include "hello_exec.h"

#include "ace/OS_NS_string.h"


hello_example::HelloWorld_Impl::HelloWorld_Impl ()
{
}

hello_example::HelloWorld_Impl::~HelloWorld_Impl ()
{
}

char *
hello_example::HelloWorld_Impl::sayhello (const char *username
                                          ACE_ENV_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  static const char *fmt = "Hello World message for ";

  CORBA::String_var str =
    CORBA::string_alloc (ACE_OS::strlen (fmt) +
                         ACE_OS::strlen (username) +
                         1);

  ACE_OS::strcpy (str.inout (), fmt);
  ACE_OS::strcat (str.inout (), username);

  return str._retn ();
}


void
hello_example::HelloWorld_Impl::set_session_context (
    Components::SessionContext_ptr ctx
    ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   Components::CCMException))
{
  ACE_DEBUG ((LM_DEBUG,
              "hello_example::HelloWorld_Impl::set_session_context\n"));

  this->context_ =
    hello_example::HelloWorld_Exec_Context::_narrow (ctx
                                                     ACE_ENV_ARG_PARAMETER);

  ACE_CHECK;

  if (CORBA::is_nil (this->context_.in ()))
    ACE_THROW (CORBA::INTERNAL ());
  // Urm, we actually discard exceptions thown from this operation.
}

void
hello_example::HelloWorld_Impl::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   Components::CCMException))
{
}

void
hello_example::HelloWorld_Impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   Components::CCMException))
{
}

void
hello_example::HelloWorld_Impl::ciao_postactivate (
    ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   Components::CCMException))
{
}

void
hello_example::HelloWorld_Impl::ccm_passivate (
    ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   Components::CCMException))
{
}

void
hello_example::HelloWorld_Impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   Components::CCMException))
{
}


hello_example::HelloHome_Impl::HelloHome_Impl ()
{
}

hello_example::HelloHome_Impl::~HelloHome_Impl ()
{
}

Components::EnterpriseComponent_ptr
hello_example::HelloHome_Impl::create (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((Components::CCMException,
                   CORBA::SystemException))
{
  return new hello_example::HelloWorld_Impl ();
}

extern "C" HELLO_EXEC_Export ::Components::HomeExecutorBase_ptr
createHelloHome_Impl (void)
{
  return new hello_example::HelloHome_Impl ();
}