F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Models.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Os/Models/Models.cpp
3 // \brief test used to validate Os/Models before use
4 // ======================================================================
16 #include "Os/File.hpp"
17 #include "Os/Task.hpp"
18 #include "Os/Mutex.hpp"
19 #include "Os/Directory.hpp"
20 #include "Os/FileSystem.hpp"
21 #include "Os/Os.hpp"
22 #include "Os/RawTime.hpp"
23 #include "Os/Queue.hpp"
24 
25 // Check consistency of every constant in the Os::File::Status enum
26 static_assert(static_cast<FwIndexType>(Os::File::Status::MAX_STATUS) ==
28  "File status and FPP shadow enum have inconsistent number of values");
30  "File status and FPP shadow enum do not match");
31 static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::DOESNT_EXIST) == Os::FileStatus::T::DOESNT_EXIST,
32  "File status and FPP shadow enum do not match");
34  "File status and FPP shadow enum do not match");
35 static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::NO_PERMISSION) == Os::FileStatus::T::NO_PERMISSION,
36  "File status and FPP shadow enum do not match");
37 static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::BAD_SIZE) == Os::FileStatus::T::BAD_SIZE,
38  "File status and FPP shadow enum do not match");
39 static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::NOT_OPENED) == Os::FileStatus::T::NOT_OPENED,
40  "File status and FPP shadow enum do not match");
41 static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::FILE_EXISTS) == Os::FileStatus::T::FILE_EXISTS,
42  "File status and FPP shadow enum do not match");
43 static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::NOT_SUPPORTED) == Os::FileStatus::T::NOT_SUPPORTED,
44  "File status and FPP shadow enum do not match");
45 static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::INVALID_MODE) == Os::FileStatus::T::INVALID_MODE,
46  "File status and FPP shadow enum do not match");
47 static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::INVALID_ARGUMENT) == Os::FileStatus::T::INVALID_ARGUMENT,
48  "File status and FPP shadow enum do not match");
50  "File status and FPP shadow enum do not match");
51 
52 // Check consistency of every constant in the Os::File::Mode enum
53 static_assert(static_cast<FwIndexType>(Os::File::Mode::MAX_OPEN_MODE) ==
55  "File mode and FPP shadow enum have inconsistent number of values");
56 static_assert(static_cast<Os::FileMode::T>(Os::File::Mode::OPEN_NO_MODE) == Os::FileMode::T::OPEN_NO_MODE,
57  "File mode and FPP shadow enum do not match");
58 static_assert(static_cast<Os::FileMode::T>(Os::File::Mode::OPEN_READ) == Os::FileMode::T::OPEN_READ,
59  "File mode and FPP shadow enum do not match");
60 static_assert(static_cast<Os::FileMode::T>(Os::File::Mode::OPEN_CREATE) == Os::FileMode::T::OPEN_CREATE,
61  "File mode and FPP shadow enum do not match");
62 static_assert(static_cast<Os::FileMode::T>(Os::File::Mode::OPEN_WRITE) == Os::FileMode::T::OPEN_WRITE,
63  "File mode and FPP shadow enum do not match");
64 static_assert(static_cast<Os::FileMode::T>(Os::File::Mode::OPEN_SYNC_WRITE) == Os::FileMode::T::OPEN_SYNC_WRITE,
65  "File mode and FPP shadow enum do not match");
66 static_assert(static_cast<Os::FileMode::T>(Os::File::Mode::OPEN_APPEND) == Os::FileMode::T::OPEN_APPEND,
67  "File mode and FPP shadow enum do not Mode");
68 
70  "Task status and FPP shadow enum do not match");
71 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::INVALID_HANDLE) == Os::TaskStatus::T::INVALID_HANDLE,
72  "Task status and FPP shadow enum do not match");
73 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::INVALID_PARAMS) == Os::TaskStatus::T::INVALID_PARAMS,
74  "Task status and FPP shadow enum do not match");
75 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::INVALID_STACK) == Os::TaskStatus::T::INVALID_STACK,
76  "Task status and FPP shadow enum do not match");
77 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::UNKNOWN_ERROR) == Os::TaskStatus::T::UNKNOWN_ERROR,
78  "Task status and FPP shadow enum do not match");
79 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::INVALID_AFFINITY) == Os::TaskStatus::T::INVALID_AFFINITY,
80  "Task status and FPP shadow enum do not match");
81 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::DELAY_ERROR) == Os::TaskStatus::T::DELAY_ERROR,
82  "Task status and FPP shadow enum do not match");
83 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::JOIN_ERROR) == Os::TaskStatus::T::JOIN_ERROR,
84  "Task status and FPP shadow enum do not match");
85 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::ERROR_RESOURCES) == Os::TaskStatus::T::ERROR_RESOURCES,
86  "Task status and FPP shadow enum do not match");
87 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::ERROR_PERMISSION) == Os::TaskStatus::T::ERROR_PERMISSION,
88  "Task status and FPP shadow enum do not match");
89 static_assert(static_cast<Os::TaskStatus::T>(Os::Task::Status::INVALID_STATE) == Os::TaskStatus::T::INVALID_STATE,
90  "Task status and FPP shadow enum do not match");
91 
93  "Mutex status and FPP shadow enum do not match");
94 static_assert(static_cast<Os::MutexStatus::T>(Os::Mutex::Status::ERROR_BUSY) == Os::MutexStatus::T::ERROR_BUSY,
95  "Mutex status and FPP shadow enum do not match");
96 static_assert(static_cast<Os::MutexStatus::T>(Os::Mutex::Status::ERROR_DEADLOCK) == Os::MutexStatus::T::ERROR_DEADLOCK,
97  "Mutex status and FPP shadow enum do not match");
98 static_assert(static_cast<Os::MutexStatus::T>(Os::Mutex::Status::ERROR_OTHER) == Os::MutexStatus::T::ERROR_OTHER,
99  "Mutex status and FPP shadow enum do not match");
100 
101 
102 // Check consistency of every constant in the Os::Directory::Status enum
104  "Directory status and FPP shadow enum do not match");
105 static_assert(static_cast<Os::DirectoryStatus::T>(Os::Directory::Status::DOESNT_EXIST) == Os::DirectoryStatus::T::DOESNT_EXIST,
106  "Directory status and FPP shadow enum do not match");
107 static_assert(static_cast<Os::DirectoryStatus::T>(Os::Directory::Status::NO_PERMISSION) == Os::DirectoryStatus::T::NO_PERMISSION,
108  "Directory status and FPP shadow enum do not match");
109 static_assert(static_cast<Os::DirectoryStatus::T>(Os::Directory::Status::NOT_OPENED) == Os::DirectoryStatus::T::NOT_OPENED,
110  "Directory status and FPP shadow enum do not match");
111 static_assert(static_cast<Os::DirectoryStatus::T>(Os::Directory::Status::NOT_DIR) == Os::DirectoryStatus::T::NOT_DIR,
112  "Directory status and FPP shadow enum do not match");
113 static_assert(static_cast<Os::DirectoryStatus::T>(Os::Directory::Status::NO_MORE_FILES) == Os::DirectoryStatus::T::NO_MORE_FILES,
114  "Directory status and FPP shadow enum do not match");
115 static_assert(static_cast<Os::DirectoryStatus::T>(Os::Directory::Status::FILE_LIMIT) == Os::DirectoryStatus::T::FILE_LIMIT,
116  "Directory status and FPP shadow enum do not match");
117 static_assert(static_cast<Os::DirectoryStatus::T>(Os::Directory::Status::BAD_DESCRIPTOR) == Os::DirectoryStatus::T::BAD_DESCRIPTOR,
118  "Directory status and FPP shadow enum do not match");
119 static_assert(static_cast<Os::DirectoryStatus::T>(Os::Directory::Status::ALREADY_EXISTS) == Os::DirectoryStatus::T::ALREADY_EXISTS,
120  "Directory status and FPP shadow enum do not match");
121 static_assert(static_cast<Os::DirectoryStatus::T>(Os::Directory::Status::NOT_SUPPORTED) == Os::DirectoryStatus::T::NOT_SUPPORTED,
122  "Directory status and FPP shadow enum do not match");
124  "Directory status and FPP shadow enum do not match");
125 
126 
127 // Check consistency of every constant in the Os::Directory::Mode enum
128 static_assert(static_cast<FwIndexType>(Os::Directory::OpenMode::MAX_OPEN_MODE) ==
130  "File mode and FPP shadow enum have inconsistent number of values");
131 static_assert(static_cast<Os::DirectoryOpenMode::T>(Os::Directory::OpenMode::READ) == Os::DirectoryOpenMode::T::READ,
132  "Directory mode and FPP shadow enum do not match");
133 static_assert(static_cast<Os::DirectoryOpenMode::T>(Os::Directory::OpenMode::CREATE_IF_MISSING) == Os::DirectoryOpenMode::T::CREATE_IF_MISSING,
134  "Directory mode and FPP shadow enum do not match");
135 static_assert(static_cast<Os::DirectoryOpenMode::T>(Os::Directory::OpenMode::CREATE_EXCLUSIVE) == Os::DirectoryOpenMode::T::CREATE_EXCLUSIVE,
136  "Directory mode and FPP shadow enum do not match");
137 
138 
139 // Check consistency of every constant in the Os::FileSystem::Status enum
141  "FileSystem status and FPP shadow enum do not match");
142 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::ALREADY_EXISTS) == Os::FileSystemStatus::T::ALREADY_EXISTS,
143  "FileSystem status and FPP shadow enum do not match");
145  "FileSystem status and FPP shadow enum do not match");
146 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::NO_PERMISSION) == Os::FileSystemStatus::T::NO_PERMISSION,
147  "FileSystem status and FPP shadow enum do not match");
148 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::NOT_DIR) == Os::FileSystemStatus::T::NOT_DIR,
149  "FileSystem status and FPP shadow enum do not match");
150 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::IS_DIR) == Os::FileSystemStatus::T::IS_DIR,
151  "FileSystem status and FPP shadow enum do not match");
152 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::NOT_EMPTY) == Os::FileSystemStatus::T::NOT_EMPTY,
153  "FileSystem status and FPP shadow enum do not match");
154 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::INVALID_PATH) == Os::FileSystemStatus::T::INVALID_PATH,
155  "FileSystem status and FPP shadow enum do not match");
156 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::DOESNT_EXIST) == Os::FileSystemStatus::T::DOESNT_EXIST,
157  "FileSystem status and FPP shadow enum do not match");
158 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::FILE_LIMIT) == Os::FileSystemStatus::T::FILE_LIMIT,
159  "FileSystem status and FPP shadow enum do not match");
160 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::BUSY) == Os::FileSystemStatus::T::BUSY,
161  "FileSystem status and FPP shadow enum do not match");
162 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::NO_MORE_FILES) == Os::FileSystemStatus::T::NO_MORE_FILES,
163  "FileSystem status and FPP shadow enum do not match");
164 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::BUFFER_TOO_SMALL) == Os::FileSystemStatus::T::BUFFER_TOO_SMALL,
165  "FileSystem status and FPP shadow enum do not match");
166 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::EXDEV_ERROR) == Os::FileSystemStatus::T::EXDEV_ERROR,
167  "FileSystem status and FPP shadow enum do not match");
168 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::OVERFLOW_ERROR) == Os::FileSystemStatus::T::OVERFLOW_ERROR,
169  "FileSystem status and FPP shadow enum do not match");
170 static_assert(static_cast<Os::FileSystemStatus::T>(Os::FileSystem::Status::NOT_SUPPORTED) == Os::FileSystemStatus::T::NOT_SUPPORTED,
171  "FileSystem status and FPP shadow enum do not match");
173  "FileSystem status and FPP shadow enum do not match");
174 
175 
176 // Check consistency of every constant in the Os::RawTime::Status enum
178  "RawTime status enums do not match");
179 static_assert(static_cast<Os::RawTimeStatus::T>(Os::RawTime::Status::OP_OVERFLOW) == Os::RawTimeStatus::T::OP_OVERFLOW,
180  "RawTime status enums do not match");
181 static_assert(static_cast<Os::RawTimeStatus::T>(Os::RawTime::Status::INVALID_PARAMS) == Os::RawTimeStatus::T::INVALID_PARAMS,
182  "RawTime status enums do not match");
184  "Generic status enums do not match");
185 
186 // Check consistency of every constant in the Os::Queue::Status enum
188  "Queue status enums do not match");
189 static_assert(static_cast<Os::QueueStatus::T>(Os::Queue::Status::ALREADY_CREATED) == Os::QueueStatus::T::ALREADY_CREATED,
190  "Queue status enums do not match");
191 static_assert(static_cast<Os::QueueStatus::T>(Os::Queue::Status::EMPTY) == Os::QueueStatus::T::EMPTY,
192  "Queue status enums do not match");
193 static_assert(static_cast<Os::QueueStatus::T>(Os::Queue::Status::UNINITIALIZED) == Os::QueueStatus::T::UNINITIALIZED,
194  "Queue status enums do not match");
195 static_assert(static_cast<Os::QueueStatus::T>(Os::Queue::Status::SIZE_MISMATCH) == Os::QueueStatus::T::SIZE_MISMATCH,
196  "Queue status enums do not match");
197 static_assert(static_cast<Os::QueueStatus::T>(Os::Queue::Status::SEND_ERROR) == Os::QueueStatus::T::SEND_ERROR,
198  "Queue status enums do not match");
199 static_assert(static_cast<Os::QueueStatus::T>(Os::Queue::Status::RECEIVE_ERROR) == Os::QueueStatus::T::RECEIVE_ERROR,
200  "Queue status enums do not match");
201 static_assert(static_cast<Os::QueueStatus::T>(Os::Queue::Status::INVALID_PRIORITY) == Os::QueueStatus::T::INVALID_PRIORITY,
202  "Queue status enums do not match");
203 static_assert(static_cast<Os::QueueStatus::T>(Os::Queue::Status::FULL) == Os::QueueStatus::T::FULL,
204  "Queue status enums do not match");
205 static_assert(static_cast<Os::QueueStatus::T>(Os::Queue::Status::UNKNOWN_ERROR) == Os::QueueStatus::T::UNKNOWN_ERROR,
206  "Queue status enums do not match");
207 
208 // Check consistency of every constant in the Os::Queue::BlockingType enum
209 static_assert(static_cast<Os::QueueBlockingType::T>(Os::Queue::BlockingType::BLOCKING) == Os::QueueBlockingType::T::BLOCKING,
210  "Queue BlockingType enums do not match");
211 static_assert(static_cast<Os::QueueBlockingType::T>(Os::Queue::BlockingType::NONBLOCKING) == Os::QueueBlockingType::T::NONBLOCKING,
212  "Queue BlockingType enums do not match");
213 
214 // Check Generic mappings
216  "Generic status enums do not match");
218  "Generic status enums do not match");
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
@ NUM_CONSTANTS
The number of enumerated constants.
T
The raw enum type.
@ NUM_CONSTANTS
The number of enumerated constants.
T
The raw enum type.
@ NUM_CONSTANTS
The number of enumerated constants.
T
The raw enum type.
T
The raw enum type.
T
The raw enum type.
T
The raw enum type.
T
The raw enum type.
@ OP_OK
Operation succeeded.
Definition: Os.hpp:26
@ ERROR
Operation failed.
Definition: Os.hpp:27
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.
@ NO_SPACE
No space left on the device for writing.