00001 #ifndef DBICONFIGSTREAM_H 00002 #define DBICONFIGSTREAM_H 00003 00004 /** 00005 * 00006 * $Id: TDbiConfigStream.hxx,v 1.1 2011/01/18 05:49:19 finch Exp $ 00007 * 00008 * \class TDbiConfigStream 00009 * 00010 * 00011 * \brief 00012 * <b>Concept</b> I/O of configuration data and equivalent TDbiRegistry objs. 00013 * 00014 * \brief 00015 * <b>Purpose</b> Used to fill/store TDbiRegistry objects. 00016 * 00017 * Contact: A.Finch@lancaster.ac.uk 00018 * 00019 * 00020 */ 00021 00022 #include <string> 00023 00024 #include "TDbi.hxx" 00025 #include "TDbiConfigSet.hxx" 00026 #include "TDbiResultSetHandle.hxx" 00027 #include "TDbiRegistry.hxx" 00028 #include "TVldContext.hxx" 00029 00030 00031 class TDbiConfigStream; 00032 class TDbiFieldType; 00033 00034 class TDbiRegistry; 00035 00036 00037 #include <iosfwd> 00038 00039 ostream& operator<<(ostream& s, const TDbiConfigStream& cfStream); 00040 00041 00042 class TDbiConfigStream 00043 { 00044 00045 00046 public: 00047 00048 static TVldContext fgDefaultContext; 00049 00050 // Constructors and destructors. 00051 TDbiConfigStream(); 00052 TDbiConfigStream(const std::string& SoftwName, 00053 const std::string& ConfigName="default", 00054 TVldContext vc = TDbiConfigStream::fgDefaultContext, 00055 TDbi::Task task=0, 00056 const std::string& tableName="SOFTWARE_CONFIGURATION"); 00057 virtual ~TDbiConfigStream(); 00058 00059 // State testing member functions 00060 const TDbiConfigStream& operator>>(TDbiRegistry* reg); 00061 const TDbiConfigSet* GetConfigSet() const { return fCFSet; } 00062 00063 // State changing member functions 00064 00065 TDbiConfigStream& operator<<(const TDbiRegistry* reg); 00066 Bool_t IsEmpty() { return fCFSet == 0; } 00067 TDbiValidityRec& GetValidityRec() { return fVRec; } 00068 Bool_t Write(UInt_t dbNo = 0, 00069 const std::string& logComment = "", 00070 Bool_t localTest = false); 00071 00072 private: 00073 00074 TDbiConfigStream(const TDbiConfigStream&); // Not implimented 00075 00076 // Data members 00077 00078 /// Pointer to the associated configuration set. May point either 00079 /// to a row of fCFSetTable (or 0) or, after operator <<, to fCFSetModified 00080 const TDbiConfigSet* 00081 fCFSet; 00082 00083 /// Pointer to ConfigSet table 00084 TDbiResultSetHandle<TDbiConfigSet> 00085 fCFSetTable; 00086 00087 /// Local TDbiConfigSet (empty until/unless filled using operator <<). 00088 TDbiConfigSet fCFSetModified; 00089 00090 /// Associated validity rec (used when writing back to the database). 00091 TDbiValidityRec fVRec; 00092 00093 /// Name of the configuration set 00094 std::string fConfigName; 00095 00096 /// Name of the software system to be configured 00097 std::string fSoftwName; 00098 00099 ClassDef(TDbiConfigStream,0) // Input/output stream of configuration data 00100 00101 }; 00102 00103 00104 #endif // DBICONFIGSTREAM_H 00105