aecd0a730cb90b967febdf1fc04dc8899fb0fdc5
[mono.git] / mcs / class / corlib / System.Runtime.Remoting.Messaging / ReturnMessage.cs
1 //
2 // System.Runtime.Remoting.Messaging.ReturnMessage.cs
3 //
4 // Author:
5 //   Dietmar Maurer (dietmar@ximian.com)
6 //
7 // (C) Ximian, Inc.  http://www.ximian.com
8 //
9
10 using System;
11 using System.Collections;
12 using System.Reflection;
13
14 namespace System.Runtime.Remoting.Messaging {
15
16         internal class ReturnMessage : IMethodReturnMessage, IMethodMessage {
17
18                 MonoMethodMessage msg;
19                 IMethodCallMessage request;
20                 
21                 public ReturnMessage (object returnValue, object [] outArgs,
22                                int outArgCount, LogicalCallContext callCtx,
23                                IMethodCallMessage request)
24                 {
25                         // fixme: why do we need outArgCount?
26                         msg = new MonoMethodMessage ((MonoMethod)request.MethodBase, outArgs);
27                         this.request = request;
28                         msg.rval = returnValue;
29                         msg.ctx = callCtx;
30                 }
31
32                 public ReturnMessage (Exception exc, IMethodCallMessage request)
33                 {
34                         msg = new MonoMethodMessage ((MonoMethod)request.MethodBase, null);
35                         this.request = request;
36                         msg.exc = exc;
37                         msg.ctx = request.LogicalCallContext;
38                 }
39                 
40                 public int ArgCount {
41                         get {
42                                 return msg.ArgCount;
43                         }
44                 }
45                 
46                 public object [] Args {
47                         get {
48                                 return msg.Args;
49                         }
50                 }
51                 
52                 public bool HasVarArgs {
53                         get {
54                                 return msg.HasVarArgs;
55                         }
56                 }
57
58                 public LogicalCallContext LogicalCallContext {
59                         get {
60                                 return msg.ctx;
61                         }
62                 }
63
64                 public MethodBase MethodBase {
65                         get {
66                                 return msg.MethodBase;
67                         }
68                 }
69
70                 public string MethodName {
71                         get {
72                                 return msg.MethodName;
73                         }
74                 }
75
76                 public object MethodSignature {
77                         get {
78                                 return msg.MethodSignature;
79                         }
80                 }
81
82                 [MonoTODO]
83                 public virtual IDictionary Properties {
84                         get {
85                                 return null;
86                         }
87                 }
88
89                 public string TypeName {
90                         get {
91                                 return msg.TypeName;
92                         }
93                 }
94
95                 public string Uri {
96                         get {
97                                 return msg.Uri;
98                         }
99                 }
100
101                 public object GetArg (int arg_num)
102                 {
103                         return msg.GetArg (arg_num);
104                 }
105                 
106                 public string GetArgName (int arg_num)
107                 {
108                         return msg.GetArgName (arg_num);
109                 }
110
111                 public Exception Exception {
112                         get {
113                                 return msg.exc;
114                         }
115                 }
116
117                 public int OutArgCount {
118                         get {
119                                 return msg.OutArgCount;
120                         }
121                 }
122
123                 public object [] OutArgs {
124                         get {
125                                 return msg.OutArgs;
126                         }
127                 }
128
129                 public virtual object ReturnValue {
130                         get {
131                                 return msg.rval;
132                         }
133                 }
134
135                 public object GetOutArg (int arg_num)
136                 {
137                         return msg.GetOutArg (arg_num);
138                 }
139
140                 public string GetOutArgName (int arg_num)
141                 {
142                         return msg.GetOutArgName (arg_num);
143                 }
144
145         }
146 }