0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FileDevice.cc
Go to the documentation of this file.
1 
22 #include "FileDevice.h"
23 #include "Common/StaticBuffer.h"
24 #include "Common/Error.h"
25 
26 using namespace Hypertable::FsBroker::Lib;
27 using namespace std;
28 using namespace boost::iostreams;
29 
31  bool accurate_length, BOOST_IOS::openmode mode)
32 {
33  open(client, filename, accurate_length, mode);
34 }
35 
37  bool accurate_length, BOOST_IOS::openmode mode)
38 {
39  pimpl_.reset(new impl(client, filename, accurate_length, mode));
40 }
41 
42 bool FileDevice::is_open() const
43 {
44  return pimpl_->m_open;
45 }
46 
47 streamsize FileDevice::read(char_type *dst, size_t amount)
48 {
49  return pimpl_->read(dst, amount);
50 }
51 
53 {
54  return pimpl_->bytes_read();
55 }
56 
58 {
59  return pimpl_->length();
60 }
61 
62 size_t FileDevice::write(const char_type *dst, size_t amount)
63 {
64  return pimpl_->write(dst, amount);
65 }
66 
68 {
69  return pimpl_->bytes_written();
70 }
72 {
73  pimpl_->close();
74 }
FileDevice(ClientPtr &client, const String &filename, bool accurate_length=true, BOOST_IOS::openmode mode=BOOST_IOS::in)
Definition: FileDevice.cc:30
static String filename
Definition: Config.cc:48
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
STL namespace.
std::shared_ptr< Client > ClientPtr
Smart pointer to Client.
Definition: Client.h:233
virtual streamsize read(char_type *dst, size_t amount)
Definition: FileDevice.cc:47
A memory buffer of static size.
virtual size_t write(const char_type *src, size_t amount)
Definition: FileDevice.cc:62
virtual void open(ClientPtr &client, const String &filename, bool accurate_length=true, BOOST_IOS::openmode mode=BOOST_IOS::in)
Definition: FileDevice.cc:36
File system broker framework and client library.
Definition: Broker.h:44
Error codes, Exception handling, error logging.