TciCDWrapper.java 2.43 KB
Newer Older
filatov's avatar
filatov committed
/**
 * @author	STF 424_ITS_Test_Platform
 * @version	$id$
 */
package org.etsi.tool.testingtech;

import java.math.BigInteger;

import org.etsi.codec.ITciCDWrapper;
import org.etsi.ttcn.tci.FloatValue;
import org.etsi.ttcn.tci.IntegerValue;
import org.etsi.ttcn.tci.OctetstringValue;
import org.etsi.ttcn.tci.Type;
import org.etsi.ttcn.tci.Value;

import de.tu_berlin.cs.uebb.muttcn.runtime.RB;

/** This class implements the ITciCDWrapper interface
 * 
 * Note that the TCI Codec Interface (TCI-CD) describes the operations a TTCN-3 Executable is required to implement and the operations a codec implementation for a certain encoding scheme shall provide to the TE
 * 
 * See ETSI ES 201 873-6 V4.2.1 - Clause 7.3.2.1 TCI-CD required
 */
public class TciCDWrapper implements ITciCDWrapper {

	/**
	 * RuntimeBehavior instance reference
	 */
	private RB _rb;

	/**
	 * Specialized ctor
	 * @param rb TTCN-3 runtime reference
	 */
	public TciCDWrapper(final RB rb) {
		_rb = rb;
	}

	/** Constructs and returns a basic TTCN-3 float type
	 * 
	 * See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.3 getFloat
	 * @return An instance of Type representing a TTCN-3 float type
	 */
	@Override
	public FloatValue getFloat() {
		return (FloatValue)_rb.getTciCDRequired().getFloat().newInstance();
	}

	/** Constructs and returns a basic TTCN-3 integer type
	 * 
	 * See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
	 * @return An instance of Type representing a TTCN-3 integer type
	 */
	@Override
	public IntegerValue getInteger() {
		return (IntegerValue)_rb.getTciCDRequired().getInteger().newInstance();
	}

	/** Constructs and returns a basic TTCN-3 integer type
	 * 
	 * See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
	 * @return An instance of Type representing a TTCN-3 integer type
	 */
	@Override
	public OctetstringValue getOctetstring() {
		return (OctetstringValue)_rb.getTciCDRequired().getOctetstring().newInstance();
	}

	@Override
	public IntegerValue getBigInteger(BigInteger bigInt) {
		return (IntegerValue)_rb.getTciCDRequired().getInteger().newInstance();
	}

	@Override
	public Value getUnionValue(Type decodingHypothesis, String variantName) {
		// TODO Auto-generated method stub
		throw new RuntimeException("Not implemented for TTWB");
	}

	@Override
	public Type getTypeForName(String type) {
		return _rb.getTciCDRequired().getTypeForName(type);
	}

} // End of class TciCDWrapper