TinkoffInvestSDK
servicereply.h
1 #ifndef SERVICEREPLY_H
2 #define SERVICEREPLY_H
3 
4 #include "google/protobuf/message.h"
5 #include <grpcpp/grpcpp.h>
6 #include "tinkoffinvestsdk_export.h"
7 
8 using grpc::Status;
9 
10 static const std::string APP_NAME = "samoilovv.TinkoffInvestSDK";
11 
17 class TINKOFFINVESTSDK_EXPORT ServiceReply
18 {
19 
20 public:
21  ServiceReply();
22  ServiceReply(const std::shared_ptr<google::protobuf::Message> protoMsg);
23  const std::shared_ptr<google::protobuf::Message> ptr();
24  const std::string accountID(const int i);
25  int accountCount();
26 
27  template<class T>
28  static const ServiceReply prepareServiceAnswer(const Status &status, const T &protoMsg)
29  {
30  return (status.ok()) ? ServiceReply(std::make_shared<T>(protoMsg)) : ServiceReply(nullptr);
31  }
32 
33 private:
34  std::shared_ptr<google::protobuf::Message> m_replyPtr;
35 
36 };
37 
38 #endif // SERVICEREPLY_H
ServiceReply
Класс-обертка над proto-ответами сервисов
Definition: servicereply.h:17