summaryrefslogtreecommitdiff
path: root/TAO/IIOP/tests/Cubit/TAO/method_db.i
blob: 6b77cdf040a99f30a1a5ab65ea2d87f34c3e2b1e (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
// @(#)method_db.i 05/14/97

// This file provides a way of initializing the method database
// Written by: Brian Mendel

#include	"cubitS.h"

static void
is_a_skel (CORBA_ServerRequest &req,
           CORBA_Object_ptr    obj,
           CORBA_Environment   &env)
{
    CORBA_NVList_ptr		nvlist;
    CORBA_NamedValue_ptr	nv;
    CORBA_Any			temp_value (_tc_CORBA_String);

    req.orb()->create_list (0, nvlist);
    nv = nvlist->add_value (0, temp_value, CORBA_ARG_IN, env);

    req.params (nvlist, env);
    if (env.exception () != 0) 
    {
      dexc (env, "is_a_skel, get params");
	   return;
    }

    CORBA_Boolean *retval;
    CORBA_String value = *(CORBA_String *) nv->value()->value();

    if (ACE_OS::strcmp ((char*)value, "IDL:Cubit:1.0") == 0
    || ACE_OS::strcmp ((char *)value, _tc_CORBA_Object->id (env)) == 0)
	   retval = new CORBA_Boolean (CORBA_B_TRUE);
    else
	   retval = new CORBA_Boolean (CORBA_B_FALSE);

    CORBA_Any *any = new CORBA_Any (_tc_CORBA_Boolean, retval, CORBA_B_TRUE);

    req.result (any, env);
    dexc (env, "_is_a, result");
}


struct method_db
{
   CORBA_String opname;
   TAO_Skeleton skel_ptr;
};

static const method_db cubit_operations[] = {
   { "_is_a", &is_a_skel },
   { "cube_octet", &_skel_Cubit::_cube_octet_skel },
   { "cube_short", &_skel_Cubit::_cube_short_skel },
   { "cube_long", &_skel_Cubit::_cube_long_skel },
   { "cube_struct", &_skel_Cubit::_cube_struct_skel },
   { "cube_union", &_skel_Cubit::_cube_union_skel },
   { "please_exit", &_skel_Cubit::_please_exit_skel },
   { 0, 0 }
};
   

void initialize_method_db (TAO_Operation_Table *the_optable)
{
   for (int ndx = 0; ndx < 7; ndx++)
      the_optable->bind(cubit_operations[ndx].opname, 
                        cubit_operations[ndx].skel_ptr);
   
}