BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/ProxyDict/include/ProxyDict/IfdStrKey.h
Go to the documentation of this file.
1#ifndef IFDSTRKEY_HH
2#define IFDSTRKEY_HH
3//--------------------------------------------------------------------------
4// File and Version Information:
5// $Id: IfdStrKey.h,v 1.1.1.1 2005/04/21 01:18:05 zhangy Exp $
6//
7// Description:
8// IfdKeys based on string values. Implementation is not in
9// terms of a string class, i.e., is in terms of char*, because
10// the package's usage is spreading and not everyone uses the
11// same standard String class.
12//
13// Author List:
14// Ed Frank University of Pennsylvania
15//
16// History:
17// Ed Frank 17 Nov 96 Creation of first version
18//
19// Copyright Information:
20// Copyright (C) 1997
21//
22// Bugs:
23//
24//------------------------------------------------------------------------
25
26#include "ProxyDict/IfdKey.h"
27#if !( defined( __GNUC__ ) && ( __GNUC__ < 3 ) && \
28 ( __GNUC_MINOR__ < 95 ) ) // BABAR_IOSTREAMS_MIGRATION
29# include <iostream>
30#else // BABAR_IOSTREAMS_MIGRATION
31# include <iostream.h>
32#endif // BABAR_IOSTREAMS_MIGRATION
33#include <stdlib.h>
34#include <string.h>
35#ifndef VXWORKS
36# include <string>
37#endif
38
39class IfdStrKey : public IfdKey {
40public:
41 enum { IFDKEY_BUFSIZE = 32 }; // See comments for _string
42
43 IfdStrKey( const char* s );
44#ifndef VXWORKS
45 IfdStrKey( const std::string& s );
46#endif
47 virtual ~IfdStrKey();
48
49 virtual int operator==( const IfdKey& k ) const;
50 virtual int operator<( const IfdKey& k ) const;
51 // colation as determined by strcmp. Be careful.
52
53 virtual IfdKey* clone( void ) const;
54 // clone this key. caller owns returned key.
55
56 const char* asString( void ) const { return strVal; }
57#if !( defined( __GNUC__ ) && ( __GNUC__ < 3 ) && \
58 ( __GNUC_MINOR__ < 95 ) ) // BABAR_IOSTREAMS_MIGRATION
59 virtual void print( std::ostream& o ) const;
60#else // BABAR_IOSTREAMS_MIGRATION
61 virtual void print( ostream& o ) const;
62#endif // BABAR_IOSTREAMS_MIGRATION
63
64protected:
65 // virtual keyKind getKeyKind( void ) const { return strKey; }
66
67private:
68 IfdStrKey( const char* s, unsigned int hashVal );
69 // Used for clone() to avoid cost of hash function.
70
71 // Copy ctor and assignemnt op are not allowed. This keeps
72 // the class behavior like its base, IfdKey. See that class for
73 // more info.
74 IfdStrKey( const IfdStrKey& );
75 IfdStrKey& operator=( IfdStrKey& );
76
77 // We allocate space for strings up to 32 bytes (including termination)
78 // and, if a string longer than that is needed, we allocate on the heap.
79 // The intention is to provide faster service for the most often used
80 // cases, although at a penalty in size.
81
82 char _stringBuf[IFDKEY_BUFSIZE];
83 bool _onHeap;
84};
85
86#endif /* IFDSTRKEY_HH */
XmlRpcServer s
IfdKey(keyKind kind)
Definition IfdKey.cxx:23
virtual int operator<(const IfdKey &k) const
virtual void print(std::ostream &o) const
virtual ~IfdStrKey()
IfdStrKey(const std::string &s)
virtual int operator==(const IfdKey &k) const
IfdStrKey(const char *s)
virtual IfdKey * clone(void) const