more API docs

This commit is contained in:
lganzzzo 2019-03-21 02:42:32 +02:00
parent c3f6a09d7b
commit 704fdb52c2
15 changed files with 467 additions and 70 deletions

View File

@ -23,3 +23,12 @@
***************************************************************************/
#include "Allocator.hpp"
namespace oatpp { namespace base { namespace memory {
AllocatorPoolInfo::AllocatorPoolInfo(const char* pPoolName, v_int32 pPoolChunkSize)
: poolName(pPoolName)
, poolChunkSize(pPoolChunkSize)
{}
}}}

View File

@ -29,16 +29,35 @@
namespace oatpp { namespace base { namespace memory {
/**
* Pool Information for Pool Allocators.
*/
class AllocatorPoolInfo {
public:
AllocatorPoolInfo(const char* pPoolName, v_int32 pPoolChunkSize)
: poolName(pPoolName)
, poolChunkSize(pPoolChunkSize)
{}
/**
* Constructor.
* @param pPoolName - memory pool name.
* @param pPoolChunkSize - memory pool chunk size. For more about chunk size see &id:oatpp::base::memory::MemoryPool::MemoryPool;.
*/
AllocatorPoolInfo(const char* pPoolName, v_int32 pPoolChunkSize);
/**
* Memory pool name.
*/
const char* const poolName;
/**
* Memory pool chunk size.
* For more about chunk size see &id:oatpp::base::memory::MemoryPool::MemoryPool;.
*/
const v_int32 poolChunkSize;
};
/**
* Allocator to allocate shared object on &id:oatpp::base::memory::MemoryPool;
* Used to allocate shared_ptr control block and an object in the same memory entry of the pool.
* @tparam T - type of the object to allocate.
*/
template<class T>
class PoolSharedObjectAllocator {
public:
@ -79,7 +98,11 @@ template <typename T, typename U>
inline bool operator != (const PoolSharedObjectAllocator<T>& a, const PoolSharedObjectAllocator<U>& b) {
return !(a == b);
}
/**
* Same as &l:PoolSharedObjectAllocator; but uses `thread_local` &id:oatpp::base::memory::MemoryPool;.
* @tparam T - type of the object to allocate.
*/
template<class T>
class ThreadLocalPoolSharedObjectAllocator {
public:
@ -120,17 +143,26 @@ template <typename T, typename U>
inline bool operator != (const ThreadLocalPoolSharedObjectAllocator<T>& a, const ThreadLocalPoolSharedObjectAllocator<U>& b) {
return !(a == b);
}
/**
* Extra information for, and about allocation.
* Used for variable-size objects allocations. (ex.: for strings).
*/
class AllocationExtras {
public:
AllocationExtras(v_int32 pExtraWanted)
: extraWanted(pExtraWanted)
: extraWanted(pExtraWanted)
{}
const v_int32 extraWanted;
void* extraPtr;
v_int32 baseSize;
};
/**
* Allocator for shared objects.
* Used to allocate object and shared_ptr's control block in the same memory entry.
* @tparam T - type of the object to allocate.
*/
template<class T>
class SharedObjectAllocator {
public:
@ -160,7 +192,12 @@ public:
}
};
/**
* Allocator for shared objects. Allocates objects on the pool provided.
* @tparam T - type of object to allocate.
* @tparam P - type of memory pool to allocate object on.
*/
template<class T, class P>
class CustomPoolSharedObjectAllocator {
public:
@ -203,7 +240,7 @@ template <typename T, typename U>
inline bool operator != (const SharedObjectAllocator<T>& a, const SharedObjectAllocator<U>& b) {
return !(a == b);
}
template<typename T, typename ... Args>
static std::shared_ptr<T> allocateSharedWithExtras(AllocationExtras& extras, Args... args){
typedef SharedObjectAllocator<T> _Allocator;

View File

@ -30,6 +30,12 @@
namespace oatpp { namespace base { namespace memory {
/**
* Macro to declare object pool class which uses &id:oatpp::base::memory::PoolSharedObjectAllocator; to allocate objects.
* @param NAME - name of the memory pool.
* @param TYPE - type of the object.
* @param CHUNK_SIZE - chunk size for &id:oatpp::base::memory::MemoryPool;.
*/
#define SHARED_OBJECT_POOL(NAME, TYPE, CHUNK_SIZE) \
class NAME { \
public: \
@ -54,7 +60,12 @@ public: \
\
};
/**
* Macro to declare object pool class which uses &id:oatpp::base::memory::ThreadLocalPoolSharedObjectAllocator; to allocate objects.
* @param NAME - name of the memory pool.
* @param TYPE - type of the object.
* @param CHUNK_SIZE - chunk size for &id:oatpp::base::memory::MemoryPool;.
*/
#define SHARED_OBJECT_POOL_THREAD_LOCAL(NAME, TYPE, CHUNK_SIZE) \
class NAME { \
public: \
@ -78,7 +89,15 @@ public: \
} \
\
};
/**
* Macro to declare: &id:oatpp::base::memory::MemoryPool; for object, plus class-specific operators
* `static void* operator new(std::size_t sz)`, `static void operator delete(void* ptr, std::size_t sz)`,
* `static void* operator new(std::size_t sz, void* entry)`, `static void operator delete(void* ptr, void* entry)`.
* @param NAME - name of the memory pool.
* @param TYPE - type of the object.
* @param CHUNK_SIZE - chunk size for &id:oatpp::base::memory::MemoryPool;.
*/
#define OBJECT_POOL(POOL_NAME, TYPE, CHUNK_SIZE) \
class POOL_NAME { \
public: \
@ -115,6 +134,14 @@ static void* operator new(std::size_t sz, void* entry) { \
static void operator delete(void* ptr, void* entry) { \
}
/**
* Macro to declare: `thread_local` &id:oatpp::base::memory::MemoryPool; for object, plus class-specific operators
* `static void* operator new(std::size_t sz)`, `static void operator delete(void* ptr, std::size_t sz)`,
* `static void* operator new(std::size_t sz, void* entry)`, `static void operator delete(void* ptr, void* entry)`.
* @param NAME - name of the memory pool.
* @param TYPE - type of the object.
* @param CHUNK_SIZE - chunk size for &id:oatpp::base::memory::MemoryPool;.
*/
#define OBJECT_POOL_THREAD_LOCAL(POOL_NAME, TYPE, CHUNK_SIZE) \
class POOL_NAME { \
public: \

View File

@ -37,16 +37,27 @@
namespace oatpp { namespace data { namespace mapping { namespace type {
namespace __class {
/**
* AbstractObject class.
*/
class AbstractObject {
public:
static const char* const CLASS_NAME;
};
/**
* Template for Object class of type T.
* @tparam T - object type.
*/
template<class T>
class Object : public AbstractObject {
public:
/**
* Get type describing this class.
* @return - &id:oatpp::data::mapping::type::Type;
*/
static Type* getType(){
static Type* type = static_cast<Type*>(T::Z__CLASS_GET_TYPE());
return type;
@ -55,7 +66,11 @@ namespace __class {
};
}
/**
* Base class for all DTO objects.
* For more info about Data Transfer Object (DTO) see [Data Transfer Object (DTO)](https://oatpp.io/docs/components/dto/).
*/
class Object : public oatpp::base::Countable {
public:
typedef oatpp::data::mapping::type::String String;

View File

@ -31,7 +31,9 @@
namespace oatpp { namespace data { namespace share {
/**
* MemoryLabel represent a part of the whole memory buffer refered by handle
* MemoryLabel represent a part of the whole memory buffer refered by handle.
* Advantage of MemoryLabel use is that you may just "label" some data instead of allocating buffer for it's copy.
* You may allocate separate buffer for data copy later once you need it.
*/
class MemoryLabel {
protected:
@ -39,32 +41,66 @@ protected:
p_char8 m_data;
v_int32 m_size;
public:
/**
* Default constructor. Null MemoryLabel.
*/
MemoryLabel()
: m_memoryHandle(nullptr)
, m_data(nullptr)
, m_size(0)
{}
/**
* Constructor.
* @param memHandle - memory handle. `std::shared_ptr` to buffer pointed by a memory label.
* @param data - pointer to data.
* @param size - size of the data in bytes.
*/
MemoryLabel(const std::shared_ptr<base::StrBuffer>& memHandle, p_char8 data, v_int32 size);
/**
* Get pointer to labeled data.
* @return - pointer to data.
*/
p_char8 getData() const {
return m_data;
}
/**
* Get data size.
* @return - size of the data.
*/
v_int32 getSize() const {
return m_size;
}
/**
* Get memory handle which this memory label holds.
* @return - `std::shared_ptr` to &id:oatpp::base::StrBuffer;.
*/
std::shared_ptr<base::StrBuffer> getMemoryHandle() const {
return m_memoryHandle;
}
/**
* Check if labeled data equals to data specified.
* Data is compared using &id:oatpp::base::StrBuffer::equals;.
* @param data - data to compare with labeled data.
* @return - `true` if equals.
*/
bool equals(const char* data) const {
v_int32 size = (v_int32) std::strlen(data);
return m_size == size && base::StrBuffer::equals(m_data, data, m_size);
}
/**
* Check if labeled data equals to data specified.
* Data is compared using &id:oatpp::base::StrBuffer::equals;.
* @param data - data to compare with labeled data.
* @param size - data size.
* @return - `true` if equals.
*/
bool equals(const void* data, v_int32 size) const {
return m_size == size && base::StrBuffer::equals(m_data, data, m_size);
}

View File

@ -34,7 +34,18 @@ const data::v_io_size ChunkedBuffer::CHUNK_ENTRY_SIZE_INDEX_SHIFT = 11;
const data::v_io_size ChunkedBuffer::CHUNK_ENTRY_SIZE =
(1 << ChunkedBuffer::CHUNK_ENTRY_SIZE_INDEX_SHIFT);
const data::v_io_size ChunkedBuffer::CHUNK_CHUNK_SIZE = 32;
ChunkedBuffer::ChunkedBuffer()
: m_size(0)
, m_chunkPos(0)
, m_firstEntry(nullptr)
, m_lastEntry(nullptr)
{}
ChunkedBuffer::~ChunkedBuffer() {
clear();
}
ChunkedBuffer::ChunkEntry* ChunkedBuffer::obtainNewEntry(){
auto result = new ChunkEntry(getSegemntPool().obtain(), nullptr);
if(m_firstEntry == nullptr) {
@ -187,19 +198,22 @@ oatpp::String ChunkedBuffer::getSubstring(data::v_io_size pos,
readSubstring(str->getData(), pos, count);
return str;
}
// TODO - refactor this.
bool ChunkedBuffer::flushToStream(const std::shared_ptr<OutputStream>& stream){
data::v_io_size pos = m_size;
auto curr = m_firstEntry;
while (pos > 0) {
if(pos > CHUNK_ENTRY_SIZE) {
auto res = stream->write(curr->chunk, CHUNK_ENTRY_SIZE);
// TODO handle I/O errors.
if(res != CHUNK_ENTRY_SIZE) {
return false;
}
pos -= res;
} else {
auto res = stream->write(curr->chunk, pos);
// TODO handle I/O errors.
if(res != pos) {
return false;
}

View File

@ -31,7 +31,10 @@
#include "oatpp/core/async/Coroutine.hpp"
namespace oatpp { namespace data{ namespace stream {
/**
* Buffer wich can grow by chunks and implements &id:oatpp::data::stream::OutputStream; interface.
*/
class ChunkedBuffer : public oatpp::base::Countable, public OutputStream, public std::enable_shared_from_this<ChunkedBuffer> {
public:
static const char* ERROR_ASYNC_FAILED_TO_WRITE_ALL_DATA;
@ -126,54 +129,102 @@ private:
public:
ChunkedBuffer()
: m_size(0)
, m_chunkPos(0)
, m_firstEntry(nullptr)
, m_lastEntry(nullptr)
{}
~ChunkedBuffer() {
clear();
}
/**
* Constructor.
*/
ChunkedBuffer();
/**
* Virtual Destructor.
*/
~ChunkedBuffer();
public:
/**
* Deleted copy constructor.
*/
ChunkedBuffer(const ChunkedBuffer&) = delete;
ChunkedBuffer& operator=(const ChunkedBuffer&) = delete;
public:
/**
* Create shared ChunkedBuffer.
* @return `std::shared_ptr` to ChunkedBuffer.
*/
static std::shared_ptr<ChunkedBuffer> createShared(){
return Shared_ChunkedBuffer_Pool::allocateShared();
}
/**
* Write data to ChunkedBuffer. Implementation of &id:oatpp::data::stream::OutputStream::write; method.
* @param data - data to write.
* @param count - size of data in bytes.
* @return - actual number of bytes written.
*/
data::v_io_size write(const void *data, data::v_io_size count) override;
data::v_io_size readSubstring(void *buffer,
data::v_io_size pos,
data::v_io_size count);
/**
* Read part of ChunkedBuffer to buffer.
* @param buffer - buffer to write data to.
* @param pos - starting position in ChunkedBuffer to read data from.
* @param count - number of bytes to read.
* @return - actual number of bytes read from ChunkedBuffer and written to buffer.
*/
data::v_io_size readSubstring(void *buffer, data::v_io_size pos, data::v_io_size count);
/**
* return substring of the data written to stream; NOT NULL
* Create &id:oatpp::String; from part of ChunkedBuffer.
*/
/**
* Create &id:oatpp::String; from part of ChunkedBuffer.
* @param pos - starting position in ChunkedBuffer.
* @param count - size of bytes to write to substring.
* @return - &id:oatpp::String;
*/
oatpp::String getSubstring(data::v_io_size pos, data::v_io_size count);
/**
* return data written to stream as oatpp::String; NOT NULL
* Create &id:oatpp::String; from all data in ChunkedBuffer.
* @return - &id:oatpp::String;
*/
oatpp::String toString() {
return getSubstring(0, m_size);
}
/**
* Write all data from ChunkedBuffer to &id:oatpp::data::stream::OutputStream;.
* ChunkedBuffer will not be cleared during this call!
* @param stream - &id:oatpp::data::stream::OutputStream; stream to write all data to.
* @return - `true` if no errors occured. **will be refactored to return actual amount of bytes flushed**.
*/
bool flushToStream(const std::shared_ptr<OutputStream>& stream);
/**
* Write all data from ChunkedBuffer to &id:oatpp::data::stream::OutputStream; in asynchronous manner.
* @param parentCoroutine - caller coroutine. &id:oatpp::async::AbstractCoroutine;.
* @param actionOnFinish - action to do once finished. &id:oatpp::async::Action;.
* @param stream - &id:oatpp::data::stream::OutputStream; stream to write all data to.
* @return - &id:oatpp::async::Action;.
*/
oatpp::async::Action flushToStreamAsync(oatpp::async::AbstractCoroutine* parentCoroutine,
const oatpp::async::Action& actionOnFinish,
const std::shared_ptr<OutputStream>& stream);
std::shared_ptr<Chunks> getChunks();
/**
* Get number of bytes written to ChunkedBuffer.
* @return - number of bytes written to ChunkedBuffer.
*/
data::v_io_size getSize();
/**
* Clear data in ChunkedBuffer.
*/
void clear();
};

View File

@ -28,14 +28,31 @@
#include "./Stream.hpp"
namespace oatpp { namespace data{ namespace stream {
/**
* Stream writer delegate which can write data to stream provided.
*/
class WriterDelegate {
public:
/**
* Write data to provided stream.
* @param stream - stream to write data to.
* @return - actual number of bytes written to stream. &id:oatpp::data::v_io_size;.
*/
virtual data::v_io_size writeToStream(const std::shared_ptr<OutputStream>& stream) = 0;
};
/**
* Stream reader delegate which can read data from stream provided.
*/
class ReaderDelegate {
public:
/**
* Read data from provided stream.
* @param stream - stream to read data from.
* @return - actual number of bytes read. &id:oatpp::data::v_io_size;.
*/
virtual data::v_io_size readFromStream(const std::shared_ptr<InputStream>& stream) = 0;
};

View File

@ -22,6 +22,10 @@
*
***************************************************************************/
/**[info]
* This file contains source code for basic helper macros used for code-generator.
*/
#ifndef oatpp_macro_ForEach_hpp
#define oatpp_macro_ForEach_hpp

View File

@ -22,6 +22,19 @@
*
***************************************************************************/
/**[info]
* This file contains source code for `OATPP_CODEGEN_BEGIN(NAME)` and `OATPP_CODEGEN_END(NAME)` macros. <br>
* <br>
*
* More about use of `OATPP_CODEGEN_BEGIN` and `OATPP_CODEGEN_BEGIN` see: <br>
* <ul>
* <li>[ApiController component](https://oatpp.io/docs/components/api-controller/)</li>
* <li>[ApiClient component](https://oatpp.io/docs/components/api-client/)</li>
* <li>[Data Transfer Object(DTO) component](https://oatpp.io/docs/components/dto/)</li>
* </ul>
*
*/
#ifndef codegen_hpp
#define codegen_hpp

View File

@ -22,6 +22,18 @@
*
***************************************************************************/
/**[info]
* This file contains source code for `OATPP_CREATE_COMPONENT` and `OATPP_COMPONENT` macros which are part of
* oatpp Dependency Injection (DI) framework. <br>
* <br>
* For usage examples see example-projects:
* <ul>
* <li>[CRUD - example](https://github.com/oatpp/example-crud)</li>
* <li>[HLS Media Stream - example](https://github.com/oatpp/example-hls-media-stream)</li>
* <li>[Async API - example](https://github.com/oatpp/example-async-api)</li>
* </ul>
*/
#ifndef oatpp_macro_component_hpp
#define oatpp_macro_component_hpp
@ -62,10 +74,21 @@ OATPP_MACRO_COMPONENT_(X, TYPE, NAME, LIST)
#define OATPP_MACRO_COMPONENT___(TYPE, NAME, LIST) \
OATPP_MACRO_COMPONENT__(OATPP_MACRO_HAS_ARGS LIST, TYPE, NAME, LIST)
/**
* Inject component. Create variable of type=TYPE and name=NAME and assign registered component to it.
* @param TYPE - type of the component.
* @param NAME - name of the variable.
* @param QUALIFIER_NAME - qualifier name is needed if there are multiple components registered of the same type.
* If there is one component registered only then TYPE info is enought to search for component.
*/
#define OATPP_COMPONENT(TYPE, NAME, ...) \
OATPP_MACRO_COMPONENT___(TYPE, NAME, (__VA_ARGS__))
/**
* Create component that then can be injected in other application classes.
* @param TYPE - type of the component.
* @param NAME - name of the component field.
*/
#define OATPP_CREATE_COMPONENT(TYPE, NAME) \
oatpp::base::Environment::Component<TYPE> NAME = oatpp::base::Environment::Component<TYPE>

View File

@ -43,27 +43,70 @@ public:
static const char* const ERROR_NAME_EXPECTED;
public:
/**
* Class to label parsing data.
*/
class Label {
private:
Caret* m_caret;
v_int32 m_start;
v_int32 m_end;
public:
/**
* Constructor.
* @param caret.
*/
Label(Caret* caret);
/**
* Set current caret position as a starting point for label.
*/
void start();
/**
* Fix current caret position as an end point for label.
*/
void end();
/**
* Get pointer to a labeled data.
* @return
*/
p_char8 getData();
/**
* Get size of labeled data.
* @return
*/
v_int32 getSize();
/**
* Create &id:oatpp::String; from labeled data.
* @param saveAsOwnData - `true` - allocate new memory block for string. `false` - string will point to the same data as label.
* @return - &id:oatpp::String;.
*/
oatpp::String toString(bool saveAsOwnData);
/**
* Same as`toString(true).`
* @return - &id:oatpp::String;.
*/
oatpp::String toString();
/**
* Create `std::string` from labeled data.
* @return - `std::string`.
*/
std::string std_str();
explicit operator bool() const;
};
/**
* Caret state saver guard.
*/
class StateSaveGuard {
private:
Caret& m_caret;
@ -72,11 +115,33 @@ public:
v_int32 m_savedErrorCode;
public:
/**
* Constructor.
* @param caret.
*/
StateSaveGuard(Caret& caret);
/**
* Destructor. Restore saved state.
*/
~StateSaveGuard();
/**
* Get caret saved position.
* @return
*/
v_int32 getSavedPosition();
/**
* Get caret saved error message.
* @return
*/
const char* getSavedErrorMessage();
/**
* Get caret saved error code.
* @return
*/
v_int32 getSavedErrorCode();
};

View File

@ -34,6 +34,13 @@ const v_int32 Server::STATUS_RUNNING = 1;
const v_int32 Server::STATUS_STOPPING = 2;
const v_int32 Server::STATUS_DONE = 3;
Server::Server(const std::shared_ptr<ServerConnectionProvider>& connectionProvider,
const std::shared_ptr<ConnectionHandler>& connectionHandler)
: m_status(STATUS_CREATED)
, m_connectionProvider(connectionProvider)
, m_connectionHandler(connectionHandler)
{}
void Server::mainLoop(){
setStatus(STATUS_CREATED, STATUS_RUNNING);

View File

@ -40,6 +40,10 @@
namespace oatpp { namespace network { namespace server {
/**
* Server calls &id:oatpp::network::ConnectionProvider::getConnection; in the loop and passes obtained Connection
* to &id:oatpp::network::server::ConnectionHandler;.
*/
class Server : public base::Countable, public concurrency::Runnable{
private:
@ -58,32 +62,70 @@ private:
std::shared_ptr<ConnectionHandler> m_connectionHandler;
public:
Server(
const std::shared_ptr<ServerConnectionProvider>& connectionProvider,
const std::shared_ptr<ConnectionHandler>& connectionHandler
)
: m_status(STATUS_CREATED)
, m_connectionProvider(connectionProvider)
, m_connectionHandler(connectionHandler)
{}
/**
* Constructor.
* @param connectionProvider - &id:oatpp::network::ConnectionProvider;.
* @param connectionHandler - &id:oatpp::network::server::ConnectionHandler;.
*/
Server(const std::shared_ptr<ServerConnectionProvider>& connectionProvider,
const std::shared_ptr<ConnectionHandler>& connectionHandler);
public:
/**
* Status constant.
*/
static const v_int32 STATUS_CREATED;
/**
* Status constant.
*/
static const v_int32 STATUS_RUNNING;
/**
* Status constant.
*/
static const v_int32 STATUS_STOPPING;
/**
* Status constant.
*/
static const v_int32 STATUS_DONE;
/**
* Create shared Server.
* @param connectionProvider - &id:oatpp::network::ConnectionProvider;.
* @param connectionHandler - &id:oatpp::network::server::ConnectionHandler;.
* @return - `std::shared_ptr` to Server.
*/
static std::shared_ptr<Server> createShared(const std::shared_ptr<ServerConnectionProvider>& connectionProvider,
const std::shared_ptr<ConnectionHandler>& connectionHandler){
const std::shared_ptr<ConnectionHandler>& connectionHandler){
return std::make_shared<Server>(connectionProvider, connectionHandler);
}
/**
* Call &id:oatpp::network::ConnectionProvider::getConnection; in the loop and passes obtained Connection
* to &id:oatpp::network::server::ConnectionHandler;.
*/
void run() override;
/**
* Break server loop.
* Note: thread can still be blocked on the &l:Server::run (); call as it may be waiting for ConnectionProvider to provide connection.
*/
void stop();
/**
* Get server status.
* @return - one of:<br>
* <ul>
* <li>&l:Server::STATUS_CREATED;</li>
* <li>&l:Server::STATUS_RUNNING;</li>
* <li>&l:Server::STATUS_STOPPING;</li>
* <li>&l:Server::STATUS_DONE;</li>
* </ul>
*/
v_int32 getStatus();
};

View File

@ -31,7 +31,10 @@
#include "oatpp/core/Types.hpp"
namespace oatpp { namespace network { namespace server {
/**
* Simple provider of TCP connections.
*/
class SimpleTCPConnectionProvider : public base::Countable, public ServerConnectionProvider {
private:
v_word16 m_port;
@ -41,22 +44,52 @@ private:
private:
oatpp::data::v_io_handle instantiateServer();
public:
/**
* Constructor.
* @param port - port to listen for incoming connections.
* @param nonBlocking - set `true` to provide non-blocking &id:oatpp::data::stream::IOStream; for connection.
* `false` for blocking &id:oatpp::data::stream::IOStream;. Default `false`.
*/
SimpleTCPConnectionProvider(v_word16 port, bool nonBlocking = false);
public:
/**
* Create shared SimpleTCPConnectionProvider.
* @param port - port to listen for incoming connections.
* @param nonBlocking - set `true` to provide non-blocking &id:oatpp::data::stream::IOStream; for connection.
* `false` for blocking &id:oatpp::data::stream::IOStream;. Default `false`.
*/
static std::shared_ptr<SimpleTCPConnectionProvider> createShared(v_word16 port, bool nonBlocking = false){
return std::make_shared<SimpleTCPConnectionProvider>(port, nonBlocking);
}
/**
* Virtual destructor.
*/
~SimpleTCPConnectionProvider();
/**
* Close accept-socket.
*/
void close() override;
/**
* Get incoming connection.
* @return &id:oatpp::data::stream::IOStream;.
*/
std::shared_ptr<IOStream> getConnection() override;
/**
* No need to implement this.<br>
* For Asynchronous IO in oatpp it is considered to be a good practice
* to accept connections in a seperate thread with the blocking accept()
* and then process connections in Asynchronous manner with non-blocking read/write.
* <br>
* *It may be implemented later*
*/
Action getConnectionAsync(oatpp::async::AbstractCoroutine* parentCoroutine,
AsyncCallback callback) override {
/**
/*
* No need to implement this.
* For Asynchronous IO in oatpp it is considered to be a good practice
* to accept connections in a seperate thread with the blocking accept()
@ -66,7 +99,11 @@ public:
*/
throw std::runtime_error("[oatpp::network::server::SimpleTCPConnectionProvider::getConnectionAsync()]: Error. Not implemented.");
}
/**
* Get port.
* @return
*/
v_word16 getPort(){
return m_port;
}