RpcController.h 653 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef RPC_RPCCONTROLLER_H
  2. #define RPC_RPCCONTROLLER_H
  3. #include <google/protobuf/service.h>
  4. namespace Egametang {
  5. class RpcController: public google::protobuf::RpcController
  6. {
  7. private:
  8. bool failed;
  9. std::string reason;
  10. bool canceled;
  11. public:
  12. RpcController();
  13. virtual ~RpcController();
  14. // client
  15. virtual void Reset();
  16. virtual bool Failed() const;
  17. virtual std::string ErrorText() const;
  18. virtual void StartCancel();
  19. // server
  20. virtual void SetFailed(const std::string& reason);
  21. virtual bool IsCanceled() const;
  22. virtual void NotifyOnCancel(google::protobuf::Closure* callback);
  23. };
  24. } // namespace Egametang
  25. #endif // RPC_RPCCONTROLLER_H