1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
20 #ifndef _PlatformLayer_H_
21 #define _PlatformLayer_H_
41 #pragma comment(lib, "Shlwapi.lib")
42 #pragma comment(lib, "../Outputs/sqlite3.lib")
51 #include <semaphore.h>
55 #include <android/log.h>
66 #define LOCATION_SSM_DB ":memory:"
67 #define RAPIDXML_STATIC_POOL_SIZE 4*1024
68 #define DEFAULT_PATH_SOFT_SENSORS "SoftSensorDescription.xml"
69 #define LOCATION_SSM_DB_DUMP ""
70 //#define LOCATION_SSM_DB_DUMP "myBackup.db"
75 #define PRINT_LOG(strError) printf("[SSM] %s:%d %s\n", __FUNCTION__, __LINE__, strError)
76 #define REPORT_MESSAGE(tag, msg) printf("[%s] %s\n", tag, msg)
82 void ReportMessage(const char *tag, const char *msg);
83 #define REPORT_MESSAGE(tag, msg) ReportMessage(tag, msg)
84 #define PRINT_LOG(strError) __android_log_print(ANDROID_LOG_ERROR, "[SSM]", "%s:%d %s", __PRETTY_FUNCTION__, __LINE__, strError)
88 void ReportMessage(const char *tag, const char *msg);
89 #define REPORT_MESSAGE(tag, msg) ReportMessage(tag, msg)
90 #define PRINT_LOG(strError) dlog_print(DLOG_DEBUG, "SSM", "%s:%d %s", __PRETTY_FUNCTION__, __LINE__, strError)
94 #define REPORT_MESSAGE(tag, msg) printf("[%s] %s\n", tag, msg)
95 #define PRINT_LOG(strError) printf("[SSM] %s:%d %s\n", __PRETTY_FUNCTION__, __LINE__, strError)
103 #define SSM_VOID_ASSERT(Exp, STRErrorMsg) \
107 PRINT_LOG(STRErrorMsg); \
113 #define SSM_RESULT_ASSERT(Exp, STRErrorMsg, Result) \
117 PRINT_LOG(STRErrorMsg); \
123 #define SSM_CLEANUP_ASSERT(Exp) \
125 if((res = (Exp)) != SSM_S_OK) \
127 PRINT_LOG(GetSSMError(res)); \
133 #define SSM_CLEANUP_COND_ASSERT(Exp, Cond, STRErrorMsg) \
137 PRINT_LOG(STRErrorMsg); \
143 #define SSM_CLEANUP_NULL_ASSERT(Val) \
147 PRINT_LOG("NULL value"); \
153 #define CLEAN_STACKVARIABLE(val) memset(&val, 0, sizeof(val))
154 #define SAFE_RELEASE(p) {if(p != NULL){p->release();p = NULL;}else{;/*NULL*/}}
155 #define SAFE_DELETE(p) {if(p != NULL){delete p;p = NULL;}else{;/*NULL*/}}
156 #define SAFE_ARRAY_DELETE(p) {if(p != NULL){delete [] p;p = NULL;}else{;/*NULL*/}}
158 #include "ObjectManager.h"
159 #include "ThreadManager.h"
160 #include "SSMInterface/SSMModelDefinition.h"
162 typedef std::vector<std::string> StringVec;
163 typedef std::vector<int> IntVec;
167 * @brief Create instance using given OID (Object ID).
168 * After using the IBase object, you must call Release method.
170 * @param [in] const OID& objectID - objectID
171 * @param [out] IBase** ppObject - reference pointer to get instance pointer
177 INTERFACE_DECLSPEC SSMRESULT CreateInstance(const OID &objectID, IBase **ppObject);
180 * @fn createGlobalInstance
181 * @brief Create global instance using given OID (Object ID).
182 * The instance is managed by global instance map.
183 * After using the IBase object, you must call Release method.
185 * @param [in] const OID& objectID - objectID
186 * @param [out] IBase** ppObject - reference pointer to get instance pointer
192 INTERFACE_DECLSPEC SSMRESULT CreateGlobalInstance(const OID &objectID, IBase **ppObject);
194 INTERFACE_DECLSPEC SSMRESULT CreateGlobalInstanceRepo();
196 INTERFACE_DECLSPEC SSMRESULT DestroyGlobalInstanceRepo();