Line |
Branch |
Exec |
Source |
1 |
|
|
/** |
2 |
|
|
* @file api.System.hpp |
3 |
|
|
* @author Sergey Baigudin, sergey@baigudin.software |
4 |
|
|
* @copyright 2017-2022, Sergey Baigudin, Baigudin Software |
5 |
|
|
*/ |
6 |
|
|
#ifndef API_SYSTEM_HPP_ |
7 |
|
|
#define API_SYSTEM_HPP_ |
8 |
|
|
|
9 |
|
|
#include "api.Object.hpp" |
10 |
|
|
#include "api.Scheduler.hpp" |
11 |
|
|
#include "api.Heap.hpp" |
12 |
|
|
#include "api.Mutex.hpp" |
13 |
|
|
#include "api.Semaphore.hpp" |
14 |
|
|
#include "api.OutStream.hpp" |
15 |
|
|
|
16 |
|
|
namespace eoos |
17 |
|
|
{ |
18 |
|
|
namespace api |
19 |
|
|
{ |
20 |
|
|
|
21 |
|
|
/** |
22 |
|
|
* @class System |
23 |
|
|
* @brief The operating system syscall interface. |
24 |
|
|
*/ |
25 |
|
|
class System : public Object |
26 |
|
|
{ |
27 |
|
|
|
28 |
|
|
public: |
29 |
|
|
|
30 |
|
|
/** |
31 |
|
|
* @brief Returns the system scheduler. |
32 |
|
|
* |
33 |
|
|
* @return The system scheduler. |
34 |
|
|
*/ |
35 |
|
|
virtual Scheduler& getScheduler() = 0; |
36 |
|
|
|
37 |
|
|
/** |
38 |
|
|
* @brief Returns the system heap memory. |
39 |
|
|
* |
40 |
|
|
* @return The system heap memory. |
41 |
|
|
*/ |
42 |
|
|
virtual Heap& getHeap() = 0; |
43 |
|
|
|
44 |
|
|
/** |
45 |
|
|
* @brief Returns system output character stream. |
46 |
|
|
* |
47 |
|
|
* @return The system output character stream. |
48 |
|
|
*/ |
49 |
|
|
virtual OutStream<char_t>& getOutStreamChar() = 0; |
50 |
|
|
|
51 |
|
|
/** |
52 |
|
|
* @brief Returns system error output character stream. |
53 |
|
|
* |
54 |
|
|
* @return The system error output character stream. |
55 |
|
|
*/ |
56 |
|
|
virtual OutStream<char_t>& getErrorStreamChar() = 0; |
57 |
|
|
|
58 |
|
|
/** |
59 |
|
|
* @brief Creates a new mutex resource. |
60 |
|
|
* |
61 |
|
|
* @return A new mutex resource, or NULLPTR if an error has been occurred. |
62 |
|
|
*/ |
63 |
|
|
virtual Mutex* createMutex() = 0; |
64 |
|
|
|
65 |
|
|
/** |
66 |
|
|
* @brief Creates a new semaphore resource. |
67 |
|
|
* |
68 |
|
|
* @param permits The initial number of permits available. |
69 |
|
|
* @return A new semaphore resource, or NULLPTR if an error has been occurred. |
70 |
|
|
*/ |
71 |
|
|
virtual Semaphore* createSemaphore(int32_t permits) = 0; |
72 |
|
|
|
73 |
|
|
protected: |
74 |
|
|
|
75 |
|
|
/** |
76 |
|
|
* @brief Destructor. |
77 |
|
|
*/ |
78 |
|
|
virtual ~System() = 0; |
79 |
|
|
|
80 |
|
|
}; |
81 |
|
|
|
82 |
|
368 |
inline System::~System() {} |
83 |
|
|
|
84 |
|
|
} // namespace api |
85 |
|
|
} // namespace eoos |
86 |
|
|
#endif // API_SYSTEM_HPP_ |
87 |
|
|
|