summaryrefslogtreecommitdiff
path: root/comm/BusAccess.h
blob: e0bcdf1dd8d548b2fba0a514037a431b3e904081 (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
/*
 *	The Unix Channel
 *
 *	by Michel Beaudouin-Lafon
 *
 *	Copyright 1990-1997
 *	Laboratoire de Recherche en Informatique (LRI)
 *
 *	Bus access, by Stephane Chatty
 *
 *	$Id$
 *	$CurLog$
 */


#ifndef BusAccess_H_
#define BusAccess_H_

#include "Datagram.h"
#include "Stream.h"
#include "SignalHandler.h"
#include "ccu/List.h"
#include "ccu/IdTable.h"

class UchBusSubscription;
class UchBusTrigger;
class DnnBaseReaction;

class UchBusAccess : public UchDatagram, public UchBaseSignalHandler {
friend	class	UchBusAgent;

protected:
static	int	Version;
	sword	ListenPort;
	sword	BroadcastPort;
	UchStream*	Server;
	CcuListOf<UchBusAgent>	Agents;
	CcuListOf<UchBusTrigger>	LocalSubscriptions;
	CcuIdTableOf<UchBusTrigger>	IdToSubscription;

	void	HandleRead ();
	void	DeferredHandle (int);
	void	HandleEvent (int, const char*);

public:
		UchBusAccess (sword);
		~UchBusAccess ();
	void	Subscribe (DnnBaseReaction&, const char*);
	void	Emit (const char*, ...);
};

#endif	/* BusAccess_H_ */