Replace the glib-json wrapper CtxJson with jsoncpp 74/136674/6
authorMu-Woong Lee <muwoong.lee@samsung.com>
Sat, 1 Jul 2017 14:18:44 +0000 (23:18 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 3 Jul 2017 05:29:52 +0000 (14:29 +0900)
Change-Id: I73edc779b88688e675bef73c9e43089df631cf5f
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
21 files changed:
packaging/context-sensor-recorder.spec
src/client/CMakeLists.txt
src/client/sensor_recorder.cpp
src/server/CMakeLists.txt
src/server/legacy/Querier.cpp
src/server/legacy/Querier.h
src/server/legacy/RecorderClientInfo.cpp
src/server/legacy/RecorderClientInfo.h
src/server/legacy/SensorProvider.cpp
src/server/legacy/SensorProvider.h
src/server/legacy/heartrate/HeartRate.cpp
src/server/legacy/heartrate/HeartRate.h
src/server/legacy/heartrate/HeartRateLogger.cpp
src/server/legacy/heartrate/HeartRateQuerier.cpp
src/server/legacy/heartrate/HeartRateQuerier.h
src/server/legacy/pedometer/PedometerQuerier.cpp
src/server/legacy/pedometer/PedometerQuerier.h
src/server/legacy/pressure/PressureQuerier.cpp
src/server/legacy/pressure/PressureQuerier.h
src/server/legacy/sleep/SleepQuerier.cpp
src/server/legacy/sleep/SleepQuerier.h

index aaadc2d..6a27459 100644 (file)
@@ -9,6 +9,7 @@ Source0:    %{name}-%{version}.tar.gz
 BuildRequires: cmake
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(jsoncpp)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(sensor)
 BuildRequires: pkgconfig(capi-base-common)
index 8f551d7..46d4131 100644 (file)
@@ -1,6 +1,6 @@
 SET(target "${PROJECT_NAME}-client-genuine")
 
-SET(DEPS "${DEPS} context-common-client")
+SET(DEPS "${DEPS} jsoncpp context-common-client")
 
 FILE(GLOB_RECURSE SRCS *.cpp ../shared/*.cpp)
 MESSAGE("Sources: ${SRCS}")
index 618cfcf..1973f76 100644 (file)
  * limitations under the License.
  */
 
+#include <json/json.h>
 #include <sensor_recorder_internal.h>
 #include <SensorRecorderTypesPrivate.h>
 #include <ServiceProxy.h>
-#include <CtxJson.h>
 #include "QueryResultListener.h"
 
 #define STR_BUFFER_SIZE 128
@@ -48,8 +48,11 @@ EXPORT_API int ctx_sensor_rec_start(const char* subject, ctx_sensor_rec_option_h
        IF_FAIL_RETURN(subject, E_PARAM);
 
        std::string optionStr;
-       if (option)
-               optionStr = static_cast<ctx::CtxJson *>(option)->str();
+       if (option) {
+               Json::FastWriter fw;
+               fw.omitEndingLineFeed();
+               optionStr = fw.write(*static_cast<Json::Value*>(option));
+       }
 
        GVariant* param = g_variant_new("(ss)", subject, optionStr.c_str());
 
@@ -66,7 +69,7 @@ EXPORT_API int ctx_sensor_rec_create_option(ctx_sensor_rec_option_h *option)
 {
        IF_FAIL_RETURN(option, E_PARAM);
 
-       *option = new(std::nothrow) ctx::CtxJson;
+       *option = new(std::nothrow) Json::Value;
        IF_FAIL_RETURN(*option, E_NO_MEM);
 
        return E_NONE;
@@ -76,7 +79,7 @@ EXPORT_API int ctx_sensor_rec_destroy_option(ctx_sensor_rec_option_h option)
 {
        IF_FAIL_RETURN(option, E_PARAM);
 
-       delete static_cast<ctx::CtxJson*>(option);
+       delete static_cast<Json::Value*>(option);
 
        return E_NONE;
 }
@@ -87,8 +90,8 @@ EXPORT_API int ctx_sensor_rec_option_set_int(ctx_sensor_rec_option_h option, con
        IF_FAIL_RETURN(STR_EQ(param, CTX_SENSOR_RECORDER_KEY_INTERVAL) ||
                                   STR_EQ(param, CTX_SENSOR_RECORDER_KEY_RETENTION), E_PARAM);
 
-       ctx::CtxJson* optionCtxJson = static_cast<ctx::CtxJson*>(option);
-       optionCtxJson->set(NULL, param, static_cast<int64_t>(value));
+       Json::Value& optionJson = *static_cast<Json::Value*>(option);
+       optionJson[param] = value;
 
        return E_NONE;
 }
@@ -97,7 +100,7 @@ EXPORT_API int ctx_sensor_rec_create_query(ctx_sensor_rec_query_h *query)
 {
        IF_FAIL_RETURN(query, E_PARAM);
 
-       *query = new(std::nothrow) ctx::CtxJson;
+       *query = new(std::nothrow) Json::Value;
        IF_FAIL_RETURN(*query, E_NO_MEM);
 
        return E_NONE;
@@ -107,7 +110,7 @@ EXPORT_API int ctx_sensor_rec_destroy_query(ctx_sensor_rec_query_h query)
 {
        IF_FAIL_RETURN(query, E_PARAM);
 
-       delete static_cast<ctx::CtxJson*>(query);
+       delete static_cast<Json::Value*>(query);
 
        return E_NONE;
 }
@@ -120,8 +123,8 @@ EXPORT_API int ctx_sensor_rec_query_set_int(ctx_sensor_rec_query_h query, const
                                   STR_EQ(param, CTX_SENSOR_RECORDER_KEY_START_TIME) ||
                                   STR_EQ(param, CTX_SENSOR_RECORDER_KEY_END_TIME), E_PARAM);
 
-       ctx::CtxJson* queryCtxJson = static_cast<ctx::CtxJson*>(query);
-       queryCtxJson->set(NULL, param, static_cast<int64_t>(value));
+       Json::Value& queryJson = *static_cast<Json::Value*>(query);
+       queryJson[param] = value;
 
        return E_NONE;
 }
@@ -133,8 +136,8 @@ EXPORT_API int ctx_sensor_rec_query_set_time(ctx_sensor_rec_query_h query, const
                                   STR_EQ(param, CTX_SENSOR_RECORDER_KEY_START_TIME) ||
                                   STR_EQ(param, CTX_SENSOR_RECORDER_KEY_END_TIME), E_PARAM);
 
-       ctx::CtxJson* queryCtxJson = static_cast<ctx::CtxJson*>(query);
-       queryCtxJson->set(NULL, param, static_cast<int64_t>(t));
+       Json::Value& queryJson = *static_cast<Json::Value*>(query);
+       queryJson[param] = static_cast<int64_t>(t);
 
        return E_NONE;
 }
@@ -146,7 +149,9 @@ EXPORT_API int ctx_sensor_rec_read(const char* subject, ctx_sensor_rec_query_h q
        QueryResultListener* listener = new(std::nothrow) QueryResultListener(subject, cb, user_data);
        IF_FAIL_RETURN_TAG(listener, E_NO_MEM, _E, E_STR_ALLOC);
 
-       std::string queryStr = static_cast<ctx::CtxJson*>(query)->str();
+       Json::FastWriter fw;
+       fw.omitEndingLineFeed();
+       std::string queryStr = fw.write(*static_cast<Json::Value*>(query));
        GVariant* param = g_variant_new("(ss)", subject, queryStr.c_str());
 
        int error = __getServiceProxy()->call(METHOD_READ_REC, param, listener);
@@ -164,7 +169,9 @@ EXPORT_API int ctx_sensor_rec_read_sync(const char* subject, ctx_sensor_rec_quer
        QueryResultListener* listener = new(std::nothrow) QueryResultListener(subject, cb, user_data);
        IF_FAIL_RETURN_TAG(listener, E_NO_MEM, _E, E_STR_ALLOC);
 
-       std::string queryStr = static_cast<ctx::CtxJson*>(query)->str();
+       Json::FastWriter fw;
+       fw.omitEndingLineFeed();
+       std::string queryStr = fw.write(*static_cast<Json::Value*>(query));
        GVariant* param = g_variant_new("(ss)", subject, queryStr.c_str());
 
        GVariant* outParam = NULL;
index ee007d8..d380df0 100644 (file)
@@ -1,6 +1,6 @@
 SET(target "${PROJECT_NAME}-server-genuine")
 
-SET(DEPS "${DEPS} context-common-server capi-system-info sensor")
+SET(DEPS "${DEPS} jsoncpp context-common-server capi-system-info sensor")
 
 FILE(GLOB_RECURSE SRCS *.cpp ../shared/*.cpp)
 MESSAGE("Sources: ${SRCS}")
index 37f16e8..3eee5bf 100644 (file)
@@ -39,17 +39,17 @@ int Querier::query(const char *sql, std::vector<std::shared_ptr<Tuple>>* tuples)
        return ret ? E_NONE : E_FAILED;
 }
 
-int Querier::queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int Querier::queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        return E_PARAM;
 }
 
-int Querier::query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int Querier::query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        return E_PARAM;
 }
 
-int Querier::query(int startTime, int endTime, int anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples)
+int Querier::query(time_t startTime, time_t endTime, time_t anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        _D("Ignore anchor & interval");
        return query(startTime, endTime, tuples);
index 354681d..948fa4e 100644 (file)
@@ -29,9 +29,9 @@ namespace ctx {
 
                virtual std::string getProjection();
 
-               virtual int queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
-               virtual int query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
-               virtual int query(int startTime, int endTime, int anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples);
+               virtual int queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               virtual int query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               virtual int query(time_t startTime, time_t endTime, time_t anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples);
 
        protected:
                int query(const char *sql, std::vector<std::shared_ptr<Tuple>>* tuples);
index 2bf99d8..56b8f02 100644 (file)
@@ -55,7 +55,7 @@ RecorderClientInfo::~RecorderClientInfo()
        __uninstallMonitor = NULL;
 }
 
-int RecorderClientInfo::get(std::string subject, std::string pkgId, CtxJson& option)
+int RecorderClientInfo::get(std::string subject, std::string pkgId, Json::Value& option)
 {
        bool ret;
        std::string optStr;
@@ -73,12 +73,14 @@ int RecorderClientInfo::get(std::string subject, std::string pkgId, CtxJson& opt
        IF_FAIL_RETURN(!tuples.empty(), E_NO_DATA);
 
        tuples[0]->getAt(0, &optStr);
-       option = optStr;
+
+       Json::Reader jr;
+       jr.parse(optStr, option);
 
        return E_NONE;
 }
 
-int RecorderClientInfo::get(std::string subject, std::vector<CtxJson>& options)
+int RecorderClientInfo::get(std::string subject, std::vector<Json::Value>& options)
 {
        bool ret;
        std::string optStr;
@@ -95,9 +97,15 @@ int RecorderClientInfo::get(std::string subject, std::vector<CtxJson>& options)
        IF_FAIL_RETURN(ret, E_FAILED);
        IF_FAIL_RETURN(!tuples.empty(), E_NO_DATA);
 
+       Json::Reader jr;
+
        for (auto& tuple : tuples) {
                tuple->getAt(0, &optStr);
-               options.push_back(CtxJson(optStr));
+
+               Json::Value opt;
+               jr.parse(optStr, opt);
+
+               options.push_back(opt);
        }
 
        return E_NONE;
@@ -122,12 +130,15 @@ bool RecorderClientInfo::exist(std::string subject)
        return true;
 }
 
-bool RecorderClientInfo::set(std::string subject, std::string pkgId, CtxJson option, int retentionPeriod)
+bool RecorderClientInfo::set(std::string subject, std::string pkgId, const Json::Value& option, int retentionPeriod)
 {
        bool ret;
+       Json::FastWriter fw;
+       fw.omitEndingLineFeed();
+
        char *query = sqlite3_mprintf(
                        "INSERT INTO " CLIENT_INFO " VALUES ('%q', '%q', '%q', %d)",
-                       subject.c_str(), pkgId.c_str(), option.str().c_str(), retentionPeriod);
+                       subject.c_str(), pkgId.c_str(), fw.write(option).c_str(), retentionPeriod);
 
        ret = SensorDatabase::execute(query, NULL);
        sqlite3_free(query);
@@ -149,17 +160,15 @@ bool RecorderClientInfo::remove(std::string subject, std::string pkgId)
        return ret;
 }
 
-void RecorderClientInfo::getParam(std::vector<CtxJson> &options, const char *key, float *min, float *max)
+void RecorderClientInfo::getParam(std::vector<Json::Value> &options, const char *key, float *min, float *max)
 {
-       double val;
-
-       for (CtxJson& opt : options) {
-               if (!opt.get(NULL, key, &val))
+       for (auto& opt : options) {
+               if (!opt.isMember(key))
                        continue;
                if (min)
-                       *min = MIN(*min, static_cast<float>(val));
+                       *min = MIN(*min, static_cast<float>(opt[key].asInt64()));
                if (max)
-                       *max = MAX(*max, static_cast<float>(val));
+                       *max = MAX(*max, static_cast<float>(opt[key].asInt64()));
        }
 }
 
index 0c85919..1b8b710 100644 (file)
@@ -17,9 +17,9 @@
 #ifndef __SENSOR_RECORDER_CLIENT_INFO_H__
 #define __SENSOR_RECORDER_CLIENT_INFO_H__
 
+#include <json/json.h>
 #include <string>
 #include <vector>
-#include <CtxJson.h>
 #include <SensorRecorderTypesPrivate.h>
 #include "UninstallMonitor.h"
 
@@ -32,14 +32,14 @@ namespace ctx {
                RecorderClientInfo();
                ~RecorderClientInfo();
 
-               int get(std::string subject, std::string pkgId, CtxJson& option);
-               int get(std::string subject, std::vector<CtxJson>& options);
+               int get(std::string subject, std::string pkgId, Json::Value& option);
+               int get(std::string subject, std::vector<Json::Value>& options);
                bool exist(std::string subject);
 
-               bool set(std::string subject, std::string pkgId, CtxJson option, int retentionPeriod);
+               bool set(std::string subject, std::string pkgId, const Json::Value& option, int retentionPeriod);
                bool remove(std::string subject, std::string pkgId);
 
-               void getParam(std::vector<CtxJson>& options, const char *key, float *min, float *max);
+               void getParam(std::vector<Json::Value>& options, const char *key, float *min, float *max);
 
                static void purgeClient(std::string pkgId);
                static void setHostService(SensorRecorderService* hostService);
index a31a050..a3a4e00 100644 (file)
@@ -98,24 +98,32 @@ const char* SensorProvider::getPrivilege()
        return NULL;
 }
 
-int SensorProvider::readRecords(CtxJson option, std::string* projection, std::vector<std::shared_ptr<Tuple>>* tuples)
+int SensorProvider::readRecords(const std::string& option, std::string* projection, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
-       int endTime = static_cast<int>(time(NULL)) + 1;
-       int startTime = endTime - DEFAULT_QUERY_PERIOD - 1;
-       int anchor = -1;
+       time_t endTime = time(NULL) + 1;
+       time_t startTime = endTime - DEFAULT_QUERY_PERIOD - 1;
+       time_t anchor = -1;
        int interval = -1;
 
-       if (option.get(NULL, KEY_START_TIME, &startTime))
-               IF_FAIL_RETURN(startTime >= 0, E_PARAM);
+       Json::Reader jr;
+       Json::Value optionJson;
+       jr.parse(option, optionJson);
 
-       if (option.get(NULL, KEY_END_TIME, &endTime))
-               IF_FAIL_RETURN(endTime >= 0, E_PARAM);
+       startTime = static_cast<time_t>(optionJson.get(KEY_START_TIME, static_cast<int64_t>(startTime)).asInt64());
+       IF_FAIL_RETURN(startTime >= 0, E_PARAM);
 
-       if (option.get(NULL, KEY_ANCHOR, &anchor))
+       endTime = static_cast<time_t>(optionJson.get(KEY_END_TIME, static_cast<int64_t>(endTime)).asInt64());
+       IF_FAIL_RETURN(endTime >= 0, E_PARAM);
+
+       if (optionJson.isMember(KEY_ANCHOR)) {
+               anchor = static_cast<time_t>(optionJson[KEY_ANCHOR].asInt64());
                IF_FAIL_RETURN(anchor >= 0, E_PARAM);
+       }
 
-       if (option.get(NULL, KEY_INTERVAL, &interval))
+       if (optionJson.isMember(KEY_INTERVAL)) {
+               interval = optionJson[KEY_INTERVAL].asInt();
                IF_FAIL_RETURN(interval >= 0, E_PARAM);
+       }
 
        if (endTime >= 0 && startTime >= endTime)
                return E_PARAM;
@@ -141,21 +149,24 @@ int SensorProvider::readRecords(CtxJson option, std::string* projection, std::ve
        return ret;
 }
 
-int SensorProvider::startRecording(const std::string& pkgId, CtxJson option)
+int SensorProvider::startRecording(const std::string& pkgId, const std::string& option)
 {
        int retentionPeriod = DEFAULT_RETENTION;
 
-       _D("PkgId: %s", pkgId.c_str());
-       _J("Option", option);
+       _D("PkgId: %s, Option: %s", pkgId.c_str(), option.c_str());
+
+       Json::Reader jr;
+       Json::Value optionJson;
+       jr.parse(option, optionJson);
 
-       if (option.get(NULL, KEY_RETENTION, &retentionPeriod)) {
-               retentionPeriod *= SECONDS_PER_HOUR;
-               option.remove(NULL, KEY_RETENTION);
+       if (optionJson.isMember(KEY_RETENTION)) {
+               retentionPeriod = optionJson[KEY_RETENTION].asInt() * SECONDS_PER_HOUR;
+               optionJson.removeMember(KEY_RETENTION);
        }
 
-       IF_FAIL_RETURN(verifyOption(option), E_PARAM);
+       IF_FAIL_RETURN(verifyOption(optionJson), E_PARAM);
 
-       return __addClient(pkgId, retentionPeriod, option);
+       return __addClient(pkgId, retentionPeriod, optionJson);
 }
 
 int SensorProvider::stopRecording(const std::string& pkgId)
@@ -165,16 +176,14 @@ int SensorProvider::stopRecording(const std::string& pkgId)
        return __removeClient(pkgId);
 }
 
-bool SensorProvider::verifyOption(CtxJson option)
+bool SensorProvider::verifyOption(const Json::Value& option)
 {
-       std::list<std::string> keys;
-       option.getKeys(&keys);
-       return keys.size() == 0;
+       return option.empty();
 }
 
-int SensorProvider::__addClient(std::string pkgId, int retentionPeriod, CtxJson option)
+int SensorProvider::__addClient(std::string pkgId, int retentionPeriod, Json::Value& option)
 {
-       CtxJson tmp;
+       Json::Value tmp;
        int ret;
 
        /* Validate the retention period */
@@ -197,7 +206,7 @@ int SensorProvider::__addClient(std::string pkgId, int retentionPeriod, CtxJson
 
 int SensorProvider::__removeClient(std::string pkgId)
 {
-       std::vector<CtxJson> options;
+       std::vector<Json::Value> options;
        int ret;
 
        /* Remove the app's request first */
index 0e17775..e76068a 100644 (file)
@@ -35,8 +35,8 @@ namespace ctx {
 
                const char* getSubject();
 
-               int readRecords(CtxJson option, std::string* projection, std::vector<std::shared_ptr<Tuple>>* tuples);
-               int startRecording(const std::string& pkgId, CtxJson option);
+               int readRecords(const std::string& option, std::string* projection, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int startRecording(const std::string& pkgId, const std::string& option);
                int stopRecording(const std::string& pkgId);
 
                virtual bool isSupported();
@@ -55,10 +55,10 @@ namespace ctx {
 
                virtual SensorLogger* getLogger() = 0;
                virtual Querier* getQuerier() = 0;
-               virtual bool verifyOption(CtxJson option);
+               virtual bool verifyOption(const Json::Value& option);
 
        private:
-               int __addClient(std::string pkgId, int retentionPeriod, CtxJson option);
+               int __addClient(std::string pkgId, int retentionPeriod, Json::Value& option);
                int __removeClient(std::string pkgId);
 
                std::string __subject;
index 55dadf2..17ef774 100644 (file)
@@ -49,18 +49,13 @@ Querier* HeartRateProvider::getQuerier()
        return &__querier;
 }
 
-bool HeartRateProvider::verifyOption(CtxJson option)
+bool HeartRateProvider::verifyOption(const Json::Value& option)
 {
-       std::list<std::string> keys;
-       option.getKeys(&keys);
+       IF_FAIL_RETURN(option.size() <= 1, false);
 
-       IF_FAIL_RETURN(keys.size() <= 1, false);
-
-       int interval = 0;
-       if (option.get(NULL, KEY_INTERVAL, &interval)) {
-               if (interval < MIN_MEASURING_INTERVAL || interval > MAX_MEASURING_INTERVAL)
-                       return false;
-       }
+       int interval = option.get(KEY_INTERVAL, MIN_MEASURING_INTERVAL).asInt();
+       if (interval < MIN_MEASURING_INTERVAL || interval > MAX_MEASURING_INTERVAL)
+               return false;
 
        return true;
 }
index 05b1e60..0aaab05 100644 (file)
@@ -34,7 +34,7 @@ namespace ctx {
        protected:
                SensorLogger* getLogger();
                Querier* getQuerier();
-               bool verifyOption(CtxJson option);
+               bool verifyOption(const Json::Value& option);
 
        private:
                HeartRateLogger __logger;
index 427fcf1..15c2f12 100644 (file)
@@ -58,7 +58,7 @@ HeartRateLogger::~HeartRateLogger()
 
 bool HeartRateLogger::start()
 {
-       std::vector<CtxJson> options;
+       std::vector<Json::Value> options;
        RecorderClientInfo clientInfo;
        float interval = MAX_MEASURING_INTERVAL;
 
index 2bf1fba..546a50d 100644 (file)
@@ -39,12 +39,12 @@ std::string HeartRateQuerier::getProjection()
        return KEY_HEART_RATE "," KEY_START_TIME "," KEY_END_TIME;
 }
 
-int HeartRateQuerier::queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int HeartRateQuerier::queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        return query(startTime, endTime, tuples);
 }
 
-int HeartRateQuerier::query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int HeartRateQuerier::query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        char *sql = sqlite3_mprintf(
                        "SELECT " PROJECTION \
index 9ca670e..01995d3 100644 (file)
@@ -28,8 +28,8 @@ namespace ctx {
 
                std::string getProjection();
 
-               int queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
-               int query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
        };
 }
 
index 648c5d0..6df0d11 100644 (file)
@@ -59,7 +59,7 @@ std::string PedometerQuerier::getProjection()
                KEY_END_TIME;
 }
 
-int PedometerQuerier::queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int PedometerQuerier::queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        char *sql = sqlite3_mprintf(
                        "SELECT " PROJECTION_RAW \
@@ -74,7 +74,7 @@ int PedometerQuerier::queryRaw(int startTime, int endTime, std::vector<std::shar
        return ret;
 }
 
-int PedometerQuerier::query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int PedometerQuerier::query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        char *sql = sqlite3_mprintf(
                        "SELECT " PROJECTION \
@@ -88,7 +88,7 @@ int PedometerQuerier::query(int startTime, int endTime, std::vector<std::shared_
        return ret;
 }
 
-int PedometerQuerier::query(int startTime, int endTime, int anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples)
+int PedometerQuerier::query(time_t startTime, time_t endTime, time_t anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        char *sql = sqlite3_mprintf(
                        "SELECT " PROJECTION \
index 057d0d4..08ce5f7 100644 (file)
@@ -28,9 +28,9 @@ namespace ctx {
 
                std::string getProjection();
 
-               int queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
-               int query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
-               int query(int startTime, int endTime, int anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int query(time_t startTime, time_t endTime, time_t anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples);
        };
 }
 
index 00f67bb..070dc25 100644 (file)
@@ -57,7 +57,7 @@ std::string PressureQuerier::getProjection()
                KEY_END_TIME;
 }
 
-int PressureQuerier::queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int PressureQuerier::queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        char *sql = sqlite3_mprintf(
                        "SELECT " PROJECTION_RAW \
@@ -71,7 +71,7 @@ int PressureQuerier::queryRaw(int startTime, int endTime, std::vector<std::share
        return ret;
 }
 
-int PressureQuerier::query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int PressureQuerier::query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        char *sql = sqlite3_mprintf(
                        "SELECT " PROJECTION \
@@ -85,7 +85,7 @@ int PressureQuerier::query(int startTime, int endTime, std::vector<std::shared_p
        return ret;
 }
 
-int PressureQuerier::query(int startTime, int endTime, int anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples)
+int PressureQuerier::query(time_t startTime, time_t endTime, time_t anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        char *sql = sqlite3_mprintf(
                        "SELECT " PROJECTION \
index f6380e6..a89e7ba 100644 (file)
@@ -28,9 +28,9 @@ namespace ctx {
 
                std::string getProjection();
 
-               int queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
-               int query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
-               int query(int startTime, int endTime, int anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int query(time_t startTime, time_t endTime, time_t anchor, int interval, std::vector<std::shared_ptr<Tuple>>* tuples);
        };
 }
 
index 1e3e344..9b2dd0f 100644 (file)
@@ -40,12 +40,12 @@ std::string SleepQuerier::getProjection()
        return KEY_STATE "," KEY_START_TIME "," KEY_END_TIME;
 }
 
-int SleepQuerier::queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int SleepQuerier::queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        return query(startTime, endTime, tuples);
 }
 
-int SleepQuerier::query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
+int SleepQuerier::query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples)
 {
        char *sql = sqlite3_mprintf(
                        "SELECT " PROJECTION \
index e76fc10..69da521 100644 (file)
@@ -28,8 +28,8 @@ namespace ctx {
 
                std::string getProjection();
 
-               int queryRaw(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
-               int query(int startTime, int endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int queryRaw(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
+               int query(time_t startTime, time_t endTime, std::vector<std::shared_ptr<Tuple>>* tuples);
        };
 }