ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
graph_utils.h
Go to the documentation of this file.
1
7#pragma once
8
9#include "graph.h"
10#include "samplestream.h"
12#include "filtergraphport.h"
13#include "samplestreaminport.h"
14#include "samplestreamoutport.h"
15#include "data_binding_intf.h"
18#include <memory>
19
20namespace adtf
21{
22
23namespace streaming
24{
25
26namespace devil
27{
40 const util::cString& strCID,
41 const util::cString& strName,
42 const std::map<util::cString, util::cString>& oProperties,
43 int32_t nOrderNumber,
45{
47 RETURN_IF_FAILED(_runtime->CreateInstance(strCID, pNewObject));
48 RETURN_IF_FAILED(pNewObject->SetName(strName));
49 if (!oProperties.empty())
50 {
51 auto pConfiguration = ucom::ucom_cast<base::IConfiguration*>(pNewObject.Get());
52 for (const auto& oProperty: oProperties)
53 {
54 base::set_property_by_path<util::cString>(*pConfiguration, oProperty.first, oProperty.second);
55 }
56 }
57
58 RETURN_IF_FAILED(oGraph.AddNamedGraphObject(pNewObject, nOrderNumber));
59 return pObject.Reset(pNewObject);
60}
61
73 const util::cString& strCID,
74 const util::cString& strName,
75 const std::map<util::cString, util::cString>& oProperties = {},
76 int32_t nOrderNumber = 0)
77{
79 return add_graph_object(oGraph, strCID, strName, oProperties, nOrderNumber, pObject);
80}
81
82inline tResult add_sample_stream(ant::cGraph& oGraph,
83 const util::cString& strName,
84 int32_t nOrderNumber,
86{
88 RETURN_IF_FAILED(oGraph.AddNamedGraphObject(pNewSampleStream, nOrderNumber));
89 return pSampleStream.Reset(pNewSampleStream);
90}
91
100inline tResult add_sample_stream(ant::cGraph& oGraph,
101 const util::cString& strName,
102 int32_t nOrderNumber = 0)
103{
105 return add_sample_stream(oGraph, strName, nOrderNumber, pSampleStream);
106}
107
118 const util::cString& strName,
119 int32_t nOrderNumber,
121{
123 RETURN_IF_FAILED(oGraph.AddNamedGraphObject(pNewBindingProxy, nOrderNumber));
124 return pBindingProxy.Reset(pNewBindingProxy);
125}
126
134inline tResult add_binding_proxy(cGraph& oGraph, const util::cString& strName, int32_t nOrderNumber = 0)
135{
137 return add_binding_proxy(oGraph, strName, nOrderNumber, pBindingProxy);
138}
139
150 const util::cString& strName,
151 int32_t nOrderNumber,
153{
155 RETURN_IF_FAILED(oGraph.AddNamedGraphObject(pNewPort, nOrderNumber));
156 return pPort.Reset(pNewPort);
157}
158
168 const util::cString& strName,
169 int32_t nOrderNumber = 0)
170{
172 return add_data_out_port(oGraph, strName, nOrderNumber, pPort);
173}
174
185 const util::cString& strName,
186 int32_t nOrderNumber,
188{
190 RETURN_IF_FAILED(oGraph.AddNamedGraphObject(pNewPort, nOrderNumber));
191 return pPort.Reset(pNewPort);
192}
193
203 const util::cString& strName,
204 int32_t nOrderNumber = 0)
205{
207 return add_data_in_port(oGraph, strName, nOrderNumber, pPort);
208}
209
221 const util::cString& strName,
222 const util::cString& strPortID,
223 int32_t nOrderNumber,
225{
227 RETURN_IF_FAILED(oGraph.AddNamedGraphObject(pNewPort, nOrderNumber));
228 return pPort.Reset(pNewPort);
229}
230
241 const util::cString& strName,
242 const util::cString& strPortID,
243 int32_t nOrderNumber = 0)
244{
246 return add_sample_stream_out_port(oGraph, strName, strPortID, nOrderNumber, pPort);
247}
248
260 const util::cString& strName,
261 const util::cString& strPortID,
262 int32_t nOrderNumber,
264{
266 RETURN_IF_FAILED(oGraph.AddNamedGraphObject(pNewPort, nOrderNumber));
267 return pPort.Reset(pNewPort);
268}
269
280 const util::cString& strName,
281 const util::cString& strPortID,
282 int32_t nOrderNumber = 0)
283{
285 return add_sample_stream_in_port(oGraph, strName, strPortID, nOrderNumber, pPort);
286}
287
288}
289
290namespace hollow
291{
292
301{
303 pDataBinding->GetPins(oPins);
304 for (auto& pPin: oPins)
305 {
306 oObjects.PushObject(pPin);
307 }
308}
309
318{
320 pInterfaceBinding->GetBindingObjects(oBindingObjects);
321 for (auto& pBindingObject: oBindingObjects)
322 {
323 oObjects.PushObject(pBindingObject);
324 }
325}
326
334{
336 pRuntimeBehaviour->GetRunners(oRunnerObjects);
337 for (auto& pRunner: oRunnerObjects)
338 {
339 oObjects.PushObject(pRunner);
340 }
341}
342
350
357inline void get_graph_objects(ant::IGraph* pGraph,
359{
361 pGraph->GetNamedGraphObjects(oChildren);
362 for (auto& pChild: oChildren)
363 {
364 oObjects.PushObject(pChild);
365 get_child_objects(*pChild, oObjects);
366 }
367}
368
377{
378 using namespace adtf::ucom;
379 auto pDataBinding = ucom_cast<IDataBinding*>(&oObject);
380 if (pDataBinding)
381 {
382 get_data_binding_objects(pDataBinding, oObjects);
383 }
384
385 auto pInterfaceBinding = ucom_cast<IInterfaceBinding*>(&oObject);
386 if (pInterfaceBinding)
387 {
388 get_interface_binding_objects(pInterfaceBinding, oObjects);
389 }
390
391 auto pRuntimeBehaviour = ucom_cast<IRuntimeBehaviour*>(&oObject);
392 if (pRuntimeBehaviour)
393 {
394 get_runner_objects(pRuntimeBehaviour, oObjects);
395 }
396
397 auto pGraph = ucom_cast<IGraph*>(&oObject);
398 if (pGraph)
399 {
400 get_graph_objects(pGraph, oObjects);
401 }
402}
403
404}
405
410using devil::add_sample_stream;
413
419
420}
421
422}
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
The IDataBinding interfaces provides methods for retrive information of the Pins published.
virtual tResult GetPins(ucom::ant::iobject_list< IPin > &lstPins) const =0
Returns the current Pins (only const access).
Defines the Interface used to connect Items to each other.
Definition graph_intf.h:104
virtual tResult GetNamedGraphObjects(ucom::ant::iobject_list< INamedGraphObject > &lstItems) const =0
Gets a every registered graph objects.
The IInterfaceBinding provides an interface to implement and access a common dynamic binding object r...
virtual tResult GetBindingObjects(iobject_list< IBindingObject > &lstBindingObject)=0
Return a list of all Binding Objects on lstBindingObject.
Interface for a NamedGraphObject which can be added to the FilterGraph.
The RuntimeBehaviour interface is to clearly define a filters running entry points (IRunner) and thei...
virtual tResult GetRunners(iobject_list< IRunner > &lstRunners) const =0
Returns the current Runners.
Default implementation for the IFilterGraph interface.
Definition graph.h:22
virtual tResult AddNamedGraphObject(const ucom::ant::iobject_ptr< INamedGraphObject > &pGraphObject, int32_t ui32OrderNumber)
This is to intialize and build an FilterGraph.
Interface definition for a container of objects.
Definition object_list.h:22
virtual tResult PushObject(const value_type &oObject)=0
Pushes a object of value_type to the container.
virtual tResult Reset(const iobject_ptr< T > &i_oOther)=0
Reset this object_ptr<> with the content of another iobject_ptr<>
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Namespace for all functionality of the ADTF Streaming SDK provided since v3.3.
tResult add_sample_stream_out_port(ant::cGraph &oGraph, const util::cString &strName, const util::cString &strPortID, int32_t nOrderNumber, ucom::iobject_ptr< ucom::IObject > &pPort)
adds a Stream Out Port to a graph and return the created port.
tResult add_graph_object(ant::cGraph &oGraph, const util::cString &strCID, const util::cString &strName, const std::map< util::cString, util::cString > &oProperties, int32_t nOrderNumber, ucom::iobject_ptr< ucom::IObject > &pObject)
Convenience functionality to create and add add graph object to a existing graph.
Definition graph_utils.h:39
tResult add_data_in_port(ant::cGraph &oGraph, const util::cString &strName, int32_t nOrderNumber, ucom::iobject_ptr< ucom::IObject > &pPort)
adds an In Port to a graph and return the created port.
tResult add_sample_stream_in_port(ant::cGraph &oGraph, const util::cString &strName, const util::cString &strPortID, int32_t nOrderNumber, ucom::iobject_ptr< ucom::IObject > &pPort)
adds a Stream In Port to a graph and return the created port.
tResult add_binding_proxy(ant::cGraph &oGraph, const util::cString &strName, int32_t nOrderNumber, ucom::iobject_ptr< ucom::IObject > &pBindingProxy)
adds a Binding Proxy to a graph and return the created proxy.
tResult add_data_out_port(ant::cGraph &oGraph, const util::cString &strName, int32_t nOrderNumber, ucom::iobject_ptr< ucom::IObject > &pPort)
adds an Out Port to a graph and return the created port.
void get_runner_objects(ant::IRuntimeBehaviour *pRuntimeBehaviour, ucom::ant::iobject_enum< ucom::ant::IObject > &oObjects)
Get all runner objects object out of pRuntimeBehaviour.
void get_data_binding_objects(ant::IDataBinding *pDataBinding, ucom::ant::iobject_enum< adtf::ucom::ant::IObject > &oObjects)
Get all the data binding objects out of pDataBinding.
void get_graph_objects(ant::IGraph *pGraph, ucom::ant::iobject_enum< ucom::ant::IObject > &oObjects)
Get all graph objects out of the pGraph.
void get_child_objects(ant::INamedGraphObject &oObject, ucom::ant::iobject_enum< ucom::ant::IObject > &oObjects)
Get all child objects of the given oObject.
void get_interface_binding_objects(ant::IInterfaceBinding *pInterfaceBinding, ucom::ant::iobject_enum< adtf::ucom::ant::IObject > &oObjects)
Get all the interface binding objects out of pInterfaceBinding.
Namespace for the ADTF Streaming SDK.
object_enum< T, INTERFACE_TYPE, std::vector > object_vector
Implementation of an iobject_vector<INTERFACE_TYPE> interface by using a std::vector as container typ...
Namespace for the ADTF uCOM3 SDK.
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
object_ptr< Implementation > make_object_ptr(Args &&... args)
Alias always bringing the latest version of ant::make_object_ptr() into scope.
InterfacePointerType ucom_cast(ObjectPointerType i_pObject)
Alias always bringing the latest version of ucom_cast() into scope.
Definition ucom_cast.h:126
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.