Operation_Table_Perfect_Hash.cpp

Go to the documentation of this file.
00001 // $Id: Operation_Table_Perfect_Hash.cpp 79209 2007-08-05 18:58:56Z johnnyw $
00002 
00003 #include "tao/PortableServer/Operation_Table_Perfect_Hash.h"
00004 #include "tao/Timeprobe.h"
00005 #include "ace/Log_Msg.h"
00006 
00007 ACE_RCSID(PortableServer,
00008           Operation_Table_Perfect_Hash,
00009           "$Id: Operation_Table_Perfect_Hash.cpp 79209 2007-08-05 18:58:56Z johnnyw $")
00010 
00011 #if defined (ACE_ENABLE_TIMEPROBES)
00012 
00013 static const char *TAO_Operation_Table_Timeprobe_Description[] =
00014   {
00015     "TAO_Perfect_Hash_OpTable::find - start",
00016     "TAO_Perfect_Hash_OpTable::find - end",
00017   };
00018 
00019 enum
00020   {
00021     // Timeprobe description table start key
00022     TAO_PERFECT_HASH_OPTABLE_FIND_START = 606,
00023     TAO_PERFECT_HASH_OPTABLE_FIND_END,
00024   };
00025 
00026 // Setup Timeprobes
00027 ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Operation_Table_Timeprobe_Description,
00028                                   TAO_PERFECT_HASH_OPTABLE_FIND_START);
00029 
00030 #endif /* ACE_ENABLE_TIMEPROBES */
00031 
00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00033 
00034 // Do nothing destrctor.
00035 TAO_Perfect_Hash_OpTable::~TAO_Perfect_Hash_OpTable (void)
00036 {
00037 }
00038 
00039 int
00040 TAO_Perfect_Hash_OpTable::find (const char *opname,
00041                                 TAO_Skeleton &skelfunc,
00042                                 const unsigned int length)
00043 {
00044   ACE_FUNCTION_TIMEPROBE (TAO_PERFECT_HASH_OPTABLE_FIND_START);
00045 
00046   TAO_operation_db_entry const * const entry = lookup (opname,
00047                                                        length);
00048   if (entry == 0)
00049     {
00050       skelfunc = 0; // insure that somebody can't call a wrong function!
00051       ACE_ERROR_RETURN ((LM_ERROR,
00052                          ACE_TEXT ("TAO_Perfect_Hash_OpTable:find for ")
00053                          ACE_TEXT ("operation '%s' (length=%d) failed\n"),
00054                          ACE_TEXT_CHAR_TO_TCHAR (opname ? opname : "<null string>"), length),
00055                         -1);
00056     }
00057 
00058   // Valid entry. Figure out the skel_ptr.
00059   skelfunc = entry->skel_ptr;
00060 
00061   return 0;
00062 }
00063 
00064 int
00065 TAO_Perfect_Hash_OpTable::find (const char *opname,
00066                                 TAO_Collocated_Skeleton &skelfunc,
00067                                 TAO::Collocation_Strategy st,
00068                                 const unsigned int length)
00069 {
00070   ACE_FUNCTION_TIMEPROBE (TAO_PERFECT_HASH_OPTABLE_FIND_START);
00071 
00072   TAO_operation_db_entry const * const entry = lookup (opname,
00073                                                        length);
00074   if (entry == 0)
00075     {
00076       skelfunc = 0; // insure that somebody can't call a wrong function!
00077       ACE_ERROR_RETURN ((LM_ERROR,
00078                          ACE_TEXT ("TAO_Perfect_Hash_OpTable:find for ")
00079                          ACE_TEXT ("operation '%s' (length=%d) failed\n"),
00080                          ACE_TEXT_CHAR_TO_TCHAR (opname ? opname : "<null string>"), length),
00081                         -1);
00082     }
00083 
00084   switch (st)
00085     {
00086     case TAO::TAO_CS_DIRECT_STRATEGY:
00087       skelfunc = entry->direct_skel_ptr;
00088       break;
00089     default:
00090       return -1;
00091     }
00092 
00093   return 0;
00094 }
00095 
00096 int
00097 TAO_Perfect_Hash_OpTable::bind (const char *, const TAO::Operation_Skeletons)
00098 {
00099   return 0;
00100 }
00101 
00102 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:40:54 2010 for TAO_PortableServer by  doxygen 1.4.7