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

IdDict.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/xmlUtil/xmlUtil/id/IdDict.h,v 1.7 2002/04/05 18:28:44 jrb Exp $
00002 #ifndef XMLUTIL_IDDICT_H
00003 #define XMLUTIL_IDDICT_H
00004 
00005 #include <dom/DOM_Element.hpp>
00006 
00007 #include <vector>
00008 #include <string>
00009 
00010 #include "xmlUtil/id/DictObject.h"
00011 #include "xmlUtil/id/NamedId.h"
00012 
00013 namespace xmlUtil {
00015 
00030   /* Some day should redo this using Builder architecture.
00031      Define abstract (or nearly abstract) IdDictBuilder class, then
00032      concrete derived XMLbuilder.  That way the dictionary class and
00033      classes making up elements of the dictionary wouldn't have to know
00034      about the XML representation at all.
00035   */
00036   class DictNode;
00037   class DictField;
00038   class DictFieldMan;
00039   class DictVisitor;
00040 
00041   class IdDict : public DictObject {
00042   public:
00043     enum Constituents {nodeHierarchy = 1,
00044                        fieldManager = 2};
00045 
00046     IdDict(DOM_Element elt);
00047     ~IdDict();
00048 
00050     bool isValid();
00051 
00053     bool idOk(const Identifier& id) const;
00054 
00056     bool idOk(const NamedId& id) const;
00057 
00060     bool nameSeqOk(const NameSeq& seq) const;
00061 
00064     // Not clear anyone wants or needs this service; if not, dump it
00065     //    NameSeq*     getNameSeq(const Identifier& id) const;
00066 
00069     NamedId *  getNamedId(const Identifier& id) const;
00070 
00071     const std::string& getDictName() const {return m_name;};
00072     int                getMajorVersion() const {return m_major;};
00073     int                getMinorVersion() const {return m_minor;};
00074     int                getPatchVersion() const {return m_patch;};
00075     DictNode&          getRoot() const {return *m_root;};
00076     bool               accept(DictVisitor *vis);
00077 
00078     bool               accept(DictVisitor *vis, unsigned constituentMask);
00082   protected:
00083     friend class IdConverter;
00084 
00085     // Maybe make a derived class, IdDictBuildable, where the following
00086     // constructor and member function are declared.  IdConverter
00087     // would create an object of this (derived) type.
00088 
00091     IdDict(DictNode* root);
00092 
00095     bool addChild(DictNode* parent, DictNode* newNode);
00096 
00097     /* vector<DictField*> m_fields;  */
00098                             /*< all fields defined in the dictionary;
00099                                 need not all be used (associated with
00100                                 a node) */
00101     DictFieldMan*      m_fieldMan;
00102     DictNode*          m_root;
00103     std::string        m_name;   /*< dictionary name */
00104     int                m_major;  /*< version information */
00105     int                m_minor;  /*< version information */
00106     int                m_patch;  /*< version information */
00107   };  // end of IdDict class definition
00108 }      // end of namespace xmlUtil
00109 #endif

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