// Bus.h : déclaration de CBus #pragma once #include "resource.h" // symboles principaux #include "Ivy.h" #include "Expression.h" // IBus [ object, uuid("D694594D-D119-443B-B3CB-58F6859CE990"), dual, helpstring("Interface IBus"), pointer_default(unique) ] __interface IBus : IDispatch { [id(1), helpstring("method Start")] HRESULT Start([in] BSTR domain); [id(2), helpstring("method Stop")] HRESULT Stop(void); [id(3), helpstring("method Create")] HRESULT Create([in] BSTR appName, [in] BSTR readyMsg); [id(4), helpstring("method Delete")] HRESULT Delete(void); [id(5), helpstring("method Send")] HRESULT Send([in] BSTR message, [out,retval] SHORT* count); [id(6), helpstring("method Bind")] HRESULT Bind([in] BSTR regexp, [out,retval] IExpression** binding); [id(7), helpstring("method GetDomain")] HRESULT GetDomain([out,retval] BSTR* domain); }; // _IBusEvents [ dispinterface, uuid("59377CC5-59FD-480F-B761-644C40190920"), helpstring("Interface _IBusEvents") ] __interface _IBusEvents { [id(1), helpstring("method ApplicationConnected")] void ApplicationConnected([in] BSTR applicationName); [id(2), helpstring("method ApplicationDisconnected")] void ApplicationDisconnected([in] BSTR applicationName); }; // CBus [ coclass, threading("apartment"), event_source("com"), vi_progid("comIvy.Bus"), progid("comIvy.Bus"), version(2.0), uuid("537805F0-1950-40B6-9833-DD5F8E8A19B7"), helpstring("Bus Class") ] class ATL_NO_VTABLE CBus : public IBus, public IvyApplicationCallback { public: CBus(); ~CBus(); friend class CExpression; __event __interface _IBusEvents; DECLARE_PROTECT_FINAL_CONSTRUCT() HRESULT FinalConstruct() { return S_OK; } void FinalRelease() { } public: STDMETHOD(Start)(BSTR domain); STDMETHOD(Stop)(void); STDMETHOD(Create)(BSTR appname, BSTR readyMsg); STDMETHOD(Delete)(void); STDMETHOD(Send)(BSTR message, SHORT* count); STDMETHOD(Bind)(BSTR regexp, IExpression** binding); protected: Ivy* bus; void OnApplicationConnected(IvyApplication * app); void OnApplicationDisconnected(IvyApplication * app); public: STDMETHOD(GetDomain)(BSTR* domain); };