TextRenderer: updated to new IPlugin interface
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Tue, 11 Dec 2012 12:04:25 +0000 (04:04 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Mon, 14 Jan 2013 08:34:16 +0000 (00:34 -0800)
TextRenderer is now based on the updated IPlugin interface
to support static linking.

Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
LayerManagerPlugins/Renderers/Platform/TextRenderer/CMakeLists.txt
LayerManagerPlugins/Renderers/Platform/TextRenderer/include/TextRenderer.h
LayerManagerPlugins/Renderers/Platform/TextRenderer/src/TextRenderer.cpp

index 4ad0aa3..414cc50 100644 (file)
@@ -1,6 +1,6 @@
 ############################################################################
 #
-# Copyright 2010-2012 BMW Car IT GmbH
+# Copyright 2012 BMW Car IT GmbH
 #
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 #
 ############################################################################
 
+
 cmake_minimum_required (VERSION 2.6)
 
+#===========================================================================
+# plugin configuration
+#===========================================================================
 project(TextRenderer)
 
-find_package (Threads)
-
 include_directories(
     include
     ../../Base/include
@@ -32,26 +34,44 @@ include_directories(
     ${CMAKE_SOURCE_DIR}/LayerManagerUtils/include
 )
 
+set(LIBS
+    LayerManagerUtils
+    LayerManagerBase
+)
+
 set(SRC_FILES
     ../../Base/src/BaseRenderer.cpp
     src/TextRenderer.cpp
 )
 
-set(LIBS
-    ${LIBS}
-    ${CMAKE_THREAD_LIBS_INIT}
-    LayerManagerUtils
-)
+set(PLUGIN_INSTALL_PATH lib/layermanager/renderer)
+
+#===========================================================================
+# create statically linked plugin
+#===========================================================================
+if (WITH_STATIC_LIBRARIES)
 
-add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
+    add_library(${PROJECT_NAME} STATIC ${SRC_FILES})
 
+    set (STATICALLY_LINKED_PLUGINS ${STATICALLY_LINKED_PLUGINS}
+        ${PROJECT_NAME} CACHE INTERNAL "list of static plugins")
+
+#===========================================================================
+# create dynamically linked plugin
+#===========================================================================
+else(WITH_STATIC_LIBRARIES)
+
+    add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
+
+    install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
+
+endif(WITH_STATIC_LIBRARIES)
+
+
+#===========================================================================
+# external libraries
+#===========================================================================
 target_link_libraries(${PROJECT_NAME} ${LIBS})
 
-add_dependencies(${PROJECT_NAME}
-    LayerManagerService
-    LayerManagerUtils
-)
+add_dependencies(${PROJECT_NAME} ${LIBS})
 
-install(TARGETS ${PROJECT_NAME}
-        DESTINATION lib/layermanager/renderer
-)
index 7bf8f09..73ba254 100644 (file)
@@ -26,7 +26,7 @@
 class TextRenderer : public BaseRenderer
 {
 public:
-       TextRenderer(Scene* pScene);
+    TextRenderer(ICommandExecutor& executor, Configuration& config);
     virtual ~TextRenderer();
     void doScreenShot(std::string fileToSave);
     void doScreenShotOfLayer(std::string fileToSave, uint id);
@@ -43,6 +43,10 @@ public:
     virtual bool setOptimizationMode(OptimizationType id, OptimizationModeType mode);
     virtual bool getOptimizationMode(OptimizationType id, OptimizationModeType* mode);
 
+    // from PluginBase
+    virtual HealthCondition pluginGetHealth();
+    virtual t_ilm_const_string pluginGetName() const;
+
 private:
     uint m_width;
     uint m_height;
index 3462237..c5b30a9 100644 (file)
 ****************************************************************************/
 
 #include "TextRenderer.h"
-#include "config.h"
+#include "Configuration.h"
 #include "Log.h"
 #include <string.h>
 #include <fstream>
 
-TextRenderer::TextRenderer(Scene* pScene)
-: BaseRenderer(pScene)
+TextRenderer::TextRenderer(ICommandExecutor& executor, Configuration& config)
+: BaseRenderer(executor, config)
 , m_width(0)
 , m_height(0)
 {
@@ -136,11 +136,14 @@ bool TextRenderer::getOptimizationMode(OptimizationType id, OptimizationModeType
     return true;
 }
 
-extern "C" IRenderer* createTextRenderer(Scene* pScene) {
-    return new TextRenderer(pScene);
+HealthCondition TextRenderer::pluginGetHealth()
+{
+    return HealthRunning;
 }
 
-extern "C" void destroyTextRenderer(TextRenderer* p)
+t_ilm_const_string TextRenderer::pluginGetName() const
 {
-    delete p;
+    return "TextRenderer";
 }
+
+DECLARE_LAYERMANAGEMENT_PLUGIN(TextRenderer)