#ifndef __COSMO_FORTRAN_HPP #define __COSMO_FORTRAN_HPP #include #include #include #include #include "config.hpp" namespace CosmoTool { class InvalidUnformattedAccess : public Exception { }; class UnformattedRead { public: enum Ordering { LittleEndian, BigEndian }; enum CheckpointSize { Check_32bits, Check_64bits }; UnformattedRead(const std::string& fname) throw (); UnformattedRead(const char *fname) throw (); ~UnformattedRead(); // Todo implement primitive description void setOrdering(Ordering o); void setCheckpointSize(CheckpointSize cs); void beginCheckpoint() throw (InvalidUnformattedAccess,EndOfFileException); void endCheckpoint() throw (InvalidUnformattedAccess); double readReal64() throw (InvalidUnformattedAccess); float readReal32() throw (InvalidUnformattedAccess); int32_t readInt32() throw (InvalidUnformattedAccess); int64_t readInt64() throw (InvalidUnformattedAccess); protected: bool swapOrdering; CheckpointSize cSize; uint64_t checkPointRef; uint64_t checkPointAccum; std::ifstream *f; void readOrderedBuffer(void *buffer, int size) throw (InvalidUnformattedAccess); }; }; #endif