summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-01-24 17:07:25 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-01-24 17:07:25 +0100
commitaf0ba5b505b361679c07899187b7043d867742c3 (patch)
treec0b463cbe355883c7606cfacbf9c19eaef2506cb
parent4fe50302a695c625d5161b538da771b2c36bd33e (diff)
downloadaudiomanager-af0ba5b505b361679c07899187b7043d867742c3.tar.gz
* finalized Router implementation
* added new generated ControlSendInterface with router support
-rw-r--r--AudioManagerDaemon/include/Router.h65
-rw-r--r--AudioManagerDaemon/src/Router.cpp370
-rw-r--r--CHANGELOG32
-rw-r--r--includes/control/ControlSendInterface.h18
4 files changed, 266 insertions, 219 deletions
diff --git a/AudioManagerDaemon/include/Router.h b/AudioManagerDaemon/include/Router.h
index 7635522..8fb859b 100644
--- a/AudioManagerDaemon/include/Router.h
+++ b/AudioManagerDaemon/include/Router.h
@@ -27,51 +27,54 @@
#include <audiomanagertypes.h>
-namespace am {
+namespace am
+{
class DatabaseHandler;
-class Router {
+class Router
+{
public:
- Router(DatabaseHandler* iDatabaseHandler);
- am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
- virtual ~Router();
+ Router(DatabaseHandler* iDatabaseHandler);
+ am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
+ virtual ~Router();
private:
- am_Error_e findBestWay(std::vector<am_RoutingElement_s>& listRoute,std::vector<am_RoutingElement_s>::iterator routeIterator,std::vector<am_gatewayID_t>::iterator gatewayIterator,int choiceNumber);
- void listPossibleConnectionFormats(const am_sourceID_t sourceID,const am_sinkID_t sinkID,std::vector<am_ConnectionFormat_e>& listFormats) const;
- void listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e>& listFormats) const;
- DatabaseHandler* mDatabaseHandler;
+ am_Error_e findBestWay(std::vector<am_RoutingElement_s>& listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator, int choiceNumber);
+ void listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e>& listFormats) const;
+ void listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e>& listFormats) const;
+ DatabaseHandler* mDatabaseHandler;
};
-class RoutingTreeItem {
+class RoutingTreeItem
+{
public:
- RoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID = 0, RoutingTreeItem *parent = 0);
- void appendChild(RoutingTreeItem *newChild);
- void returnChildItems(std::vector<RoutingTreeItem*> listChildItems);
- am_domainID_t returnDomainID() const;
- am_gatewayID_t returnGatewayID() const;
- virtual ~RoutingTreeItem();
- RoutingTreeItem* returnParent() const;
+ RoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID = 0, RoutingTreeItem *parent = 0);
+ void appendChild(RoutingTreeItem *newChild);
+ void returnChildItems(std::vector<RoutingTreeItem*> listChildItems);
+ am_domainID_t returnDomainID() const;
+ am_gatewayID_t returnGatewayID() const;
+ virtual ~RoutingTreeItem();
+ RoutingTreeItem* returnParent() const;
private:
- std::vector<RoutingTreeItem*> mListChildItems; //!< List of all child items
- am_domainID_t mDomainID; //!< the domain ID of the item
- am_gatewayID_t mGatewayID; //!< the gateway Id
- RoutingTreeItem *mParentItem; //!< pointer to the parent item
+ std::vector<RoutingTreeItem*> mListChildItems; //!< List of all child items
+ am_domainID_t mDomainID; //!< the domain ID of the item
+ am_gatewayID_t mGatewayID; //!< the gateway Id
+ RoutingTreeItem *mParentItem; //!< pointer to the parent item
};
-
-class RoutingTree {
+class RoutingTree
+{
public:
- RoutingTree(const am_domainID_t rootDomainID);
- RoutingTreeItem* insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, RoutingTreeItem *parent);
- void getRoute(RoutingTreeItem* targetItem, std::vector<am_gatewayID_t>* listGateways);
- am_domainID_t returnRootDomainID() const;
- RoutingTreeItem* returnRootItem();
- virtual ~RoutingTree();
+ RoutingTree(const am_domainID_t rootDomainID);
+ RoutingTreeItem* insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, RoutingTreeItem *parent);
+ void getRoute(RoutingTreeItem* targetItem, std::vector<am_gatewayID_t>* listGateways);
+ am_domainID_t returnRootDomainID() const;
+ RoutingTreeItem* returnRootItem();
+ virtual ~RoutingTree();
private:
- RoutingTreeItem mRootItem; //!< pointer to root item
- std::vector<RoutingTreeItem*> mListChild; //!< list of all childs
+ RoutingTreeItem mRootItem; //!< pointer to root item
+ std::vector<RoutingTreeItem*> mListChild; //!< list of all childs
};
} /* namespace am */
diff --git a/AudioManagerDaemon/src/Router.cpp b/AudioManagerDaemon/src/Router.cpp
index 9e1b5f6..e7c9096 100644
--- a/AudioManagerDaemon/src/Router.cpp
+++ b/AudioManagerDaemon/src/Router.cpp
@@ -27,264 +27,268 @@
#include <assert.h>
#include <algorithm>
#include <vector>
+#include <iterator>
using namespace am;
am_Error_e getConnectionFormatChoice(const am_sinkID_t, const am_sourceID_t, const std::vector<am_ConnectionFormat_e>& listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPriorityConnectionFormats)
{
- listPriorityConnectionFormats=listPossibleConnectionFormats;
- return (E_OK);
+ listPriorityConnectionFormats = listPossibleConnectionFormats;
+ return (E_OK);
}
-Router::Router(DatabaseHandler *iDatabaseHandler)
- :mDatabaseHandler(iDatabaseHandler)
+Router::Router(DatabaseHandler *iDatabaseHandler) :
+ mDatabaseHandler(iDatabaseHandler)
{
- assert(mDatabaseHandler);
+ assert(mDatabaseHandler);
}
-am_Error_e am::Router::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
+am_Error_e Router::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
{
- //first find out in which domains the source and sink are
- am_domainID_t sourceDomainID;
- am_domainID_t sinkDomainID;
- if (mDatabaseHandler->getDomainOfSource(sourceID,sourceDomainID) != E_OK) return (E_NON_EXISTENT);
- if (mDatabaseHandler->getDomainOfSink(sinkID,sinkDomainID) != E_OK) return (E_NON_EXISTENT);
-
- RoutingTree routingtree(sourceDomainID); //Build up a Tree from the Source_Domain to every other domain.
- std::vector<RoutingTreeItem*> flattree; //This list is the flat tree
- std::vector<RoutingTreeItem*> matchtree; //This List holds all TreeItems which have the right Domain Sink IDs
- std::vector<am_gatewayID_t> listGatewayID; //holds all gateway ids of the route
- am_RoutingElement_s routingElement;
- std::vector<am_RoutingElement_s> actualRoutingElement;//intermediate list of current routing pairs
- am_Route_s actualRoute; //holds the actual Route
- am_sourceID_t lastSource = 0;
-
- //TODO: kind of unclean. The separation between database and router could be better.
- mDatabaseHandler->getRoutingTree(onlyfree, &routingtree, &flattree); //Build up the tree out of the database as
-
- //we go through the returned flattree and look for our sink, after that flattree holds only treeItems that match
- std::vector<RoutingTreeItem*>::iterator flatIterator=flattree.begin();
- for(;flatIterator!=flattree.end();++flatIterator)
- {
- if((*flatIterator)->returnDomainID()!=sinkDomainID)
- {
- flatIterator=flattree.erase(flatIterator);
- }
- }
-
- //No we need to trace back the routes for each entry in matchtree
- flatIterator=flattree.begin();
- for(;flatIterator!=flattree.end();++flatIterator)
- {
- //getting the route for the actual item
- routingtree.getRoute(*flatIterator, &listGatewayID); //This gives only the Gateway IDs we need more
-
- //go throught the gatewayids and get more information
- std::vector<am_gatewayID_t>::iterator gatewayIterator =listGatewayID.begin();
- for(;gatewayIterator!=listGatewayID.end();++gatewayIterator)
- {
- am_Gateway_s gatewayData;
- if (mDatabaseHandler->getGatewayInfoDB(2,gatewayData) != E_OK) return (E_UNKNOWN);
-
- //at the beginning of the route, we connect first the source to the first gateway
- if (gatewayIterator ==listGatewayID.begin())
- {
- routingElement.sourceID = sourceID;
- routingElement.domainID = sourceDomainID;
- }
- else
- {
- routingElement.sourceID = lastSource;
- routingElement.domainID = gatewayData.domainSinkID;
- }
- routingElement.sinkID = gatewayData.sinkID;
- actualRoutingElement.push_back(routingElement);
- lastSource = gatewayData.sourceID;
- }
- //at the end of the route, connect to the sink !
- routingElement.sourceID = lastSource;
- routingElement.sinkID = sinkID;
- routingElement.domainID = sinkDomainID;
- actualRoutingElement.push_back(routingElement);
-
- //So now we got the route, what is missing are the connectionFormats...
-
- //Step through the routes and try to use always the best connectionFormat
- std::vector<am_RoutingElement_s>::iterator routingInterator=actualRoutingElement.begin();
- gatewayIterator =listGatewayID.begin();
- if(findBestWay(actualRoutingElement,routingInterator,gatewayIterator,0)!=E_OK) continue;
-
- //add the route to the list of routes...
- actualRoute.sourceID = sourceID;
- actualRoute.sinkID = sinkID;
- actualRoute.route = actualRoutingElement;
- returnList.push_back(actualRoute);
- }
- return (E_OK);
+ //first find out in which domains the source and sink are
+ am_domainID_t sourceDomainID;
+ am_domainID_t sinkDomainID;
+ if (mDatabaseHandler->getDomainOfSource(sourceID, sourceDomainID) != E_OK)
+ return (E_NON_EXISTENT);
+ if (mDatabaseHandler->getDomainOfSink(sinkID, sinkDomainID) != E_OK)
+ return (E_NON_EXISTENT);
+
+ RoutingTree routingtree(sourceDomainID); //Build up a Tree from the Source_Domain to every other domain.
+ std::vector<RoutingTreeItem*> flattree; //This list is the flat tree
+ std::vector<RoutingTreeItem*> matchtree; //This List holds all TreeItems which have the right Domain Sink IDs
+ std::vector<am_gatewayID_t> listGatewayID; //holds all gateway ids of the route
+ am_RoutingElement_s routingElement;
+ std::vector<am_RoutingElement_s> actualRoutingElement; //intermediate list of current routing pairs
+ am_Route_s actualRoute; //holds the actual Route
+ am_sourceID_t lastSource = 0;
+
+ //TODO: kind of unclean. The separation between database and router could be better.
+ mDatabaseHandler->getRoutingTree(onlyfree, &routingtree, &flattree); //Build up the tree out of the database as
+
+ //we go through the returned flattree and look for our sink, after that flattree holds only treeItems that match
+ std::vector<RoutingTreeItem*>::iterator flatIterator = flattree.begin();
+ for (; flatIterator != flattree.end(); ++flatIterator)
+ {
+ if ((*flatIterator)->returnDomainID() != sinkDomainID)
+ {
+ flatIterator = flattree.erase(flatIterator);
+ }
+ }
+
+ //No we need to trace back the routes for each entry in matchtree
+ flatIterator = flattree.begin();
+ for (; flatIterator != flattree.end(); ++flatIterator)
+ {
+ //getting the route for the actual item
+ routingtree.getRoute(*flatIterator, &listGatewayID); //This gives only the Gateway IDs we need more
+
+ //go throught the gatewayids and get more information
+ std::vector<am_gatewayID_t>::iterator gatewayIterator = listGatewayID.begin();
+ for (; gatewayIterator != listGatewayID.end(); ++gatewayIterator)
+ {
+ am_Gateway_s gatewayData;
+ if (mDatabaseHandler->getGatewayInfoDB(*gatewayIterator, gatewayData) != E_OK)
+ return (E_UNKNOWN);
+
+ //at the beginning of the route, we connect first the source to the first gateway
+ if (gatewayIterator == listGatewayID.begin())
+ {
+ routingElement.sourceID = sourceID;
+ routingElement.domainID = sourceDomainID;
+ }
+ else
+ {
+ routingElement.sourceID = lastSource;
+ routingElement.domainID = gatewayData.domainSinkID;
+ }
+ routingElement.sinkID = gatewayData.sinkID;
+ actualRoutingElement.push_back(routingElement);
+ lastSource = gatewayData.sourceID;
+ }
+ //at the end of the route, connect to the sink !
+ routingElement.sourceID = lastSource;
+ routingElement.sinkID = sinkID;
+ routingElement.domainID = sinkDomainID;
+ actualRoutingElement.push_back(routingElement);
+
+ //So now we got the route, what is missing are the connectionFormats...
+
+ //Step through the routes and try to use always the best connectionFormat
+ std::vector<am_RoutingElement_s>::iterator routingInterator = actualRoutingElement.begin();
+ gatewayIterator = listGatewayID.begin();
+ if (findBestWay(actualRoutingElement, routingInterator, gatewayIterator, 0) != E_OK)
+ continue;
+
+ //add the route to the list of routes...
+ actualRoute.sourceID = sourceID;
+ actualRoute.sinkID = sinkID;
+ actualRoute.route = actualRoutingElement;
+ returnList.push_back(actualRoute);
+ }
+ return (E_OK);
}
-void Router::listPossibleConnectionFormats(const am_sourceID_t sourceID,const am_sinkID_t sinkID,std::vector<am_ConnectionFormat_e>& listFormats) const
+void Router::listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e>& listFormats) const
{
- std::vector<am_ConnectionFormat_e> listSourceFormats;
- std::vector<am_ConnectionFormat_e> listSinkFormats;
- mDatabaseHandler->getListSinkConnectionFormats(sinkID,listSinkFormats);
- mDatabaseHandler->getListSourceConnectionFormats(sourceID,listSourceFormats);
- set_union(listSourceFormats.begin(), listSourceFormats.end(), listSinkFormats.begin(), listSinkFormats.end(), listFormats.begin());
+ std::vector<am_ConnectionFormat_e> listSourceFormats;
+ std::vector<am_ConnectionFormat_e> listSinkFormats;
+ mDatabaseHandler->getListSinkConnectionFormats(sinkID, listSinkFormats);
+ mDatabaseHandler->getListSourceConnectionFormats(sourceID, listSourceFormats);
+ std::insert_iterator<std::vector<am_ConnectionFormat_e> > inserter(listFormats, listFormats.begin());
+ set_intersection(listSourceFormats.begin(), listSourceFormats.end(), listSinkFormats.begin(), listSinkFormats.end(), inserter);
}
am_Error_e Router::findBestWay(std::vector<am_RoutingElement_s> & listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator, int choiceNumber)
{
- std::vector<am_ConnectionFormat_e> listConnectionFormats;
- std::vector<am_ConnectionFormat_e> listPriorityConnectionFormats;
- //get best connection format for the first connection, now
- listPossibleConnectionFormats(routeIterator->sinkID,routeIterator->sourceID,listConnectionFormats);
-
- //if we get to the point that no choice makes sense, return ...
- if (choiceNumber>=(int)listConnectionFormats.size()) return (E_NOT_POSSIBLE);
-
- //if we have not just started, we need to take care about the gateways...
- if(routeIterator!=listRoute.begin())
- {
- //since we have to deal with Gateways, there are restrictions what connectionFormat we can take. So we need to take the subset of connections that are restricted:
- std::vector<am_ConnectionFormat_e> listRestrictedConnectionFormats;
- listRestrictedOutputFormatsGateways(*gatewayIterator,(routeIterator--)->connectionFormat,listRestrictedConnectionFormats);
- set_union(listConnectionFormats.begin(), listConnectionFormats.end(), listRestrictedConnectionFormats.begin(), listRestrictedConnectionFormats.end(), listConnectionFormats.begin());
- }
-
- //let the controller decide:
- getConnectionFormatChoice(routeIterator->sinkID,routeIterator->sourceID,listConnectionFormats,listPriorityConnectionFormats);
-
- //go back one step, if we cannot find a format!
- if(listPriorityConnectionFormats.empty())
- {
- findBestWay(listRoute,routeIterator--,gatewayIterator--,choiceNumber++);
- }
- routeIterator->connectionFormat=listPriorityConnectionFormats.at(choiceNumber);
-
- if (routeIterator<listRoute.end())
- {
- findBestWay(listRoute,routeIterator++,gatewayIterator++,0);
- }
- return (E_OK);
+ std::vector<am_ConnectionFormat_e> listConnectionFormats;
+ std::vector<am_ConnectionFormat_e> listPriorityConnectionFormats;
+ //get best connection format for the first connection, now
+ listPossibleConnectionFormats(routeIterator->sourceID, routeIterator->sinkID, listConnectionFormats);
+
+ //if we get to the point that no choice makes sense, return ...
+ if (choiceNumber >= (int) listConnectionFormats.size())
+ return (E_NOT_POSSIBLE);
+
+ //if we have not just started, we need to take care about the gateways...
+ if (routeIterator != listRoute.begin())
+ {
+ //since we have to deal with Gateways, there are restrictions what connectionFormat we can take. So we need to take the subset of connections that are restricted:
+ std::vector<am_ConnectionFormat_e> listRestrictedConnectionFormats;
+ std::insert_iterator<std::vector<am_ConnectionFormat_e> > inserter(listConnectionFormats, listConnectionFormats.begin());
+ std::vector<am_RoutingElement_s>::iterator tempIterator(routeIterator);
+ tempIterator--;
+ listRestrictedOutputFormatsGateways(*gatewayIterator, (tempIterator)->connectionFormat, listRestrictedConnectionFormats);
+ set_intersection(listConnectionFormats.begin(), listConnectionFormats.end(), listRestrictedConnectionFormats.begin(), listRestrictedConnectionFormats.end(), inserter);
+ gatewayIterator++;
+ }
+
+ //let the controller decide:
+ getConnectionFormatChoice(routeIterator->sinkID, routeIterator->sourceID, listConnectionFormats, listPriorityConnectionFormats);
+
+ //go back one step, if we cannot find a format and take the next best!
+ if (listPriorityConnectionFormats.empty())
+ {
+ findBestWay(listRoute, --routeIterator, --gatewayIterator, ++choiceNumber);
+ }
+
+ routeIterator->connectionFormat = listPriorityConnectionFormats.at(choiceNumber);
+
+ //ok, we are through and found a way, if not, take the next part of the route and start with toplevel
+ if (routeIterator < listRoute.end())
+ {
+ findBestWay(listRoute, ++routeIterator, gatewayIterator, 0);
+ }
+ return (E_OK);
}
void Router::listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e> & listFormats) const
{
- listFormats.clear();
- am_Gateway_s gatewayData;
- std::vector<am_ConnectionFormat_e>::const_iterator rowSinkIterator=gatewayData.listSinkFormats.begin();
- std::vector<bool>::const_iterator matrixIterator=gatewayData.convertionMatrix.begin();
- mDatabaseHandler->getGatewayInfoDB(gatewayID,gatewayData);
-
- //find the row number of the sink
- rowSinkIterator = find (gatewayData.listSinkFormats.begin(), gatewayData.listSinkFormats.end(), sinkConnectionFormat);
- int rowNumberSink=rowSinkIterator - gatewayData.listSinkFormats.begin();
-
- //go through the convertionMatrix and find out if the conversion is possible, if yes, add connectionFormat ...
- matrixIterator+rowNumberSink;
-
- //iterate line-wise through the matrix and add more formats
- do
- {
- if(*matrixIterator)
- {
- listFormats.push_back(gatewayData.listSourceFormats.at(matrixIterator-gatewayData.convertionMatrix.begin()));
- }
- matrixIterator+gatewayData.listSinkFormats.size();
- }
- while (matrixIterator-gatewayData.convertionMatrix.begin()<(int)gatewayData.listSourceFormats.size());
+ listFormats.clear();
+ am_Gateway_s gatewayData;
+ mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData);
+ std::vector<am_ConnectionFormat_e>::const_iterator rowSinkIterator = gatewayData.listSinkFormats.begin();
+ std::vector<bool>::const_iterator matrixIterator = gatewayData.convertionMatrix.begin();
+
+ //find the row number of the sink
+ rowSinkIterator = find(gatewayData.listSinkFormats.begin(), gatewayData.listSinkFormats.end(), sinkConnectionFormat);
+ int rowNumberSink = rowSinkIterator - gatewayData.listSinkFormats.begin();
+
+ //go through the convertionMatrix and find out if the conversion is possible, if yes, add connectionFormat ...
+ matrixIterator + rowNumberSink;
+
+ //iterate line-wise through the matrix and add more formats
+ do
+ {
+ if (*matrixIterator)
+ {
+ listFormats.push_back(gatewayData.listSourceFormats.at(matrixIterator - gatewayData.convertionMatrix.begin()));
+ }
+ matrixIterator += gatewayData.listSinkFormats.size();
+ } while (matrixIterator - gatewayData.convertionMatrix.begin() < (int) gatewayData.listSourceFormats.size());
}
-
Router::~Router()
{
}
-RoutingTreeItem::RoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, RoutingTreeItem *parent)
- :mDomainID(domainID),
- mGatewayID(gatewayID),
- mParentItem(parent)
+RoutingTreeItem::RoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, RoutingTreeItem *parent) :
+ mDomainID(domainID), //
+ mGatewayID(gatewayID), //
+ mParentItem(parent)
{
- assert(mDomainID==0);
- assert(mGatewayID==0);
- assert(mParentItem);
+ assert(mDomainID!=0);
}
void RoutingTreeItem::appendChild(RoutingTreeItem *newChild)
{
- assert(newChild);
- mListChildItems.push_back(newChild);
+ assert(newChild);
+ mListChildItems.push_back(newChild);
}
void RoutingTreeItem::returnChildItems(std::vector<RoutingTreeItem*> listChildItems)
{
- listChildItems=mListChildItems;
+ listChildItems = mListChildItems;
}
am_domainID_t RoutingTreeItem::returnDomainID() const
{
- return (mDomainID);
+ return (mDomainID);
}
am_gatewayID_t RoutingTreeItem::returnGatewayID() const
{
- return (mGatewayID);
+ return (mGatewayID);
}
RoutingTreeItem* RoutingTreeItem::returnParent() const
{
- return (mParentItem);
+ return (mParentItem);
}
RoutingTreeItem::~RoutingTreeItem()
{
}
-
-RoutingTree::RoutingTree(const am_domainID_t rootDomainID)
- :mRootItem(RoutingTreeItem(rootDomainID))
+RoutingTree::RoutingTree(const am_domainID_t rootDomainID) :
+ mRootItem(RoutingTreeItem(rootDomainID))
{
- assert(rootDomainID!=0);
+ assert(rootDomainID!=0);
}
RoutingTreeItem *RoutingTree::insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, RoutingTreeItem *parent)
{
- RoutingTreeItem *newTree = new RoutingTreeItem(domainID, gatewayID,parent);
- parent->appendChild(newTree);
- mListChild.push_back(newTree);
- return newTree;
+ RoutingTreeItem *newTree = new RoutingTreeItem(domainID, gatewayID, parent);
+ parent->appendChild(newTree);
+ mListChild.push_back(newTree);
+ return newTree;
}
void RoutingTree::getRoute(RoutingTreeItem *targetItem, std::vector<am_gatewayID_t> *listGateways)
{
- RoutingTreeItem *parentItem = targetItem;
- while (parentItem != &mRootItem) {
- listGateways->push_back(parentItem->returnGatewayID());
- parentItem = parentItem->returnParent();
- }
+ RoutingTreeItem *parentItem = targetItem;
+ while (parentItem != &mRootItem)
+ {
+ listGateways->push_back(parentItem->returnGatewayID());
+ parentItem = parentItem->returnParent();
+ }
}
am_domainID_t RoutingTree::returnRootDomainID() const
{
- return (mRootItem.returnDomainID());
+ return (mRootItem.returnDomainID());
}
RoutingTreeItem *RoutingTree::returnRootItem()
{
- return (&mRootItem);
+ return (&mRootItem);
}
RoutingTree::~RoutingTree()
{
- std::vector<RoutingTreeItem*>::iterator it=mListChild.begin();
- for(;it!=mListChild.end();++it)
- {
- delete *it;
- }
+ std::vector<RoutingTreeItem*>::iterator it = mListChild.begin();
+ for (; it != mListChild.end(); ++it)
+ {
+ delete *it;
+ }
}
-
-
-
-
-
diff --git a/CHANGELOG b/CHANGELOG
index 5b30a2f..088864e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,34 @@
-commit 126870e1c2af541558aefd46aad38565c0ece795
+commit 4fe50302a695c625d5161b538da771b2c36bd33e
+Author: christian mueller <christian.ei.mueller@bmw.de>
+
+ * formatting all the source code with eclipse source code style
+ * added used xml to the project
+
+commit 80213f17291e5b58c733de09f06439d71640d2e2
+Author: christian mueller <christian.ei.mueller@bmw.de>
+
+ * fixed wrong memset in main.cpp (thanks to frank)
+ * fixed compiler warnings in signalhandler
+ * added Router Class: this class does now the autorouting job. First commit, no tests yet
+
+commit adf0d48f869007e4527b00e1a346ed37ee82cc1a
+Author: christian mueller <christian.ei.mueller@bmw.de>
+
+ * fix for package building with lower cmake versions
+ * fix DBus interface to be GLIB tolerant 32bit types
+
+commit 8a99f39f0a5b84230bb6e764950dc674258870e8
+Author: christian mueller <christian.ei.mueller@bmw.de>
+
+ * fix build without git
+
+commit 3d458653de2ec50f524b38d33645fd773bcb207f
+Author: christian mueller <christian.ei.mueller@bmw.de>
+
+ * fixed compilation without git
+ * fixed compilation without tests
+
+commit 23c90675c09d4e2947b5a827a5ebcd5516c0270e
Author: christian mueller <christian.ei.mueller@bmw.de>
* added package creation based on cpack
diff --git a/includes/control/ControlSendInterface.h b/includes/control/ControlSendInterface.h
index 8d2f299..9c1fa7a 100644
--- a/includes/control/ControlSendInterface.h
+++ b/includes/control/ControlSendInterface.h
@@ -22,8 +22,8 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_F5981A51_5790_4c74_A384_3600DFC50AF5__INCLUDED_)
-#define EA_F5981A51_5790_4c74_A384_3600DFC50AF5__INCLUDED_
+#if !defined(EA_7E13E25E_46FA_4211_BD7C_7169D8F7D065__INCLUDED_)
+#define EA_7E13E25E_46FA_4211_BD7C_7169D8F7D065__INCLUDED_
#include <vector>
#include <string>
@@ -40,7 +40,7 @@ namespace am {
* All the hooks represent system events that need to be handled. The callback functions are used to handle for example answers to function calls on the AudioManagerCoreInterface.
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:55:56 PM
+ * @created 19-Jan-2012 4:32:01 PM
*/
class ControlSendInterface
{
@@ -342,6 +342,16 @@ namespace am {
*/
virtual void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
/**
+ * This function is used by the routing algorithm to retrieve a priorized list of connectionFormats from the Controller.
+ * @return E_OK in case of successfull priorisation.
+ *
+ * @param sourceID sourceID of source that shall be connected
+ * @param sinkID sinkID of sink that shall be connected
+ * @param listPossibleConnectionFormats list of possible connectionformats
+ * @param listPrioConnectionFormats the list return with prioos from the controller. Best choice on first position.
+ */
+ virtual am_Error_e getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats) =0;
+ /**
* This function returns the version of the interface
* returns E_OK, E_UNKOWN if version is unknown.
*/
@@ -349,4 +359,4 @@ namespace am {
};
}
-#endif // !defined(EA_F5981A51_5790_4c74_A384_3600DFC50AF5__INCLUDED_)
+#endif // !defined(EA_7E13E25E_46FA_4211_BD7C_7169D8F7D065__INCLUDED_)