/**
 * @author	STF 424_ITS_Test_Platform
 * @version    $URL$
 *             $Id$
 */
package org.etsi.codec;

import org.etsi.ttcn.tci.BitstringValue;
import org.etsi.ttcn.tci.BooleanValue;
import org.etsi.ttcn.tci.CharValue;
import org.etsi.ttcn.tci.CharstringValue;
import org.etsi.ttcn.tci.EnumeratedValue;
import org.etsi.ttcn.tci.FloatValue;
import org.etsi.ttcn.tci.HexstringValue;
import org.etsi.ttcn.tci.IntegerValue;
import org.etsi.ttcn.tci.OctetstringValue;
import org.etsi.ttcn.tci.RecordOfValue;
import org.etsi.ttcn.tci.RecordValue;
import org.etsi.ttcn.tci.TciCDProvided;
import org.etsi.ttcn.tci.Type;
import org.etsi.ttcn.tci.UnionValue;
import org.etsi.ttcn.tci.UniversalCharstringValue;

/** This interface provides the methods which shall be implemented by the TTCN-3 codec
 * 
 * @category Codec
 */
public interface ICodec {

	/** 
	 * This method provides the codec associated to the specified encoding identifier
	 * 
	 * @param encodingName The name of the encoding, specified by the tTCN-3 key words 'with/encode'
	 * @return The codec associated to the specified encoding identifier
	 */
	public TciCDProvided getCodec(final String encodingName);
	
	/**
	 * This method decodes a BitstringValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode
	 * @return A BitstringValue representing the decoded value
	 */
	public BitstringValue decodeBitstringValue(DecodingContext decodingContext, int decodingLength);

	/**
	 * This method decodes a BitstringValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode
	 * @param decodingHypothesis The requested type
	 * @return an <code>BitstringValue</code> representing the decoded value
	 */
	public BitstringValue decodeBitstringValue(DecodingContext decodingContext, int decodingLength, Type decodingHypothesis);

	/**
	 * This method decodes a CharstringValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode
	 * @return an <code>CharstringValue</code> representing the decoded value
	 */
	public CharstringValue decodeCharstringValue(DecodingContext decodingContext, int decodingLength);

	/**
	 * This method decodes the CharstringValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength an integer amount bits to decode.
	 * @param decodingHypothesis The requested type
	 * @return A <code>CharstringValue</code> representing the decoded value
	 */
	public CharstringValue decodeCharstringValue(DecodingContext decodingContext, int decodingLength, Type decodingHypothesis);

	/**
	 * This method decodes an unicode string from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength an integer amount bits to decode.
	 * @return An UniversalCharstringValue representing the decoded value
	 */
	public UniversalCharstringValue decodeUniversalCharstringValue(DecodingContext decodingContext, int decodingLength);

	/**
	 * This method decodes an unicode string from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength an integer amount bits to decode.
	 * @param decodingHypothesis The requested type
	 * @return An UniversalCharstringValue representing the decoded value
	 */
	public UniversalCharstringValue decodeUniversalCharstringValue(DecodingContext decodingContext, int decodingLength, Type decodingHypothesis);

	/**
	 * This method decodes a CharValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode
	 * @return A <code>CharValue</code> representing the decoded value
	 */
	public CharValue decodeCharValue(DecodingContext decodingContext, int decodingLength);

	/**
	 * This method decodes a CharstringValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode
	 * @param decodingHypothesis The requested type
	 * @return an <code>CharValue</code> representing the decoded value
	 */
	public CharValue decodeCharValue(DecodingContext decodingContext, int decodingLength, Type decodingHypothesis);

	/**
	 * This method decodes a FloatValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode.
	 *
	 * @return A <code>FloatValue</code> representing the decoded value
	 */
	public FloatValue decodeFloatValue(DecodingContext decodingContext, int decodingLength);

	/**
	 * This method decodes a FloatValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode.
	 * @param decodingHypothesis The requested type
	 *
	 * @return A <code>FloatValue</code> representing the decoded value
	 */
	public FloatValue decodeFloatValue(DecodingContext decodingContext, int decodingLength, Type decodingHypothesis);

	/**
	 * This method decodes a BooleanValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength an integer amount bits to decode
	 * @return an <code>BooleanValue</code> representing the decoded value
	 */
	public BooleanValue decodeBooleanValue(DecodingContext decodingContext, int decodingLength);

	/**
	 * This method decodes a BooleanValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @return an <code>BooleanValue</code> representing the decoded value
	 */
	public BooleanValue decodeBooleanValue(DecodingContext decodingContext);

	/**
	 * This method decodes a BooleanValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingHypothesis The requested type
	 * @return an <code>BooleanValue</code> representing the decoded value
	 */
	public BooleanValue decodeBooleanValue(DecodingContext decodingContext, Type decodingHypothesis);

	/**
	 * This method decodes a HexstringValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode.
	 *
	 * @return A <code>HexstringValue</code> representing the decoded value
	 */
	public HexstringValue decodeHexstringValue(DecodingContext decodingContext, int decodingLength);

	/**
	 * This method decodes an HexstringValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode
	 * @param decodingHypothesis The requested type
	 *
	 * @return An <code>HexstringValue</code> representing the decoded value
	 */
	public HexstringValue decodeHexstringValue(DecodingContext decodingContext, int decodingLength, Type decodingHypothesis);

	/**
	 * This method decodes a IntegerValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode
	 *
	 * @return An <code>IntegerValue</code> representing the decoded value
	 */
	public IntegerValue decodeIntegerValue(DecodingContext decodingContext, int decodingLength);

	/**
	 * This method decodes a IntegerValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 *
	 * @return An <code>IntegerValue</code> representing the decoded value
	 */
	public IntegerValue decodeIntegerValue(DecodingContext decodingContext);

	/**
	 * This method decodes a IntegerValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingHypothesis The requested type
	 *
	 * @return An <code>IntegerValue</code> representing the decoded value
	 */
	public IntegerValue decodeIntegerValue(DecodingContext decodingContext, Type decodingHypothesis);

	/**
	 * This method decodes an OctetstringValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode
	 *
	 * @return An <code>OctetstringValue</code> representing the decoded value
	 */
	public OctetstringValue decodeOctetstringValue(DecodingContext decodingContext, int decodingLength);

	/**
	 * This method decodes an OctetstringValue from a ByteArray representation at a global bit position
	 *
	 * @param decodingContext The complete encoded message as received at a system port
	 * @param decodingLength An integer amount bits to decode
	 * @param decodingHypothesis The requested type
	 *
	 * @return An <code>OctetstringValue</code> representing the decoded value
	 */
	public OctetstringValue decodeOctetstringValue(DecodingContext decodingContext, int decodingLength, Type decodingHypothesis);

	/** 
	 * This method encodes an HexstringValue in a ByteArray representation at a global bit position
	 *
	 * @param encodingContext The context to encode the TTCN-3 message
	 * @param hv The <code>HexstringValue</code> to encode
	 */
	public void encodeHexstringValue(EncodingContext encodingContext, final HexstringValue hv);

	/** 
	 * This method encodes a BitstringValue in a ByteArray representation at a global bit position
	 *
	 * @param encodingContext The context to encode the TTCN-3 message
	 * @param bv The <code>BitstringValue</code> to encode
	 */
	public void encodeBitstringValue(EncodingContext encodingContext, final BitstringValue bv);

	/** 
	 * This method encodes an Octetstring in a ByteArray representation at a global bit position
	 *
	 * @param encodingContext The context to encode the TTCN-3 message
	 * @param ov The <code>OctetstringValue</code> to encode
	 */
	public void encodeOctetstringValue(EncodingContext encodingContext, final OctetstringValue ov);

	/** 
	 * This method encodes an BooleanValue in a ByteArray representation at a global bit position
	 *
	 * Note that:
	 * - true -> 0x01
	 * - false -> 0x00
	 *
	 * @param encodingContext The context to encode the TTCN-3 message
	 * @param boolValue The <code>BooleanValue</code> to encode
	 */
	public void encodeBooleanValue(EncodingContext encodingContext, final BooleanValue boolValue);

	/**
	 * This method encodes an IntegerValue in a ByteArray representation at a global position <code>_bitpos</code>
	 * 
	 * @param encodingContext The context to encode the TTCN-3 message
	 * @param intValue The <code>IntegerValue</code> to encode
	 */
	public void encodeIntegerValue(EncodingContext encodingContext, final IntegerValue intValue);
	
	/** This method encodes an UniversalCharstringValue in a ByteArray representation at a global bit position
	 *
	 * @param encodingContext The context to encode the TTCN-3 message
	 * @param uniCharstringValue The <code>UniversalCharstringValue</code> to encode
	 */
	public void encodeUniversalCharstringValue(EncodingContext encodingContext, final UniversalCharstringValue uniCharstringValue);

	/** 
	 * This method encodes an CharstringValue in a ByteArray representation at a global bit position
	 *
	 * @param encodingContext The context to encode the TTCN-3 message
	 * @param charstringValue The <code>CharstringValue</code> to encode
	 */
	public void encodeCharstringValue(EncodingContext encodingContext, final CharstringValue charstringValue);

	/**
	 * This method encodes an EnumeratedValue in a ByteArray representation at a global bit position
	 *
	 * Note that it is encoded as an the integer Value
	 * 
	 * @param encodingContext The context to encode the TTCN-3 message
	 * @param value The <code>EnumeratedValue</code> to encode
	 */
	public void encodeEnumeratedValue(EncodingContext encodingContext, final EnumeratedValue value);

	/**
	 * This method encodes a FloatValue in a ByteArray representation at a global bit position. 
	 *
	 * @param encodingContext The context to encode the TTCN-3 message.
	 * @param value The <code>FloatValue</code> to encode.
	 */ 
	public void encodeFloatValue(EncodingContext encodingContext, final FloatValue value);

	/** 
	 * This method encodes a RecordValue in a ByteArray representation at a global bit position
	 *
	 * @param encodingContext The EncodingContext collect the ByteArray
	 * @param rv The <code>RecordValue</code> to encode
	 */
	public void encodeRecordValue(EncodingContext encodingContext, final RecordValue rv);

	/** 
	 * This method encodes a RecordOfValue in a ByteArray representation at a global bit position
	 *
	 * @param encodingContext The EncodingContext collect the ByteArray
	 * @param rov The <code>RecordOfValue</code> to encode
	 */
	public void encodeRecordofValue(EncodingContext encodingContext, final RecordOfValue rov);

	/** 
	 * This method encodes an UnionValue in a ByteArray representation at a global bit position
	 *
	 * @param encodingContext The context to encode the TTCN-3 message
	 * @param uv The <code>UnionValue</code> to encode
	 */
	public void encodeUnionValue(EncodingContext encodingContext, final UnionValue uv);
	
} // End of class AbstractTciCDProvided
