38 const std::vector<am_CustomConnectionFormat_t> & listConnectionFormats, std::vector<am_CustomConnectionFormat_t> & outListMergeConnectionFormats)
40 std::vector<am_CustomConnectionFormat_t> listRestrictedConnectionFormats;
42 listRestrictedConnectionFormats);
43 std::sort(listRestrictedConnectionFormats.begin(), listRestrictedConnectionFormats.end());
44 std::insert_iterator<std::vector<am_CustomConnectionFormat_t> > inserter(outListMergeConnectionFormats, outListMergeConnectionFormats.begin());
45 set_intersection(listConnectionFormats.begin(), listConnectionFormats.end(), listRestrictedConnectionFormats.begin(),
46 listRestrictedConnectionFormats.end(), inserter);
51 mpDatabaseHandler(iDatabaseHandler),
52 mpControlSender(iSender),
53 mUpdateGraphNodesAction(true),
62 assert(mpDatabaseHandler);
63 assert(mpControlSender);
67 mUpdateGraphNodesAction =
true;
71 mUpdateGraphNodesAction=
true;
75 mUpdateGraphNodesAction=
true;
79 mUpdateGraphNodesAction=
true;
83 mUpdateGraphNodesAction=
true;
87 mUpdateGraphNodesAction=
true;
91 mUpdateGraphNodesAction=
true;
95 mUpdateGraphNodesAction=
true;
113 if (mUpdateGraphNodesAction)
116 mUpdateGraphNodesAction =
false;
127 std::vector<am_Route_s> & returnList)
134 if (!pRootSource || !pRootSink)
141 if (!returnList.size() && mMaxAllowedCycles > 0)
143 error =
getFirstNShortestPaths(onlyfree, mMaxAllowedCycles, mMaxPathCount, *pRootSource, *pRootSink, returnList);
154 std::vector<am_Route_s> & listRoutes)
164 nodeDataSrc.
type = CAmNodeDataType::SOURCE;
168 auto node = &mRoutingGraph.
addNode(nodeDataSrc);
173 nodeDataSink.
type = CAmNodeDataType::SINK;
177 auto node = &mRoutingGraph.
addNode(nodeDataSink);
182 nodeDataGateway.
type = CAmNodeDataType::GATEWAY;
186 auto node = &mRoutingGraph.
addNode(nodeDataGateway);
191 nodeDataConverter.
type = CAmNodeDataType::CONVERTER;
195 auto node = &mRoutingGraph.
addNode(nodeDataConverter);
199 constructConverterConnections();
200 constructGatewayConnections();
201 constructSourceSinkConnections();
206 std::cout <<
"Node " << node.
getIndex() <<
":";
215 std::cout <<
"Node " << data->
getIndex() <<
":";
219 std::cout <<
"]" << std::endl;
227 mRoutingGraph.
clear();
228 mNodeListSources.clear();
229 mNodeListSinks.clear();
230 mNodeListGateways.clear();
231 mNodeListConverters.clear();
237 for (
auto it = mNodeListSinks.begin(); it != mNodeListSinks.end(); it++)
249 std::vector<CAmRoutingNode*> & value = mNodeListSinks[domainID];
250 auto iter = std::find_if(value.begin(), value.end(), [sinkID](
CAmRoutingNode* node)
252 return node->getData().data.sink->sinkID==sinkID;
254 if (iter != value.end())
262 for (
auto it = mNodeListSources.begin(); it != mNodeListSources.end(); it++)
274 std::vector<CAmRoutingNode*> & value = mNodeListSources[domainID];
275 auto iter = std::find_if(value.begin(), value.end(), [sourceID](
CAmRoutingNode* node)
277 return node->getData().data.source->sourceID==sourceID;
279 if (iter != value.end())
287 std::vector<CAmRoutingNode*> & value = mNodeListConverters[domainID];
288 auto iter = std::find_if(value.begin(), value.end(), [sinkID](
CAmRoutingNode* node)
290 return node->getData().data.converter->sinkID==sinkID;
292 if (iter != value.end())
299 for (
auto it = mNodeListGateways.begin(); it != mNodeListGateways.end(); it++)
301 std::vector<CAmRoutingNode*> & value = it->second;
302 auto iter = std::find_if(value.begin(), value.end(), [sinkID](
CAmRoutingNode* node)
304 return node->getData().data.gateway->sinkID==sinkID;
306 if (iter != value.end())
312 void CAmRouter::constructSourceSinkConnections()
314 std::vector<am_CustomConnectionFormat_t> intersection;
315 for (
auto itSrc = mNodeListSources.begin(); itSrc != mNodeListSources.end(); itSrc++)
317 for (
auto it = itSrc->second.begin(); it != itSrc->second.end(); it++)
322 for (
auto itSink = mNodeListSinks[itSrc->first].begin(); itSink != mNodeListSinks[itSrc->first].end(); itSink++)
328 intersection.clear();
331 if (intersection.size() > 0)
340 void CAmRouter::constructGatewayConnections()
342 std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats;
343 for (
auto iter = mNodeListGateways.begin(); iter != mNodeListGateways.end(); iter++)
345 for (
auto it = iter->second.begin(); it != iter->second.end(); it++)
358 sourceFormats.clear();
364 if (gatewaySourceNode)
376 void CAmRouter::constructConverterConnections()
378 std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats;
380 for (
auto iter = mNodeListConverters.begin(); iter != mNodeListConverters.end(); iter++)
382 for (
auto it = iter->second.begin(); it != iter->second.end(); it++)
391 if (converterSinkNode)
395 sourceFormats.clear();
401 if (converterSourceNode)
416 std::vector<am_CustomConnectionFormat_t> intersection;
418 std::vector<CAmRoutingNode*> & sinks = mNodeListSinks[source->
domainID];
419 for (
auto itSink = sinks.begin(); itSink != sinks.end(); itSink++)
425 intersection.clear();
428 if (intersection.size() > 0)
438 std::vector<am_CustomConnectionFormat_t> intersection;
444 std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats;
450 list.emplace_back(converterNode,
CF_UNKNOWN, 1);
454 std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats;
458 std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats;
464 list.emplace_back(gatewayNode,
CF_UNKNOWN, 1);
472 std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats;
479 if (converterSourceNode)
481 list.emplace_back(converterSourceNode,
CF_UNKNOWN, 1);
489 std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats;
494 if (gatewaySourceNode)
497 list.emplace_back(gatewaySourceNode,
CF_UNKNOWN, 1);
505 if (nodeData.
type == CAmNodeDataType::SOURCE)
507 getVerticesForSource(node, list);
509 else if (nodeData.
type == CAmNodeDataType::SINK)
511 getVerticesForSink(node, list);
513 else if (nodeData.
type == CAmNodeDataType::CONVERTER)
515 getVerticesForConverter(node, list);
517 else if (nodeData.
type == CAmNodeDataType::GATEWAY)
519 getVerticesForGateway(node, list);
523 am_Error_e CAmRouter::determineConnectionFormatsForPath(
am_Route_s & routeObjects, std::vector<CAmRoutingNode*> & nodes, std::vector<am_Route_s> & result)
525 std::vector<am_RoutingElement_s>::iterator routingElementIterator = routeObjects.
route.begin();
526 std::vector<CAmRoutingNode*>::iterator nodeIterator = nodes.begin();
527 if (routingElementIterator != routeObjects.
route.end() && nodeIterator != nodes.end())
528 return doConnectionFormatsForPath(routeObjects, nodes, routingElementIterator, nodeIterator, result);
532 am_Error_e CAmRouter::doConnectionFormatsForPath(
am_Route_s & routeObjects, std::vector<CAmRoutingNode*> & nodes,
533 std::vector<am_RoutingElement_s>::iterator routingElementIterator, std::vector<CAmRoutingNode*>::iterator nodeIterator,
534 std::vector<am_Route_s> & result)
537 std::vector<am_CustomConnectionFormat_t> listConnectionFormats;
538 std::vector<am_CustomConnectionFormat_t> listMergeConnectionFormats;
540 std::vector<CAmRoutingNode*>::iterator currentNodeIterator = nodeIterator;
541 std::vector<am_RoutingElement_s>::iterator currentRoutingElementIterator = routingElementIterator;
543 if (currentRoutingElementIterator != routeObjects.
route.begin())
545 std::vector<am_CustomConnectionFormat_t> listConnectionFormats;
546 std::vector<am_RoutingElement_s>::iterator tempIterator = (currentRoutingElementIterator - 1);
551 if (currentNode->
getData().
type == CAmNodeDataType::GATEWAY)
556 else if (currentNode->
getData().
type == CAmNodeDataType::CONVERTER)
563 currentNodeIterator += 3;
568 if (currentNode->
getData().
type != CAmNodeDataType::SOURCE)
570 currentNodeIterator++;
572 if (currentNodeIterator == nodes.end())
576 if (nodeSink->
getData().
type != CAmNodeDataType::SINK)
582 currentNodeIterator += 1;
585 std::vector<am_CustomConnectionFormat_t> listPriorityConnectionFormats;
586 if ((returnError = mpControlSender->
getConnectionFormatChoice(currentRoutingElementIterator->sourceID, currentRoutingElementIterator->sinkID,
587 routeObjects, listMergeConnectionFormats, listPriorityConnectionFormats)) !=
E_OK)
588 return (returnError);
590 if (listPriorityConnectionFormats.empty())
593 std::vector<am_CustomConnectionFormat_t>::iterator connectionFormatIterator = listPriorityConnectionFormats.begin();
595 std::vector<am_RoutingElement_s>::iterator nextIterator = currentRoutingElementIterator + 1;
596 if (nextIterator == routeObjects.
route.end())
598 for (; connectionFormatIterator != listPriorityConnectionFormats.end(); ++connectionFormatIterator)
600 currentRoutingElementIterator->connectionFormat = *connectionFormatIterator;
601 result.push_back(routeObjects);
606 for (; connectionFormatIterator != listPriorityConnectionFormats.end(); ++connectionFormatIterator)
608 currentRoutingElementIterator->connectionFormat = *connectionFormatIterator;
609 doConnectionFormatsForPath(routeObjects, nodes, nextIterator, currentNodeIterator, result);
615 am_Error_e CAmRouter::cfPermutationsForPath(
am_Route_s shortestRoute, std::vector<CAmRoutingNode*> resultNodesPath, std::vector<am_Route_s>& resultPath)
617 std::vector<am_Route_s> result;
618 am_Error_e err = determineConnectionFormatsForPath(shortestRoute, resultNodesPath, result);
621 resultPath.insert(resultPath.end(), result.begin(), result.end());
624 <<
"Determined connection formats for path from source:" 627 for (
auto routeConnectionFormats : result)
630 for (
auto it = routeConnectionFormats.route.begin();it != routeConnectionFormats.route.end(); it++)
633 if (it - routeConnectionFormats.route.begin() > 0)
636 std::cout << routingElement.
sourceID <<
":" 637 << routingElement.
sinkID <<
" CF:" 649 <<
"Error by determining connection formats for path from source:" 661 std::vector<CAmRoutingNode*> resultNodesPath;
671 resultNodesPath.insert(resultNodesPath.begin(), (
CAmRoutingNode*)&
object);
673 if(routingData.
type==CAmNodeDataType::SINK)
675 auto iter = shortestRoute.
route.emplace(shortestRoute.
route.begin());
681 else if(routingData.
type==CAmNodeDataType::SOURCE)
689 if (shortestRoute.
route.size())
691 err = cfPermutationsForPath(shortestRoute, resultNodesPath, resultPath);
696 int CAmRouter::insertPostion(
const std::vector<CAmRoutingNode*>& path,
const std::vector<std::vector<CAmRoutingNode*> >& nodes)
701 auto itNodes = nodes.begin();
702 for (; itNodes != nodes.end(); itNodes++)
704 if (itNodes->size() > path.size())
707 if (itNodes == nodes.end())
708 index = nodes.size();
710 index = itNodes - nodes.begin();
722 std::vector<am_Route_s> paths;
723 std::vector<std::vector<CAmRoutingNode*>> nodes;
724 std::vector<am_domainID_t> visitedDomains;
725 visitedDomains.push_back(((
CAmRoutingNode*) &aSource)->getData().domainID());
727 auto cbShouldVisitNode = [&visitedDomains, &cycles, &onlyFree,
this](
const CAmRoutingNode * node)->
bool 735 return (!onlyFree || !isComponentConnected(*gateway));
740 return (!onlyFree || !isComponentConnected(*converter));
746 auto cbWillVisitNode = [&visitedDomains](
const CAmRoutingNode * node)
748 auto cbDidVisitNode = [&visitedDomains](
const CAmRoutingNode * node)
749 { visitedDomains.erase(visitedDomains.end()-1);};
750 auto cbDidFinish = [&resultPath, &nodes, &paths, &sinkID, &sourceID](
const std::vector<CAmRoutingNode*> & path)
752 int index = CAmRouter::insertPostion(path, nodes);
753 nodes.emplace(nodes.begin()+index);
754 paths.emplace(paths.begin()+index);
757 nextRoute.
sinkID = sinkID;
760 for(
auto it = path.begin(); it!=path.end(); it++)
763 if(routingData.
type==CAmNodeDataType::SOURCE)
765 auto iter = nextRoute.
route.emplace(nextRoute.
route.end());
771 else if(routingData.
type==CAmNodeDataType::SINK)
780 mRoutingGraph.
getAllPaths(aSource, aSink, cbShouldVisitNode, cbWillVisitNode, cbDidVisitNode, cbDidFinish);
781 unsigned pathsFound = 0;
783 for (
auto it = paths.begin(); pathsFound < maxPathCount && it != paths.end(); it++)
785 cfError = cfPermutationsForPath(*it, nodes[it - paths.begin()], resultPath);
788 pathsFound += (resultPath.size() > 0);
799 unsigned recourseCounter(0);
800 if (visitedDomains.size())
802 if (visitedDomains.back() == nodeDomainID)
806 for (
auto it = visitedDomains.begin(); it != visitedDomains.end() - 1; it++)
808 if (lastDomain != *it)
810 if (nodeDomainID == *it)
813 if (recourseCounter > maxCyclesNumber)
829 const std::vector<am_CustomConnectionFormat_t> & listSourceFormats,
const std::vector<am_CustomConnectionFormat_t> & listSinkFormats,
830 std::vector<am_CustomConnectionFormat_t> & sourceFormats, std::vector<am_CustomConnectionFormat_t> & sinkFormats)
832 const size_t sizeSourceFormats = listSourceFormats.size();
833 const size_t sizeSinkFormats = listSinkFormats.size();
834 const size_t sizeConvertionMatrix = convertionMatrix.size();
836 if (sizeSourceFormats == 0 || sizeSinkFormats == 0 || sizeConvertionMatrix == 0 || sizeConvertionMatrix != sizeSinkFormats * sizeSourceFormats)
841 std::vector<bool>::const_iterator iterator = convertionMatrix.begin();
842 for (; iterator != convertionMatrix.end(); ++iterator)
844 if (
true == *iterator)
846 const size_t index = iterator - convertionMatrix.begin();
847 size_t idx = index % sizeSourceFormats;
848 sourceFormats.push_back(listSourceFormats.at(idx));
849 idx = index / sizeSourceFormats;
850 sinkFormats.push_back(listSinkFormats.at(idx));
853 return sourceFormats.size() > 0;
857 std::vector<am_CustomConnectionFormat_t> & inListSinkFormats, std::vector<am_CustomConnectionFormat_t> & outListFormats)
859 std::sort(inListSourceFormats.begin(), inListSourceFormats.end());
860 std::sort(inListSinkFormats.begin(), inListSinkFormats.end());
861 std::insert_iterator<std::vector<am_CustomConnectionFormat_t> > inserter(outListFormats, outListFormats.begin());
862 set_intersection(inListSourceFormats.begin(), inListSourceFormats.end(), inListSinkFormats.begin(), inListSinkFormats.end(), inserter);
867 std::vector<am_CustomConnectionFormat_t> & listFormats)
870 std::vector<am_CustomConnectionFormat_t>::const_iterator rowSinkIterator = listSinkFormats.begin();
871 std::vector<bool>::const_iterator matrixIterator = convertionMatrix.begin();
874 rowSinkIterator = find(listSinkFormats.begin(), listSinkFormats.end(), connectionFormat);
875 int rowNumberSink = rowSinkIterator - listSinkFormats.begin();
878 std::advance(matrixIterator, rowNumberSink);
885 listFormats.push_back(listSourceFormats.at((matrixIterator - convertionMatrix.begin()) / listSinkFormats.size()));
887 std::advance(matrixIterator, listSinkFormats.size());
888 }
while (convertionMatrix.end() - matrixIterator > 0);
890 return listFormats.size();
894 std::vector<CAmRoutingNode*>::iterator iteratorSink, std::vector<am_CustomConnectionFormat_t> & outConnectionFormats)
897 if (nodeSink->
getData().
type != CAmNodeDataType::SINK)
901 if (nodeSource->
getData().
type != CAmNodeDataType::SOURCE)
911 std::vector<std::vector<CAmRoutingNode*>> & resultNodesPath,
const bool includeCycles,
const bool onlyFree)
923 uint8_t errorsCount = 0, successCount = 0;
926 std::vector<am_Route_s> paths;
927 std::vector<am_domainID_t> visitedDomains;
928 visitedDomains.push_back(((
CAmRoutingNode*) &aSource)->getData().domainID());
937 return (!onlyFree || !isComponentConnected(*gateway));
942 return (!onlyFree || !isComponentConnected(*converter));
951 { visitedDomains.erase(visitedDomains.end()-1);},
952 [&resultPath, &resultNodesPath, &paths, &errorsCount, &successCount, &sinkID, &sourceID](
const std::vector<CAmRoutingNode*> & path)
954 int index = CAmRouter::insertPostion(path, resultNodesPath);
955 resultNodesPath.emplace(resultNodesPath.begin()+index);
956 paths.emplace(paths.begin()+index);
957 resultNodesPath[index] = path;
959 nextRoute.
sinkID = sinkID;
962 for(
auto it = path.begin(); it!=path.end(); it++)
965 if(routingData.
type==CAmNodeDataType::SOURCE)
967 auto iter = nextRoute.
route.emplace(nextRoute.
route.end());
973 else if(routingData.
type==CAmNodeDataType::SINK)
982 for (
auto it = paths.begin(); successCount < mMaxPathCount && it != paths.end(); it++)
984 if (cfPermutationsForPath(*it, resultNodesPath[it - paths.begin()], resultPath) ==
E_UNKNOWN)
CAmRoutingNode * converterNodeWithSinkID(const am_sinkID_t sinkID, const am_domainID_t domainID)
Returns a converter node for given sinkID.
am_sourceID_t sourceID
The sourceID of the converter sink-end.
std::function< void(const am_sourceID_t, const bool)> dboRemovedSource
CAmRoutingNode * sourceNodeWithID(const am_sourceID_t sourceID)
Returns a source node with given sourceID.
std::function< void(const am_Sink_s &)> dboNewSink
virtual am_Error_e enumerateSources(std::function< void(const am_Source_s &element)> cb) const =0
am_sourceID_t sourceID
the source ID
am_domainID_t domainID() const
A Common-API wrapper class, which loads the common-api runtime and instantiates all necessary objects...
the desired object is non existent
am_Error_e
the errors of the audiomanager.
am_domainID_t domainSourceID
The ID of the source.
void getShortestPath(const CAmNode< T > &source, const CAmListNodePtrs &listTargets, std::vector< CAmListNodePtrs > &resultPath)
Finds the shortest path from given node to all nodes in listTargets.
void connectNodes(const CAmNode< T > &first, const CAmNode< T > &last, const V &vertexData, const int16_t weight=1)
Connect first with last node and set user data and weight to the vertex.
std::function< void(const am_sinkID_t, const bool)> dboRemovedSink
This struct describes the attribiutes of a sink.
NodeData & getData()
Setters and getters.
std::function< void(const am_converterID_t)> dboRemoveConverter
am_CustomConnectionFormat_t connectionFormat
the connectionformat that is used for the route
am_sinkID_t sinkID
This is the ID of the sink, it is unique in the system.
CAmNode< T > & addNode(const T &in)
Adds a new node to the graph with given user data.
am_domainID_t controlDomainID
This is the ID of the domain that registers the gateway.
am_NodeDataType_e type
data type:sink, source, gateway or converter
uint16_t am_CustomConnectionFormat_t
This type classifies the format in which data is exchanged within a connection.
am_sourceID_t sourceID
the sourceID where the route starts
am_sinkID_t sinkID
The sinkID of the convertersink-end.
union am::am_RoutingNodeData_s::@0 data
union pointer to sink, source, gateway or converter
static bool getRestrictedOutputFormats(const std::vector< bool > &convertionMatrix, const std::vector< am_CustomConnectionFormat_t > &listSourceFormats, const std::vector< am_CustomConnectionFormat_t > &listSinkFormats, const am_CustomConnectionFormat_t connectionFormat, std::vector< am_CustomConnectionFormat_t > &listFormats)
am_Error_e getFirstNShortestPaths(const bool onlyfree, const unsigned cycles, const unsigned maxPathCount, CAmRoutingNode &source, CAmRoutingNode &sink, std::vector< am_Route_s > &resultPath)
Find first mMaxPathCount paths between given source and sink.
A_CONST am_CustomConnectionFormat_t CF_UNKNOWN
SPDX license identifier: MPL-2.0.
virtual am_Error_e enumerateConverters(std::function< void(const am_Converter_s &element)> cb) const =0
std::function< void(const am_Source_s &)> dboNewSource
GRAPH_PATH_END am_GraphPathPosition_e
am_sinkID_t sinkID
the sinkID
am_Error_e getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector< am_CustomConnectionFormat_t > listPossibleConnectionFormats, std::vector< am_CustomConnectionFormat_t > &listPrioConnectionFormats)
am_sinkID_t sinkID
The sinkID of the gateway sink-end.
am_Error_e getRouteFromLoadedNodes(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector< am_Route_s > &returnList)
Find first mMaxPathCount paths between given source and sink after the nodes have been loaded...
SPDX license identifier: MPL-2.0.
std::vector< am_CustomConnectionFormat_t > listSinkFormats
This is the list of available formats on the sink side of the gateway.
#define MAX_ROUTING_PATHS
Optimal path search is implemented with graph which contains nodes - sinks, sources, gateways, converters.
uint16_t am_converterID_t
a converter ID
std::vector< am_CustomConnectionFormat_t > listSourceFormats
This is the list of available formats on the source side of the converter.
CAmRoutingNode * sinkNodeWithID(const am_sinkID_t sinkID)
Returns a sink node with given sinkID.
static void listPossibleConnectionFormats(std::vector< am_CustomConnectionFormat_t > &inListSourceFormats, std::vector< am_CustomConnectionFormat_t > &inListSinkFormats, std::vector< am_CustomConnectionFormat_t > &outListFormats)
This represents one "hopp" in a route.
SPDX license identifier: MPL-2.0.
am_domainID_t domainID
The domainID is the domain the source belongs to.
uint16_t am_sourceID_t
a source ID
CAmRouter(IAmDatabaseHandler *iDatabaseHandler, CAmControlSender *iSender)
#define MAX_ALLOWED_DOMAIN_CYCLES
How many times the routing algorithm should look back into domains.
std::vector< am_CustomConnectionFormat_t > listSinkFormats
This is the list of available formats on the sink side of the gateway.
am_Error_e getAllPaths(CAmRoutingNode &aSource, CAmRoutingNode &aSink, std::vector< am_Route_s > &resultPath, std::vector< std::vector< CAmRoutingNode * >> &resultNodesPath, const bool includeCycles=false, const bool onlyFree=false) __attribute__((deprecated("You should use am_Error_e getFirstNShortestPaths( const bool onlyFree
DEPRECATED!
sends data to the commandInterface, takes the file of the library that needs to be loaded ...
static bool getAllowedFormatsFromConvMatrix(const std::vector< bool > &convertionMatrix, const std::vector< am_CustomConnectionFormat_t > &listSourceFormats, const std::vector< am_CustomConnectionFormat_t > &listSinkFormats, std::vector< am_CustomConnectionFormat_t > &sourceFormats, std::vector< am_CustomConnectionFormat_t > &sinkFormats)
void trace(std::function< void(const CAmNode< T > &, const std::vector< CAmVertex< T, V > * > &)> cb)
Goes through all nodes and vertices and calls the callback.
void getMergeConnectionFormats(const X *element, const am_CustomConnectionFormat_t connectionFormat, const std::vector< am_CustomConnectionFormat_t > &listConnectionFormats, std::vector< am_CustomConnectionFormat_t > &outListMergeConnectionFormats)
This class handles and abstracts the database.
This struct describes the attributes of a converter.
am_domainID_t domainSinkID
The ID of the sink.
std::vector< am_RoutingElement_s > route
the actual route as list of routing elements
a list of routing elements that lead from source to sink
std::vector< bool > convertionMatrix
This is matrix holding information about the conversion capability of the gateway, it's length is defined by the length(listSinkFormats) x length(listSourceFormats).
virtual am_Error_e enumerateSinks(std::function< void(const am_Sink_s &element)> cb) const =0
am_sourceID_t sourceID
This is the ID of the source, it is unique in the system.
am_Error_e getShortestPath(CAmRoutingNode &source, CAmRoutingNode &sink, std::vector< am_Route_s > &resultPath)
Find the shortest path between given source and sink.
the desired action is not possible
am_Converter_s * converter
std::list< CAmRoutingVertex > CAmRoutingListVertices
virtual am_Error_e enumerateGateways(std::function< void(const am_Gateway_s &element)> cb) const =0
std::vector< bool > convertionMatrix
This is matrix holding information about the conversion capability of the converter, it's length is defined by the length(listSinkFormats) x length(listSourceFormats).
am_sourceID_t sourceID
The sourceID of the gateway sink-end.
am_domainID_t domainID
This is the ID of the domain that registers the converter.
void clear()
Clears all nodes and vertices.
This struct describes the attributes of a gateway.
static bool shouldGoInDomain(const std::vector< am_domainID_t > &visitedDomains, const am_domainID_t nodeDomainID, const unsigned maxCyclesNumber)
std::vector< am_CustomConnectionFormat_t > listSourceFormats
This is the list of available formats on the source side of the gateway.
am_sinkID_t sinkID
the sinkID where the route ends
CAmRoutingNode * gatewayNodeWithSinkID(const am_sinkID_t sinkID)
Returns a gateway node for given sinkID.
uint16_t getIndex() const
std::function< void(const am_Gateway_s &)> dboNewGateway
uint16_t am_domainID_t
a domain ID
no error - positive reply
SPDX license identifier: MPL-2.0.
std::vector< am_CustomConnectionFormat_t > listConnectionFormats
This list holds information about the formats that the Source is capable of supporting when deliverin...
void getAllPaths(CAmNode< T > &src, CAmNode< T > &dst, std::function< bool(const CAmNode< T > *)> cbShouldVisitNode, std::function< void(const CAmNode< T > *)> cbWillVisitNode, std::function< void(const CAmNode< T > *)> cbDidVisitNode, std::function< void(const CAmNodeReferenceList &path)> cbDidFindPath)
Finds all possible paths between two given nodes.
uint16_t am_gatewayID_t
a gateway ID
This struct describes the attribiutes of a source.
uint16_t am_sinkID_t
a sink ID
This class handles and abstracts the database.
am_domainID_t domainID
The domainID is the domain the sink belongs to.
am_domainID_t domainID
the domainID the routeElement is in
am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector< am_Route_s > &returnList)
Find first mMaxPathCount paths between given source and sink.
std::function< void(const am_gatewayID_t)> dboRemoveGateway
std::vector< am_CustomConnectionFormat_t > listConnectionFormats
This list holds information about the formats that the Source is capable of supporting when deliverin...
A structure used as user data in the graph nodes.
std::function< void(const am_Converter_s &)> dboNewConverter
static am_Error_e getSourceSinkPossibleConnectionFormats(std::vector< CAmRoutingNode * >::iterator iteratorSource, std::vector< CAmRoutingNode * >::iterator iteratorSink, std::vector< am_CustomConnectionFormat_t > &outConnectionFormats)