
// @(#) 1.8 com/src/odscript/idl/oddsemgr.idl, odscript, od96nt, odnt9712d 10/31/96 12:44:16 [3/21/97 17:22:31]
//
//
//     File:          oddsemgr.idl
//
//     Contains:       Class definition for Direct Scripting Event Manager
#ifndef _ODDSEMGR_
#define _ODDSEMGR_

#include <somobj.idl>

typedef somToken ODGUID;
typedef ODGUID * LPODGUID;
typedef void * ODDSRESULT;
typedef somToken DISPID;
typedef somToken ODDSSinkSet;
typedef somToken ODDSSinkEnumSet;
typedef somToken HMTX;
typedef somToken HANDLE ;               // windows handle

interface ODDSConnection;
interface ODDSSinkEnum;
interface ODDSSink;
interface ODDSEventMgr : SOMObject
{
  exception ODDS_ERROR {long ErrorCode; char Reason[80];};
  attribute ODDSConnection connection;
  attribute unsigned long languageId;
  readonly attribute LPODGUID guid;

  long AddSink(in ODDSSink sink) raises(ODDS_ERROR);
               // AddSink:
               //      Verifies that the sink's ODGUID matches the
               //      EventMgr's ODGUID and adds it to the Eventmgr's
               //      sink list.
  long RemoveSink(in ODDSSink sink) raises(ODDS_ERROR);
               // RemoveSink:
               //      Removes the sink from the list
  boolean SinkIsConnnected(in ODDSSink sink) raises(ODDS_ERROR);
               // SinkIsConnected:
               //      returns True if connected. False otherwise.
  long PrepareEventFiring(out long numberOfSinks, out ODDSSinkEnum sinks)
                             raises(ODDS_ERROR);
               //  PrepareEventFiring:
               //      Sets up a single use cursor for calling sinks notifying
               //      them of an event. Each subsequent call to FireEvent will
               //      increment the cursor to notify the next sink.
               //      Returns error if another cursor is present.
  long FireEvent(in ODDSSinkEnum sinks, in string eventName, in sequence<any> inputParms,
                     out ODDSRESULT result) raises(ODDS_ERROR);
               //   FireEvent:
               //      Results in a call to the next sink.
               //      If all the sinks have been called, returns error.
  long StopEventFiring( in ODDSSinkEnum sinks);
               // StopEventFiring:
               // Deletes current cursor.
  long CreateSinkEnum(out ODDSSinkEnum sinks) raises(ODDS_ERROR);
               // CreateSinkEnum:
               // Returns an object which can be used to access the Sinks
               // connected to this event manager
  void EventMgrWithGUID(inout somInitCtrl ctrl, in ODGUID guid) raises(ODDS_ERROR);
               //  EventMgrWithGUID:
               //      Constructor for Event Manager. This should be used instead of
               //      the default constructor in order to set the guid.

#ifdef __SOMIDL__

 implementation
 {
    functionprefix = ODDSEventMgr;
    MajorVersion = 1;
    MinorVersion = 0;
    dllname = "oddsevnt.dll";
    EventMgrWithGUID: init;
    somDefaultInit: override, init;
    somDestruct: override;
    releaseorder:
           EventMgrWithGUID,
           AddSink,
           RemoveSink,
           SinkIsConnnected,
           PrepareEventFiring,
           FireEvent,
           StopEventFiring,
           CreateSinkEnum,
           _get_connection,
           _set_connection,
           _get_guid,
           _get_languageId,
           _set_languageId
           ;

     passthru C_xh_before = " #include \"oddsconn.h\" ";
     passthru C_xih_before = " #include \"oddsconn.h\" ";

};
#endif
};

interface ODDSSinkEnum : SOMObject
{

  exception ODDS_ERROR {long ErrorCode; char Reason[80];};
  readonly attribute long count;
  long First(out ODDSSink sink);
  long Next(out ODDSSink sink);

  void Create(inout somInitCtrl ctrl, in sequence<ODDSSink> sinks, in ODDSEventMgr eventMgr );

#ifdef __SOMIDL__

 implementation
 {
    functionprefix = ODDSSinkEnum;
    MajorVersion = 1;
    MinorVersion = 0;

    Create: init;
    somDefaultInit: override, init;
    somDestruct: override;
    releaseorder:
           Create,
           First,
           Next,
           _get_count;

};
#endif
};
#endif // _ODDSEMGR_

