Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

DictFieldMan.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/xmlUtil/xmlUtil/id/DictFieldMan.h,v 1.4 2001/06/12 19:57:06 jrb Exp $
00002 
00003 #ifndef XMLUTIL_DICTFIELDMAN_H
00004 #define XMLUTIL_DICTFIELDMAN_H
00005 
00006 #include <string>
00007 #ifdef __GNUG__
00008 #include <hash_map>
00009 #else
00010 #include <map>
00011 #endif
00012 
00013 #include "xmlUtil/id/DictObject.h"
00014 
00015 namespace xmlUtil {
00018   class DictField;
00019   class DictVisitor;
00020 
00021 
00022 #ifdef __GNUG__
00023   struct eqstr {
00024     bool operator()(const char* s1, const char* s2) const
00025     {
00026       return strcmp(s1, s2) == 0;
00027     }
00028   };
00029   typedef std::hash_map<const char *, DictField*, std::hash<const char *>, eqstr> 
00030   Registry;
00031 #else
00032   struct ltstr {
00033     bool operator()(const char* s1, const char* s2) const
00034     {
00035       return strcmp(s1, s2) < 0;
00036     }
00037   };
00038   typedef std::map<const char *, DictField*, ltstr> Registry;
00039 #endif
00040 
00041   class DictFieldMan : public DictObject {
00042   public:
00043 
00044     DictFieldMan(int size = 0);
00045     ~DictFieldMan();
00046 
00047 
00048     bool accept(DictVisitor* vis);
00049     void signup(DictField *field);
00050     const DictField * const find(const std::string& name) const;
00051 
00052   private:
00053     // Mechanism for keeping track of the fields is a 
00054     // pair-associative container with key = name and 
00055     // value = pointer to the DictField object
00056     Registry *m_reg;
00057 
00058   };
00059 }
00060 #endif

Generated on Wed Oct 16 14:02:47 2002 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001