Beamlib  3.0.1
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) 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 BEvent1_H
9 #define BEvent1_H 1
10 
11 #include <stdint.h>
12 #include <BError.h>
13 
15 
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 
32 class BEvent1Error : public BError, public BEvent1 {
33 public:
34  BEvent1Error(int errNo = ErrorOk, BString errStr = "");
35  BError getBinary(void* data, uint32_t& size);
36  BError setBinary(void* data, uint32_t& size);
37 private:
38 };
39 
41 class BEvent1Pipe {
42 public:
43  BEvent1Pipe();
44  ~BEvent1Pipe();
45 
46  void clear();
47  BError sendEvent(BEvent1* event);
48  BError getEvent(BEvent1* event, int timeOutUs = -1);
49 
50  int getReceiveFd();
51 private:
52  int ofds[2];
53 };
54 
55 
57 class BEvent1Int {
58 public:
59  BEvent1Int();
60  ~BEvent1Int();
61 
62  void clear();
63  BError sendEvent(int event);
64  BError getEvent(int& event, int timeOutUs = -1);
65 
66  int getFd();
67 private:
68  int ofds[2];
69 };
70 
71 #endif
@ ErrorOk
Definition: BError.h:23
BEvent1Type
Definition: BEvent1.h:14
@ BEvent1TypeError
Definition: BEvent1.h:14
@ BEvent1TypeNone
Definition: BEvent1.h:14
@ BEvent1TypeInt
Definition: BEvent1.h:14
char data[8]
Definition: BoapMc1.h:2
Error return class. This class is used to return the error status from a function....
Definition: BError.h:31
This class provides a class to send a BError event.
Definition: BEvent1.h:32
BEvent1Error(int errNo=ErrorOk, BString errStr="")
Definition: BEvent1.cpp:42
BError setBinary(void *data, uint32_t &size)
Definition: BEvent1.cpp:61
BError getBinary(void *data, uint32_t &size)
Definition: BEvent1.cpp:45
This class provides an interface for sending simple integer events via a file descriptor....
Definition: BEvent1.h:57
BEvent1Int()
Definition: BEvent1.cpp:138
void clear()
Clear events pending.
Definition: BEvent1.cpp:147
BError getEvent(int &event, int timeOutUs=-1)
Receive the event.
Definition: BEvent1.cpp:161
BError sendEvent(int event)
Send an event.
Definition: BEvent1.cpp:153
~BEvent1Int()
Definition: BEvent1.cpp:142
int getFd()
Definition: BEvent1.cpp:177
This class provides a base interface for sending events via a pipe. This allows threads to send event...
Definition: BEvent1.h:41
BEvent1Pipe()
Definition: BEvent1.cpp:80
int getReceiveFd()
returns the receive file descriptor for the poll system call
Definition: BEvent1.cpp:133
~BEvent1Pipe()
Definition: BEvent1.cpp:84
BError sendEvent(BEvent1 *event)
Send an event.
Definition: BEvent1.cpp:96
BError getEvent(BEvent1 *event, int timeOutUs=-1)
Receive the event.
Definition: BEvent1.cpp:110
void clear()
Clear events pending.
Definition: BEvent1.cpp:90
This class provides a base class for all event objects that can be sent over the events interface.
Definition: BEvent1.h:17
BEvent1(uint32_t type)
Definition: BEvent1.cpp:14
virtual BError setBinary(void *data, uint32_t &size)
Definition: BEvent1.cpp:33
uint32_t getType()
Definition: BEvent1.cpp:20
virtual BError getBinary(void *data, uint32_t &size)
Definition: BEvent1.cpp:24
virtual ~BEvent1()
Definition: BEvent1.cpp:17
This class stores and manipulates ASCII strings.
Definition: BString.h:20