38 #define ROUTING_BUILD_CONNECTIONS 1
51 #if !defined(ROUTING_BUILD_CONNECTIONS)
59 #if !defined(ROUTING_BUILD_CONNECTIONS)
60 #undef ROUTING_BUILD_CONNECTIONS
63 #if defined(TRACE_GRAPH)
64 #if !defined(ROUTING_BUILD_CONNECTIONS)
65 #warning "You should define ROUTING_BUILD_CONNECTIONS in order to be able to see the connections in the trace."
101 else if(
type==CONVERTER)
111 std::cout <<
"[SINK:" <<
data.sink->sinkID <<
":" <<
data.sink->name <<
"(" <<
data.sink->domainID <<
")"
114 std::cout <<
"[SOUR:" <<
data.source->sourceID <<
":" <<
data.source->name <<
"(" <<
data.source->domainID <<
")"
117 std::cout <<
"[GATE:" <<
data.gateway->gatewayID <<
":" <<
data.gateway->name <<
"(" <<
data.gateway->controlDomainID <<
")"
119 else if(
type==CONVERTER)
120 std::cout <<
"[CONV:" <<
data.converter->converterID <<
":" <<
data.converter->name <<
"(" <<
data.converter->domainID <<
")"
128 return data.sink->domainID;
130 return data.source->domainID;
132 return data.gateway->controlDomainID;
133 else if(
type==CONVERTER)
134 return data.converter->domainID;
156 bool mOnlyFreeConversionNodes;
158 std::map<am_domainID_t,std::vector<CAmRoutingNode*>> mNodeListSources;
159 std::map<am_domainID_t,std::vector<CAmRoutingNode*>> mNodeListSinks;
160 std::map<am_domainID_t,std::vector<CAmRoutingNode*>> mNodeListGateways;
161 std::map<am_domainID_t,std::vector<CAmRoutingNode*>> mNodeListConverters;
163 am_Error_e determineConnectionFormatsForPath(
am_Route_s & routeObjects, std::vector<CAmRoutingNode*> & nodes);
165 std::vector<CAmRoutingNode*> & route,
166 std::vector<am_RoutingElement_s>::iterator routingElementIterator,
167 std::vector<CAmRoutingNode*>::iterator routeIterator);
175 template <
class Component>
bool isComponentConnected(
const Component & comp)
181 const bool includeCycles,
182 std::function<
void(
const std::vector<CAmRoutingNode*> & path)> cb);
184 std::vector<CAmRoutingNode*> & visited,
185 std::vector<am_domainID_t> & visitedDomains,
186 std::function<
void(
const std::vector<CAmRoutingNode*> & path)> cb);
188 #ifdef ROUTING_BUILD_CONNECTIONS
193 void constructConverterConnections();
199 void constructGatewayConnections();
205 void constructSourceSinkConnections();
250 std::vector<am_Route_s> & resultPath, std::vector<std::vector<CAmRoutingNode*>> & resultNodesPath,
252 __attribute__((unused))
254 const bool includeCycles =
false);
255 #ifdef ROUTING_BUILD_CONNECTIONS
261 const std::vector<am_CustomConnectionFormat_t> & listSourceFormats,
262 const std::vector<am_CustomConnectionFormat_t> & listSinkFormats,
263 std::vector<am_CustomConnectionFormat_t> & sourceFormats,
264 std::vector<am_CustomConnectionFormat_t> & sinkFormats);
266 std::vector<am_CustomConnectionFormat_t> & inListSinkFormats,
267 std::vector<am_CustomConnectionFormat_t> & outListFormats);
269 const std::vector<am_CustomConnectionFormat_t> & listSourceFormats,
270 const std::vector<am_CustomConnectionFormat_t> & listSinkFormats,
272 std::vector<am_CustomConnectionFormat_t> & listFormats);
274 std::vector<CAmRoutingNode*>::iterator iteratorSink,
275 std::vector<am_CustomConnectionFormat_t> & outConnectionFormats);
314 void load(
const bool onlyFree);
CAmRoutingNode * converterNodeWithSinkID(const am_sinkID_t sinkID, const am_domainID_t domainID)
Returns a converter node for given sinkID.
CAmRoutingNode * sourceNodeWithID(const am_sourceID_t sourceID)
Returns a source node with given sourceID.
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.
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 an 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
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 getAllPaths(CAmRoutingNode &aSource, CAmRoutingNode &aSink, std::vector< am_Route_s > &resultPath, std::vector< std::vector< CAmRoutingNode * >> &resultNodesPath, const bool includeCycles=false)
am_gatewayID_t gatewayID
This is the ID of the gateway, it is unique in the system.
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)
SPDX license identifier: MPL-2.0.
uint16_t am_sourceID_t
a source ID
CAmRouter(IAmDatabaseHandler *iDatabaseHandler, CAmControlSender *iSender)
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 ...
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)
#define ROUTING_BUILD_CONNECTIONS
This class handles and abstracts the database.
This struct describes the attributes of a converter.
CAmNode< am_RoutingNodeData_s > CAmRoutingNode
a list of routing elements that lead from source to sink
CONVERTER am_NodeDataType_e
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.
SPDX license identifier: MPL-2.0.
This struct describes the attributes of a gateway.
CAmRoutingNode * gatewayNodeWithSinkID(const am_sinkID_t sinkID)
Returns a gateway node for given sinkID.
uint16_t am_domainID_t
a domain ID
void getShortestPath(const CAmRoutingNode &source, const CAmRoutingNode &destination, std::vector< CAmRoutingNode * > &resultPath)
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
static void getSourceSinkPossibleConnectionFormats(std::vector< CAmRoutingNode * >::iterator iteratorSource, std::vector< CAmRoutingNode * >::iterator iteratorSink, std::vector< am_CustomConnectionFormat_t > &outConnectionFormats)
am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector< am_Route_s > &returnList)
Finds all possible paths between given source and sink.
static bool shouldGoInDomain(const std::vector< am_domainID_t > &visitedDomains, const am_domainID_t nodeDomainID)
void load(const bool onlyFree)
A structure used as user data in the graph nodes.