mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
Rework stdext classes
Implement new classes: * stdext::any => ligher replacement for boost::any * stdext::packed_any => like any but optimized to use less memory * stdext::shared_object => ligher replacement for std::shared_ptr * stdext::shared_object_ptr => replacement for boost::intrusive_ptr * stdext::fast_storage => for storing dynamic data * stdext::packed_storage => same but with less memory * stdext::packed_vector => std::vector with less memory Compiling should be a little faster now because global boost including is not needed anymore
This commit is contained in:
@@ -69,7 +69,7 @@ void Connection::connect(const std::string& host, uint16 port, const std::functi
|
||||
|
||||
auto self = asConnection();
|
||||
m_resolver.async_resolve(query, [=](const boost::system::error_code& error, asio::ip::tcp::resolver::iterator endpointIterator) {
|
||||
if(self->is_unique_ref())
|
||||
if(self.is_unique())
|
||||
return;
|
||||
m_readTimer.cancel();
|
||||
|
||||
@@ -130,7 +130,7 @@ void Connection::write(uint8* buffer, uint16 size)
|
||||
|
||||
// wait 1 ms to do the real send
|
||||
m_sendEvent = g_dispatcher.scheduleEvent([=] {
|
||||
if(self->is_unique_ref())
|
||||
if(self.is_unique())
|
||||
return;
|
||||
//m_writeTimer.cancel();
|
||||
|
||||
|
@@ -62,7 +62,7 @@ public:
|
||||
bool isConnecting() { return m_connecting; }
|
||||
bool isConnected() { return m_connected; }
|
||||
|
||||
ConnectionPtr asConnection() { return self_cast<Connection>(); }
|
||||
ConnectionPtr asConnection() { return static_self_cast<Connection>(); }
|
||||
protected:
|
||||
void onConnect(const boost::system::error_code& error);
|
||||
void onWrite(const boost::system::error_code& error, size_t);
|
||||
|
@@ -34,10 +34,10 @@ class Connection;
|
||||
class Protocol;
|
||||
class Server;
|
||||
|
||||
typedef boost::intrusive_ptr<InputMessage> InputMessagePtr;
|
||||
typedef boost::intrusive_ptr<OutputMessage> OutputMessagePtr;
|
||||
typedef boost::intrusive_ptr<Connection> ConnectionPtr;
|
||||
typedef boost::intrusive_ptr<Protocol> ProtocolPtr;
|
||||
typedef boost::intrusive_ptr<Server> ServerPtr;
|
||||
typedef stdext::shared_object_ptr<InputMessage> InputMessagePtr;
|
||||
typedef stdext::shared_object_ptr<OutputMessage> OutputMessagePtr;
|
||||
typedef stdext::shared_object_ptr<Connection> ConnectionPtr;
|
||||
typedef stdext::shared_object_ptr<Protocol> ProtocolPtr;
|
||||
typedef stdext::shared_object_ptr<Server> ServerPtr;
|
||||
|
||||
#endif
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
virtual void send(const OutputMessagePtr& outputMessage);
|
||||
void recv();
|
||||
|
||||
ProtocolPtr asProtocol() { return self_cast<Protocol>(); }
|
||||
ProtocolPtr asProtocol() { return static_self_cast<Protocol>(); }
|
||||
|
||||
protected:
|
||||
virtual void onConnect();
|
||||
|
Reference in New Issue
Block a user