/**
 * Fractal Runtime
 *
 * Copyright (C) 2009 STMicroelectronics
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 * Contact: mind@ow2.org
 *
 * Authors: Matthieu Leclercq
 */


/**
 * A component interface to create component instances.
 */
interface fractal.api.Factory {

  /**
   * Create a new component.
   *
   * @param instance (out parameter) the created instance.
   * @return <code>0</code> if the new instance has been created correctly.
   *      {@link ErrorConst#INSTANTIATION_ERROR} if the instantiation fails.
   */
  int newFcInstance(out void* instance);

  /**
   * Destroy a previously created component.
   *
   * @param instance the component instance to destroy.
   * @return <code>0</code> if the new instance has been created correctly.
   *      {@link ErrorConst#ILLEGAL_LIFE_CYCLE} if the component has a
   *      {@link LifeCycleController} interface, but it is not in an appropriate
   *      state to perform this operation.
   *      {@link ErrorConst#INSTANTIATION_ERROR} if the destroy fails.
   */
  int destroyFcInstance(in void* instance);

}