Infinispan HotRod C++ Client  8.2.1.Final
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RemoteExecution.h
Go to the documentation of this file.
1 /*
2  * RemoteExecution.h
3  *
4  * Created on: Dec 5, 2017
5  * Author: rigazilla
6  */
7 
8 #ifndef INCLUDE_INFINISPAN_HOTROD_REMOTEEXECUTION_H_
9 #define INCLUDE_INFINISPAN_HOTROD_REMOTEEXECUTION_H_
10 
14 
15 namespace infinispan {
16 namespace hotrod {
17 
28 template<class M = JBossMarshaller>
30 public:
31  RemoteExecution(RemoteCacheBase& cache) :
32  cache(cache) {
33  }
34 
42  template<typename ResultType>
43  ResultType execute(const std::string& s) {
44  std::vector<char> buff(s.begin(), s.end());
45  return M::template unmarshall<ResultType>(cache.base_execute(buff, m));
46  }
47 
56  template<typename ArgType>
57  void addArg(std::string s, ArgType v) {
58  std::vector<char> buffK(s.begin(), s.end());
59  std::vector<char> buffV(M::marshall(v));
60  m[buffK] = buffV;
61  }
62 
69  void putScript(const std::string& name, const std::string& script) {
70  std::vector<char> buffName(M::marshall(name));
71  std::vector<char> buffScript(M::marshall(script));
72  cache.putScript(buffName, buffScript);
73  }
74 
75 private:
76  std::map<std::vector<char>, std::vector<char>> m;
77  RemoteCacheBase& cache;
78 };
79 
80 }
81 }
82 
83 #endif /* INCLUDE_INFINISPAN_HOTROD_REMOTEEXECUTION_H_ */
ResultType execute(const std::string &s)
Definition: RemoteExecution.h:43
RemoteExecution(RemoteCacheBase &cache)
Definition: RemoteExecution.h:31
void putScript(const std::string &name, const std::string &script)
Definition: RemoteExecution.h:69
void addArg(std::string s, ArgType v)
Definition: RemoteExecution.h:57
Definition: RemoteExecution.h:29