00001 // $Header: /nfs/slac/g/glast/ground/cvs/xmlUtil/xmlUtil/id/IdConverter.h,v 1.8 2002/04/05 18:28:44 jrb Exp $ 00002 00003 #ifndef XMLUTIL_IDCONVERTER_H 00004 #define XMLUTIL_IDCONVERTER_H 00005 #include "xmlUtil/id/NamedId.h" 00006 #include <dom/DOM_Element.hpp> 00007 #include <string> 00008 #include <vector> 00009 #include <iostream> 00010 00011 namespace xmlUtil { 00012 class IdDict; 00013 class IdConversion; 00014 class IdDictMan; 00015 00020 class IdConverter { 00021 public: 00027 IdConverter(DOM_Element elt); 00028 ~IdConverter(); 00029 00030 std::ostream& displayConversions(std::ostream& s); 00031 00032 /* Wait on implementing this one. 00033 // Return image of the input dictionary under the conversions 00034 // defined in the IdConverter object. 00035 // \arg \b inDict: the input dictionary 00036 \arg \b status: report on success of conversion, validity of 00037 output dictionary (and hence of IdConverter object). 00038 Note the collection of conversions making up a converter must 00039 act on disjoint domains, which is identical to the restriction 00040 that no conversion have a path which is a subset of another 00041 converter's path. 00042 00043 IdDict *convert(const IdDict const *inDict, unsigned *status) const; 00044 */ 00045 00047 NamedId * convert(const NamedId *in) const; 00048 00050 00053 Identifier *convert(const Identifier *inIdent) const; 00054 00059 bool isConsistent(); 00060 00061 // Better idea would be to make this a real class rather than 00062 // a typedef to hide implementation. 00063 // Might choose a different container for the conversions, for 00064 // example a tree, ordered by input path on which a conversion 00065 // operates 00066 typedef std::vector<IdConversion*> Conversions; 00067 typedef Conversions::iterator ConversionIt; 00068 00069 private: 00070 // Should inputDict be optional or required? 00071 std::string *inputDictName; 00072 IdDict *inputDict; /*< Input IdDict. */ 00073 00074 // What about outputDict? 00075 std::string *outputDictName; 00076 IdDict *outputDict; 00077 00078 // IdDictMan is a singleton 00079 static IdDictMan *dictMan; 00080 00083 void sortConvs(); 00084 00085 00086 Conversions m_convCol; /*< collection of conversion operations making up the IdConverter */ 00087 00088 enum STATES { 00089 UNKNOWN = -1, 00090 NO = 0, 00091 YES = 1}; 00092 00093 STATES m_consistent; 00094 STATES m_sorted; // (sort into order of increasing path) 00095 00096 }; // end class IdConverter 00097 00098 } // end namespace 00099 #endif
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001