This cache enables high performance mapping of operation codes to operations. It collaborates with the OperationDispatcher. Instances of this class should be reused if possible since the method registration is slower than the mapping. Registered methods must have the followig structure: More...
Public Member Functions | |
bool | RegisterOperation (Func< PeerBase, OperationRequest, SendParameters, OperationResponse > method) |
Registers a method to map by operation code. More... | |
bool | RegisterOperation (MethodInfo method) |
Registers a method tp map by operation code. The method must have the following structure: More... | |
void | RegisterOperations (Type targetType) |
Registers all methods of the targetType that are flagged with the OperationAttribute. Theses methods must have the following structure: More... | |
This cache enables high performance mapping of operation codes to operations. It collaborates with the OperationDispatcher. Instances of this class should be reused if possible since the method registration is slower than the mapping. Registered methods must have the followig structure:
[Operation(OperationCode = 1)] OperationResponse MyMethod(PeerBase peer, OperationRequest request);
|
inline |
Registers a method to map by operation code.
method | The method to register. |
ArgumentException | method already registered |
|
inline |
Registers a method tp map by operation code. The method must have the following structure:
[Operation(OperationCode = 1)] OperationResponse MyMethod(Peer peer, OperationRequest request);
method | The method to register. |
ArgumentException | method already registered |
|
inline |
Registers all methods of the targetType that are flagged with the OperationAttribute. Theses methods must have the following structure:
[Operation(OperationCode = 1)] OperationResponse MyMethod(Peer peer, OperationRequest request);
targetType | The target Type. |