BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/ProxyDict/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) && (__GNUC_MINOR__ < 95)) // BABAR_IOSTREAMS_MIGRATION
28#include <iostream>
29#else // BABAR_IOSTREAMS_MIGRATION
30#include <iostream.h>
31#endif // BABAR_IOSTREAMS_MIGRATION
32#include <stdlib.h>
33#include <string.h>
34#ifndef VXWORKS
35#include <string>
36#endif
37
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) && (__GNUC_MINOR__ < 95)) // BABAR_IOSTREAMS_MIGRATION
58 virtual void print( std::ostream &o) const;
59#else // BABAR_IOSTREAMS_MIGRATION
60 virtual void print( ostream &o) const;
61#endif // BABAR_IOSTREAMS_MIGRATION
62
63protected:
64// virtual keyKind getKeyKind( void ) const { return strKey; }
65
66private:
67 IfdStrKey( const char *s, unsigned int hashVal );
68 // Used for clone() to avoid cost of hash function.
69
70 // Copy ctor and assignemnt op are not allowed. This keeps
71 // the class behavior like its base, IfdKey. See that class for
72 // more info.
73 IfdStrKey( const IfdStrKey &);
74 IfdStrKey& operator=( IfdStrKey &);
75
76 // We allocate space for strings up to 32 bytes (including termination)
77 // and, if a string longer than that is needed, we allocate on the heap.
78 // The intention is to provide faster service for the most often used
79 // cases, although at a penalty in size.
80
81 char _stringBuf[ IFDKEY_BUFSIZE ];
82 bool _onHeap;
83
84};
85
86
87#endif /* IFDSTRKEY_HH */
XmlRpcServer s
Definition: HelloServer.cpp:11
virtual void print(std::ostream &o) const
virtual int operator==(const IfdKey &k) const
Definition: IfdStrKey.cxx:156
virtual ~IfdStrKey()
Definition: IfdStrKey.cxx:141
virtual int operator<(const IfdKey &k) const
Definition: IfdStrKey.cxx:177
virtual IfdKey * clone(void) const
Definition: IfdStrKey.cxx:149