Newer
Older
#ifndef FILEWRAPPER_H
#define FILEWRAPPER_H
#include <Configuration.h>
#include <tango.h>
#include <boost/filesystem.hpp>
namespace DataExporter_ns
{
class FileWrapper : public Tango::LogAdapter
{
public:
//------------------------------------------------------------------------------
// [Public] Shared pointer typedef
//------------------------------------------------------------------------------
typedef boost::shared_ptr<FileWrapper> SP;
protected:
//------------------------------------------------------------------------------
// [Protected] Constructor destructor deleter
//------------------------------------------------------------------------------
FileWrapper(Tango::DeviceImpl*, boost::filesystem::path&);
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 isCompleted();
virtual void read(std::vector<char>&) 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