summaryrefslogtreecommitdiff
path: root/TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp
blob: 8588dbbe75f660eb2de7001d115abc158a303e1f (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
#include "tao/PortableServer/Operation_Table_Perfect_Hash.h"
#include "tao/Timeprobe.h"
#include "ace/Log_Msg.h"

#if defined (ACE_ENABLE_TIMEPROBES)

static const char *TAO_Operation_Table_Timeprobe_Description[] =
  {
    "TAO_Perfect_Hash_OpTable::find - start",
    "TAO_Perfect_Hash_OpTable::find - end",
  };

enum
  {
    // Timeprobe description table start key
    TAO_PERFECT_HASH_OPTABLE_FIND_START = 606,
    TAO_PERFECT_HASH_OPTABLE_FIND_END,
  };

// Setup Timeprobes
ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Operation_Table_Timeprobe_Description,
                                  TAO_PERFECT_HASH_OPTABLE_FIND_START);

#endif /* ACE_ENABLE_TIMEPROBES */

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

int
TAO_Perfect_Hash_OpTable::find (const char *opname,
                                TAO_Skeleton &skelfunc,
                                const unsigned int length)
{
  ACE_FUNCTION_TIMEPROBE (TAO_PERFECT_HASH_OPTABLE_FIND_START);

  TAO_operation_db_entry const * const entry = lookup (opname,
                                                       length);
  if (entry == 0)
    {
      skelfunc = 0; // insure that somebody can't call a wrong function!
      TAOLIB_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("TAO_Perfect_Hash_OpTable:find for ")
                         ACE_TEXT ("operation '%C' (length=%d) failed\n"),
                         opname ? opname : "<null string>", length),
                        -1);
    }

  // Valid entry. Figure out the skel_ptr.
  skelfunc = entry->skel_ptr;

  return 0;
}

int
TAO_Perfect_Hash_OpTable::find (const char *opname,
                                TAO_Collocated_Skeleton &skelfunc,
                                TAO::Collocation_Strategy st,
                                const unsigned int length)
{
  ACE_FUNCTION_TIMEPROBE (TAO_PERFECT_HASH_OPTABLE_FIND_START);

  TAO_operation_db_entry const * const entry = lookup (opname, length);
  if (entry == 0)
    {
      skelfunc = 0; // insure that somebody can't call a wrong function!
      TAOLIB_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("TAO_Perfect_Hash_OpTable:find for ")
                         ACE_TEXT ("operation '%C' (length=%d) failed\n"),
                         opname ? opname : "<null string>", length),
                        -1);
    }

  switch (st)
    {
    case TAO::TAO_CS_DIRECT_STRATEGY:
      skelfunc = entry->direct_skel_ptr;
      break;
    default:
      return -1;
    }

  return 0;
}

int
TAO_Perfect_Hash_OpTable::bind (const char *, const TAO::Operation_Skeletons)
{
  return 0;
}

TAO_END_VERSIONED_NAMESPACE_DECL