FACT++
1.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
rpc_server.cxx
Go to the documentation of this file.
1
#include <
dis.hxx
>
2
#include <
dic.hxx
>
3
#include <iostream>
4
using namespace
std
;
5
#include <stdio.h>
6
7
class
RpcInt
:
public
DimRpc
8
{
9
int
val
;
10
11
void
rpcHandler
()
12
{
13
val = getInt();
14
dim_print_date_time
();
15
printf(
"Got RPC %d\n"
, val);
16
val++;
17
// usleep(700000);
18
dim_print_date_time
();
19
printf(
"Answering RPC %d\n"
, val);
20
setData(val);
21
}
22
public
:
23
RpcInt
(
const
char
*name):
DimRpc
(name,
"I"
,
"I"
) {val = 0;};
24
};
25
26
typedef
struct
tst
{
27
char
str1[16];
28
int
ints[5];
29
char
str2[18];
30
float
floats[4];
31
int
int1;
32
float
floats1[16];
33
}
MyStruct
;
34
35
typedef
struct
jeffIn
{
36
char
c1
;
37
char
c2
;
38
char
c3
;
39
char
str
[3000];
40
}
JeffIn
;
41
42
typedef
struct
jeffOut
{
43
int
i1
;
44
char
c1
;
45
char
str
[3000];
46
}
JeffOut
;
47
48
class
RpcStruct
:
public
DimRpc
49
{
50
MyStruct
*
val
;
51
52
void
rpcHandler
()
53
{
54
val = (
MyStruct
*)getData();
55
val->
int1
++;
56
setData(val,
sizeof
(
MyStruct
));
57
}
58
public
:
59
RpcStruct
(
const
char
*name):
DimRpc
(name,
"C:16;I:5;C:18;F:4;I:1;F:16"
,
60
"C:16;I:5;C:18;F:4;I:1;F:16"
) {val = 0;};
61
};
62
63
class
JeffRpcStruct
:
public
DimRpc
64
{
65
JeffIn
*
pin
;
66
JeffOut
pout
;
67
int
counter
;
68
69
void
rpcHandler
()
70
{
71
pin = (
JeffIn
*)getData();
72
pout.
i1
= counter++;
73
pout.
c1
= pin->
c1
;
74
strcpy(pout.
str
,pin->
str
);
75
setData(&pout, (
int
)strlen(pout.
str
)+1+5);
76
}
77
public
:
78
JeffRpcStruct
(
const
char
*name):
DimRpc
(name,
"C:1;C:1;C:1;C"
,
79
"I:1;C:1;C"
) {counter = 0;};
80
};
81
82
int
main
()
83
{
84
RpcInt
myRpcInt(
"TESTRPC/INT"
);
85
RpcInt
*myRpcP;
86
RpcStruct
myRpcStruct(
"TESTRPC/STRUCT"
);
87
JeffRpcStruct
jeffRpcStruct(
"TESTJEFF"
);
88
int
i
;
89
char
name[64];
90
91
for
(i = 0; i < 10; i++)
92
{
93
sprintf
(name,
"TESTRPC%d/INT"
,i);
94
myRpcP =
new
RpcInt
(name);
95
}
96
DimServer::start
(
"TESTRPC"
);
97
while
(1)
98
pause();
99
return
0;
100
}
DimRpc
Definition:
dis.hxx:301
RpcStruct::rpcHandler
void rpcHandler()
Definition:
rpc_server.cxx:52
jeffIn
Definition:
rpc_server.cxx:35
JeffRpcStruct::JeffRpcStruct
JeffRpcStruct(const char *name)
Definition:
rpc_server.cxx:78
dic.hxx
i
int i
Definition:
db_dim_client.c:21
str
char str[80]
Definition:
test_client.c:7
dis.hxx
jeffIn::c2
char c2
Definition:
rpc_server.cxx:37
std
STL namespace.
tst
Definition:
rpc_client.cxx:16
jeffOut::str
char str[3000]
Definition:
rpc_server.cxx:45
JeffRpcStruct
Definition:
rpc_server.cxx:63
RpcStruct
Definition:
rpc_client.cxx:25
jeffOut
Definition:
rpc_server.cxx:42
MyStruct
struct tst MyStruct
RpcInt::val
int val
Definition:
rpc_server.cxx:9
JeffOut
struct jeffOut JeffOut
jeffOut::c1
char c1
Definition:
rpc_server.cxx:44
JeffRpcStruct::counter
int counter
Definition:
rpc_server.cxx:67
jeffIn::str
char str[3000]
Definition:
rpc_server.cxx:39
RpcInt::rpcHandler
void rpcHandler()
Definition:
rpc_server.cxx:11
jeffIn::c3
char c3
Definition:
rpc_server.cxx:38
RpcStruct::val
MyStruct * val
Definition:
rpc_server.cxx:50
main
int main()
Definition:
rpc_server.cxx:82
JeffRpcStruct::rpcHandler
void rpcHandler()
Definition:
rpc_server.cxx:69
JeffRpcStruct::pin
JeffIn * pin
Definition:
rpc_server.cxx:65
RpcStruct::RpcStruct
RpcStruct(const char *name)
Definition:
rpc_server.cxx:59
DimServer::start
static void start()
Definition:
discpp.cxx:512
tst::int1
int int1
Definition:
rpc_client.cxx:21
JeffRpcStruct::pout
JeffOut pout
Definition:
rpc_server.cxx:66
dim_print_date_time
void dim_print_date_time()
Definition:
utilities.c:134
jeffIn::c1
char c1
Definition:
rpc_server.cxx:36
JeffIn
struct jeffIn JeffIn
jeffOut::i1
int i1
Definition:
rpc_server.cxx:43
RpcInt::RpcInt
RpcInt(const char *name)
Definition:
rpc_server.cxx:23
sprintf
sprintf(name1,"NewService%d", i)
RpcInt
Definition:
rpc_server.cxx:7
dim
src
examples
rpc_server.cxx
Generated on Sun Sep 18 2016 20:50:18 for FACT++ by
1.8.11