summaryrefslogtreecommitdiff
path: root/TAO/CIAO/examples/handcrafted/BasicSP/BasicSP_svnt.cpp
blob: fed871b78609c686ec5635bbff48d4d8901ea167 (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
// $Id$

//    The generated filename for files using this template shoule be
//       [idl-basename]GS.cpp       GS --> GlueSession

// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or
//    CIAO_GLUE_[module name] as defined in the header file.

#include "BasicSP_svnt.h"

ACE_RCSID (examples,
           BasicSP_svnt,
           "$Id$")

CIAO_GLUE_BasicSP::ReadData_Servant::ReadData_Servant (
    BasicSP::CCM_ReadData_ptr executor,
    Components::CCMContext_ptr c)
  : executor_ (BasicSP::CCM_ReadData::_duplicate (executor)),
    ctx_ (Components::CCMContext::_duplicate (c))
{
}



CIAO_GLUE_BasicSP::ReadData_Servant::~ReadData_Servant (void)
{
}

// This is only a guideline...  we always relay the operation to underlying
// executor.

char *
CIAO_GLUE_BasicSP::ReadData_Servant::get_data (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  // Simply relay to executor.  May not need to return the result...
  return this->executor_->get_data (ACE_ENV_SINGLE_ARG_PARAMETER);
}


// get_component implementation.
// get_component is a standard CORBA::Object operations that returns
// the component reference that an object interface associates to.
CORBA::Object_ptr
CIAO_GLUE_BasicSP::ReadData_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  Components::SessionContext_var sc =
    Components::SessionContext::_narrow (this->ctx_.in ());

  if (! CORBA::is_nil(sc.in ()))
    return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER);

  ::Components::EntityContext_var ec =
      ::Components::EntityContext::_narrow (this->ctx_.in ());

  if (! CORBA::is_nil(ec.in ()))
    return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER);

  ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
}