/***************************************************************************
 *                          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 IBindService
 *   Binding service interface.
 *   NOTE: Bind service DOES NOT hold reference to bind sources, while
 *   bind sources should hold ref to IBindService. It does hold references
 *   to bind-targets indeed.
 *--------------------------------------------------------------------------
 * @created: Monday, June 23, 2003 12:21:34
 */

#if !defined(IBindService_h_included)
#define IBindService_h_included
//forward declaration of this class might require
namespace services
{ class IBindService; class CBindServiceCol; };
#include <zmodeler.h>
#include <core/coreTypes.h>
#include <services/zmServices.h>
#include <services/IService.h>
#include <core/bind/IBindCondition.h>


namespace services
{
  
  class IBindService : public services::IService
  {
  public:
    virtual ZRESULT addBindSource(ZUnknown* pSource)=0;
    virtual ZRESULT removeBindSource(ZUnknown* pSource)=0;
    virtual ZRESULT addBindTarget(ZUnknown* pSource, ZUnknown* pTarget, core::bind::IBindCondition* pCondition=NULL)=0;
    virtual ZRESULT removeBindTarget(ZUnknown* pSource, ZUnknown* pTarget, core::bind::IBindCondition* pCond=NULL)=0;
    /* seqTgt contains non-refholding unknowns */
    virtual ZRESULT getBindTargets(ZUnknown* pSource, ZSequence<ZUnknown*>& seqTgt, core::bind::IBindCondition* pCond=NULL)=0;
    /* Provides set of bind-sources for supplied target interface. If null-target
     * interface supplied, all availabel bind sources are returned. Bind condition
     * is only valid with bind target interface. */
    virtual ZRESULT getBindSources(ZUnknown* pTarget, ZSequence<ZUnknown*>& seqSrc, core::bind::IBindCondition* pCond=NULL)=0;
    virtual ZRESULT addBindCondition(core::bind::IBindCondition* pCond)=0;
    virtual ZRESULT setBindConditions(core::bind::CBindConditionCol* pCond)=0;
    virtual ZRESULT getBindConditions(core::bind::CBindConditionCol** ppCond)=0;
    virtual ZRESULT getConditionByName(LPCTSTR pszName, core::bind::IBindCondition** ppCond)=0;
    /* Initiates a message to bind-targets */
    virtual ZRESULT sourceChange(ZUnknown* pSource)=0;
  
  };//class IBindService
  
  //
  // collection template
  //
  class CBindServiceCol : public ZUnknown,
      public ZIntrCollection<IBindService>
  {
  public:
    INTERFACE_FUNCTIONS_DEFAULT(CBindServiceCol)
  };//class CBindServiceCol
};//services

#endif
