#ifndef INCL_IClassFactory_h
#define INCL_IClassFactory_h

// COPYRIGHT DASSAULT SYSTEMES  1999

/**
 * @CAA2Level L1
 * @CAA2Usage U5
 */


#ifdef _WINDOWS_SOURCE
#include 
#else
#include "IUnknown.h"
#include "CATBooleanDef.h"

/**
 * Boolean flag for @href IClassFactory#LockServer.
 */
typedef unsigned char BOOL;

/**
 * Interface to component factories.
 * <b>Role</b>:
 * Objects that implement IClassFactory instantiate components using their CLSIDs as input,
 * and retrieve a pointer to the requested interface passed as an output argument to the client.
 */
class IClassFactory : public IUnknown {

public:

  /**
   * Creates an uninitialized component of a given CLSID.
   * @param iUnkOuter
   *    A pointer to the aggregating component IUnknown interface.
   *    <br><b>Legal values</b>: NULL if the client is not an aggregating component,
   *    and a pointer to its IUnknwon interface otherwise.
   * @param iIid
   *    A reference to the identifier to an interface that the component implmeents
   *    and for which the client request a pointer to be retrieved.
   *    <br><b>Legal values</b>: Should be expressed as IID_CATIXX,
   *    where CATIXX is the interface to which a pointer is requested
   * @param oObject
   *    The address of the pointer to the requested interface
   * @return
   *   An HRESULT.
   *    <br><b>Legal values</b>:
   *    <dl>
   *      <dt>S_OK
   *      <dd>The component is successfully created
   *          and the interface pointer is successfully returned
   *      <dt>E_FAIL
   *      <dd>The component was successfully created, * but the interface query failed
   *      </dt>E_NOINTERFACE
   *      <dd>The component was successfully created,
   *          but the it doesn't implement the requested interface
   *      <dt>E_OUTOFMEMORY
   *      <dd>The component allocation failed
   *    </dl>
   */
  virtual HRESULT __stdcall CreateInstance( IUnknown* iUnkOuter, REFIID iIid, void ** oObject ) = 0;

  /**
   * Keeps an out-process server in memory.
   * @param iLock
   *   Locking flag.
   *    <br><b>Legal values</b>: TRUE to keep the server in memory,
   *    and FALSE otherwise
   * @return
   *   An HRESULT.
   *   <br><b>Legal values</b>:
   *   <dl>
   *     <dt>S_OK
   *     <dd>The server is successfully locked or unlocked
   *     <dt>E_FAIL
   *     <dd>The server cannot be accessed
   *   </dl>
   */
  virtual HRESULT __stdcall LockServer( BOOL iLock ) = 0; };
 /* 00000001-0000-0000-C000-000000000046 */
 extern "C" const IID IID_IClassFactory;
 #endif
 #endif