2 using System
.Collections
.Generic
;
7 public abstract class AbstractCallable
: PxpCallable
9 public void writeResult(PxpRequest req
)
11 ServerContext ctx
= req
.context
;
12 if (req
.result
is Exception
)
22 public int csTypeToSwitchId(Type cstype
)
24 if (cstype
== typeof(bool))
28 else if (cstype
== typeof(byte))
32 else if (cstype
== typeof(short))
36 else if (cstype
== typeof(int))
40 else if (cstype
== typeof(long))
44 else if (cstype
== typeof(float))
48 else if (cstype
== typeof(double))
52 else if (cstype
== typeof(string))
63 public Object
readNext(ServerContext ctx
, int switchId
)
70 return ctx
.readInt32() != 0;
73 return (byte)ctx
.readInt32();
76 return (short)ctx
.readInt32();
79 return ctx
.readInt32();
82 return ctx
.readInt64();
85 return ctx
.readFloat32();
88 return ctx
.readFloat64();
91 int addr
= ctx
.readInt32();
92 return ctx
.refSlots
[addr
].get();
95 return ctx
.readNextString();
97 throw new NotImplementedException();
101 public void writeNext(ServerContext ctx
, int switchId
, Object obj
, int addrIfRefType
)
108 ctx
.writeInt32((Boolean
)obj
? 1 : 0);
112 ctx
.writeInt32((Byte
)obj
);
116 ctx
.writeInt32((Int16
)obj
);
120 ctx
.writeInt32((Int32
)obj
);
124 ctx
.writeInt64((Int64
)obj
);
128 ctx
.writeFloat32((Single
)obj
);
132 ctx
.writeFloat64((Double
)obj
);
137 //processed by callable
139 throw new NotImplementedException();
143 public abstract void readParameter(PxpRequest req
);
144 public abstract void call(PxpRequest req
, Action
<object> asyncRet
);