16 static void __wrap_readParameter(struct pxprpc_callable
*self
,struct pxprpc_request
*r
,void (*doneCallback
)(struct pxprpc_request
*r
));
19 static void __wrap_call(struct pxprpc_callable
*self
,struct pxprpc_request
*r
,void (*onResult
)(struct pxprpc_request
*r
,struct pxprpc_object
*result
));
22 static void __wrap_writeResult(struct pxprpc_callable
*self
,struct pxprpc_request
*r
);
24 pxprpc_server_api
*servapi
;
27 pxprpc_server_query_interface(&servapi
);
30 static uint32_t __wrap_object_addRef(struct pxprpc_object
*self
);
31 static uint32_t __wrap_object_release(struct pxprpc_object
*self
);
34 struct pxprpc_object cObj
;
40 return this->cObj
.count
;
42 virtual int release(){
44 if(this->cObj
.count
<=0){
48 return this->cObj
.count
;
52 this->cObj
.object1
=this;
54 this->cObj
.addRef
=&__wrap_object_addRef
;
55 this->cObj
.release
=&__wrap_object_release
;
57 virtual struct pxprpc_object
*cObject(){
62 class RpcRawBytes
:public RpcObject
{
64 virtual ~RpcRawBytes(){
68 RpcRawBytes(uint8_t *data
,int size
):RpcObject(){
72 virtual struct pxprpc_object
*cObject(){
73 auto r1
=pxprpc::servapi
->new_bytes_object(this->size
);
74 pxprpc::servapi
->fill_bytes_object(r1
,this->data
,this->size
);
81 static uint32_t __wrap_object_addRef(struct pxprpc_object
*self
){
82 auto rpcObj
=static_cast<RpcObject
*>(self
->object1
);
86 static uint32_t __wrap_object_release(struct pxprpc_object
*self
){
87 auto rpcObj
=static_cast<RpcObject
*>(self
->object1
);
91 static void __NamedFunctionPPIoRead(void *p
);
93 class NamedFunctionPP
;
96 std::function
<void(struct pxprpc_abstract_io
*,const char *)> doneCallback
;
97 struct pxprpc_abstract_io
*io1
;
98 NamedFunctionPP
*callable
;
102 class NamedFunctionPP
{
105 struct pxprpc_callable callable
;
106 struct pxprpc_namedfunc mCNamedFunc
;
109 virtual void readParameter(struct pxprpc_request
*r
,std::function
<void()> doneCallback
)=0;
110 virtual void call(struct pxprpc_request
*r
,std::function
<void(RpcObject
*)> onResult
)=0;
111 virtual void writeResult(struct pxprpc_request
*r
)=0;
112 void readFromIo(struct pxprpc_abstract_io
*io1
,uint8_t *buf
,int length
,
113 std::function
<void(struct pxprpc_abstract_io
*,const char *)> doneCallback
){
114 auto arg1
=new __IoReadArg();
116 arg1
->doneCallback
=doneCallback
;
118 io1
->read(io1
,length
,buf
,&__NamedFunctionPPIoRead
,arg1
);
120 NamedFunctionPP(std::string funcName
){
121 this->callable
.userData
=this;
122 this->callable
.readParameter
=__wrap_readParameter
;
123 this->callable
.call
=__wrap_call
;
124 this->callable
.writeResult
=__wrap_writeResult
;
125 this->mCNamedFunc
.callable
=&this->callable
;
127 this->mCNamedFunc
.name
=this->name
.c_str();
129 virtual struct pxprpc_namedfunc
*cNamedFunc(){
132 virtual ~NamedFunctionPP(){
136 static void __NamedFunctionPPIoRead(void *p
){
137 auto *arg0
=static_cast<__IoReadArg
*>(p
);
138 arg0
->doneCallback(arg0
->io1
,
139 arg0
->io1
->get_error(arg0
->io1
,(void *)arg0
->io1
->read
));
147 static void __wrap_readParameter(struct pxprpc_callable
*self
,struct pxprpc_request
*r
,void (*doneCallback
)(struct pxprpc_request
*r
)){
148 NamedFunctionPP
*selfpp
=static_cast<NamedFunctionPP
*>(self
->userData
);
149 selfpp
->readParameter(r
,[doneCallback
,r
]()->void{doneCallback(r
);});
153 static void __wrap_call(struct pxprpc_callable
*self
,struct pxprpc_request
*r
,void (*onResult
)(struct pxprpc_request
*r
,struct pxprpc_object
*result
)){
154 NamedFunctionPP
*selfpp
=static_cast<NamedFunctionPP
*>(self
->userData
);
155 selfpp
->call(r
,[onResult
,r
](pxprpc::RpcObject
*resultObj
)->void{
156 onResult(r
,resultObj
->cObject());
160 static void __wrap_writeResult(struct pxprpc_callable
*self
,struct pxprpc_request
*r
){
161 NamedFunctionPP
*selfpp
=static_cast<NamedFunctionPP
*>(self
->userData
);
162 selfpp
->writeResult(r
);