protected ArrayValue ToArrayValue(Object value, Validator v) { Type c = value.GetType(); int dim = 0; while (c.IsArray) { dim++; c = c.GetElementType(); } // now we want the type code for c, and if the type code is custom, // we'll also want the struct type code. sbyte typeCode = GetNativeTypeCode(c); XType customStructType; if (typeCode == TypeCode.CUSTOM || typeCode == TypeCode.STRUCT) { customStructType = GetCustomStructType(c); if (customStructType == null && c == typeof(StructValue)) { Validator_StructValue x = FindStructValueValidator(v); if (x != null) { customStructType = x.GetXType(); } } if (customStructType == null) { throw new ArgumentException(" In tagged Data"); } } else { customStructType = null; } return(new ArrayValue(value, typeCode, customStructType, dim)); }
private Validator_StructValue FindStructValueValidator(Validator v) { if (v is Validator_StructValue) { return((Validator_StructValue)v); } if (v is ComboValidator) { ComboValidator x = (ComboValidator)v; Validator_StructValue y = FindStructValueValidator(x.A()); if (y != null) { return(y); } return(FindStructValueValidator(x.B())); } return(null); }
static MyValueFactoryCuae() { DefaultValueFactory.Init(types, class2type); _mt_etch_bindings_csharp_examples_cuae_CuaeServer_doit.SetAsyncMode(AsyncMode.QUEUED); _mt_etch_bindings_csharp_examples_cuae_CuaeServer_doit.SetResult(_mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit); _mt_etch_bindings_csharp_examples_cuae_CuaeClient_doit2.SetAsyncMode(AsyncMode.FREE); _mt_etch_bindings_csharp_examples_cuae_CuaeClient_doit2.SetResult(_mt_etch_bindings_csharp_examples_cuae_CuaeServer__result_doit2); _mt_etch_bindings_csharp_examples_cuae_CuaeServer_doit3.SetResult(_mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit3); // class2type.Add( typeof( etch.bindings.csharp.examples.cuae.ConstsCuae.Request ), _mt_etch_bindings_csharp_examples_cuae_Cuae_Request ); // _mt_etch_bindings_csharp_examples_cuae_Cuae_Request.SetClass( typeof( etch.bindings.csharp.examples.cuae.ConstsCuae.Request ) ); _mt_etch_bindings_csharp_examples_cuae_Cuae_Request.SetImportExportHelper ( new ImportExportHelper( delegate(ValueFactory vf, Object value) { return((StructValue)value); }, delegate(StructValue sv) { return(sv); } ) ); // class2type.Add( typeof( etch.bindings.csharp.examples.cuae.ConstsCuae.Response ), _mt_etch_bindings_csharp_examples_cuae_Cuae_Response ); // _mt_etch_bindings_csharp_examples_cuae_Cuae_Response.SetClass( typeof( etch.bindings.csharp.examples.cuae.ConstsCuae.Response ) ); _mt_etch_bindings_csharp_examples_cuae_Cuae_Response.SetImportExportHelper ( new ImportExportHelper( delegate(ValueFactory vf, Object value) { return((StructValue)value); }, delegate(StructValue sv) { return(sv); } ) ); _mt_etch_bindings_csharp_examples_cuae_Cuae_ReqWithMessage.SetSuperType(_mt_etch_bindings_csharp_examples_cuae_Cuae_Request); _mt_etch_bindings_csharp_examples_cuae_Cuae_ReqWithMessage.SetImportExportHelper ( new ImportExportHelper( delegate(ValueFactory vf, Object value) { return((StructValue)value); }, delegate(StructValue sv) { return(sv); } ) ); _mt_etch_bindings_csharp_examples_cuae_Cuae_RespWithCode.SetSuperType(_mt_etch_bindings_csharp_examples_cuae_Cuae_Response); _mt_etch_bindings_csharp_examples_cuae_Cuae_RespWithCode.SetImportExportHelper ( new ImportExportHelper( delegate(ValueFactory vf, Object value) { return((StructValue)value); }, delegate(StructValue sv) { return(sv); } ) ); // initialize the extern serializers: // done updating types and fields, lock them. types.Lock(); class2type.Lock(); _mt_etch_bindings_csharp_examples_cuae_Cuae_Request.PutValidator(_mf_code, Validator_int.Get(0)); _mt_etch_bindings_csharp_examples_cuae_Cuae_ReqWithMessage.PutValidator(_mf_code, Validator_int.Get(0)); _mt_etch_bindings_csharp_examples_cuae_Cuae_ReqWithMessage.PutValidator(_mf_msg, Validator_string.Get(0)); _mt_etch_bindings_csharp_examples_cuae_Cuae_Response.PutValidator(_mf_msg, Validator_string.Get(0)); _mt_etch_bindings_csharp_examples_cuae_Cuae_RespWithCode.PutValidator(_mf_msg, Validator_string.Get(0)); _mt_etch_bindings_csharp_examples_cuae_Cuae_RespWithCode.PutValidator(_mf_code, Validator_int.Get(0)); // params for doit _mt_etch_bindings_csharp_examples_cuae_CuaeServer_doit.PutValidator(_mf_req, Validator_StructValue.Get(_mt_etch_bindings_csharp_examples_cuae_Cuae_Request, 0)); _mt_etch_bindings_csharp_examples_cuae_CuaeServer_doit.PutValidator(_mf__messageId, Validator_long.Get(0)); // params for _result_doit _mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit.PutValidator(_mf_result, Validator_StructValue.Get(_mt_etch_bindings_csharp_examples_cuae_Cuae_Response, 0)); _mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit.PutValidator(_mf__messageId, Validator_long.Get(0)); _mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit.PutValidator(_mf_result, Validator_RuntimeException.Get()); // thrown RuntimeException _mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit.PutValidator(_mf__inReplyTo, Validator_long.Get(0)); // params for doit2 _mt_etch_bindings_csharp_examples_cuae_CuaeClient_doit2.PutValidator(_mf_req, Validator_StructValue.Get(_mt_etch_bindings_csharp_examples_cuae_Cuae_Request, 0)); _mt_etch_bindings_csharp_examples_cuae_CuaeClient_doit2.PutValidator(_mf__messageId, Validator_long.Get(0)); // params for _result_doit2 _mt_etch_bindings_csharp_examples_cuae_CuaeServer__result_doit2.PutValidator(_mf_result, Validator_StructValue.Get(_mt_etch_bindings_csharp_examples_cuae_Cuae_Response, 0)); _mt_etch_bindings_csharp_examples_cuae_CuaeServer__result_doit2.PutValidator(_mf__messageId, Validator_long.Get(0)); _mt_etch_bindings_csharp_examples_cuae_CuaeServer__result_doit2.PutValidator(_mf_result, Validator_RuntimeException.Get()); // thrown RuntimeException _mt_etch_bindings_csharp_examples_cuae_CuaeServer__result_doit2.PutValidator(_mf__inReplyTo, Validator_long.Get(0)); // params for doit3 _mt_etch_bindings_csharp_examples_cuae_CuaeServer_doit3.PutValidator(_mf_req, Validator_StructValue.Get(_mt_etch_bindings_csharp_examples_cuae_Cuae_Request, 1)); _mt_etch_bindings_csharp_examples_cuae_CuaeServer_doit3.PutValidator(_mf__messageId, Validator_long.Get(0)); // params for _result_doit3 _mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit3.PutValidator(_mf_result, Validator_StructValue.Get(_mt_etch_bindings_csharp_examples_cuae_Cuae_Response, 1)); _mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit3.PutValidator(_mf__messageId, Validator_long.Get(0)); _mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit3.PutValidator(_mf_result, Validator_RuntimeException.Get()); // thrown RuntimeException _mt_etch_bindings_csharp_examples_cuae_CuaeClient__result_doit3.PutValidator(_mf__inReplyTo, Validator_long.Get(0)); _mt_etch_bindings_csharp_examples_cuae_CuaeServer__result_doit2.Timeout = 500; _mt_etch_bindings_csharp_examples_cuae_CuaeServer__result_doit2.ResponseField = _mf_result; } // end of static constructor