20 m_memoryAllocator(nullptr),
30 bool recoverable =
false;
31 U8*
const data =
static_cast<U8*
>(allocator.
allocate(allocationId, store_size, recoverable));
33 m_inRing.
setup(data, store_size);
35 this->m_detector = &detector;
36 this->m_allocatorId = allocationId;
37 this->m_memoryAllocator = &allocator;
38 this->m_memory = data;
43 if (this->m_memoryAllocator !=
nullptr) {
44 this->m_memoryAllocator->
deallocate(this->m_allocatorId, this->m_memory);
45 this->m_memory =
nullptr;
56 this->processBuffer(buffer);
63 void FrameAccumulator ::processBuffer(
Fw::Buffer& buffer) {
78 const FwSizeType serSize = (ringFreeSize <= remaining) ? ringFreeSize : remaining;
83 static_cast<FwAssertArgType>(offset), static_cast<FwAssertArgType>(serSize));
94 void FrameAccumulator ::processRing() {
105 for (
FwSizeType i = 0; i < ringCapacity; i++) {
109 if (remaining == 0) {
115 status = this->m_detector->
detect(this->m_inRing, size_out);
123 FW_ASSERT(size_out <= remaining, static_cast<FwAssertArgType>(size_out),
124 static_cast<FwAssertArgType>(remaining));
126 FW_ASSERT(size_out <= std::numeric_limits<U32>::max());
133 serialize_status = this->m_inRing.
rotate(size_out);
137 static_cast<FwAssertArgType>(remaining),
static_cast<FwAssertArgType>(size_out));
151 FW_ASSERT(size_out > remaining, static_cast<FwAssertArgType>(size_out),
152 static_cast<FwAssertArgType>(remaining));
159 (void)this->m_inRing.
rotate(1);
162 static_cast<FwAssertArgType>(remaining));
Serialization/Deserialization operation was successful.
Fw::Buffer bufferAllocate_out(FwIndexType portNum, U32 size)
Invoke output port bufferAllocate.
PlatformSizeType FwSizeType
virtual void * allocate(const FwEnumStoreType identifier, FwSizeType &size, bool &recoverable)=0
Allocate memory.
void frameOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port frameOut.
SerializeStatus
forward declaration for string
void log_WARNING_HI_NoBufferAvailable() const
Fw::SerializeStatus serialize(const U8 *const buffer, const FwSizeType size)
Status
status returned from the detection step
Frame detected. Extract frame and return with new data.
FrameAccumulator(const char *const compName)
Construct FrameAccumulator object.
~FrameAccumulator()
Destroy FrameAccumulator object.
Fw::SerializeStatus rotate(FwSizeType amount)
void bufferDeallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferDeallocate.
FwSizeType get_allocated_size() const
More data is needed to detect a frame. Keep current data and return with more.
uint8_t U8
8-bit unsigned integer
FwSizeType get_capacity() const
void cleanup()
Deallocate internal resources (set up by configure() call)
virtual Status detect(const Types::CircularBuffer &data, FwSizeType &size_out) const =0
detect if a frame is available within the circular buffer
Fw::SerializeStatus peek(char &value, FwSizeType offset=0) const
PlatformIndexType FwIndexType
void setup(U8 *const buffer, const FwSizeType size)
void configure(const FrameDetector &detector, FwEnumStoreType allocationId, Fw::MemAllocator &allocator, FwSizeType store_size)
configure memory allocation for the circular buffer
FwSizeType get_free_size() const
Type used to pass context info between components during framing/deframing.
Auto-generated base for FrameAccumulator component.
RateGroupDivider component implementation.
virtual void deallocate(const FwEnumStoreType identifier, void *ptr)=0
Deallocate memory.
interface class used to codify what must be supported to allow frame detection
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.