GCC Code Coverage Report


Directory: Os/
File: Stub/Queue.hpp
Date: 2026-09-03 21:15:10
Exec Total Coverage
Lines: 0 2 0.0%
Functions: 0 2 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 // ======================================================================
2 // \title Os/Stub/Queue.hpp
3 // \brief stub definitions for Os::Queue
4 // ======================================================================
5 #ifndef OS_STUB_QUEUE_HPP
6 #define OS_STUB_QUEUE_HPP
7 #include "Os/Queue.hpp"
8
9 namespace Os {
10 namespace Stub {
11 namespace Queue {
12
13 struct StubQueueHandle : public QueueHandle {};
14
15 //! \brief stub queue implementation with injectable statuses
16 class StubQueue : public QueueInterface {
17 public:
18 //! \brief default queue interface constructor
19 StubQueue() = default;
20
21 //! \brief default queue destructor
22 virtual ~StubQueue() = default;
23
24 //! \brief copy constructor is forbidden
25 StubQueue(const QueueInterface& other) = delete;
26
27 //! \brief copy constructor is forbidden
28 StubQueue(const QueueInterface* other) = delete;
29
30 //! \brief assignment operator is forbidden
31 StubQueue& operator=(const QueueInterface& other) override = delete;
32
33 //! \brief create queue storage
34 //!
35 //! Creates a queue ensuring sufficient storage to hold `depth` messages of `messageSize` size each.
36 //! \param id: identifier of queue
37 //! \param name: name of queue
38 //! \param depth: depth of queue in number of messages
39 //! \param messageSize: size of an individual message
40 //! \return: status of the creation
41 Status create(FwEnumStoreType id,
42 const Fw::ConstStringBase& name,
43 FwSizeType depth,
44 FwSizeType messageSize) override;
45
46 //! \brief teardown the queue
47 //!
48 //! Allow for queues to deallocate resources as part of system shutdown.
49 void teardown() override;
50
51 //! \brief send a message into the queue
52 //!
53 //! Send a message into the queue, providing the message data, size, priority, and blocking type. When
54 //! `blockType` is set to BLOCKING, this call will block on queue full. Otherwise, this will return an error
55 //! status on queue full.
56 //!
57 //! \param buffer: message data
58 //! \param size: size of message data
59 //! \param priority: priority of the message
60 //! \param blockType: BLOCKING to block for space or NONBLOCKING to return error when queue is full
61 //! \return: status of the send
62 Status send(const U8* buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override;
63
64 //! \brief receive a message from the queue
65 //!
66 //! Receive a message from the queue, providing the message destination, capacity, priority, and blocking type.
67 //! When `blockType` is set to BLOCKING, this call will block on queue empty. Otherwise, this will return an
68 //! error status on queue empty. Actual size received and priority of message is set on success status.
69 //!
70 //! \param destination: destination for message data
71 //! \param capacity: maximum size of message data
72 //! \param blockType: BLOCKING to wait for message or NONBLOCKING to return error when queue is empty
73 //! \param actualSize: (output) actual size of message read
74 //! \param priority: (output) priority of message read
75 //! \return: status of the send
76 Status receive(U8* destination,
77 FwSizeType capacity,
78 BlockingType blockType,
79 FwSizeType& actualSize,
80 FwQueuePriorityType& priority) override;
81
82 //! \brief get number of messages available
83 //!
84 //! \return number of messages available
85 FwSizeType getMessagesAvailable() const override;
86
87 //! \brief get maximum messages stored at any given time
88 //!
89 //! Returns the maximum number of messages in this queue at any given time. This is the high-water mark for this
90 //! queue.
91 //! \return queue message high-water mark
92 FwSizeType getMessageHighWaterMark() const override;
93
94 QueueHandle* getHandle() override;
95
96 StubQueueHandle m_handle;
97 };
98
99 } // namespace Queue
100 } // namespace Stub
101 } // namespace Os
102
103 #endif // OS_STUB_QUEUE_HPP
104