00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Operation_Table_Perfect_Hash.h 00006 * 00007 * $Id: Operation_Table_Perfect_Hash.h 71473 2006-03-10 07:19:20Z jtc $ 00008 * 00009 * @author Aniruddha Gokhale 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_OPERATION_TABLE_PERFECT_HASH_H 00014 #define TAO_OPERATION_TABLE_PERFECT_HASH_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/PortableServer/portableserver_export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/PortableServer/Operation_Table.h" 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 /** 00029 * @class TAO_Perfect_Hash_OpTable 00030 * 00031 * @brief Helper class for use of perfect hashing operation lookup 00032 * strategy. 00033 * 00034 * This class declares pure virtual methods called 'lookup ()' 00035 * and 'hash ()' which will be generated by the GPERF 00036 * program. These methods are used by 'bind ()' and 'find ()' 00037 * methods. Subclasses will define the lookup and hash 00038 * functions. 00039 */ 00040 class TAO_PortableServer_Export TAO_Perfect_Hash_OpTable 00041 : public TAO_Operation_Table 00042 { 00043 public: 00044 00045 /// Do nothing destrctor. 00046 virtual ~TAO_Perfect_Hash_OpTable (void); 00047 00048 /// See the documentation in the base class for details. 00049 virtual int find (const char *opname, 00050 TAO_Skeleton &skelfunc, 00051 const unsigned int length = 0); 00052 00053 virtual int find (const char *opname, 00054 TAO_Collocated_Skeleton &skelfunc, 00055 TAO::Collocation_Strategy s, 00056 const unsigned int length = 0); 00057 00058 virtual int bind (const char *opname, 00059 const TAO::Operation_Skeletons skel_ptr); 00060 00061 private: 00062 // = Methods that should defined by the subclasses. GPERF program 00063 // will generate these routines. 00064 00065 virtual unsigned int hash (const char *str, unsigned int len) = 0; 00066 00067 virtual const TAO_operation_db_entry* lookup (const char *str, 00068 unsigned int len) = 0; 00069 }; 00070 00071 TAO_END_VERSIONED_NAMESPACE_DECL 00072 00073 #include /**/ "ace/post.h" 00074 #endif /* TAO_OPERATION_TABLE_PERFECT_HASH_H */