فهرست منبع

把typedef分到各自目录,加快编译速度

tanghai 14 سال پیش
والد
کامیت
485c27c271

+ 0 - 7
Src/Base/Base.h

@@ -1,7 +0,0 @@
-#ifndef BASE_BASE_H
-#define BASE_BASE_H
-
-#include "Base/Typedefs.h"
-#include "Base/Marcos.h"
-
-#endif // BASE_BASE_H

+ 24 - 0
Src/Base/Typedef.h

@@ -0,0 +1,24 @@
+#ifndef BASE_TYPEDEFS_H
+#define BASE_TYPEDEFS_H
+#include <boost/cstdint.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace Egametang {
+
+typedef boost::int8_t   int8;
+typedef boost::int16_t  int16;
+typedef boost::int32_t  int32;
+typedef boost::int64_t  int64;
+typedef boost::uint8_t  uint8;
+typedef boost::uint16_t uint16;
+typedef boost::uint32_t uint32;
+typedef boost::uint64_t uint64;
+
+// smart_ptr typedef
+
+typedef boost::shared_ptr<int> IntPtr;
+typedef boost::shared_ptr<std::string> StringPtr;
+
+} // namespace Egametang
+
+#endif // BASE_TYPEDEFS_H

+ 0 - 44
Src/Base/Typedefs.h

@@ -1,44 +0,0 @@
-#ifndef BASE_TYPEDEFS_H
-#define BASE_TYPEDEFS_H
-#include <boost/cstdint.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/thread.hpp>
-#include <google/protobuf/service.h>
-
-namespace Egametang {
-
-typedef boost::int8_t   int8;
-typedef boost::int16_t  int16;
-typedef boost::int32_t  int32;
-typedef boost::int64_t  int64;
-typedef boost::uint8_t  uint8;
-typedef boost::uint16_t uint16;
-typedef boost::uint32_t uint32;
-typedef boost::uint64_t uint64;
-
-// smart_ptr typedef
-
-typedef boost::shared_ptr<int> IntPtr;
-typedef boost::shared_ptr<std::string> StringPtr;
-
-// boost
-typedef boost::shared_ptr<boost::thread> ThreadPtr;
-
-// google
-typedef boost::shared_ptr<google::protobuf::Service> ProtobufServicePtr;
-typedef boost::shared_ptr<google::protobuf::Message> ProtobufMessagePtr;
-
-// Egametang
-class RpcSession;
-class RpcRequest;
-class RpcChannel;
-class ThreadPool;
-class ThreadPoolIf;
-typedef boost::shared_ptr<RpcSession> RpcSessionPtr;
-typedef boost::shared_ptr<RpcRequest> RpcRequestPtr;
-typedef boost::shared_ptr<RpcChannel> RpcChannelPtr;
-typedef boost::shared_ptr<ThreadPool> ThreadPoolPtr;
-
-} // namespace Egametang
-
-#endif // BASE_TYPEDEFS_H

+ 1 - 1
Src/Net/RpcChannel.cc → Src/Rpc/RpcChannel.cc

@@ -1,7 +1,7 @@
 #include <boost/asio.hpp>
 #include <boost/make_shared.hpp>
 #include <google/protobuf/message.h>
-#include "Net/RpcChannel.h"
+#include "Rpc/RpcChannel.h"
 
 namespace Egametang {
 

+ 4 - 4
Src/Net/RpcChannel.h → Src/Rpc/RpcChannel.h

@@ -1,10 +1,10 @@
-#ifndef NET_RPC_CHANNEL_H
-#define NET_RPC_CHANNEL_H
+#ifndef RPC_RPC_CHANNEL_H
+#define RPC_RPC_CHANNEL_H
 
 #include <google/protobuf/service.h>
 #include <boost/unordered_map.hpp>
 #include <boost/asio.hpp>
-#include "Base/Base.h"
+#include "Base/Typedef.h"
 
 namespace Egametang {
 
@@ -47,4 +47,4 @@ public:
 
 } // namespace Egametang
 
-#endif // NET_RPC_CHANNEL_H
+#endif // RPC_RPC_CHANNEL_H

+ 1 - 1
Src/Net/RpcChannelTest.cc → Src/Rpc/RpcChannelTest.cc

@@ -1,7 +1,7 @@
 #include <gtest/gtest.h>
 #include <gflags/gflags.h>
 #include <glog/logging.h>
-#include "Net/RpcChannel.h"
+#include "Rpc/RpcChannel.h"
 
 namespace Egametang {
 

+ 1 - 1
Src/Net/RpcController.cc → Src/Rpc/RpcController.cc

@@ -1,4 +1,4 @@
-#include "Net/RpcController.h"
+#include "Rpc/RpcController.h"
 
 namespace Egametang {
 

+ 3 - 3
Src/Net/RpcController.h → Src/Rpc/RpcController.h

@@ -1,5 +1,5 @@
-#ifndef NET_RPC_CONTROLLER_H
-#define NET_RPC_CONTROLLER_H
+#ifndef RPC_RPC_CONTROLLER_H
+#define RPC_RPC_CONTROLLER_H
 
 #include <google/protobuf/service.h>
 
@@ -30,4 +30,4 @@ public:
 
 } // namespace Egametang
 
-#endif // NET_RPC_CONTROLLER_H
+#endif // RPC_RPC_CONTROLLER_H

+ 1 - 1
Src/Net/RpcHandler.cc → Src/Rpc/RpcHandler.cc

@@ -1,4 +1,4 @@
-#include "Net/RpcHandler.h"
+#include "Rpc/RpcHandler.h"
 
 namespace Egametang {
 

+ 3 - 5
Src/Net/RpcHandler.h → Src/Rpc/RpcHandler.h

@@ -1,5 +1,5 @@
-#ifndef NET_RPC_HANDLER_H
-#define NET_RPC_HANDLER_H
+#ifndef RPC_RPC_HANDLER_H
+#define RPC_RPC_HANDLER_H
 
 #include "boost/shared_ptr.hpp"
 
@@ -24,8 +24,6 @@ public:
     google::protobuf::Message *GetResponse() const;
 };
 
-typedef boost::shared_ptr<RpcHandler> RpcHandlerPtr;
-
 } // namespace Egametang
 
-#endif // NET_RPC_HANDLER_H
+#endif // RPC_RPC_HANDLER_H

+ 0 - 0
Src/Net/RpcProtobufData.proto → Src/Rpc/RpcProtobufData.proto


+ 4 - 3
Src/Net/RpcServer.cc → Src/Rpc/RpcServer.cc

@@ -1,10 +1,11 @@
 #include <boost/asio.hpp>
 #include <boost/foreach.hpp>
 #include <google/protobuf/service.h>
-#include "Base/Base.h"
-#include "Net/RpcServer.h"
-#include "Net/RpcSession.h"
+#include "Rpc/RpcTypedef.h"
+#include "Rpc/RpcServer.h"
+#include "Rpc/RpcSession.h"
 #include "Thread/ThreadPool.h"
+#include "Base/Marcos.h"
 
 namespace Egametang {
 

+ 5 - 5
Src/Net/RpcServer.h → Src/Rpc/RpcServer.h

@@ -1,7 +1,7 @@
-#ifndef NET_RPC_SERVER_H
-#define NET_RPC_SERVER_H
+#ifndef RPC_RPC_SERVER_H
+#define RPC_RPC_SERVER_H
 #include <boost/asio.hpp>
-#include "base/base.h"
+#include "Rpc/RpcTypedef.h"
 
 namespace Egametang {
 
@@ -13,7 +13,7 @@ private:
 	google::protobuf::Service& service_;
 	boost::asio::io_service& io_service_;
 	boost::asio::ip::tcp::acceptor acceptor_;
-	ThreadPoolIf& thread_pool_;
+	ThreadPool& thread_pool_;
 	RpcSessionSet sessions_;
 
 	void HandleAsyncAccept(RpcSessionPtr session, const boost::system::error_code& err);
@@ -33,4 +33,4 @@ public:
 
 } // namespace Egametang
 
-#endif // NET_RPC_SERVER_H
+#endif // RPC_RPC_SERVER_H

+ 1 - 1
Src/Net/RpcSession.cc → Src/Rpc/RpcSession.cc

@@ -1,4 +1,4 @@
-#include "Net/RpcSession.h"
+#include "Rpc/RpcSession.h"
 
 namespace Egametang {
 

+ 3 - 5
Src/Net/RpcSession.h → Src/Rpc/RpcSession.h

@@ -1,10 +1,8 @@
-#ifndef NET_RPC_SESSION_H
-#define NET_RPC_SESSION_H
+#ifndef RPC_RPC_SESSION_H
+#define RPC_RPC_SESSION_H
 
 #include <boost/asio.hpp>
-#include <boost/array.hpp>
 #include <boost/noncopyable.hpp>
-#include <boost/shared_ptr.hpp>
 #include <boost/enable_shared_from_this.hpp>
 
 namespace Egametang {
@@ -35,4 +33,4 @@ public:
 
 } // namespace Egametang
 
-#endif // NET_RPC_SESSION_H
+#endif // RPC_RPC_SESSION_H

+ 26 - 0
Src/Rpc/RpcTypedef.h

@@ -0,0 +1,26 @@
+#ifndef RPC_RPC_TYPEDEF_H
+#define RPC_RPC_TYPEDEF_H
+#include <boost/shared_ptr.hpp>
+#include <google/protobuf/service.h>
+
+namespace Egametang {
+
+// google
+typedef boost::shared_ptr<google::protobuf::Service> ProtobufServicePtr;
+typedef boost::shared_ptr<google::protobuf::Message> ProtobufMessagePtr;
+
+// rpc
+class RpcSession;
+class RpcRequest;
+class RpcChannel;
+class RpcHandler;
+class RpcResponse;
+typedef boost::shared_ptr<RpcSession> RpcSessionPtr;
+typedef boost::shared_ptr<RpcRequest> RpcRequestPtr;
+typedef boost::shared_ptr<RpcChannel> RpcChannelPtr;
+typedef boost::shared_ptr<RpcHandler> RpcHandlerPtr;
+typedef boost::shared_ptr<RpcResponse> RpcResponsePtr;
+
+} // namespace Egametang
+
+#endif // RPC_RPC_TYPEDEF_H

+ 1 - 1
Src/Thread/ThreadPool.h

@@ -5,7 +5,7 @@
 #include <boost/thread.hpp>
 #include <boost/function.hpp>
 #include <boost/detail/atomic_count.hpp>
-#include "Base/Base.h"
+#include "Thread/ThreadTypedef.h"
 
 namespace Egametang {
 

+ 13 - 0
Src/Thread/ThreadTypedef.h

@@ -0,0 +1,13 @@
+#ifndef THREAD_TYPEDEF_H
+#define THREAD_TYPEDEF_H
+#include <boost/shared_ptr.hpp>
+#include <boost/thread.hpp>
+
+namespace Egametang {
+
+// boost
+typedef boost::shared_ptr<boost::thread> ThreadPtr;
+
+} // namespace Egametang
+
+#endif // THREAD_TYPEDEF_H