I am writing an OOT block in C++ that receives a sequence of numbers and searches through for a sync pattern and passes to its output the sync pattern and the bytes of data which follows it. The QA test shows the block recognizes the pattern and will pass the pattern along with the data that follow it, but there is a problem. The block does not know a priori the number of spurious bytes preceding the sync pattern of bytes, so I cannot set up the true relationship between the ninput_items and noutput_items. However, the block can count the number of bytes that came in before the pattern. This is my problem:
1) In the OOT general_work method: If I set noutput_items = ninput_items, then in addition to passing the correct data to the output, it passes trailing zeros equal to the number of spurious bytes that entered before the pattern.
2) If I set the return noutput_items = ninput_items - cnt (where cnt is the number of spurious bytes before the pattern) depending on where I put noutput_items in the code, it either throws a core dump or cuts off the number of true data.
Also, within the forecast method, I simply use a for loop and set
I will appreciate any help to point me in the right direction in dealing with this non-regular output/ inputs relationship.