34 #ifndef NET_GRPC_NODE_CALL_H_
35 #define NET_GRPC_NODE_CALL_H_
42 #include "grpc/grpc.h"
43 #include "grpc/support/log.h"
51 using std::unique_ptr;
52 using std::shared_ptr;
63 NanDisposePersistent(*persist);
68 v8::Persistent<v8::Value> *persist;
72 std::vector<unique_ptr<NanUtf8String> > strings;
73 std::vector<unique_ptr<PersistentHolder> > handles;
78 virtual v8::Handle<v8::Value> GetNodeValue()
const = 0;
79 virtual bool ParseOp(v8::Handle<v8::Value> value,
grpc_op *out,
80 shared_ptr<Resources> resources) = 0;
81 v8::Handle<v8::Value> GetOpType()
const;
84 virtual std::string GetTypeString()
const = 0;
87 typedef std::vector<unique_ptr<Op>> OpVec;
90 tag(NanCallback *callback, OpVec *ops,
91 shared_ptr<Resources> resources);
93 NanCallback *callback;
95 shared_ptr<Resources> resources;
98 v8::Handle<v8::Value> GetTagNodeValue(
void *
tag);
100 NanCallback *GetTagCallback(
void *
tag);
102 void DestroyTag(
void *
tag);
105 class Call :
public ::node::ObjectWrap {
107 static void Init(v8::Handle<v8::Object> exports);
108 static bool HasInstance(v8::Handle<v8::Value> val);
110 static v8::Handle<v8::Value> WrapStruct(
grpc_call *call);
120 static NAN_METHOD(New);
121 static NAN_METHOD(StartBatch);
122 static NAN_METHOD(Cancel);
123 static NanCallback *constructor;
125 static v8::Persistent<v8::FunctionTemplate> fun_tpl;
133 #endif // NET_GRPC_NODE_CALL_H_