BDS Public
Beamlib 3.3.4
This is the Beam C++ class library.
Loading...
Searching...
No Matches
BEvent.h
Go to the documentation of this file.
1/*******************************************************************************
2 * BEvent.h Event class
3 * T.Barnaby, BEAM Ltd, 2005-07-08
4 * Copyright (c) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5 * For license see LICENSE.txt at the root of the beamlib source tree.
6 *******************************************************************************
7 */
8#ifndef BEvent_H
9#define BEvent_H 1
10
11#include <BTypes.h>
12#include <BQueue.h>
13
15class BEvent {
16public:
18
19 BUInt32 type();
20 BUInt32 arg();
21
22private:
23 BUInt32 otype;
24 BUInt32 oarg;
25};
26
29
30
33public:
34 BEventPipe();
36
37 void clear();
38 int getFd();
39
40 BUInt writeAvailable() const;
41 BError write(const BEvent& event, BTimeout timeout = BTimeoutForever);
42
43 BUInt readAvailable() const;
44 BError read(BEvent& event, BTimeout timeout = BTimeoutForever);
45
46private:
47 int ofds[2];
48};
49#endif
BQueue< BEvent > BEventQueue
This class provides an interface for sending simple integer events via a BQueue.
Definition BEvent.h:28
@ BEventTypeNone
Definition BTypes.h:41
const BTimeout BTimeoutForever
Definition BTypes.h:46
BUInt32 BUInt
Definition BTypes.h:33
uint32_t BUInt32
Definition BTypes.h:24
BUInt32 BTimeout
Definition BTypes.h:45
Error return class. This class is used to return the error status from a function....
Definition BError.h:31
This class provides an interface for sending simple integer events via a pipe file descriptor.
Definition BEvent.h:32
int getFd()
Definition BEvent.cpp:41
~BEventPipe()
Definition BEvent.cpp:30
BError read(BEvent &event, BTimeout timeout=BTimeoutForever)
Get an item from the queue.
Definition BEvent.cpp:65
BUInt writeAvailable() const
Definition BEvent.cpp:45
BEventPipe()
Definition BEvent.cpp:26
BUInt readAvailable() const
Definition BEvent.cpp:57
void clear()
Clear events pending.
Definition BEvent.cpp:35
BError write(const BEvent &event, BTimeout timeout=BTimeoutForever)
Append an item onto the queue.
Definition BEvent.cpp:49
An event description class.
Definition BEvent.h:15
BUInt32 arg()
Definition BEvent.cpp:21
BUInt32 type()
Definition BEvent.cpp:17
Provides a thread save queue of objects that can be used to communicate between threads.
Definition BQueue.h:20