libcryfs/implementations/testfake/FakeBlock.cpp

43 lines
786 B
C++
Raw Normal View History

2015-02-17 00:23:33 +01:00
#include <messmer/blockstore/implementations/testfake/FakeBlock.h>
#include <messmer/blockstore/implementations/testfake/FakeBlockStore.h>
#include <cstring>
using std::unique_ptr;
using std::shared_ptr;
using std::istream;
using std::ostream;
using std::ifstream;
using std::ofstream;
using std::ios;
using std::string;
namespace blockstore {
namespace testfake {
2015-01-24 22:08:41 +01:00
FakeBlock::FakeBlock(FakeBlockStore *store, const Key &key, shared_ptr<Data> data)
: Block(key), _store(store), _data(data) {
}
FakeBlock::~FakeBlock() {
flush();
}
void *FakeBlock::data() {
return _data->data();
}
const void *FakeBlock::data() const {
return _data->data();
}
size_t FakeBlock::size() const {
return _data->size();
}
void FakeBlock::flush() {
2015-01-24 22:08:41 +01:00
_store->updateData(key(), *_data);
}
}
}