diff options
author | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2012-09-10 06:07:34 -0700 |
---|---|---|
committer | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2012-10-02 01:19:01 -0700 |
commit | 553aaf34ffb9d95761ea3cb874eea8201da12d40 (patch) | |
tree | f79d70caef14ed3c8b7c101e97793f3c621c9cd9 | |
parent | c25c8c48c85a19c4aed6cbfb93760fbd04940517 (diff) | |
download | layer_management-553aaf34ffb9d95761ea3cb874eea8201da12d40.tar.gz |
LayerManagerService: added internal notification queue
The executor now has an interface to add client notifications.
This enables commands to trigger client notifications, if they
have changed a property of a graphical object.
-rw-r--r-- | LayerManagerService/include/ApplicationReferenceList.h | 28 | ||||
-rw-r--r-- | LayerManagerService/include/GraphicalObject.h | 31 | ||||
-rw-r--r-- | LayerManagerService/include/ICommandExecutor.h | 6 | ||||
-rw-r--r-- | LayerManagerService/include/Layermanager.h | 23 | ||||
-rw-r--r-- | LayerManagerService/include/NotificationQueue.h | 28 | ||||
-rw-r--r-- | LayerManagerService/src/main.cpp | 4 |
6 files changed, 118 insertions, 2 deletions
diff --git a/LayerManagerService/include/ApplicationReferenceList.h b/LayerManagerService/include/ApplicationReferenceList.h new file mode 100644 index 0000000..734a4a0 --- /dev/null +++ b/LayerManagerService/include/ApplicationReferenceList.h @@ -0,0 +1,28 @@ +/*************************************************************************** +* +* Copyright 2010,2011 BMW Car IT GmbH +* +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +****************************************************************************/ +#ifndef _APPLICATION_REFERENCE_LIST_H_ +#define _APPLICATION_REFERENCE_LIST_H_ + +#include <list> + +typedef std::list<t_ilm_client_handle> ApplicationReferenceList; +typedef std::list<t_ilm_client_handle>::iterator ApplicationReferenceListIterator; +typedef std::list<t_ilm_client_handle>::const_iterator ApplicationReferenceListConstIterator; + +#endif // _APPLICATION_REFERENCE_LIST_H_ diff --git a/LayerManagerService/include/GraphicalObject.h b/LayerManagerService/include/GraphicalObject.h index 2c05d66..0859812 100644 --- a/LayerManagerService/include/GraphicalObject.h +++ b/LayerManagerService/include/GraphicalObject.h @@ -22,6 +22,7 @@ #define _GRAPHICALOBJECT_H_ #include "ObjectType.h" +#include "ApplicationReferenceList.h" class Shader; @@ -115,6 +116,21 @@ public: */ Shader* getShader(); + /** + * @brief add a client application to be notified on property changes of this graphical object. + * @param applicationHash UUID of application, as registered during ServiceConnect() in the client API + */ + void addNotification(t_ilm_client_handle client); + + /** + * @brief remove a client application from the notification list on property changes of this graphical object. + * @param applicationHash UUID of application, as registered during ServiceConnect() in the client API + */ + void removeNotification(t_ilm_client_handle client); + + ApplicationReferenceList& getNotificationClients(); + + public: static const unsigned int INVALID_ID; ObjectType type; @@ -133,6 +149,7 @@ public: protected: unsigned int graphicInternalId; unsigned int graphicExternalId; + ApplicationReferenceList applicationList; private: static unsigned int nextGraphicId[TypeMax]; @@ -259,5 +276,19 @@ inline Shader* GraphicalObject::getShader() return shader; } +inline void GraphicalObject::addNotification(t_ilm_client_handle client) +{ + applicationList.push_back(client); +} + +inline void GraphicalObject::removeNotification(t_ilm_client_handle client) +{ + applicationList.remove(client); +} + +inline ApplicationReferenceList& GraphicalObject::getNotificationClients() +{ + return applicationList; +} #endif /* _GRAPHICALOBJECT_H_ */ diff --git a/LayerManagerService/include/ICommandExecutor.h b/LayerManagerService/include/ICommandExecutor.h index 8747183..8773a40 100644 --- a/LayerManagerService/include/ICommandExecutor.h +++ b/LayerManagerService/include/ICommandExecutor.h @@ -25,6 +25,8 @@ #include "SceneProviderList.h" #include "ApplicationReferenceMap.h" #include "LayerType.h" +#include "ObjectType.h" +#include "NotificationQueue.h" class ICommand; class Scene; @@ -216,6 +218,10 @@ public: * \todo removable, use default command processing */ virtual unsigned int* getScreenIDs(unsigned int* length) const = 0; + + virtual void addClientNotification(GraphicalObject* object, t_ilm_notification_mask mask) = 0; + + virtual NotificationQueue& getClientNotificationQueue() = 0; }; #endif /* _COMMANDEXECUTOR_H_ */ diff --git a/LayerManagerService/include/Layermanager.h b/LayerManagerService/include/Layermanager.h index 8b0ac87..067dd1c 100644 --- a/LayerManagerService/include/Layermanager.h +++ b/LayerManagerService/include/Layermanager.h @@ -21,6 +21,7 @@ #define _LAYERMANAGER_H_ #include "ICommandExecutor.h" +#include "NotificationQueue.h" #include "Scene.h" class ICommand; @@ -59,6 +60,9 @@ public: virtual RendererList* getRendererList(void); virtual CommunicatorList* getCommunicatorList(void); virtual SceneProviderList* getSceneProviderList(void); + + virtual void addClientNotification(GraphicalObject* object, t_ilm_notification_mask mask); + virtual NotificationQueue& getClientNotificationQueue(); virtual ApplicationReferenceMap* getApplicationReferenceMap(void); private: @@ -76,6 +80,7 @@ private: RendererList* m_pRendererList; CommunicatorList* m_pCommunicatorList; SceneProviderList* m_pSceneProviderList; + NotificationQueue m_clientNotificationQueue; ApplicationReferenceMap* m_pApplicationReferenceMap; }; @@ -103,4 +108,22 @@ inline ApplicationReferenceMap* Layermanager::getApplicationReferenceMap(void) { return m_pApplicationReferenceMap; } + +inline void Layermanager::addClientNotification(GraphicalObject* object, t_ilm_notification_mask newMask) +{ + if (m_clientNotificationQueue.find(object) != m_clientNotificationQueue.end()) + { + m_clientNotificationQueue[object] = (t_ilm_notification_mask)(m_clientNotificationQueue[object] | newMask); + } + else + { + m_clientNotificationQueue[object] = newMask; + } +} + +inline NotificationQueue& Layermanager::getClientNotificationQueue() +{ + return m_clientNotificationQueue; +} + #endif /* _LAYERMANAGER_H_ */ diff --git a/LayerManagerService/include/NotificationQueue.h b/LayerManagerService/include/NotificationQueue.h new file mode 100644 index 0000000..134171b --- /dev/null +++ b/LayerManagerService/include/NotificationQueue.h @@ -0,0 +1,28 @@ +/*************************************************************************** + * + * Copyright 2010,2011 BMW Car IT GmbH + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************/ +#ifndef __NOTIFICATIONQUEUE_H__ +#define __NOTIFICATIONQUEUE_H__ + +#include "GraphicalObject.h" +#include "ilm_types.h" +#include <map> + +typedef std::map<GraphicalObject*, t_ilm_notification_mask> NotificationQueue; + +#endif // __NOTIFICATIONQUEUE_H__ diff --git a/LayerManagerService/src/main.cpp b/LayerManagerService/src/main.cpp index 3f88078..ed6180a 100644 --- a/LayerManagerService/src/main.cpp +++ b/LayerManagerService/src/main.cpp @@ -121,7 +121,7 @@ T* getCreateFunction(string libname) LOG_ERROR("LayerManagerService", "Failed to load shared lib entry point: " << dlsym_error); } - // TODO: free these resources on shutdown + // Note: free these resources on shutdown //dlclose(libraryHandle); //free(libraryHandle); @@ -517,7 +517,7 @@ int main(int argc, char **argv) CommunicatorListIterator commIterEnd = communicatorList.end(); for (; commIter != commIterEnd; ++commIter) { - (*commIter)->process(100); + (*commIter)->process(-1); } } } |