#ifndef FILEWRAPPER_H #define FILEWRAPPER_H #include #include #include namespace DataExporter_ns { class FileWrapper : public Tango::LogAdapter { public: //------------------------------------------------------------------------------ // [Public] Shared pointer typedef //------------------------------------------------------------------------------ typedef boost::shared_ptr SP; protected: //------------------------------------------------------------------------------ // [Protected] Constructor destructor deleter //------------------------------------------------------------------------------ FileWrapper(Tango::DeviceImpl*, boost::filesystem::path&); virtual ~FileWrapper(); class Deleter; friend Deleter; class Deleter { public: void operator()(FileWrapper* d) { delete d; } }; public: //------------------------------------------------------------------------------ // [Public] Class creation method //------------------------------------------------------------------------------ static FileWrapper::SP create(Tango::DeviceImpl*, boost::filesystem::path&); //------------------------------------------------------------------------------ // [Public] Input stream methods //------------------------------------------------------------------------------ virtual bool isOpen(); virtual bool isBad(); virtual bool isCompleted(); virtual void read(std::vector&) throw(std::runtime_error); protected: //------------------------------------------------------------------------------ // [Protected] Class variables //------------------------------------------------------------------------------ //Input file size int m_inputFileSize; //Input file stream std::ifstream m_inputFileStream; //Read buffer size const int BUFFER_SIZE = 1024; }; } //End of namespace #endif /* FILEWRAPPER_H */