提交 e0c513c5 编写于 作者: Y youngwolf 提交者: youngowlf

A trivial change.

上级 3a65f1a4
...@@ -59,9 +59,9 @@ public: ...@@ -59,9 +59,9 @@ public:
inner_packer(global_packer); inner_packer(global_packer);
#if 2 == PACKER_UNPACKER_TYPE #if 2 == PACKER_UNPACKER_TYPE
dynamic_cast<ST_ASIO_DEFAULT_UNPACKER*>(&*inner_unpacker())->fixed_length(1024); boost::dynamic_pointer_cast<ST_ASIO_DEFAULT_UNPACKER>(inner_unpacker())->fixed_length(1024);
#elif 3 == PACKER_UNPACKER_TYPE #elif 3 == PACKER_UNPACKER_TYPE
dynamic_cast<ST_ASIO_DEFAULT_UNPACKER*>(&*inner_unpacker())->prefix_suffix("begin", "end"); boost::dynamic_pointer_cast<ST_ASIO_DEFAULT_UNPACKER>(inner_unpacker())->prefix_suffix("begin", "end");
#endif #endif
} }
......
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
#define ST_ASIO_WRAPPER_EXT_H_ #define ST_ASIO_WRAPPER_EXT_H_
#include <string> #include <string>
#include <sstream>
#include <boost/array.hpp>
#include <boost/container/set.hpp>
#include "../st_asio_wrapper_base.h" #include "../st_asio_wrapper_base.h"
......
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
#ifndef ST_ASIO_WRAPPER_NET_H_ #ifndef ST_ASIO_WRAPPER_NET_H_
#define ST_ASIO_WRAPPER_NET_H_ #define ST_ASIO_WRAPPER_NET_H_
#include "st_asio_wrapper_packer.h"
#include "st_asio_wrapper_unpacker.h"
#include "../st_asio_wrapper_client.h" #include "../st_asio_wrapper_client.h"
#include "../st_asio_wrapper_tcp_client.h" #include "../st_asio_wrapper_tcp_client.h"
#include "../st_asio_wrapper_udp_client.h" #include "../st_asio_wrapper_udp_client.h"
#include "../st_asio_wrapper_server.h" #include "../st_asio_wrapper_server.h"
#include "st_asio_wrapper_packer.h"
#include "st_asio_wrapper_unpacker.h"
#ifndef ST_ASIO_DEFAULT_PACKER #ifndef ST_ASIO_DEFAULT_PACKER
#define ST_ASIO_DEFAULT_PACKER packer #define ST_ASIO_DEFAULT_PACKER packer
#endif #endif
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#ifndef ST_ASIO_WRAPPER_UNPACKER_H_ #ifndef ST_ASIO_WRAPPER_UNPACKER_H_
#define ST_ASIO_WRAPPER_UNPACKER_H_ #define ST_ASIO_WRAPPER_UNPACKER_H_
#include <boost/array.hpp>
#include "st_asio_wrapper_ext.h" #include "st_asio_wrapper_ext.h"
#ifdef ST_ASIO_HUGE_MSG #ifdef ST_ASIO_HUGE_MSG
......
...@@ -117,6 +117,14 @@ namespace st_asio_wrapper ...@@ -117,6 +117,14 @@ namespace st_asio_wrapper
}; };
//packer concept //packer concept
//just provide msg_type definition, you should not call any functions of it, and send msgs directly
template<typename MsgType>
class dummy_packer : public i_packer<MsgType>
{
public:
virtual bool pack_msg(msg_type& msg, const char* const pstr[], const size_t len[], size_t num, bool native = false) {assert(false); return msg_type();}
};
//unpacker concept //unpacker concept
template<typename MsgType> template<typename MsgType>
class i_unpacker class i_unpacker
......
...@@ -9,9 +9,7 @@ ...@@ -9,9 +9,7 @@
//#define ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER //#define ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER
//#define ST_ASIO_WANT_MSG_SEND_NOTIFY //#define ST_ASIO_WANT_MSG_SEND_NOTIFY
#define ST_ASIO_MSG_BUFFER_SIZE 65536 #define ST_ASIO_MSG_BUFFER_SIZE 65536
#define ST_ASIO_DEFAULT_UNPACKER stream_unpacker //non-protocol
//stream unpacker (non-protocol)
#define ST_ASIO_DEFAULT_UNPACKER stream_unpacker
//configuration //configuration
#include "../include/ext/st_asio_wrapper_net.h" #include "../include/ext/st_asio_wrapper_net.h"
......
...@@ -6,9 +6,7 @@ ...@@ -6,9 +6,7 @@
#define ST_ASIO_REUSE_OBJECT //use objects pool #define ST_ASIO_REUSE_OBJECT //use objects pool
//#define ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER //#define ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER
#define ST_ASIO_MSG_BUFFER_SIZE 65536 #define ST_ASIO_MSG_BUFFER_SIZE 65536
#define ST_ASIO_DEFAULT_UNPACKER stream_unpacker //non-protocol
//stream unpacker (non-protocol)
#define ST_ASIO_DEFAULT_UNPACKER stream_unpacker
//configuration //configuration
#include "../include/ext/st_asio_wrapper_net.h" #include "../include/ext/st_asio_wrapper_net.h"
......
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
#define ST_ASIO_WRAPPER_EXT_H_ #define ST_ASIO_WRAPPER_EXT_H_
#include <string> #include <string>
#include <sstream>
#include <boost/array.hpp>
#include <boost/container/set.hpp>
#include "../st_asio_wrapper_base.h" #include "../st_asio_wrapper_base.h"
......
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
#ifndef ST_ASIO_WRAPPER_NET_H_ #ifndef ST_ASIO_WRAPPER_NET_H_
#define ST_ASIO_WRAPPER_NET_H_ #define ST_ASIO_WRAPPER_NET_H_
#include "st_asio_wrapper_packer.h"
#include "st_asio_wrapper_unpacker.h"
#include "../st_asio_wrapper_client.h" #include "../st_asio_wrapper_client.h"
#include "../st_asio_wrapper_tcp_client.h" #include "../st_asio_wrapper_tcp_client.h"
#include "../st_asio_wrapper_udp_client.h" #include "../st_asio_wrapper_udp_client.h"
#include "../st_asio_wrapper_server.h" #include "../st_asio_wrapper_server.h"
#include "st_asio_wrapper_packer.h"
#include "st_asio_wrapper_unpacker.h"
#ifndef ST_ASIO_DEFAULT_PACKER #ifndef ST_ASIO_DEFAULT_PACKER
#define ST_ASIO_DEFAULT_PACKER packer #define ST_ASIO_DEFAULT_PACKER packer
#endif #endif
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#ifndef ST_ASIO_WRAPPER_UNPACKER_H_ #ifndef ST_ASIO_WRAPPER_UNPACKER_H_
#define ST_ASIO_WRAPPER_UNPACKER_H_ #define ST_ASIO_WRAPPER_UNPACKER_H_
#include <boost/array.hpp>
#include "st_asio_wrapper_ext.h" #include "st_asio_wrapper_ext.h"
#ifdef ST_ASIO_HUGE_MSG #ifdef ST_ASIO_HUGE_MSG
......
...@@ -115,6 +115,14 @@ namespace st_asio_wrapper ...@@ -115,6 +115,14 @@ namespace st_asio_wrapper
}; };
//packer concept //packer concept
//just provide msg_type definition, you should not call any functions of it, and send msgs directly
template<typename MsgType>
class dummy_packer : public i_packer<MsgType>
{
public:
virtual msg_type pack_msg(const char* const pstr[], const size_t len[], size_t num, bool native = false) {assert(false); return msg_type();}
};
//unpacker concept //unpacker concept
template<typename MsgType> template<typename MsgType>
class i_unpacker class i_unpacker
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
//#define ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER //#define ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER
//#define ST_ASIO_WANT_MSG_SEND_NOTIFY //#define ST_ASIO_WANT_MSG_SEND_NOTIFY
#define ST_ASIO_MSG_BUFFER_SIZE 65536 #define ST_ASIO_MSG_BUFFER_SIZE 65536
#define ST_ASIO_DEFAULT_UNPACKER stream_unpacker #define ST_ASIO_DEFAULT_UNPACKER stream_unpacker //non-protocol
//configuration //configuration
#include "../include/ext/st_asio_wrapper_net.h" #include "../include/ext/st_asio_wrapper_net.h"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define ST_ASIO_REUSE_OBJECT //use objects pool #define ST_ASIO_REUSE_OBJECT //use objects pool
//#define ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER //#define ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER
#define ST_ASIO_MSG_BUFFER_SIZE 65536 #define ST_ASIO_MSG_BUFFER_SIZE 65536
#define ST_ASIO_DEFAULT_UNPACKER stream_unpacker #define ST_ASIO_DEFAULT_UNPACKER stream_unpacker //non-protocol
//configuration //configuration
#include "../include/ext/st_asio_wrapper_net.h" #include "../include/ext/st_asio_wrapper_net.h"
......
...@@ -64,10 +64,10 @@ public: ...@@ -64,10 +64,10 @@ public:
test_socket(boost::asio::io_service& io_service_) : st_connector(io_service_), recv_bytes(0), recv_index(0) test_socket(boost::asio::io_service& io_service_) : st_connector(io_service_), recv_bytes(0), recv_index(0)
{ {
#if 2 == PACKER_UNPACKER_TYPE #if 2 == PACKER_UNPACKER_TYPE
dynamic_cast<ST_ASIO_DEFAULT_UNPACKER*>(&*inner_unpacker())->fixed_length(1024); boost::dynamic_pointer_cast<ST_ASIO_DEFAULT_UNPACKER>(inner_unpacker())->fixed_length(1024);
#elif 3 == PACKER_UNPACKER_TYPE #elif 3 == PACKER_UNPACKER_TYPE
dynamic_cast<ST_ASIO_DEFAULT_PACKER*>(&*inner_packer())->prefix_suffix("begin", "end"); boost::dynamic_pointer_cast<ST_ASIO_DEFAULT_PACKER>(inner_packer())->prefix_suffix("begin", "end");
dynamic_cast<ST_ASIO_DEFAULT_UNPACKER*>(&*inner_unpacker())->prefix_suffix("begin", "end"); boost::dynamic_pointer_cast<ST_ASIO_DEFAULT_UNPACKER>(inner_unpacker())->prefix_suffix("begin", "end");
#endif #endif
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册