summaryrefslogtreecommitdiff
path: root/ivi-layermanagement-examples/LayerManagerUtils/include
diff options
context:
space:
mode:
Diffstat (limited to 'ivi-layermanagement-examples/LayerManagerUtils/include')
-rw-r--r--ivi-layermanagement-examples/LayerManagerUtils/include/Bitmap.h26
-rw-r--r--ivi-layermanagement-examples/LayerManagerUtils/include/IlmMatrix.h107
-rw-r--r--ivi-layermanagement-examples/LayerManagerUtils/include/IpcModule.h107
-rw-r--r--ivi-layermanagement-examples/LayerManagerUtils/include/IpcModuleLoader.h75
-rw-r--r--ivi-layermanagement-examples/LayerManagerUtils/include/Log.h132
-rw-r--r--ivi-layermanagement-examples/LayerManagerUtils/include/LogMessageBuffer.h126
-rw-r--r--ivi-layermanagement-examples/LayerManagerUtils/include/ThreadBase.h55
7 files changed, 628 insertions, 0 deletions
diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/Bitmap.h b/ivi-layermanagement-examples/LayerManagerUtils/include/Bitmap.h
new file mode 100644
index 0000000..ec6a1d7
--- /dev/null
+++ b/ivi-layermanagement-examples/LayerManagerUtils/include/Bitmap.h
@@ -0,0 +1,26 @@
+/***************************************************************************
+*
+* 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 _BITMAP_H_
+#define _BITMAP_H_
+
+#include <string>
+
+void writeBitmap(std::string FileName, char* imagedataRGB, int width, int height);
+
+#endif /*_BITMAP_H_ */
diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/IlmMatrix.h b/ivi-layermanagement-examples/LayerManagerUtils/include/IlmMatrix.h
new file mode 100644
index 0000000..e0c606f
--- /dev/null
+++ b/ivi-layermanagement-examples/LayerManagerUtils/include/IlmMatrix.h
@@ -0,0 +1,107 @@
+/***************************************************************************
+*
+* 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.
+*
+* This file incorporates work covered by the following copyright and
+* permission notice:
+*
+* Oolong Engine for the iPhone / iPod touch
+* Copyright (c) 2007-2008 Wolfgang Engel http://code.google.com/p/oolongengine/
+*
+* This software is provided 'as-is', without any express or implied warranty.
+* In no event will the authors be held liable for any damages arising from the use of this software.
+* Permission is granted to anyone to use this software for any purpose,
+* including commercial applications, and to alter it and redistribute it freely,
+* subject to the following restrictions:
+*
+* 1. The origin of this software must not be misrepresented; you must not claim that
+* you wrote the original software. If you use this software in a product, an
+* acknowledgment in the product documentation would be appreciated but is not required.
+* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
+* as being the original software.
+* 3. This notice may not be removed or altered from any source distribution.
+****************************************************************************/
+
+#ifndef _ILMMATRIX_H_
+#define _ILMMATRIX_H_
+
+#define MAT00 0
+#define MAT01 1
+#define MAT02 2
+#define MAT03 3
+#define MAT10 4
+#define MAT11 5
+#define MAT12 6
+#define MAT13 7
+#define MAT20 8
+#define MAT21 9
+#define MAT22 10
+#define MAT23 11
+#define MAT30 12
+#define MAT31 13
+#define MAT32 14
+#define MAT33 15
+
+typedef struct
+{
+ float x;
+ float y;
+} IlmVector2f;
+
+typedef struct
+{
+ float x;
+ float y;
+ float z;
+} IlmVector3f;
+
+typedef struct
+{
+ float x;
+ float y;
+ float z;
+ float w;
+} IlmVector4f;
+
+class IlmMatrix
+{
+public:
+ float* operator [] (const int row)
+ {
+ return &f[row<<2];
+ }
+
+ float f[16];
+};
+
+void IlmMatrixIdentity(IlmMatrix &mOut);
+
+void IlmMatrixMultiply(IlmMatrix &mOut, const IlmMatrix &mA, const IlmMatrix &mB);
+
+void IlmMatrixTranslation(IlmMatrix &mOut, const float X, const float Y, const float Z);
+
+void IlmMatrixScaling(IlmMatrix &mOut, const float X, const float Y, const float Z);
+
+void IlmMatrixRotateX(IlmMatrix &mOut, const float angle);
+
+void IlmMatrixRotateY(IlmMatrix &mOut, const float angle);
+
+void IlmMatrixRotateZ(IlmMatrix &mOut, const float angle);
+
+void IlmMatrixProjection(IlmMatrix &mOut, const float fov, const float near, const float far, const float aspectRatio);
+
+
+#endif /* _ILMMATRIX_H_*/
diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModule.h b/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModule.h
new file mode 100644
index 0000000..ff0e959
--- /dev/null
+++ b/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModule.h
@@ -0,0 +1,107 @@
+/***************************************************************************
+*
+* Copyright 2012 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 __IPCMODULE_H__
+#define __IPCMODULE_H__
+
+#include "ilm_types.h"
+
+/*
+=============================================================================
+ initialization
+=============================================================================
+*/
+t_ilm_bool initClientMode();
+t_ilm_bool initServiceMode();
+
+/*
+=============================================================================
+ create new messages
+=============================================================================
+*/
+t_ilm_message createMessage(t_ilm_const_string);
+t_ilm_message createResponse(t_ilm_message);
+t_ilm_message createErrorResponse(t_ilm_message);
+t_ilm_message createNotification(t_ilm_const_string);
+
+/*
+=============================================================================
+ add content to message
+=============================================================================
+*/
+t_ilm_bool appendBool(t_ilm_message, const t_ilm_bool);
+t_ilm_bool appendDouble(t_ilm_message, const double);
+t_ilm_bool appendString(t_ilm_message, const char*);
+t_ilm_bool appendInt(t_ilm_message, const int);
+t_ilm_bool appendIntArray(t_ilm_message, const int*, int);
+t_ilm_bool appendUint(t_ilm_message, const unsigned int);
+t_ilm_bool appendUintArray(t_ilm_message, const unsigned int*, int);
+
+/*
+=============================================================================
+ send message
+=============================================================================
+*/
+t_ilm_bool sendToClients(t_ilm_message, t_ilm_client_handle*, int);
+t_ilm_bool sendToService(t_ilm_message);
+
+/*
+=============================================================================
+ receive message
+=============================================================================
+*/
+t_ilm_message receive(t_ilm_int); /* timeout in ms*/
+
+/*
+=============================================================================
+ get message information
+=============================================================================
+*/
+t_ilm_const_string getMessageName(t_ilm_message);
+t_ilm_message_type getMessageType(t_ilm_message);
+t_ilm_const_string getSenderName(t_ilm_message);
+t_ilm_client_handle getSenderHandle(t_ilm_message);
+
+/*
+=============================================================================
+ get content of message
+=============================================================================
+*/
+t_ilm_bool getBool(t_ilm_message, t_ilm_bool*);
+t_ilm_bool getDouble(t_ilm_message, double*);
+t_ilm_bool getString(t_ilm_message, char*);
+t_ilm_bool getInt(t_ilm_message, int*);
+t_ilm_bool getIntArray(t_ilm_message, int**, int*);
+t_ilm_bool getUint(t_ilm_message, unsigned int*);
+t_ilm_bool getUintArray(t_ilm_message, unsigned int**, int*);
+
+/*
+=============================================================================
+ destroy message
+=============================================================================
+*/
+t_ilm_bool destroyMessage(t_ilm_message);
+
+/*
+=============================================================================
+ shutdown
+=============================================================================
+*/
+t_ilm_bool destroy();
+
+#endif /* __IPCMODULE_H__*/
diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModuleLoader.h b/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModuleLoader.h
new file mode 100644
index 0000000..0e1952e
--- /dev/null
+++ b/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModuleLoader.h
@@ -0,0 +1,75 @@
+/**************************************************************************
+ *
+ * Copyright 2012 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 __IPCMODULELOADER_H_
+#define __IPCMODULELOADER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus*/
+
+#include "ilm_types.h"
+
+struct IpcModule
+{
+ t_ilm_bool (*initClientMode)();
+ t_ilm_bool (*initServiceMode)();
+
+ t_ilm_message (*createMessage)(t_ilm_const_string);
+ t_ilm_message (*createResponse)(t_ilm_message);
+ t_ilm_message (*createErrorResponse)(t_ilm_message);
+ t_ilm_message (*createNotification)(t_ilm_const_string);
+
+ t_ilm_bool (*appendBool)(t_ilm_message, const t_ilm_bool);
+ t_ilm_bool (*appendDouble)(t_ilm_message, const double);
+ t_ilm_bool (*appendString)(t_ilm_message, const char*);
+ t_ilm_bool (*appendInt)(t_ilm_message, const int);
+ t_ilm_bool (*appendIntArray)(t_ilm_message, const int*, int);
+ t_ilm_bool (*appendUint)(t_ilm_message, const unsigned int);
+ t_ilm_bool (*appendUintArray)(t_ilm_message, const unsigned int*, int);
+
+ t_ilm_bool (*sendToClients)(t_ilm_message, t_ilm_client_handle*, int);
+ t_ilm_bool (*sendToService)(t_ilm_message);
+
+ t_ilm_message (*receive)(t_ilm_int); /* timeout in ms*/
+
+ t_ilm_const_string (*getMessageName)(t_ilm_message);
+ t_ilm_message_type (*getMessageType)(t_ilm_message);
+ t_ilm_const_string (*getSenderName)(t_ilm_message);
+ t_ilm_client_handle (*getSenderHandle)(t_ilm_message);
+
+ t_ilm_bool (*getBool)(t_ilm_message, t_ilm_bool*);
+ t_ilm_bool (*getDouble)(t_ilm_message, double*);
+ t_ilm_bool (*getString)(t_ilm_message, char*);
+ t_ilm_bool (*getInt)(t_ilm_message, int*);
+ t_ilm_bool (*getIntArray)(t_ilm_message, int**, int*);
+ t_ilm_bool (*getUint)(t_ilm_message, unsigned int*);
+ t_ilm_bool (*getUintArray)(t_ilm_message, unsigned int**, int*);
+
+ t_ilm_bool (*destroyMessage)(t_ilm_message);
+
+ t_ilm_bool (*destroy)();
+};
+
+t_ilm_bool loadIpcModule(struct IpcModule* communicator);
+
+#ifdef __cplusplus
+} /* extern "C"*/
+#endif /* __cplusplus*/
+
+#endif /* __IPCMODULELOADER_H_*/
diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/Log.h b/ivi-layermanagement-examples/LayerManagerUtils/include/Log.h
new file mode 100644
index 0000000..3d96d30
--- /dev/null
+++ b/ivi-layermanagement-examples/LayerManagerUtils/include/Log.h
@@ -0,0 +1,132 @@
+/***************************************************************************
+* Copyright (C) 2011 BMW Car IT GmbH.
+* Author: Michael Schuldt (michael.schuldt@bmw-carit.de)
+*
+* 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.
+*
+* This file incorporates work covered by the following copyright and
+* permission notice:
+* Apache log4cxx
+* Copyright 2004-2007 The Apache Software Foundation
+*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You 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 _LOG_H_
+#define _LOG_H_
+#include "LogMessageBuffer.h"
+#include <iostream>
+#include <fstream>
+#include <pthread.h>
+#include <map>
+typedef enum
+{
+ LOG_DISABLED = 0,
+ LOG_ERROR = 1,
+ LOG_INFO = 2,
+ LOG_WARNING = 3,
+ LOG_DEBUG = 4,
+ LOG_MAX_LEVEL
+} LOG_MODES;
+
+/*The log context content is configuration dependend. Due
+ to the fact that we don't want to share the config file
+ in development headers, the real context is established
+ during the compiliation phase*/
+typedef void* LogContext;
+
+/* Diagnostic Injection Callback function to wrap dlt_injections for usage with c++ class names */
+typedef void (*diagnosticInjectionCallback)(unsigned int module_id, void *data, unsigned int length, void* userdata);
+
+class Log
+{
+public:
+
+ typedef struct diagnosticCallbackData_t
+ {
+ unsigned int module_id;
+ void *userdata;
+ diagnosticInjectionCallback diagFunc;
+ } diagnosticCallbackData;
+
+ typedef std::map<unsigned int, diagnosticCallbackData*> DiagnosticCallbackMap;
+
+ virtual ~Log();
+ static LOG_MODES fileLogLevel;
+ static LOG_MODES consoleLogLevel;
+ static LOG_MODES dltLogLevel;
+ static Log* getInstance();
+ static DiagnosticCallbackMap* getDiagnosticCallbackMap()
+ {
+ return getInstance()->m_diagnosticCallbackMap;
+ }
+ void warning(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
+ void info(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
+ void error(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
+ void debug(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
+ void log(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output);
+ void registerDiagnosticInjectionCallback(unsigned int module_id, diagnosticInjectionCallback diagFunc, void* userdata);
+ void unregisterDiagnosticInjectionCallback(unsigned int module_id);
+ LogContext getLogContext();
+ static void closeInstance();
+private:
+ Log();
+ void LogToFile(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output);
+ void LogToConsole(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output);
+ void LogToDltDaemon(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output);
+
+private:
+ std::ofstream* m_fileStream;
+ pthread_mutex_t m_LogBufferMutex;
+ LogContext m_logContext;
+ static DiagnosticCallbackMap* m_diagnosticCallbackMap;
+
+ static Log* m_instance;
+};
+
+//#define LOG_ERROR(logcontext,module, message)
+
+#define LOG_ERROR(module, message) { \
+ LogMessageBuffer oss_; \
+ Log::getInstance()->error(Log::getInstance()->getLogContext(), module, oss_.str(oss_<< message)); }
+
+//#define LOG_INFO(logcontext,module, message)
+
+#define LOG_INFO(module, message) { \
+ LogMessageBuffer oss_; \
+ Log::getInstance()->info(Log::getInstance()->getLogContext(), module, oss_.str(oss_<< message)); }
+
+//#define LOG_DEBUG(logcontext,module, message)
+
+#define LOG_DEBUG(module, message) { \
+ LogMessageBuffer oss_; \
+ Log::getInstance()->debug(Log::getInstance()->getLogContext(), module, oss_.str(oss_<< message)); }
+
+//#define LOG_WARNING(logcontext,module, message)
+
+#define LOG_WARNING(module, message) { \
+ LogMessageBuffer oss_; \
+ Log::getInstance()->warning(Log::getInstance()->getLogContext(), module, oss_.str(oss_<< message)); }
+#endif /* _LOG_H_ */
diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/LogMessageBuffer.h b/ivi-layermanagement-examples/LayerManagerUtils/include/LogMessageBuffer.h
new file mode 100644
index 0000000..aca6166
--- /dev/null
+++ b/ivi-layermanagement-examples/LayerManagerUtils/include/LogMessageBuffer.h
@@ -0,0 +1,126 @@
+/***************************************************************************
+* Copyright (C) 2011 BMW Car IT GmbH.
+* Author: Michael Schuldt (michael.schuldt@bmw-carit.de)
+*
+* 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.
+*
+* This file incorporates work covered by the following copyright and
+* permission notice:
+* Apache log4cxx
+* Copyright 2004-2007 The Apache Software Foundation
+*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You 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 _LOGMESSAGEBUFFER_H_
+#define _LOGMESSAGEBUFFER_H_
+
+#include <sstream>
+#include <pthread.h>
+typedef std::ios_base& (*ios_base_manip)(std::ios_base&);
+
+class LogMessageBuffer
+{
+public:
+ /**
+ * Creates a new instance.
+ */
+ LogMessageBuffer();
+ /**
+ * Destructor.
+ */
+ ~LogMessageBuffer();
+
+ LogMessageBuffer& operator<<(const std::basic_string<char>& msg);
+
+ LogMessageBuffer& operator<<(const char* msg);
+
+ LogMessageBuffer& operator<<(char* msg);
+
+ LogMessageBuffer& operator<<(const char msg);
+
+ std::ostream& operator<<(ios_base_manip manip);
+
+ std::ostream& operator<<(bool val);
+
+ std::ostream& operator<<(short val);
+
+ std::ostream& operator<<(int val);
+
+ std::ostream& operator<<(unsigned int val);
+
+ std::ostream& operator<<(long val);
+
+ std::ostream& operator<<(unsigned long val);
+
+ std::ostream& operator<<(float val);
+
+ std::ostream& operator<<(double val);
+
+ std::ostream& operator<<(long double val);
+
+ std::ostream& operator<<(void* val);
+
+ /**
+ * Cast to ostream.
+ */
+ operator std::basic_ostream<char>&();
+
+ const std::basic_string<char>& str(std::basic_ostream<char>& os);
+
+ const std::basic_string<char>& str() const;
+
+ bool hasStream() const;
+
+private:
+ /**
+ * No default copy constructor.
+ */
+ LogMessageBuffer(const LogMessageBuffer&);
+
+ /**
+ * No assignment operator.
+ */
+ LogMessageBuffer& operator=(const LogMessageBuffer&);
+
+ /**
+ * Encapsulated std::string.
+ */
+ std::basic_string<char> buf;
+
+ /**
+ * Encapsulated stream, created on demand.
+ */
+ std::basic_ostringstream<char>* stream;
+};
+
+template<class V>
+std::basic_ostream<char>& operator<<(LogMessageBuffer& os, const V& val)
+{
+ return ((std::basic_ostream<char>&) os) << val;
+}
+
+#endif /* _LOGMESSAGEBUFFER_H_ */
diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/ThreadBase.h b/ivi-layermanagement-examples/LayerManagerUtils/include/ThreadBase.h
new file mode 100644
index 0000000..77cc7b5
--- /dev/null
+++ b/ivi-layermanagement-examples/LayerManagerUtils/include/ThreadBase.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ *
+ * 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 __THREADBASE_H__
+#define __THREADBASE_H__
+
+#include "ilm_types.h"
+#include <pthread.h>
+
+class ThreadBase
+{
+public:
+ ThreadBase();
+ virtual ~ThreadBase();
+
+ t_ilm_bool threadCreate();
+ t_ilm_bool threadInit();
+ t_ilm_bool threadStart();
+ t_ilm_bool threadStop();
+
+ pthread_t threadGetId() const;
+ t_ilm_bool threadIsRunning();
+
+ // override in inheriting class if required
+ virtual t_ilm_bool threadInitInThreadContext();
+ virtual t_ilm_bool threadDestroyInThreadContext();
+
+ // implement in inheriting class
+ virtual t_ilm_bool threadMainLoop() = 0;
+
+private:
+ static unsigned int mGlobalThreadCount;
+ pthread_t mThreadId;
+ pthread_mutex_t mInitLock;
+ pthread_mutex_t mRunLock;
+ t_ilm_bool mRunning;
+};
+
+#endif // __THREADBASE_H__