summaryrefslogtreecommitdiff
path: root/comIvy/Bus.h
blob: 9494cb17ec49574d3e861551f2e63d0cc48c9429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// 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);
};