00001 // $Header: /nfs/slac/g/glast/ground/cvs/xmlUtil/xmlUtil/id/IdOperation.h,v 1.6 2002/04/05 18:28:44 jrb Exp $ 00002 00003 #ifndef XMLUTIL_IDOPERATION_H 00004 #define XMLUTIL_IDOPERATION_H 00005 00006 #include <dom/DOM_Element.hpp> 00007 #include "xmlUtil/id/NamedId.h" 00008 #include <iostream> 00009 #include <string> 00010 00011 namespace xmlUtil { 00012 00013 00016 00025 class IdOperation; 00026 std::ostream& operator<<(std::ostream& s, const IdOperation& op); 00027 00028 00029 class IdOperation { 00030 public: 00031 00032 virtual ~IdOperation() {}; 00033 friend class IdConversion; 00034 00035 virtual std::string myOp() const 00036 {return std::string("IDENTITY (default) ");} 00037 // Perhaps need to throw exception if inputId isn't compatible 00038 // with requested operation?? 00039 00040 protected: 00041 // Convert input NamedId in place. Do we really want this?? 00042 // Probably not. 00043 /* Return true if /b inputId has whatever fields might be 00044 needed for the operation. This base class just leaves the 00045 the input alone and always returns true. */ 00046 // virtual bool convert(NamedId* inputId) {return true;}; 00047 00050 virtual NamedId * convert(const NamedId& inputId); 00051 // Might also want something to convert a simple identifier (i.e., 00052 // just a list of integers without accompanying field names). 00053 // However converters work in terms of fields names, so one needs 00054 // an Id Dictionary w.r.t which one can generate a NamedId out of 00055 // the Identifier, then invoke the above version of convert. 00056 00058 IdOperation(DOM_Element); 00059 00060 // Default constructor produces an operation which acts on any NamedId 00061 // and does nothing to it. 00062 // Not yet clear whether this can be made private 00063 IdOperation() {} 00064 }; 00065 } 00066 #endif 00067
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001