/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/ProxyDict/ProxyDict-00-00-01/ProxyDict/IfdStrKey.h

Go to the documentation of this file.
00001 #ifndef IFDSTRKEY_HH
00002 #define IFDSTRKEY_HH
00003 //--------------------------------------------------------------------------
00004 // File and Version Information:
00005 //    $Id: IfdStrKey.h,v 1.1.1.1 2005/04/21 01:18:05 zhangy Exp $
00006 //
00007 // Description:
00008 //    IfdKeys based on string values.  Implementation is not in
00009 //    terms of a string class, i.e., is in terms of char*, because
00010 //    the package's usage is spreading and not everyone uses the
00011 //    same standard String class.
00012 //
00013 // Author List:
00014 //    Ed Frank                        University of Pennsylvania
00015 //
00016 // History:
00017 //    Ed Frank      17 Nov 96         Creation of first version
00018 //
00019 // Copyright Information:
00020 //      Copyright (C) 1997
00021 //
00022 // Bugs:
00023 //
00024 //------------------------------------------------------------------------
00025 
00026 #include "ProxyDict/IfdKey.h"
00027 #if !(defined(__GNUC__) && (__GNUC__ < 3) && (__GNUC_MINOR__ < 95)) // BABAR_IOSTREAMS_MIGRATION
00028 #include <iostream>
00029 #else                                                               // BABAR_IOSTREAMS_MIGRATION
00030 #include <iostream.h>
00031 #endif                                                              // BABAR_IOSTREAMS_MIGRATION
00032 #include <stdlib.h>
00033 #include <string.h>
00034 #ifndef VXWORKS
00035 #include <string>
00036 #endif
00037 
00038 
00039 class IfdStrKey : public IfdKey {
00040 public:
00041    enum { IFDKEY_BUFSIZE=32 };  // See comments for _string
00042 
00043    IfdStrKey( const char *s );
00044 #ifndef VXWORKS
00045    IfdStrKey( const std::string& s );
00046 #endif
00047    virtual ~IfdStrKey();
00048 
00049    virtual int operator==( const IfdKey& k ) const;
00050    virtual int operator< ( const IfdKey& k ) const;
00051       // colation as determined by strcmp.  Be careful.
00052 
00053    virtual IfdKey* clone(void) const;
00054       // clone this key.  caller owns returned key.
00055 
00056    const char* asString(void) const { return strVal; }
00057 #if !(defined(__GNUC__) && (__GNUC__ < 3) && (__GNUC_MINOR__ < 95)) // BABAR_IOSTREAMS_MIGRATION
00058    virtual void print( std::ostream &o) const;
00059 #else                                                               // BABAR_IOSTREAMS_MIGRATION
00060    virtual void print( ostream &o) const;
00061 #endif                                                              // BABAR_IOSTREAMS_MIGRATION
00062 
00063 protected:
00064 //   virtual keyKind getKeyKind( void ) const { return strKey; }
00065 
00066 private:
00067    IfdStrKey( const char *s, unsigned int hashVal );
00068       // Used for clone() to avoid cost of hash function.
00069 
00070    // Copy ctor and assignemnt op are not allowed.  This keeps
00071    // the class behavior like its base, IfdKey.  See that class for
00072    // more info.
00073    IfdStrKey( const IfdStrKey &);
00074    IfdStrKey& operator=( IfdStrKey &);
00075 
00076    // We allocate space for strings up to 32 bytes (including termination)
00077    // and, if a string longer than that is needed, we allocate on the heap.
00078    // The intention is to provide faster service for the most often used
00079    // cases, although at a penalty in size.
00080 
00081    char _stringBuf[ IFDKEY_BUFSIZE ];
00082    bool _onHeap;
00083 
00084 };
00085 
00086 
00087 #endif /*  IFDSTRKEY_HH */

Generated on Tue Nov 29 23:13:39 2016 for BOSS_7.0.2 by  doxygen 1.4.7