/***************************************************************************
 *                          Zanoza Modeler v2.x                            *
 *      This is unpublished propietary source code of Zanoza Software.     *
 *      The copyright notice does not evidence any actual or intended      *
 *                    publication of such source code.                     *
 *                                                                         *
 *                Copyright (c) 2002-2008 Zanoza Software.                 *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg Melashenko
 *--------------------------------------------------------------------------
 * @purpose:  Declaration of the class ILibrary
 *   Generic plug-in library interface
 *--------------------------------------------------------------------------
 * @created: Saturday, September 21, 2002 13:20:00
 */

#if !defined(ILibrary_h_included)
#define ILibrary_h_included
//forward declaration of this class might require
namespace core
{ namespace libs
  { class ILibrary; class CLibraryCol; }; };
#include <zmodeler.h>
#include <core/libs/libtypes.h>
#include <core/ICopyrightInfo.h>


namespace core
{
  namespace libs
  {
    
    class ILibrary : public ZUnknown
    {
    public:
      virtual ZRESULT getDescription(ZStringSeq& desc)=0;
      virtual ZRESULT getCopyrightInfo(core::ICopyrightInfo** ppInfo)=0;
      /* Provides the set of classes information. This
       * sec can be used by ZModeler to map serives
       * tools, filters and other stuff, available in the
       * library */
      virtual ZRESULT getClassesList(tClassInfoSeq& classList)=0;
      virtual ZRESULT createClass(ZString name, ZUnknown** ppUnk)=0;
      virtual ZRESULT getHandle(tModuleHandle& handle)=0;
      virtual ZRESULT setHandle(tModuleHandle handle)=0;
      virtual ZRESULT requires(DWORD& dwFlags)=0;
      /* Called after all libraries were loaded but before zmodeler switches to "started" state.
       * This is where you can perform compatibility tests and perform any library-specific stuff.
       * Note, it's unsafe to access external services and tools in this routine. */
      virtual ZRESULT initialize(void)=0;
      /* Called after tools and services were intialized but before zmodeler switches to "started"
       * state. This is an entrypoint for your shared classes and handlers to be registered. */
      virtual ZRESULT startup(void)=0;
      /* Performs unload-specific stuff. Returns ZRESULT_OK if the library can
       * be safely unloaded */
      virtual ZRESULT unload(bool bOnClose=false)=0;
    
    };//class ILibrary
    
    //
    // collection template
    //
    class CLibraryCol : public ZUnknown,
        public ZIntrCollection<ILibrary>
    {
    public:
      INTERFACE_FUNCTIONS_DEFAULT(CLibraryCol)
    };//class CLibraryCol
  };//libs
};//core

#endif
