ConnectionProvider.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/network/ConnectionProvider.hpp"

ConnectionProvider

Abstract ConnectionProvider.
Basically it returns whatever stream (oatpp::data::stream::IOStream).
User of ConnectionProvider should care about IOStream only. All other properties are optional.

namespace oatpp { namespace network { 
  class ConnectionProvider {}
}}

Typedefs

Type Name Summary
oatpp::data::stream::IOStream IOStream Convenience typedef for oatpp::data::stream::IOStream.
oatpp::async::Action Action Convenience typedef for oatpp::async::Action.

Fields

Type Name Summary
const char* const PROPERTY_HOST Predefined property key for HOST.
const char* const PROPERTY_PORT Predefined property key for PORT.

Methods

Return Type Name Summary
[none] ~ConnectionProvider Virtual default destructor.
std::shared_ptr<IOStream> getConnection Implement this method.
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync Implement this method.
void invalidateConnection Invalidate connection that was previously created by this provider.
void close Should close all handles here.
const std::unordered_map<oatpp::data::share::StringKeyLabelCI, oatpp::data::share::StringKeyLabel>& getProperties Some optional properties that user might want to know.
oatpp::data::share::StringKeyLabel getProperty Get optional property

ConnectionProvider::IOStream

Convenience typedef for oatpp::data::stream::IOStream.

typedef oatpp::data::stream::IOStream IOStream

ConnectionProvider::Action

Convenience typedef for oatpp::async::Action.

typedef oatpp::async::Action Action

ConnectionProvider::PROPERTY_HOST

Predefined property key for HOST.

static const char* const PROPERTY_HOST

ConnectionProvider::PROPERTY_PORT

Predefined property key for PORT.

static const char* const PROPERTY_PORT

ConnectionProvider::~ConnectionProvider

Virtual default destructor.

virtual ~ConnectionProvider() = default

ConnectionProvider::getConnection

Implement this method. Get IOStream representing connection to resource.

virtual std::shared_ptr<IOStream> getConnection() = 0

ConnectionProvider::getConnectionAsync

Implement this method. Obtain IOStream representing connection to resource.

  • @return - oatpp::async::CoroutineStarterForResult.

virtual oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() = 0

ConnectionProvider::invalidateConnection

Invalidate connection that was previously created by this provider. Ex.: if provider is pool based - you can signal that this connection should not be reused anymore.

  • @param connection

virtual void invalidateConnection(const std::shared_ptr<IOStream>& connection) = 0

ConnectionProvider::close

Should close all handles here.

virtual void close() = 0

ConnectionProvider::getProperties

Some optional properties that user might want to know.
Note: All properties are optional and user should not rely on this.

const std::unordered_map<oatpp::data::share::StringKeyLabelCI, oatpp::data::share::StringKeyLabel>& getProperties()

ConnectionProvider::getProperty

Get optional property

oatpp::data::share::StringKeyLabel getProperty(const oatpp::String& key)

ServerConnectionProvider

No properties here. It is just a logical division

namespace oatpp { namespace network { 
  class ServerConnectionProvider : public ConnectionProvider {}
}}

ClientConnectionProvider

No properties here. It is just a logical division

namespace oatpp { namespace network { 
  class ClientConnectionProvider : public ConnectionProvider {}
}}