Beam-lib  2.16.3
This is the Beam C++ class library.
BEvent1.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BEvent1.h File Event class
3  * T.Barnaby, BEAM Ltd, 2005-07-08
4  * Copyright (c) 2012 All Right Reserved, Beam Ltd, http://www.beam.ltd.uk
5  *******************************************************************************
6  */
7 #ifndef BEvent1_H
8 #define BEvent1_H 1
9 
10 #include <stdint.h>
11 #include <BError.h>
12 
14 
17 class BEvent1 {
18 public:
19  BEvent1(uint32_t type);
20  virtual ~BEvent1();
21 
22  uint32_t getType();
23 
24  // Implementation functions
25  virtual BError getBinary(void* data, uint32_t& size);
26  virtual BError setBinary(void* data, uint32_t& size);
27 private:
28  uint32_t otype;
29 };
30 
31 class BEvent1Error : public BError, public BEvent1 {
32 public:
33  BEvent1Error(int errNo = ErrorOk, BString errStr = "");
34  BError getBinary(void* data, uint32_t& size);
35  BError setBinary(void* data, uint32_t& size);
36 private:
37 };
38 
42 class BEvent1Pipe {
43 public:
44  BEvent1Pipe();
45  ~BEvent1Pipe();
46 
47  void clear();
48  BError sendEvent(BEvent1* event);
49  BError getEvent(BEvent1* event, int timeOutUs = -1);
50 
51  int getReceiveFd();
52 private:
53  int ofds[2];
54 };
55 
56 
60 class BEvent1Int {
61 public:
62  BEvent1Int();
63  ~BEvent1Int();
64 
65  void clear();
66  BError sendEvent(int event);
67  BError getEvent(int& event, int timeOutUs = -1);
68 
69  int getFd();
70 private:
71  int ofds[2];
72 };
73 
74 #endif
~BEvent1Int()
Definition: BEvent1.cpp:140
BEvent1Error(int errNo=ErrorOk, BString errStr="")
Definition: BEvent1.cpp:40
This class provides an interface for sending simple integer events via a file descriptor....
Definition: BEvent1.h:60
Definition: BEvent1.h:13
BError sendEvent(BEvent1 *event)
Send an event.
Definition: BEvent1.cpp:94
Definition: BString.h:18
virtual BError getBinary(void *data, uint32_t &size)
Definition: BEvent1.cpp:22
Definition: BEvent1.h:13
void clear()
Clear events pending.
Definition: BEvent1.cpp:88
BError setBinary(void *data, uint32_t &size)
Definition: BEvent1.cpp:59
BError sendEvent(int event)
Send an event.
Definition: BEvent1.cpp:151
BError getEvent(BEvent1 *event, int timeOutUs=-1)
Receive the event.
Definition: BEvent1.cpp:108
BError getEvent(int &event, int timeOutUs=-1)
Receive the event.
Definition: BEvent1.cpp:159
BEvent1Pipe()
Definition: BEvent1.cpp:78
int getReceiveFd()
returns the receive file descriptor for the poll system call
Definition: BEvent1.cpp:131
BEvent1Type
Definition: BEvent1.h:13
This class provides a base interface for sending events via a pipe. This allows threads to send event...
Definition: BEvent1.h:42
BError getBinary(void *data, uint32_t &size)
Definition: BEvent1.cpp:43
Definition: BEvent1.h:13
virtual BError setBinary(void *data, uint32_t &size)
Definition: BEvent1.cpp:31
BEvent1Int()
Definition: BEvent1.cpp:136
virtual ~BEvent1()
Definition: BEvent1.cpp:15
Definition: BEvent1.h:31
~BEvent1Pipe()
Definition: BEvent1.cpp:82
char data[8]
Definition: BoapMc1.h:21
BEvent1(uint32_t type)
Definition: BEvent1.cpp:12
int getFd()
Definition: BEvent1.cpp:175
Definition: BError.h:25
void clear()
Clear events pending.
Definition: BEvent1.cpp:145
Definition: BError.h:13
This class provides a base class for all event objects that can be sent over the events interface.
Definition: BEvent1.h:17
uint32_t getType()
Definition: BEvent1.cpp:18