From e688b1c618813e400b0f75a40c05bf1c13417dc3 Mon Sep 17 00:00:00 2001 From: Mu-Woong Lee Date: Tue, 13 Jun 2017 18:48:47 +0900 Subject: [PATCH] Add the skeleton of JobManagerProxy, which is used to implement the API Change-Id: I6ba2218ec0259b35ebcc689de58c9f83f7a53965 Signed-off-by: Mu-Woong Lee --- include/job_scheduler_internal.h | 12 ++- src/client/JobManagerProxy.cpp | 83 ++++++++++++++++++ src/client/JobManagerProxy.h | 52 +++++++++++ src/client/job_scheduler.cpp | 182 ++++++++++++++++++++++++++++++--------- src/shared/JobInfo.cpp | 36 ++++++++ src/shared/JobInfo.h | 9 ++ 6 files changed, 332 insertions(+), 42 deletions(-) create mode 100644 src/client/JobManagerProxy.cpp create mode 100644 src/client/JobManagerProxy.h diff --git a/include/job_scheduler_internal.h b/include/job_scheduler_internal.h index 716bc9a..30c6007 100644 --- a/include/job_scheduler_internal.h +++ b/include/job_scheduler_internal.h @@ -301,14 +301,18 @@ int ctx_sched_job_get_user_data(ctx_sched_job_h job, const char** user_data); /** * @brief Checks whether the trigger context corresponding to a URI is supported. + * @param[in] scheduler TBD * @param[in] uri URI * @param[out] supported @c true, if the corresponding context is supported as a trigger * @return @c 0 on success, otherwise a negative error value */ -int ctx_sched_job_trigger_is_supported(const char* uri, bool* supported); +int ctx_sched_job_trigger_is_supported(ctx_sched_h scheduler, const char* uri, bool* supported); /** * @brief Creates a trigger context handle. + * @remarks Before creating a trigger context handle, It is strongly recommended to check + * the availability of the trigger corresponding to the given URI using + * ctx_sched_job_trigger_is_supported(). * @param[in] uri URI * @param[out] job_context Trigger context handle * @return @c 0 on success, otherwise a negative error value @@ -317,14 +321,18 @@ int ctx_sched_job_trigger_create(const char* uri, ctx_sched_job_context_h* job_c /** * @brief Checks whether the requirement context corresponding to a URI is supported. + * @param[in] scheduler TBD * @param[in] uri URI * @param[out] supported @c true, if the corresponding context is supported as a requirement * @return @c 0 on success, otherwise a negative error value */ -int ctx_sched_job_requirement_is_supported(const char* uri, bool* supported); +int ctx_sched_job_requirement_is_supported(ctx_sched_h scheduler, const char* uri, bool* supported); /** * @brief Creates a requirement context handle. + * @remarks Before creating a requirement context handle, It is strongly recommended to check + * the availability of the requirement corresponding to the given URI using + * ctx_sched_job_requirement_is_supported(). * @param[in] uri URI * @param[in] optional @c true, if the requirement is optional * @param[out] job_context Requirement context handle diff --git a/src/client/JobManagerProxy.cpp b/src/client/JobManagerProxy.cpp new file mode 100644 index 0000000..27decb9 --- /dev/null +++ b/src/client/JobManagerProxy.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * 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. + */ + +#include +#include "JobManagerProxy.h" + +using namespace ctx; + +JobManagerProxy::JobManagerProxy() : + __serviceProxy(CTX_JOB_SCHEDULER) +{ +} + +JobManagerProxy::~JobManagerProxy() +{ +} + +int JobManagerProxy::addJob(JobInfo* jobInfo) +{ + //TODO: return a positive jobId or a negative error value + return E_SUPPORT; +} + +int JobManagerProxy::startJob(int jobId) +{ + //TODO + return E_SUPPORT; +} + +int JobManagerProxy::stopJob(int jobId) +{ + //TODO + return E_SUPPORT; +} + +int JobManagerProxy::removeJob(int jobId) +{ + //TODO + return E_SUPPORT; +} + +JobInfo* JobManagerProxy::getJob(int jobId) +{ + //TODO: throwable + return NULL; +} + +std::vector JobManagerProxy::getAllJob() +{ + //TODO: throwable + std::vector jobInfos; + return jobInfos; +} + +void JobManagerProxy::setStopJobCb(void (*stopJobCb)(JobInfo*, void*), void* userData) +{ + //TODO +} + +bool JobManagerProxy::isAvailableTrigger(const std::string& uri) +{ + //TODO: throwable + return false; +} + +bool JobManagerProxy::isAvailableRequirement(const std::string& uri) +{ + //TODO: throwable + return false; +} diff --git a/src/client/JobManagerProxy.h b/src/client/JobManagerProxy.h new file mode 100644 index 0000000..69a4f8d --- /dev/null +++ b/src/client/JobManagerProxy.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * 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 __CONTEXT_JOB_SCHEDULER_MANAGER_PROXY_H__ +#define __CONTEXT_JOB_SCHEDULER_MANAGER_PROXY_H__ + +#include +#include +#include +#include + +namespace ctx { + + class JobManagerProxy { + public: + JobManagerProxy(); + ~JobManagerProxy(); + + int addJob(JobInfo* jobInfo); + int removeJob(int jobId); + + int startJob(int jobId); + int stopJob(int jobId); + + JobInfo* getJob(int jobId); + std::vector getAllJob(); + + void setStopJobCb(void (*stopJobCb)(JobInfo*, void*), void* userData); + + bool isAvailableTrigger(const std::string& uri); + bool isAvailableRequirement(const std::string& uri); + + private: + ServiceProxy __serviceProxy; + }; + +} + +#endif /* __CONTEXT_JOB_SCHEDULER_MANAGER_PROXY_H__ */ diff --git a/src/client/job_scheduler.cpp b/src/client/job_scheduler.cpp index bc4d245..26c4685 100644 --- a/src/client/job_scheduler.cpp +++ b/src/client/job_scheduler.cpp @@ -14,35 +14,53 @@ * limitations under the License. */ -#include +#include #include #include #include #include #include #include +#include "JobManagerProxy.h" #define ASSERT_ALLOC(PTR) IF_FAIL_RETURN_TAG((PTR), E_NO_MEM, _E, E_STR_ALLOC) using namespace ctx; + typedef struct _ctx_sched_s { - ServiceProxy proxy; //FIXME - _ctx_sched_s() : proxy(CTX_JOB_SCHEDULER) {} + JobManagerProxy jobManager; + ctx_sched_stop_job_cb stopJobCb; + void* userData; + + _ctx_sched_s() : + stopJobCb(NULL), userData(NULL) {} } ctx_sched_s; + typedef struct _ctx_sched_job_s { - int jobId; - bool started; JobInfo* jobInfo; - _ctx_sched_job_s() : jobId(-1), started(false), jobInfo(NULL) {} - ~_ctx_sched_job_s() { delete jobInfo; } + + _ctx_sched_job_s() : + jobInfo(NULL) {} + + ~_ctx_sched_job_s() + { + delete jobInfo; + } } ctx_sched_job_s; + typedef struct _ctx_sched_job_context_s { JobContext* jobContext; - _ctx_sched_job_context_s() : jobContext(NULL) {} - ~_ctx_sched_job_context_s() { delete jobContext; } + + _ctx_sched_job_context_s() : + jobContext(NULL) {} + + ~_ctx_sched_job_context_s() + { + delete jobContext; + } } ctx_sched_job_context_s; @@ -52,13 +70,16 @@ EXPORT_API int ctx_sched_create(ctx_sched_h* scheduler) ASSERT_ALLOC(sched); *scheduler = sched; + return E_NONE; } EXPORT_API int ctx_sched_destroy(ctx_sched_h scheduler) { IF_FAIL_RETURN(scheduler, E_PARAM); + delete scheduler; + return E_NONE; } @@ -75,6 +96,7 @@ EXPORT_API int ctx_sched_schedule(ctx_sched_h scheduler, ctx_sched_job_h job, in } *job_id = jid; + return E_NONE; } @@ -87,9 +109,11 @@ EXPORT_API int ctx_sched_cancel(ctx_sched_h scheduler, int job_id) static bool __cancelJob(ctx_sched_h scheduler, ctx_sched_job_h job, void* user_data) { int jid = -1; + ctx_sched_job_get_id(job, &jid); ctx_sched_cancel(scheduler, jid); ctx_sched_job_destroy(job); + return true; } @@ -102,56 +126,104 @@ EXPORT_API int ctx_sched_add_job(ctx_sched_h scheduler, ctx_sched_job_h job, int { IF_FAIL_RETURN(scheduler && job && job_id, E_PARAM); - //TODO - return E_SUPPORT; + int jid = scheduler->jobManager.addJob(job->jobInfo); + IF_FAIL_RETURN(jid > 0, jid); + + *job_id = jid; + job->jobInfo->setId(jid); + + return E_NONE; } EXPORT_API int ctx_sched_start_job(ctx_sched_h scheduler, int job_id) { IF_FAIL_RETURN(scheduler && job_id > 0, E_PARAM); - //TODO - return E_SUPPORT; + return scheduler->jobManager.startJob(job_id); } EXPORT_API int ctx_sched_stop_job(ctx_sched_h scheduler, int job_id) { IF_FAIL_RETURN(scheduler && job_id > 0, E_PARAM); - //TODO - return E_SUPPORT; + return scheduler->jobManager.stopJob(job_id); } EXPORT_API int ctx_sched_remove_job(ctx_sched_h scheduler, int job_id) { IF_FAIL_RETURN(scheduler && job_id > 0, E_PARAM); - //TODO - return E_SUPPORT; + return scheduler->jobManager.removeJob(job_id); } EXPORT_API int ctx_sched_get_job(ctx_sched_h scheduler, int job_id, ctx_sched_job_h* job) { IF_FAIL_RETURN(scheduler && job_id > 0 && job, E_PARAM); - //TODO - return E_SUPPORT; + ctx_sched_job_s* jobHandle = new(std::nothrow) ctx_sched_job_s(); + ASSERT_ALLOC(jobHandle); + + try { + jobHandle->jobInfo = scheduler->jobManager.getJob(job_id); + } catch (const int err) { + delete jobHandle; + return err; + } + + return E_NONE; } EXPORT_API int ctx_sched_foreach_job(ctx_sched_h scheduler, ctx_sched_foreach_job_cb callback, void* user_data) { IF_FAIL_RETURN(scheduler && callback, E_PARAM); - //TODO - return E_SUPPORT; + std::vector jobInfos; + + try { + jobInfos = scheduler->jobManager.getAllJob(); + } catch (const int err) { + return err; + } + + for (auto& jobInfo : jobInfos) { + ctx_sched_job_s* jobHandle = new(std::nothrow) ctx_sched_job_s(); + if (jobHandle == NULL) { + _E_ALLOC; + std::for_each(jobInfos.begin(), jobInfos.end(), [](JobInfo*& j){ delete j; }); + return E_NO_MEM; + } + + jobHandle->jobInfo = jobInfo; + jobInfo = NULL; + + if (!callback(scheduler, jobHandle, user_data)) { + std::for_each(jobInfos.begin(), jobInfos.end(), [](JobInfo*& j){ delete j; }); + break; + } + } + + return E_NONE; +} + +static void __stopJob(JobInfo* jobInfo, void* userData) +{ + ctx_sched_s* scheduler = static_cast(userData); + ctx_sched_job_s* job = new(std::nothrow) ctx_sched_job_s(); + IF_FAIL_VOID_TAG(job, _E, E_STR_ALLOC); + + job->jobInfo = jobInfo; + scheduler->stopJobCb(scheduler, job, scheduler->userData); } EXPORT_API int ctx_sched_set_stop_job_cb(ctx_sched_h scheduler, ctx_sched_stop_job_cb callback, void* user_data) { IF_FAIL_RETURN(scheduler && callback, E_PARAM); - //TODO - return E_SUPPORT; + scheduler->stopJobCb = callback; + scheduler->userData = user_data; + scheduler->jobManager.setStopJobCb(__stopJob, scheduler); + + return E_NONE; } EXPORT_API int ctx_sched_job_create_periodic(unsigned int interval, time_t anchor, ctx_sched_job_h* job) @@ -169,6 +241,7 @@ EXPORT_API int ctx_sched_job_create_periodic(unsigned int interval, time_t ancho } *job = _job; + return E_NONE; } @@ -187,6 +260,7 @@ EXPORT_API int ctx_sched_job_create_on_demand(ctx_sched_job_h* job) } *job = _job; + return E_NONE; } @@ -195,6 +269,7 @@ EXPORT_API int ctx_sched_job_destroy(ctx_sched_job_h job) IF_FAIL_RETURN(job, E_PARAM); delete job; + return E_NONE; } @@ -205,6 +280,7 @@ EXPORT_API int ctx_sched_job_add_trigger(ctx_sched_job_h job, ctx_sched_job_cont IF_FAIL_RETURN(trigger->jobContext->getType() == JobContext::Type::TRIGGER, E_PARAM); static_cast(job->jobInfo)->addTrigger(static_cast(trigger->jobContext)); + return E_NONE; } @@ -214,6 +290,7 @@ EXPORT_API int ctx_sched_job_add_requirement(ctx_sched_job_h job, ctx_sched_job_ IF_FAIL_RETURN(requirement->jobContext->getType() == JobContext::Type::REQUIREMENT, E_PARAM); job->jobInfo->addRequirement(static_cast(requirement->jobContext)); + return E_NONE; } @@ -222,6 +299,7 @@ EXPORT_API int ctx_sched_job_set_requirement_timeout(ctx_sched_job_h job, unsign IF_FAIL_RETURN(job, E_PARAM); job->jobInfo->setRequirementTimeout(timeout); + return E_NONE; } @@ -230,6 +308,7 @@ EXPORT_API int ctx_sched_job_set_persistent(ctx_sched_job_h job, bool persistent IF_FAIL_RETURN(job, E_PARAM); job->jobInfo->setPersistent(persistent); + return E_NONE; } @@ -238,6 +317,7 @@ EXPORT_API int ctx_sched_job_set_one_time(ctx_sched_job_h job, bool one_time) IF_FAIL_RETURN(job, E_PARAM); job->jobInfo->setOneTime(one_time); + return E_NONE; } @@ -249,6 +329,7 @@ EXPORT_API int ctx_sched_job_set_app_control(ctx_sched_job_h job, bundle* app_co ASSERT_ALLOC(action); job->jobInfo->setAction(action); + return E_NONE; } @@ -262,6 +343,7 @@ EXPORT_API int ctx_sched_job_set_dbus(ctx_sched_job_h job, ASSERT_ALLOC(action); job->jobInfo->setAction(action); + return E_NONE; } @@ -270,6 +352,7 @@ EXPORT_API int ctx_sched_job_set_user_data(ctx_sched_job_h job, const char* user IF_FAIL_RETURN(job && user_data, E_PARAM); job->jobInfo->setUserData(user_data); + return E_NONE; } @@ -277,7 +360,8 @@ EXPORT_API int ctx_sched_job_is_started(ctx_sched_job_h job, bool* started) { IF_FAIL_RETURN(job && started, E_PARAM); - *started = job->started; + *started = job->jobInfo->isStarted(); + return E_NONE; } @@ -285,7 +369,8 @@ EXPORT_API int ctx_sched_job_get_id(ctx_sched_job_h job, int* job_id) { IF_FAIL_RETURN(job && job_id, E_PARAM); - *job_id = job->jobId; + *job_id = job->jobInfo->getId(); + return E_NONE; } @@ -294,14 +379,20 @@ EXPORT_API int ctx_sched_job_get_user_data(ctx_sched_job_h job, const char** use IF_FAIL_RETURN(job && user_data, E_PARAM); *user_data = job->jobInfo->getUserData().c_str(); + return E_NONE; } -EXPORT_API int ctx_sched_job_trigger_is_supported(const char* uri, bool* supported) +EXPORT_API int ctx_sched_job_trigger_is_supported(ctx_sched_h scheduler, const char* uri, bool* supported) { - IF_FAIL_RETURN(uri && supported, E_PARAM); + IF_FAIL_RETURN(scheduler && uri && supported, E_PARAM); + + try { + *supported = scheduler->jobManager.isAvailableTrigger(uri); + } catch (const int& err) { + return err; + } - //TODO return E_NONE; } @@ -309,10 +400,6 @@ EXPORT_API int ctx_sched_job_trigger_create(const char* uri, ctx_sched_job_conte { IF_FAIL_RETURN(uri && job_context, E_PARAM); - bool supported = false; - ctx_sched_job_trigger_is_supported(uri, &supported); - IF_FAIL_RETURN(supported, E_SUPPORT); - ctx_sched_job_context_s* jobCtxHandle = new(std::nothrow) ctx_sched_job_context_s(); ASSERT_ALLOC(jobCtxHandle); @@ -324,25 +411,27 @@ EXPORT_API int ctx_sched_job_trigger_create(const char* uri, ctx_sched_job_conte } *job_context = jobCtxHandle; + return E_NONE; } -EXPORT_API int ctx_sched_job_requirement_is_supported(const char* uri, bool* supported) +EXPORT_API int ctx_sched_job_requirement_is_supported(ctx_sched_h scheduler, const char* uri, bool* supported) { - IF_FAIL_RETURN(uri && supported, E_PARAM); + IF_FAIL_RETURN(scheduler && uri && supported, E_PARAM); - //TODO - return E_SUPPORT; + try { + *supported = scheduler->jobManager.isAvailableRequirement(uri); + } catch (const int& err) { + return err; + } + + return E_NONE; } EXPORT_API int ctx_sched_job_requirement_create(const char* uri, bool optional, ctx_sched_job_context_h* job_context) { IF_FAIL_RETURN(uri && job_context, E_PARAM); - bool supported = false; - ctx_sched_job_requirement_is_supported(uri, &supported); - IF_FAIL_RETURN(supported, E_SUPPORT); - ctx_sched_job_context_s* jobCtxHandle = new(std::nothrow) ctx_sched_job_context_s(); ASSERT_ALLOC(jobCtxHandle); @@ -354,6 +443,7 @@ EXPORT_API int ctx_sched_job_requirement_create(const char* uri, bool optional, } *job_context = jobCtxHandle; + return E_NONE; } @@ -362,6 +452,7 @@ EXPORT_API int ctx_sched_job_context_prepare_name_int(ctx_sched_job_context_h jo IF_FAIL_RETURN(job_context && name, E_PARAM); bool ret = job_context->jobContext->prepareAttributeInt(name); + return ret ? E_NONE : E_PARAM; } @@ -370,6 +461,7 @@ EXPORT_API int ctx_sched_job_context_prepare_name_str(ctx_sched_job_context_h jo IF_FAIL_RETURN(job_context && name, E_PARAM); bool ret = job_context->jobContext->prepareAttributeStr(name); + return ret ? E_NONE : E_PARAM; } @@ -382,6 +474,7 @@ EXPORT_API int ctx_sched_job_context_name_add_eq_int(ctx_sched_job_context_h job IF_FAIL_RETURN(attr->getType() == Attribute::Type::INTEGER, E_PARAM); static_cast(attr)->addTarget(value); + return E_NONE; } @@ -394,6 +487,7 @@ EXPORT_API int ctx_sched_job_context_name_add_eq_str(ctx_sched_job_context_h job IF_FAIL_RETURN(attr->getType() == Attribute::Type::STRING, E_PARAM); static_cast(attr)->addTarget(value); + return E_NONE; } @@ -406,6 +500,7 @@ EXPORT_API int ctx_sched_job_context_name_add_ne_int(ctx_sched_job_context_h job IF_FAIL_RETURN(attr->getType() == Attribute::Type::INTEGER, E_PARAM); static_cast(attr)->addNonTarget(value); + return E_NONE; } @@ -418,6 +513,7 @@ EXPORT_API int ctx_sched_job_context_name_add_ne_str(ctx_sched_job_context_h job IF_FAIL_RETURN(attr->getType() == Attribute::Type::STRING, E_PARAM); static_cast(attr)->addNonTarget(value); + return E_NONE; } @@ -430,6 +526,7 @@ EXPORT_API int ctx_sched_job_context_name_set_gt_int(ctx_sched_job_context_h job IF_FAIL_RETURN(attr->getType() == Attribute::Type::INTEGER, E_PARAM); static_cast(attr)->setOpenLowerBound(value); + return E_NONE; } @@ -442,6 +539,7 @@ EXPORT_API int ctx_sched_job_context_name_set_ge_int(ctx_sched_job_context_h job IF_FAIL_RETURN(attr->getType() == Attribute::Type::INTEGER, E_PARAM); static_cast(attr)->setClosedLowerBound(value); + return E_NONE; } @@ -454,6 +552,7 @@ EXPORT_API int ctx_sched_job_context_name_set_lt_int(ctx_sched_job_context_h job IF_FAIL_RETURN(attr->getType() == Attribute::Type::INTEGER, E_PARAM); static_cast(attr)->setOpenUpperBound(value); + return E_NONE; } @@ -466,6 +565,7 @@ EXPORT_API int ctx_sched_job_context_name_set_le_int(ctx_sched_job_context_h job IF_FAIL_RETURN(attr->getType() == Attribute::Type::INTEGER, E_PARAM); static_cast(attr)->setClosedUpperBound(value); + return E_NONE; } @@ -474,6 +574,7 @@ EXPORT_API int ctx_sched_job_context_destroy(ctx_sched_job_context_h job_context IF_FAIL_RETURN(job_context, E_PARAM); delete job_context; + return E_NONE; } @@ -511,5 +612,6 @@ EXPORT_API int ctx_sched_job_context_set_disjunction(ctx_sched_job_context_h job IF_FAIL_RETURN(job_context, E_PARAM); job_context->jobContext->setDisjunction(disjunction); + return E_NONE; } diff --git a/src/shared/JobInfo.cpp b/src/shared/JobInfo.cpp index 7e7badd..8e75261 100644 --- a/src/shared/JobInfo.cpp +++ b/src/shared/JobInfo.cpp @@ -28,9 +28,14 @@ #define KEY_USER_DATA "UserData" #define KEY_INTERVAL "Interval" #define KEY_ANCHOR "Anchor" + #define KEY_TRIGGER "Trigger" #define KEY_REQUIREMENT "Requirement" #define KEY_ACTION "Action" + +#define KEY_JOB_ID "JobId" +#define KEY_STARTED "Started" + #define KEY_DISJUNCTION "Disjunction" using namespace ctx; @@ -40,6 +45,8 @@ JobInfo::JobInfo() : __persistent(false), __requirementTimeout(0), __action(NULL), + __jobId(-1), + __started(false), __disjunction(false) { } @@ -61,6 +68,12 @@ JobInfo::JobInfo(Json::Value& jsonRoot, const std::string& serializedStr) : __requirements.push_back(new JobRequirement(name, reqNode[name])); } + if (jsonRoot.isMember(KEY_JOB_ID)) + __jobId = jsonRoot[KEY_JOB_ID].asInt(); + + if (jsonRoot.isMember(KEY_STARTED)) + __started = jsonRoot[KEY_STARTED].asBool(); + __disjunction = jsonRoot[KEY_DISJUNCTION].asBool(); } @@ -149,10 +162,33 @@ void JobInfo::toJson(Json::Value& jsonRoot) __toJson(jsonRoot); + jsonRoot[KEY_JOB_ID] = __jobId; + jsonRoot[KEY_STARTED] = __started; + /* For legacy support */ jsonRoot[KEY_DISJUNCTION] = __disjunction; } +void JobInfo::setId(int jobId) +{ + __jobId = jobId; +} + +int JobInfo::getId() +{ + return __jobId; +} + +void JobInfo::setStarted(bool started) +{ + __started = started; +} + +bool JobInfo::isStarted() +{ + return __started; +} + JobInfo& JobInfo::setDisjunction(bool disjunction) { __disjunction = disjunction; diff --git a/src/shared/JobInfo.h b/src/shared/JobInfo.h index 4e56706..c55d304 100644 --- a/src/shared/JobInfo.h +++ b/src/shared/JobInfo.h @@ -58,6 +58,12 @@ namespace ctx { const std::string& serialize(); void toJson(Json::Value& jsonRoot); + void setId(int jobId); + int getId(); + + void setStarted(bool started); + bool isStarted(); + /* Legacy support */ JobInfo& setDisjunction(bool disjunction); @@ -76,6 +82,9 @@ namespace ctx { JobAction* __action; std::string __serializedStr; + int __jobId; + bool __started; + /* Legacy support */ bool __disjunction; }; -- 2.7.4