#ifndef DBIOUTROWSTREAM_H #define DBIOUTROWSTREAM_H /** * * $Id: IDbiOutRowStream.hxx,v 1.1 2011/01/18 05:49:20 finch Exp $ * * \class COMET::IDbiOutRowStream * * * \brief * Concept Output stream for the values of a single table row * with type checking and deferred sequence number asignment. * * \brief * Purpose This is a helper class COMET::for IDbiSqlValPacket. Its * primary purpose is to provide an << operator with built-type * checking to simplify the writing of IDbiTableRow subclasses. * * Contact: A.Finch@lancaster.ac.uk * * */ #include #include "IDbi.hxx" #include "IDbiRowStream.hxx" namespace COMET { class IDbiTableMetaData; } namespace COMET { class IVldTimeStamp; }; namespace COMET { class IDbiValidityRec; } namespace COMET { class IDbiOutRowStream : public IDbiRowStream { friend class IDbiConfigSet; //To allow it to use private Store method public: // Constructors and destructors. IDbiOutRowStream(const IDbiTableMetaData* metaData); virtual ~IDbiOutRowStream(); // State testing member functions Bool_t HasGoodData() const { return ! fBadData && IsComplete(); } const string& GetCSV() const { return fCSV; } Bool_t IsComplete() const { return CurColNum() == NumCols()+1; } // State changing member functions COMET::IDbiOutRowStream& operator<<(Bool_t src); COMET::IDbiOutRowStream& operator<<(Char_t src); COMET::IDbiOutRowStream& operator<<(const Char_t* src); COMET::IDbiOutRowStream& operator<<(Short_t src); COMET::IDbiOutRowStream& operator<<(UShort_t src); COMET::IDbiOutRowStream& operator<<(Int_t src); COMET::IDbiOutRowStream& operator<<(UInt_t src); /* IDbiOutRowStream& operator<<(Long_t& src); */ /* IDbiOutRowStream& operator<<(ULong_t& src); */ IDbiOutRowStream& operator<<(Float_t src); IDbiOutRowStream& operator<<(Double_t src); IDbiOutRowStream& operator<<(const string& src); IDbiOutRowStream& operator<<(const COMET::IVldTimeStamp& src); void Clear() { fBadData = kFALSE; fCSV.erase(); ClearCurCol();} private: // State testing member functions // State changing member functions void Store(const string& str); Bool_t StoreDefaultIfInvalid(IDbi::DataTypes type); // Data members /// Set KTRUE if streamed bad data Bool_t fBadData; /// Comma separated list of values. string fCSV; ClassDef(IDbiOutRowStream,0) //Output stream for single table row }; }; #endif // DBIOUTROWSTREAM_H