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

import org.etsi.ttcn.tci.TciCDProvided;


/**
 * This class provides a factory mechanism to create a instance of TTCN-3 codec
 * 
 * @category Factory
 */
public class TCIWrapperFactory {

	/**
	 * Registered ITCIRequired implementation
	 */
	private static ITCIRequired instance; 

	/**
	 * Retrieve an instance of the specified codec
	 * @param encodingName 
	 * @return A new instance of the specified codec
	 */
	public static TciCDProvided getCodec(final String encodingName) {
		return instance.getCodec(encodingName);
	}
	
	/**
	 * Private constructor (Singleton pattern) 
	 */
	private TCIWrapperFactory() {
		//empty
	}
	
	/**
	 * Sets the implementation instance to be returned by the factory
	 * @param  impl    Instance of the implementation to be registered
	 */
	public static void setImpl(final ITCIRequired impl) {
		if (instance == null) {
			instance = impl;
		}
	}
	
}
