Project

General

Profile

Actions

Support Request #19542

closed

Using Dynamic vectors as inputs

Added by hidden about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Customer:
CARIAD
Department:
T3-HD
Requester's Priority:
Normal
Support Level:
2nd Level
Resolution:
Solved Issue
Product Issue Numbers:
Affected Products:
Platform:
Windows 10 64bit
Topic:
ADTF::FilterSDK
FAQ Links:

Description

Support Request:

I want to understand if i can send dynamic vectors as inputs to my ADTF filters as Streams. I have this question because I want to know then how do I configure the input pin in this case? I also want to keep the input type anonymous. Additionally, how would my description file look in this case?
Please let me know.

Solution:

I want to understand if i can send dynamic vectors as inputs to my ADTF filters as Streams
I also want to keep the input type anonymous.

Sure, even though that implies you will then also have to work with the raw sample buffers, and you can't use any of the strongly typed (and size checking) helpers like sample_data<T> and alike.

I have this question because I want to know then how do I configure the input pin in this case?

Check /src/examples/src/adtf/filters/standard_filters/custom_stream_type/stream_type_custom_sensor.h in your ADTF copy for an example, and https://support.digitalwerk.net/adtf/v3/adtf_html/classadtf_1_1streaming_1_1ant_1_1stream__meta__type.html for the documentation of the template your type definition needs to work with.

Additionally, how would my description file look in this case?

You don't have any. Unstructured data with arbitrary dynamic elements can't be described in DDL4. At most it will be able to describe a preamble to your dynamic data which has a static layout (think e.g. Ethernet headers), but everything starting from the first dynamic byte can't be expressed. This will also render it completely unusable with any type of the display, they will not give you any information other than "there was a sample".

Can ADTF in general have such a dynamic input?

Yes, that is supported. Raw buffer access (without using the higher level sample_data helpers etc.) is possible:

//Buffer access is permitted as long as the (read) lock is held
ucom::object_ptr_shared_locked<const streaming::ISampleBuffer> pBuffer;
RETURN_IF_FAILED(pSample->Lock(pBuffer));
your_call(/* raw, unaligned byte-buffer */ static_cast<const uint8_t*>(pBuffer->GetPtr()), /* size of buffer in bytes */ pBuffer->GetSize());

You will need to deal with reinterpret-casts or safe unaligned memory accesses yourself, but I expect you are versed in how to operate with C-style raw buffers.

Actions

Also available in: Atom PDF