1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-10-05 19:18:01 +08:00

little optimizations

This commit is contained in:
stefanocasazza 2015-07-31 18:32:33 +02:00
parent 60d9f37186
commit 672dbc2ef4
22 changed files with 112 additions and 111 deletions

View File

@ -72,9 +72,9 @@ public:
// define method VIRTUAL of class UEventFd
virtual int handlerRead() U_DECL_OVERRIDE;
virtual int handlerWrite() U_DECL_OVERRIDE;
virtual int handlerTimeout() U_DECL_OVERRIDE;
virtual void handlerDelete() U_DECL_OVERRIDE;
virtual int handlerWrite() U_DECL_FINAL;
virtual int handlerTimeout() U_DECL_FINAL;
virtual void handlerDelete() U_DECL_FINAL;
static void setNoHeaderForResponse()
{

View File

@ -25,7 +25,7 @@
class URDB;
class U_EXPORT URDBClientImage U_DECL_FINAL : public UClientImage<UTCPSocket> {
class U_EXPORT URDBClientImage : public UClientImage<UTCPSocket> {
public:
URDBClientImage() : UClientImage<UTCPSocket>()
@ -49,7 +49,7 @@ protected:
// define method VIRTUAL of class UEventFd
virtual int handlerRead() U_DECL_OVERRIDE;
virtual int handlerRead() U_DECL_FINAL;
private:
#ifdef U_COMPILER_DELETE_MEMBERS

View File

@ -30,7 +30,7 @@ public:
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
private:
#ifdef U_COMPILER_DELETE_MEMBERS

View File

@ -34,12 +34,12 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
// DEBUG

View File

@ -35,13 +35,13 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerREAD() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerREAD() U_DECL_FINAL;
virtual int handlerRequest() U_DECL_FINAL;
// DEBUG

View File

@ -36,25 +36,25 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerRun() U_DECL_OVERRIDE;
virtual int handlerFork() U_DECL_OVERRIDE;
virtual int handlerStop() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
virtual int handlerRun() U_DECL_FINAL;
virtual int handlerFork() U_DECL_FINAL;
virtual int handlerStop() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerREAD() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerREAD() U_DECL_FINAL;
virtual int handlerRequest() U_DECL_FINAL;
// SigHUP hook
virtual int handlerSigHUP() U_DECL_OVERRIDE;
virtual int handlerSigHUP() U_DECL_FINAL;
// define method VIRTUAL of class UEventFd
virtual int handlerRead() U_DECL_OVERRIDE;
virtual void handlerDelete() U_DECL_OVERRIDE;
virtual int handlerRead() U_DECL_FINAL;
virtual void handlerDelete() U_DECL_FINAL;
// DEBUG

View File

@ -71,7 +71,7 @@ public:
// define method VIRTUAL of class UEventTime
virtual int handlerTime() U_DECL_OVERRIDE;
virtual int handlerTime() U_DECL_FINAL;
// DEBUG
@ -140,18 +140,18 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerFork() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
virtual int handlerFork() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerReset() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
virtual int handlerReset() U_DECL_FINAL;
// define method VIRTUAL of class UEventTime
virtual int handlerTime() U_DECL_OVERRIDE;
virtual int handlerTime() U_DECL_FINAL;
// DEBUG

View File

@ -33,12 +33,12 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
// DEBUG

View File

@ -37,13 +37,13 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE __pure;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL __pure;
// Connection-wide hooks
virtual int handlerREAD() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerREAD() U_DECL_FINAL;
virtual int handlerRequest() U_DECL_FINAL;
// DEBUG

View File

@ -34,12 +34,12 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
// DEBUG

View File

@ -58,16 +58,16 @@ public:
// define method VIRTUAL of class UServerPlugIn
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerRun() U_DECL_OVERRIDE;
virtual int handlerFork() U_DECL_OVERRIDE;
virtual int handlerStop() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
virtual int handlerRun() U_DECL_FINAL;
virtual int handlerFork() U_DECL_FINAL;
virtual int handlerStop() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerREAD() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerReset() U_DECL_OVERRIDE;
virtual int handlerREAD() U_DECL_FINAL;
virtual int handlerRequest() U_DECL_FINAL;
virtual int handlerReset() U_DECL_FINAL;
private:
#ifdef U_COMPILER_DELETE_MEMBERS

View File

@ -33,12 +33,12 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
// DEBUG

View File

@ -33,12 +33,12 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerRun() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerRun() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
// DEBUG

View File

@ -36,12 +36,12 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
// SERVICES

View File

@ -34,13 +34,13 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerRun() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
virtual int handlerRun() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
// DEBUG

View File

@ -33,12 +33,12 @@ public:
// Server-wide hooks
virtual int handlerConfig(UFileConfig& cfg) U_DECL_OVERRIDE;
virtual int handlerInit() U_DECL_OVERRIDE;
virtual int handlerConfig(UFileConfig& cfg) U_DECL_FINAL;
virtual int handlerInit() U_DECL_FINAL;
// Connection-wide hooks
virtual int handlerRequest() U_DECL_OVERRIDE;
virtual int handlerRequest() U_DECL_FINAL;
// DEBUG

View File

@ -53,13 +53,13 @@ public: \
~server_class() { U_TRACE_UNREGISTER_OBJECT(5, server_class) } \
const char* dump(bool reset) const { return UServer<socket_type>::dump(reset); } \
protected: \
virtual void preallocate() U_DECL_OVERRIDE { \
virtual void preallocate() U_DECL_FINAL { \
U_TRACE(5+256, #server_class "::preallocate()") \
vClientImage = new client_type[UNotifier::max_connection]; } \
virtual void deallocate() U_DECL_OVERRIDE { \
virtual void deallocate() U_DECL_FINAL { \
U_TRACE(5+256, #server_class "::deallocate()") \
delete[] (client_type*)vClientImage; } \
virtual bool check_memory() U_DECL_OVERRIDE { return u_check_memory_vector<client_type>((client_type*)vClientImage, UNotifier::max_connection); } }
virtual bool check_memory() U_DECL_FINAL { return u_check_memory_vector<client_type>((client_type*)vClientImage, UNotifier::max_connection); } }
#else
# define U_MACROSERVER(server_class,client_type,socket_type) \
class server_class : public UServer<socket_type> { \
@ -67,7 +67,7 @@ public: \
server_class(UFileConfig* pcfg) : UServer<socket_type>(pcfg) {} \
~server_class() {} \
protected: \
virtual void preallocate() U_DECL_OVERRIDE { \
virtual void preallocate() U_DECL_FINAL { \
vClientImage = new client_type[UNotifier::max_connection]; } }
#endif
// ---------------------------------------------------------------------------------------------
@ -581,7 +581,7 @@ protected:
// define method VIRTUAL of class UEventTime
virtual int handlerTime() U_DECL_OVERRIDE;
virtual int handlerTime() U_DECL_FINAL;
#if defined(DEBUG) && defined(U_STDCPP_ENABLE)
const char* dump(bool _reset) const { return UEventTime::dump(_reset); }
@ -600,8 +600,8 @@ protected:
// define method VIRTUAL of class UEventFd
virtual int handlerRead() U_DECL_OVERRIDE; // This method is called to accept a new connection on the server socket
virtual void handlerDelete() U_DECL_OVERRIDE
virtual int handlerRead() U_DECL_FINAL; // This method is called to accept a new connection on the server socket
virtual void handlerDelete() U_DECL_FINAL
{
U_TRACE(0, "UServer_Base::handlerDelete()")

View File

@ -20,7 +20,7 @@
/**
* @class URDBServer
*
* @brief Handles incoming TCP/IP connections from URDBClient.
* @brief Handles incoming TCP/IP connections from URDBClient
*/
class URDB;
@ -46,10 +46,10 @@ protected:
// method VIRTUAL to redefine
virtual void preallocate() U_DECL_OVERRIDE;
virtual void preallocate() U_DECL_FINAL;
#ifdef DEBUG
virtual void deallocate() U_DECL_OVERRIDE;
virtual bool check_memory() U_DECL_OVERRIDE;
virtual void deallocate() U_DECL_FINAL;
virtual bool check_memory() U_DECL_FINAL;
#endif
private:

View File

@ -23,6 +23,7 @@
#endif
/**
* --------------------------------------------------------------------------------------------------------------------------------------------------
* Unix domain sockets are used for stream based connected sessions between processes on the same machine
* --------------------------------------------------------------------------------------------------------------------------------------------------
* - UNIX domain sockets use the file system as the address name space. This means you can use UNIX file permissions to control access to communicate

View File

@ -366,20 +366,20 @@ public:
// define method VIRTUAL of class UOrmDriver
virtual void handlerError() U_DECL_OVERRIDE;
virtual void handlerDisConnect() U_DECL_OVERRIDE;
virtual void execute(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual bool nextRow(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual void handlerStatementReset(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual void handlerStatementRemove(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual bool handlerQuery(const char* query, uint32_t query_len) U_DECL_OVERRIDE;
virtual void handlerError() U_DECL_FINAL;
virtual void handlerDisConnect() U_DECL_FINAL;
virtual void execute(USqlStatement* pstmt) U_DECL_FINAL;
virtual bool nextRow(USqlStatement* pstmt) U_DECL_FINAL;
virtual void handlerStatementReset(USqlStatement* pstmt) U_DECL_FINAL;
virtual void handlerStatementRemove(USqlStatement* pstmt) U_DECL_FINAL;
virtual bool handlerQuery(const char* query, uint32_t query_len) U_DECL_FINAL;
virtual unsigned int cols(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual unsigned long long affected(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual unsigned long long last_insert_rowid(USqlStatement* pstmt, const char* sequence) U_DECL_OVERRIDE;
virtual unsigned int cols(USqlStatement* pstmt) U_DECL_FINAL;
virtual unsigned long long affected(USqlStatement* pstmt) U_DECL_FINAL;
virtual unsigned long long last_insert_rowid(USqlStatement* pstmt, const char* sequence) U_DECL_FINAL;
virtual UOrmDriver* handlerConnect(const UString& option) U_DECL_OVERRIDE;
virtual USqlStatement* handlerStatementCreation(const char* stmt, uint32_t len) U_DECL_OVERRIDE;
virtual UOrmDriver* handlerConnect(const UString& option) U_DECL_FINAL;
virtual USqlStatement* handlerStatementCreation(const char* stmt, uint32_t len) U_DECL_FINAL;
// CREATE BIND PARAM

View File

@ -415,20 +415,20 @@ public:
// define method VIRTUAL of class UOrmDriver
virtual void handlerError() U_DECL_OVERRIDE;
virtual void handlerDisConnect() U_DECL_OVERRIDE;
virtual void execute(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual bool nextRow(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual void handlerStatementReset(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual void handlerStatementRemove(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual bool handlerQuery(const char* query, uint32_t query_len) U_DECL_OVERRIDE;
virtual void handlerError() U_DECL_FINAL;
virtual void handlerDisConnect() U_DECL_FINAL;
virtual void execute(USqlStatement* pstmt) U_DECL_FINAL;
virtual bool nextRow(USqlStatement* pstmt) U_DECL_FINAL;
virtual void handlerStatementReset(USqlStatement* pstmt) U_DECL_FINAL;
virtual void handlerStatementRemove(USqlStatement* pstmt) U_DECL_FINAL;
virtual bool handlerQuery(const char* query, uint32_t query_len) U_DECL_FINAL;
virtual unsigned int cols(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual unsigned long long affected(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual unsigned long long last_insert_rowid(USqlStatement* pstmt, const char* sequence) U_DECL_OVERRIDE;
virtual unsigned int cols(USqlStatement* pstmt) U_DECL_FINAL;
virtual unsigned long long affected(USqlStatement* pstmt) U_DECL_FINAL;
virtual unsigned long long last_insert_rowid(USqlStatement* pstmt, const char* sequence) U_DECL_FINAL;
virtual UOrmDriver* handlerConnect(const UString& option) U_DECL_OVERRIDE;
virtual USqlStatement* handlerStatementCreation(const char* stmt, uint32_t len) U_DECL_OVERRIDE
virtual UOrmDriver* handlerConnect(const UString& option) U_DECL_FINAL;
virtual USqlStatement* handlerStatementCreation(const char* stmt, uint32_t len) U_DECL_FINAL
{
U_TRACE(0, "UOrmDriverPgSql::handlerStatementCreation(%.*S,%u)", len, stmt, len)

View File

@ -358,20 +358,20 @@ public:
// define method VIRTUAL of class UOrmDriver
virtual void handlerError() U_DECL_OVERRIDE;
virtual void handlerDisConnect() U_DECL_OVERRIDE;
virtual void execute(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual bool nextRow(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual void handlerStatementReset(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual void handlerStatementRemove(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual bool handlerQuery(const char* query, uint32_t query_len) U_DECL_OVERRIDE;
virtual void handlerError() U_DECL_FINAL;
virtual void handlerDisConnect() U_DECL_FINAL;
virtual void execute(USqlStatement* pstmt) U_DECL_FINAL;
virtual bool nextRow(USqlStatement* pstmt) U_DECL_FINAL;
virtual void handlerStatementReset(USqlStatement* pstmt) U_DECL_FINAL;
virtual void handlerStatementRemove(USqlStatement* pstmt) U_DECL_FINAL;
virtual bool handlerQuery(const char* query, uint32_t query_len) U_DECL_FINAL;
virtual unsigned int cols(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual unsigned long long affected(USqlStatement* pstmt) U_DECL_OVERRIDE;
virtual unsigned long long last_insert_rowid(USqlStatement* pstmt, const char* sequence) U_DECL_OVERRIDE;
virtual unsigned int cols(USqlStatement* pstmt) U_DECL_FINAL;
virtual unsigned long long affected(USqlStatement* pstmt) U_DECL_FINAL;
virtual unsigned long long last_insert_rowid(USqlStatement* pstmt, const char* sequence) U_DECL_FINAL;
virtual UOrmDriver* handlerConnect(const UString& option) U_DECL_OVERRIDE;
virtual USqlStatement* handlerStatementCreation(const char* stmt, uint32_t len) U_DECL_OVERRIDE;
virtual UOrmDriver* handlerConnect(const UString& option) U_DECL_FINAL;
virtual USqlStatement* handlerStatementCreation(const char* stmt, uint32_t len) U_DECL_FINAL;
// CREATE BIND PARAM