Skip to content

Commit

Permalink
Merge pull request #513 from LeStarch/osal/queue
Browse files Browse the repository at this point in the history
Refactors AC queue codegen to be inline with OSAL queue refactor
  • Loading branch information
bocchino authored Sep 26, 2024
2 parents 55d4a48 + e357c06 commit 262b734
Show file tree
Hide file tree
Showing 78 changed files with 927 additions and 927 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,19 @@ case class ComponentCppWriter (
| static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
|);
|
|Os::Queue::QueueStatus qStat = this->createQueue(queueDepth, this->m_msgSize);
|Os::Queue::Status qStat = this->createQueue(queueDepth, this->m_msgSize);
|"""
)
else lines(
"""|Os::Queue::QueueStatus qStat = this->createQueue(
"""|Os::Queue::Status qStat = this->createQueue(
| queueDepth,
| ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
| static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
|);
|"""
),
lines(
"""|FW_ASSERT(
| Os::Queue::QUEUE_OK == qStat,
| Os::Queue::Status::OP_OK == qStat,
| static_cast<FwAssertArgType>(qStat)
|);
|"""
Expand Down Expand Up @@ -745,7 +745,7 @@ case class ComponentCppWriter (
else {
val assertMsgStatus = lines(
"""|FW_ASSERT(
| msgStatus == Os::Queue::QUEUE_OK,
| msgStatus == Os::Queue::OP_OK,
| static_cast<FwAssertArgType>(msgStatus)
|);
|"""
Expand Down Expand Up @@ -777,15 +777,15 @@ case class ComponentCppWriter (
lines(
s"""|FwQueuePriorityType priority = 0;
|
|Os::Queue::QueueStatus msgStatus = this->m_queue.receive(
|Os::Queue::Status msgStatus = this->m_queue.receive(
| msg,
| priority,
| Os::Queue::QUEUE_${if data.kind == Ast.ComponentKind.Queued then "NON" else ""}BLOCKING
| Os::Queue::${if data.kind == Ast.ComponentKind.Queued then "NON" else ""}BLOCKING,
| priority
|);
|""".stripMargin
),
if data.kind == Ast.ComponentKind.Queued then wrapInIfElse(
"Os::Queue::QUEUE_NO_MORE_MSGS == msgStatus",
"Os::Queue::Status::EMPTY == msgStatus",
lines("return Fw::QueuedComponentBase::MSG_DISPATCH_EMPTY;"),
assertMsgStatus
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ abstract class ComponentCppWriterUtils(
val initParams: List[CppDoc.Function.Param] = List.concat(
if data.kind != Ast.ComponentKind.Passive then List(
CppDoc.Function.Param(
CppDoc.Type("FwQueueSizeType"),
CppDoc.Type("FwSizeType"),
"queueDepth",
Some("The queue depth")
)
Expand Down Expand Up @@ -624,8 +624,8 @@ abstract class ComponentCppWriterUtils(
arguments: List[CppDoc.Function.Param]
): List[Line] = {
val queueBlocking = queueFull match {
case Ast.QueueFull.Block => "QUEUE_BLOCKING"
case _ => "QUEUE_NONBLOCKING"
case Ast.QueueFull.Block => "BLOCKING"
case _ => "NONBLOCKING"
}
val priorityNum = priority match {
case Some(num) => num
Expand All @@ -636,20 +636,20 @@ abstract class ComponentCppWriterUtils(
List(
lines(
s"""|// Send message
|Os::Queue::QueueBlocking _block = Os::Queue::$queueBlocking;
|Os::Queue::QueueStatus qStatus = this->m_queue.send($bufferName, $priorityNum, _block);
|Os::Queue::BlockingType _block = Os::Queue::$queueBlocking;
|Os::Queue::Status qStatus = this->m_queue.send($bufferName, $priorityNum, _block);
|"""
),
queueFull match {
case Ast.QueueFull.Drop => lines(
"""|if (qStatus == Os::Queue::QUEUE_FULL) {
"""|if (qStatus == Os::Queue::Status::FULL) {
| this->incNumMsgDropped();
| return;
|}
|"""
)
case Ast.QueueFull.Hook => lines(
s"""|if (qStatus == Os::Queue::QUEUE_FULL) {
s"""|if (qStatus == Os::Queue::Status::FULL) {
| this->${inputOverflowHookName(name, messageType)}(${arguments.map(_.name).mkString(", ")});
| return;
|}
Expand All @@ -659,7 +659,7 @@ abstract class ComponentCppWriterUtils(
},
lines(
"""|FW_ASSERT(
| qStatus == Os::Queue::QUEUE_OK,
| qStatus == Os::Queue::OP_OK,
| static_cast<FwAssertArgType>(qStatus)
|);
|"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ case class ComponentTestImplWriter(
lines(
s"""|
|// Queue depth supplied to the component instance under test
|static const FwQueueSizeType $queueDepthConstantName = 10;
|static const FwSizeType $queueDepthConstantName = 10;
|"""
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace {

void ActiveAsyncProductPortsOnlyComponentBase ::
init(
FwQueueSizeType queueDepth,
FwSizeType queueDepth,
FwEnumStoreType instance
)
{
Expand Down Expand Up @@ -133,12 +133,12 @@ void ActiveAsyncProductPortsOnlyComponentBase ::
#endif
}

Os::Queue::QueueStatus qStat = this->createQueue(
Os::Queue::Status qStat = this->createQueue(
queueDepth,
ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
);
FW_ASSERT(
Os::Queue::QUEUE_OK == qStat,
Os::Queue::Status::OP_OK == qStat,
static_cast<FwAssertArgType>(qStat)
);
}
Expand Down Expand Up @@ -363,11 +363,11 @@ void ActiveAsyncProductPortsOnlyComponentBase ::
);

// Send message
Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING;
Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
Os::Queue::BlockingType _block = Os::Queue::NONBLOCKING;
Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);

FW_ASSERT(
qStatus == Os::Queue::QUEUE_OK,
qStatus == Os::Queue::OP_OK,
static_cast<FwAssertArgType>(qStatus)
);
}
Expand Down Expand Up @@ -439,13 +439,13 @@ Fw::QueuedComponentBase::MsgDispatchStatus ActiveAsyncProductPortsOnlyComponentB
ComponentIpcSerializableBuffer msg;
FwQueuePriorityType priority = 0;

Os::Queue::QueueStatus msgStatus = this->m_queue.receive(
Os::Queue::Status msgStatus = this->m_queue.receive(
msg,
priority,
Os::Queue::QUEUE_BLOCKING
Os::Queue::BLOCKING,
priority
);
FW_ASSERT(
msgStatus == Os::Queue::QUEUE_OK,
msgStatus == Os::Queue::OP_OK,
static_cast<FwAssertArgType>(msgStatus)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ActiveAsyncProductPortsOnlyComponentBase :

//! Initialize ActiveAsyncProductPortsOnlyComponentBase object
void init(
FwQueueSizeType queueDepth, //!< The queue depth
FwSizeType queueDepth, //!< The queue depth
FwEnumStoreType instance = 0 //!< The instance number
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::

void ActiveAsyncProductsComponentBase ::
init(
FwQueueSizeType queueDepth,
FwSizeType queueDepth,
FwEnumStoreType instance
)
{
Expand Down Expand Up @@ -930,12 +930,12 @@ void ActiveAsyncProductsComponentBase ::
#endif
}

Os::Queue::QueueStatus qStat = this->createQueue(
Os::Queue::Status qStat = this->createQueue(
queueDepth,
ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
);
FW_ASSERT(
Os::Queue::QUEUE_OK == qStat,
Os::Queue::Status::OP_OK == qStat,
static_cast<FwAssertArgType>(qStat)
);
}
Expand Down Expand Up @@ -1940,11 +1940,11 @@ void ActiveAsyncProductsComponentBase ::
);

// Send message
Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING;
Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
Os::Queue::BlockingType _block = Os::Queue::NONBLOCKING;
Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);

FW_ASSERT(
qStatus == Os::Queue::QUEUE_OK,
qStatus == Os::Queue::OP_OK,
static_cast<FwAssertArgType>(qStatus)
);
}
Expand Down Expand Up @@ -1986,11 +1986,11 @@ void ActiveAsyncProductsComponentBase ::
);

// Send message
Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING;
Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
Os::Queue::BlockingType _block = Os::Queue::NONBLOCKING;
Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);

FW_ASSERT(
qStatus == Os::Queue::QUEUE_OK,
qStatus == Os::Queue::OP_OK,
static_cast<FwAssertArgType>(qStatus)
);
}
Expand Down Expand Up @@ -2165,11 +2165,11 @@ void ActiveAsyncProductsComponentBase ::
);

// Send message
Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING;
Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
Os::Queue::BlockingType _block = Os::Queue::NONBLOCKING;
Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);

FW_ASSERT(
qStatus == Os::Queue::QUEUE_OK,
qStatus == Os::Queue::OP_OK,
static_cast<FwAssertArgType>(qStatus)
);
}
Expand Down Expand Up @@ -2272,11 +2272,11 @@ void ActiveAsyncProductsComponentBase ::
);

// Send message
Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING;
Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
Os::Queue::BlockingType _block = Os::Queue::NONBLOCKING;
Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);

FW_ASSERT(
qStatus == Os::Queue::QUEUE_OK,
qStatus == Os::Queue::OP_OK,
static_cast<FwAssertArgType>(qStatus)
);
}
Expand Down Expand Up @@ -2379,11 +2379,11 @@ void ActiveAsyncProductsComponentBase ::
);

// Send message
Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_BLOCKING;
Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 10, _block);
Os::Queue::BlockingType _block = Os::Queue::BLOCKING;
Os::Queue::Status qStatus = this->m_queue.send(msg, 10, _block);

FW_ASSERT(
qStatus == Os::Queue::QUEUE_OK,
qStatus == Os::Queue::OP_OK,
static_cast<FwAssertArgType>(qStatus)
);
}
Expand Down Expand Up @@ -2486,16 +2486,16 @@ void ActiveAsyncProductsComponentBase ::
);

// Send message
Os::Queue::QueueBlocking _block = Os::Queue::QUEUE_NONBLOCKING;
Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 5, _block);
Os::Queue::BlockingType _block = Os::Queue::NONBLOCKING;
Os::Queue::Status qStatus = this->m_queue.send(msg, 5, _block);

if (qStatus == Os::Queue::QUEUE_FULL) {
if (qStatus == Os::Queue::Status::FULL) {
this->incNumMsgDropped();
return;
}

FW_ASSERT(
qStatus == Os::Queue::QUEUE_OK,
qStatus == Os::Queue::OP_OK,
static_cast<FwAssertArgType>(qStatus)
);
}
Expand Down Expand Up @@ -2931,13 +2931,13 @@ Fw::QueuedComponentBase::MsgDispatchStatus ActiveAsyncProductsComponentBase ::
ComponentIpcSerializableBuffer msg;
FwQueuePriorityType priority = 0;

Os::Queue::QueueStatus msgStatus = this->m_queue.receive(
Os::Queue::Status msgStatus = this->m_queue.receive(
msg,
priority,
Os::Queue::QUEUE_BLOCKING
Os::Queue::BLOCKING,
priority
);
FW_ASSERT(
msgStatus == Os::Queue::QUEUE_OK,
msgStatus == Os::Queue::OP_OK,
static_cast<FwAssertArgType>(msgStatus)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class ActiveAsyncProductsComponentBase :

//! Initialize ActiveAsyncProductsComponentBase object
void init(
FwQueueSizeType queueDepth, //!< The queue depth
FwSizeType queueDepth, //!< The queue depth
FwEnumStoreType instance = 0 //!< The instance number
);

Expand Down
Loading

0 comments on commit 262b734

Please sign in to comment.