55 #ifndef MAX_ROUTING_PATHS 56 #define MAX_ROUTING_PATHS 5 67 #ifndef MAX_ALLOWED_DOMAIN_CYCLES 68 #define MAX_ALLOWED_DOMAIN_CYCLES 1 99 if (type == anotherObject.
type)
116 #define COUT_NODE(HEAD, NAME, ID) \ 117 std::cout << HEAD << "(" << std::setfill('0') << std::setw(4) << ID << " " << NAME << ")"; 122 COUT_NODE(
"SI",
data.sink->name,
data.sink->sinkID )
124 COUT_NODE(
"SO",
data.source->name,
data.source->sourceID )
126 COUT_NODE(
"GA",
data.gateway->name,
data.gateway->gatewayID )
128 COUT_NODE(
"CO",
data.converter->name,
data.converter->converterID )
135 return data.sink->domainID;
137 return data.source->domainID;
139 return data.gateway->controlDomainID;
141 return data.converter->domainID;
163 bool mUpdateGraphNodesAction;
164 unsigned mMaxAllowedCycles;
165 unsigned mMaxPathCount;
166 CAmRoutingGraph mRoutingGraph;
167 std::map<am_domainID_t, std::vector<CAmRoutingNode*>> mNodeListSources;
168 std::map<am_domainID_t, std::vector<CAmRoutingNode*>> mNodeListSinks;
169 std::map<am_domainID_t, std::vector<CAmRoutingNode*>> mNodeListGateways;
170 std::map<am_domainID_t, std::vector<CAmRoutingNode*>> mNodeListConverters;
177 template<
class Component>
bool isComponentConnected(
const Component & comp)
186 void constructConverterConnections();
192 void constructGatewayConnections();
198 void constructSourceSinkConnections();
203 void getVerticesForNode(
const CAmRoutingNode & node, CAmRoutingListVertices & list);
208 void getVerticesForSource(
const CAmRoutingNode & node, CAmRoutingListVertices & list);
213 void getVerticesForSink(
const CAmRoutingNode & node, CAmRoutingListVertices & list);
218 void getVerticesForConverter(
const CAmRoutingNode & node, CAmRoutingListVertices & list);
223 void getVerticesForGateway(
const CAmRoutingNode & node, CAmRoutingListVertices & list);
230 am_Error_e determineConnectionFormatsForPath(
am_Route_s & routeObjects, std::vector<CAmRoutingNode*> & nodes, std::vector<am_Route_s> & result);
231 am_Error_e doConnectionFormatsForPath(
am_Route_s & routeObjects, std::vector<CAmRoutingNode*> & route,
232 std::vector<am_RoutingElement_s>::iterator routingElementIterator, std::vector<CAmRoutingNode*>::iterator routeIterator,
233 std::vector<am_Route_s> & result);
234 am_Error_e cfPermutationsForPath(
am_Route_s shortestRoute, std::vector<CAmRoutingNode*> resultNodesPath, std::vector<am_Route_s>& resultPath);
239 static int insertPostion(
const std::vector<CAmRoutingNode*>& path,
const std::vector<std::vector<CAmRoutingNode*> >& nodes);
247 return mMaxAllowedCycles;
251 mMaxAllowedCycles = count;
256 return mMaxPathCount;
260 mMaxPathCount = count;
265 return mUpdateGraphNodesAction;
290 am_Error_e getRouteFromLoadedNodes(
const bool onlyfree,
const am_Source_s & aSource,
const am_Sink_s & aSink, std::vector<am_Route_s> & listRoutes);
303 am_Error_e getFirstNShortestPaths(
const bool onlyfree,
const unsigned cycles,
const unsigned maxPathCount, CAmRoutingNode & source,
304 CAmRoutingNode & sink, std::vector<am_Route_s> & resultPath);
315 am_Error_e getShortestPath(CAmRoutingNode & source, CAmRoutingNode & sink, std::vector<am_Route_s> & resultPath);
317 static bool getAllowedFormatsFromConvMatrix(
const std::vector<bool> & convertionMatrix,
318 const std::vector<am_CustomConnectionFormat_t> & listSourceFormats,
const std::vector<am_CustomConnectionFormat_t> & listSinkFormats,
319 std::vector<am_CustomConnectionFormat_t> & sourceFormats, std::vector<am_CustomConnectionFormat_t> & sinkFormats);
320 static void listPossibleConnectionFormats(std::vector<am_CustomConnectionFormat_t> & inListSourceFormats,
321 std::vector<am_CustomConnectionFormat_t> & inListSinkFormats, std::vector<am_CustomConnectionFormat_t> & outListFormats);
322 static bool getRestrictedOutputFormats(
const std::vector<bool> & convertionMatrix,
const std::vector<am_CustomConnectionFormat_t> & listSourceFormats,
324 std::vector<am_CustomConnectionFormat_t> & listFormats);
325 static am_Error_e getSourceSinkPossibleConnectionFormats(std::vector<CAmRoutingNode*>::iterator iteratorSource,
326 std::vector<CAmRoutingNode*>::iterator iteratorSink, std::vector<am_CustomConnectionFormat_t> & outConnectionFormats);
328 static bool shouldGoInDomain(
const std::vector<am_domainID_t> & visitedDomains,
const am_domainID_t nodeDomainID,
const unsigned maxCyclesNumber);
329 bool shouldGoInDomain(
const std::vector<am_domainID_t> & visitedDomains,
const am_domainID_t nodeDomainID);
336 CAmRoutingNode* sinkNodeWithID(
const am_sinkID_t sinkID);
345 CAmRoutingNode* sourceNodeWithID(
const am_sourceID_t sourceID);
363 CAmRoutingNode* gatewayNodeWithSinkID(
const am_sinkID_t sinkID);
372 am_Error_e getAllPaths(CAmRoutingNode & aSource, CAmRoutingNode & aSink, std::vector<am_Route_s> & resultPath,
373 std::vector<std::vector<CAmRoutingNode*>> & resultNodesPath,
const bool includeCycles =
false,
374 const bool onlyFree =
false)
375 __attribute__((deprecated("You should use
am_Error_e getFirstNShortestPaths(const
bool onlyFree, CAmRoutingNode &, CAmRoutingNode &,
std::vector<
am_Route_s> &) instead!")));
std::vector< CAmRoutingListVertices * > CAmRoutingVertexReferenceList
am_domainID_t domainID() const
am_converterID_t converterID
This is the ID of the converter, it is unique in the system.
A Common-API wrapper class, which loads the common-api runtime and instantiates all necessary objects...
am_Error_e
the errors of the audiomanager.
This struct describes the attribiutes of a sink.
am_sinkID_t sinkID
This is the ID of the sink, it is unique in the system.
Implements autorouting algorithm for connecting sinks and sources via different audio domains...
am_NodeDataType_e type
data type:sink, source, gateway or converter
virtual bool isComponentConnected(const am_Gateway_s &gateway) const =0
uint16_t am_CustomConnectionFormat_t
This type classifies the format in which data is exchanged within a connection.
union am::am_RoutingNodeData_s::@0 data
union pointer to sink, source, gateway or converter
am_gatewayID_t gatewayID
This is the ID of the gateway, it is unique in the system.
SPDX license identifier: MPL-2.0.
uint16_t am_sourceID_t
a source ID
am_RoutingNodeData_s::am_NodeDataType_e CAmNodeDataType
CAmGraph< am_RoutingNodeData_s, uint16_t > CAmRoutingGraph
sends data to the commandInterface, takes the file of the library that needs to be loaded ...
This class handles and abstracts the database.
bool getUpdateGraphNodesAction()
This struct describes the attributes of a converter.
CAmNode< am_RoutingNodeData_s > CAmRoutingNode
a list of routing elements that lead from source to sink
am_sourceID_t sourceID
This is the ID of the source, it is unique in the system.
am_Converter_s * converter
std::list< CAmRoutingVertex > CAmRoutingListVertices
Copyright (C) 2012 - 2014, BMW AG.
unsigned getMaxPathCount()
SPDX license identifier: MPL-2.0.
void setMaxPathCount(unsigned count)
This struct describes the attributes of a gateway.
uint16_t am_domainID_t
a domain ID
void setMaxAllowedCycles(unsigned count)
unsigned getMaxAllowedCycles()
This struct describes the attribiutes of a source.
uint16_t am_sinkID_t
a sink ID
CAmVertex< am_RoutingNodeData_s, uint16_t > CAmRoutingVertex
bool operator==(const am_RoutingNodeData_s &anotherObject) const
A structure used as user data in the graph nodes.