1 #include "tao/PortableServer/Operation_Table_Dynamic_Hash.h"
2 #include "tao/Timeprobe.h"
3 #include "ace/Log_Msg.h"
5 #if defined (ACE_ENABLE_TIMEPROBES)
7 static const char *TAO_Operation_Table_Timeprobe_Description
[] =
9 "TAO_Dynamic_Hash_OpTable::find - start",
10 "TAO_Dynamic_Hash_OpTable::find - end",
15 // Timeprobe description table start key
16 TAO_DYNAMIC_HASH_OPTABLE_FIND_START
= 600,
17 TAO_DYNAMIC_HASH_OPTABLE_FIND_END
,
21 ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Operation_Table_Timeprobe_Description
,
22 TAO_DYNAMIC_HASH_OPTABLE_FIND_START
);
24 #endif /* ACE_ENABLE_TIMEPROBES */
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
29 TAO_Dynamic_Hash_OpTable::TAO_Dynamic_Hash_OpTable (
30 TAO_operation_db_entry
const * db
,
32 CORBA::ULong hashtblsize
,
34 : hash_ (hashtblsize
, alloc
)
36 // Iterate thru each entry in the database and bind the operation
37 // name to its corresponding skeleton.
38 for (CORBA::ULong i
= 0; i
< dbsize
; ++i
)
40 TAO::Operation_Skeletons s
;
41 s
.skel_ptr
= db
[i
].skel_ptr
;
42 s
.thruPOA_skel_ptr
= db
[i
].skel_ptr
;
43 s
.direct_skel_ptr
= db
[i
].direct_skel_ptr
;
45 // @@ (ASG): what happens if bind fails ???
46 if (this->bind (db
[i
].opname
, s
) == -1)
47 TAOLIB_ERROR ((LM_ERROR
,
48 ACE_TEXT ("(%P|%t) %p\n"),
49 ACE_TEXT ("bind failed")));
53 TAO_Dynamic_Hash_OpTable::~TAO_Dynamic_Hash_OpTable ()
55 // Initialize an iterator. We need to go thru each entry and free
56 // up storage allocated to hold the external ids. In this case,
58 OP_MAP_MANAGER::ITERATOR
iterator (this->hash_
);
60 for (OP_MAP_MANAGER::ENTRY
*entry
= 0;
61 iterator
.next (entry
) != 0;
64 // We had allocated memory and stored the string. So we free the
66 CORBA::string_free ((char *) entry
->ext_id_
);
72 TAO_Dynamic_Hash_OpTable::bind (const char *opname
,
73 const TAO::Operation_Skeletons skel_ptr
)
75 return this->hash_
.bind (CORBA::string_dup (opname
), skel_ptr
);
79 TAO_Dynamic_Hash_OpTable::find (const char *opname
,
80 TAO_Skeleton
& skel_ptr
,
83 ACE_FUNCTION_TIMEPROBE (TAO_DYNAMIC_HASH_OPTABLE_FIND_START
);
84 TAO::Operation_Skeletons s
;
86 int const retval
= this->hash_
.find (opname
, s
);
90 skel_ptr
= s
.skel_ptr
;
97 TAO_Dynamic_Hash_OpTable::find (const char *opname
,
98 TAO_Collocated_Skeleton
& skel_ptr
,
99 TAO::Collocation_Strategy s
,
102 ACE_FUNCTION_TIMEPROBE (TAO_DYNAMIC_HASH_OPTABLE_FIND_START
);
104 TAO::Operation_Skeletons skel
;
106 int const retval
= this->hash_
.find (opname
, skel
);
112 case TAO::TAO_CS_DIRECT_STRATEGY
:
113 skel_ptr
= skel
.direct_skel_ptr
;
123 TAO_END_VERSIONED_NAMESPACE_DECL