added compile time check to cnm for the validity of the supplied policy
This commit is contained in:
parent
66c758f13a
commit
f6fb183649
@ -6,6 +6,7 @@
|
|||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "chat_messages.hpp"
|
#include "chat_messages.hpp"
|
||||||
|
#include "check_policy.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -19,21 +20,23 @@ namespace chat
|
|||||||
struct receive_policy_stdout
|
struct receive_policy_stdout
|
||||||
{
|
{
|
||||||
static void message_do_what(chat_message msg)
|
static void message_do_what(chat_message msg)
|
||||||
{
|
{ std::cout << msg << '\n'; }
|
||||||
std::cout << msg << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: handshake_policy
|
// TODO: handshake_policy
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* most ezt így üres template paraméterekkel kell példányosítani,
|
/* most ezt így üres template paraméterekkel kell példányosítani,
|
||||||
|
* már amennyiben nem akarunk valami custom receive policyt megadni,
|
||||||
* pl.: client_network_manager<> cnm;
|
* pl.: client_network_manager<> cnm;
|
||||||
* meg lehet oldani úgy, hogy ne kelljen? usingot/typedefet nem enged saját magára */
|
* meg lehet oldani úgy, hogy ne kelljen? usingot/typedefet nem enged saját magára */
|
||||||
template <class receive_policy = receive_policy_stdout>
|
template <class receive_policy = receive_policy_stdout>
|
||||||
class client_network_manager
|
class client_network_manager
|
||||||
{
|
{
|
||||||
// TODO: add static assert to check receive_policy
|
/* compile-time check for whether receive_policy is valid or not */
|
||||||
|
static_assert(is_valid_policy<receive_policy>::value,
|
||||||
|
"Receive policy does not supply neccessary methods!");
|
||||||
|
|
||||||
/* members */
|
/* members */
|
||||||
private:
|
private:
|
||||||
asio::io_service& _ios;
|
asio::io_service& _ios;
|
||||||
|
Loading…
Reference in New Issue
Block a user