1 #ifndef _PlatformLayer_H_
2 #define _PlatformLayer_H_
22 #pragma comment(lib, "Shlwapi.lib")
23 #pragma comment(lib, "../Outputs/sqlite3.lib")
32 #include <semaphore.h>
36 #include <android/log.h>
45 #define LOCATION_SSM_DB ":memory:"
46 #define RAPIDXML_STATIC_POOL_SIZE 4*1024
47 #define DEFAULT_PATH_SOFT_SENSORS "SoftSensorDescription.xml"
48 #define LOCATION_SSM_DB_DUMP ""
49 //#define LOCATION_SSM_DB_DUMP "myBackup.db"
54 #define PRINT_LOG(strError) printf("[SSM] %s:%d %s\n", __FUNCTION__, __LINE__, strError)
55 #define REPORT_MESSAGE(tag, msg) printf("[%s] %s\n", tag, msg)
61 void ReportMessage(const char *tag, const char *msg);
62 #define REPORT_MESSAGE(tag, msg) ReportMessage(tag, msg)
63 #define PRINT_LOG(strError) __android_log_print(ANDROID_LOG_ERROR, "[SSM]", "%s:%d %s", __PRETTY_FUNCTION__, __LINE__, strError)
67 #define REPORT_MESSAGE(tag, msg) printf("[%s] %s\n", tag, msg)
68 #define PRINT_LOG(strError) printf("[SSM] %s:%d %s\n", __FUNCTION__, __LINE__, strError)
72 #define REPORT_MESSAGE(tag, msg) printf("[%s] %s\n", tag, msg)
73 #define PRINT_LOG(strError) printf("[SSM] %s:%d %s\n", __FUNCTION__, __LINE__, strError)
81 #define SSM_VOID_ASSERT(Exp, STRErrorMsg) \
85 PRINT_LOG(STRErrorMsg); \
91 #define SSM_RESULT_ASSERT(Exp, STRErrorMsg, Result) \
95 PRINT_LOG(STRErrorMsg); \
101 #define SSM_CLEANUP_ASSERT(Exp) \
103 if((res = (Exp)) != SSM_S_OK) \
105 PRINT_LOG(GetSSMError(res)); \
111 #define SSM_CLEANUP_COND_ASSERT(Exp, Cond, STRErrorMsg) \
115 PRINT_LOG(STRErrorMsg); \
121 #define SSM_CLEANUP_NULL_ASSERT(Val) \
125 PRINT_LOG("NULL value"); \
131 #define CLEAN_STACKVARIABLE(val) memset(&val, 0, sizeof(val))
132 #define SAFE_RELEASE(p) {if(p != NULL){p->release();p = NULL;}else{;/*NULL*/}}
133 #define SAFE_DELETE(p) {if(p != NULL){delete p;p = NULL;}else{;/*NULL*/}}
134 #define SAFE_ARRAY_DELETE(p) {if(p != NULL){delete [] p;p = NULL;}else{;/*NULL*/}}
136 #include "ObjectManager.h"
137 #include "ThreadManager.h"
138 #include "SSMInterface/SSMModelDefinition.h"
140 typedef std::vector<std::string> StringVec;
141 typedef std::vector<int> IntVec;
145 * @brief Create instance using given OID (Object ID).
146 * After using the IBase object, you must call Release method.
148 * @param [in] const OID& objectID - objectID
149 * @param [out] IBase** ppObject - reference pointer to get instance pointer
155 INTERFACE_DECLSPEC SSMRESULT CreateInstance(IN const OID &objectID, OUT IBase **ppObject);
158 * @fn createGlobalInstance
159 * @brief Create global instance using given OID (Object ID).
160 * The instance is managed by global instance map.
161 * After using the IBase object, you must call Release method.
163 * @param [in] const OID& objectID - objectID
164 * @param [out] IBase** ppObject - reference pointer to get instance pointer
170 INTERFACE_DECLSPEC SSMRESULT CreateGlobalInstance(IN const OID &objectID, OUT IBase **ppObject);
172 INTERFACE_DECLSPEC SSMRESULT CreateGlobalInstanceRepo();
174 INTERFACE_DECLSPEC SSMRESULT DestroyGlobalInstanceRepo();