CatapultServer  v0.5.0.1 (Elephant)
AppendContext.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "IoTypes.h"
23 
24 namespace catapult { namespace ionet {
25 
28  class AppendContext {
29  public:
31  AppendContext(ByteBuffer& data, size_t size);
32 
35 
38 
39  public:
41  boost::asio::mutable_buffers_1 buffer();
42 
44  void commit(size_t size);
45 
46  private:
47  void assertNotCommitted() const;
48 
49  private:
51  size_t m_appendSize;
54  };
55 }}
catapult::ionet::AppendContext::assertNotCommitted
void assertNotCommitted() const
Definition: AppendContext.cpp:68
exceptions.h
AppendContext.h
catapult::ionet::AppendContext::commit
void commit(size_t size)
Commits the write to the underlying buffer.
Definition: AppendContext.cpp:59
CATAPULT_THROW_RUNTIME_ERROR_2
#define CATAPULT_THROW_RUNTIME_ERROR_2(MESSAGE, PARAM1, PARAM2)
Macro used to throw a catapult runtime error with two parameters.
Definition: exceptions.h:175
catapult::ionet::AppendContext::m_appendSize
size_t m_appendSize
Definition: AppendContext.h:51
catapult::ionet::AppendContext::buffer
boost::asio::mutable_buffers_1 buffer()
An asio buffer that can be written to in place.
Definition: AppendContext.cpp:54
catapult::ionet::ByteBuffer
std::vector< uint8_t > ByteBuffer
Definition: IoTypes.h:28
catapult::ionet::AppendContext::~AppendContext
~AppendContext()
Destructor.
Definition: AppendContext.cpp:49
catapult::ionet::AppendContext::m_data
ByteBuffer & m_data
Definition: AppendContext.h:50
catapult::ionet::AppendContext::AppendContext
AppendContext(ByteBuffer &data, size_t size)
Creates an append context for appending size data to data.
Definition: AppendContext.cpp:26
size
uint64_t size
Definition: MemoryCounters.cpp:65
CATAPULT_THROW_RUNTIME_ERROR
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::ionet::AppendContext::m_isCommitted
bool m_isCommitted
Definition: AppendContext.h:53
catapult::ionet::AppendContext
Definition: AppendContext.h:28
catapult::ionet::AppendContext::m_originalSize
size_t m_originalSize
Definition: AppendContext.h:52
IoTypes.h