// $Id$
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
using System;
using System.Collections.Generic;
using System.Text;
namespace Org.Apache.Etch.Bindings.Csharp.Msg
{
/// Interface which defines the value factory which helps
/// the idl compiler serialize and deserialize messages, convert values, etc.
public interface ValueFactory
{
//////////
// XType //
//////////
/// Translates a type id into the appropriate XType object.
/// If the type does not exist, and if dynamic typing is enabled,
/// adds it to the dynamic types.
/// id a type id.
/// id translated into the appropriate XType.
XType GetType(int id);
/// Translates a type name into the appropriate XType object.
/// If the type does not exist, and if dynamic typing is enabled,
/// adds it to the dynamic types.
/// name a type name.
/// name translated into the appropriate XType.
XType GetType(string name);
///
/// Adds the type if it doesn't already exist. Use this to dynamically add
/// types to a ValueFactory. The type is per instance of the ValueFactory,
/// not global. Not available if dynamic typing is locked.
///
///
void AddType(XType type);
///
/// Locks the dynamic typing so that no new types may be created by addType
/// or getType.
///
void LockDynamicTypes();
///
/// Unlocks the dynamic typing so that new types may be created by addType
/// or getType.
///
void UnlockDynamicTypes();
/// a collection of all the types.
ICollection GetTypes();
/////////////////////
// STRING ENCODING //
/////////////////////
/// the encoding to use for strings.
Encoding GetStringEncoding();
////////////////
// MESSAGE ID //
////////////////
/// msg the message whose well-known message-id field is to be returned.
/// the value of the well-known message-id field. This is a unique identifier
/// for this message on a particular transport during a particular session. If there is no well-known
/// message-id field defined, or if the message-id field has not been set, then return null.
long? GetMessageId(Message msg);
/// Sets the value of the well-known message-id field. This is a unique identifier
/// for this message on a particular transport during a particular session. If there is no
/// well-known message-id field defined then nothing is done. If msgid is null, then the field is cleared.
///
/// msg the message whose well-known message-id field is to be set.
/// msgid the value of the well-known message-id field.
void SetMessageId(Message msg, long? msgid);
///
/// Gets well-known message field for message id.
///
/// well-known message field for message id.
Field Get_mf__messageId();
/////////////////
// IN REPLY TO //
/////////////////
/// the value of the in-reply-to field, or null if there is none or if there is no such field defined.
///
/// msg the message whose well-known in-reply-to field is to be returned.
long? GetInReplyTo(Message msg);
/// msg the message whose well-known in-reply-to field is to be set.
/// msgid the value of the well-known in-reply-to field. If there is no well-known
/// in-reply-to field defined then nothing is done. If msgid is null, then the field is cleared.
///
void SetInReplyTo(Message msg, long? msgid);
///
/// Gets well-known message field for in reply to.
///
/// well-known message field for in reply to.
Field Get_mf__inReplyTo();
//////////////////////
// VALUE CONVERSION //
//////////////////////
/// Converts a value to a struct value representation to be exported to a tagged data output.
/// value a custom type defined by a service, or a well-known standard type (e.g., date).
/// a struct value representing the value.
/// UnsupportedOperationException if the type cannot be exported.
StructValue ExportCustomValue(object value);
/// Converts a struct value imported from a tagged data input to a normal type.
/// sv a struct value representation of a custom type, or a well known standard type.
/// a custom type, or a well known standard type.
/// UnsupportedOperationException if the type cannot be imported.
Object ImportCustomValue(StructValue sv);
///
///
///
/// the class of a custom value.
/// the struct type of a custom value class.
XType GetCustomStructType( Type c );
///
/// well-known message type for exception thrown by one-way message
XType get_mt__exception();
///
/// Gets the put / write validation level.
///
/// the put / write validation level
Validator.Level GetLevel();
///
/// Sets the put / write validation level.
///
/// the new put / write validation level
/// the old put / write validation level
Validator.Level SetLevel(Validator.Level level);
}
}