Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
polymarker_tool.hpp
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
26 #ifndef SERVER_SRC_SERVICES_POLYMARKER_INCLUDE_POLYMARKER_TOOL_HPP_
27 #define SERVER_SRC_SERVICES_POLYMARKER_INCLUDE_POLYMARKER_TOOL_HPP_
28 
29 
30 #include "polymarker_service.h"
31 #include "parameter_set.h"
32 #include "service_job.h"
33 #include "polymarker_service_job.h"
34 #include "primer3_prefs.h"
35 
36 
38 
43 {
44 public:
46 
47  PolymarkerTool (PolymarkerServiceJob *job_p, const PolymarkerSequence *seq_p, const PolymarkerServiceData *data_p, const json_t *root_p);
48 
52  virtual ~PolymarkerTool ();
53 
59  const char *GetName ();
60 
69  virtual bool ParseParameters (const ParameterSet * const param_set_p) = 0;
70 
77  virtual bool PreRun ();
78 
79  virtual OperationStatus Run () = 0;
80 
87  virtual bool PostRun () = 0;
88 
97  virtual OperationStatus GetStatus (bool update_flag) = 0;
98 
99 
106  virtual char *GetLog () = 0;
107 
108 
115  virtual char *GetResults (PolymarkerFormatter *formatter_p) = 0;
116 
128  virtual bool AddToJSON (json_t *root_p);
129 
135  virtual PolymarkerToolType GetToolType () const = 0;
136 
137  bool AddSectionToResult (json_t *result_p, const char * const filename_s, const char * const key_s, PolymarkerFormatter *formatter_p);
138 
144  void SetPolymarkerSequence (const PolymarkerSequence *seq_p);
145 
146 
147  bool SaveJobMetadata () const;
148 
149  bool SetJobMetadata ();
150 
151 
152  bool SetJobUUID (const uuid_t id);
153 
154 protected:
159 
165 
171 
176 
181  static const char * const PT_JOB_DIR_S;
182 
183 private:
184  static const char * const PT_METADATA_FILENAME_S;
185 };
186 
187 
188 #ifdef __cplusplus
189 extern "C"
190 {
191 #endif
192 
193 
195 
196 POLYMARKER_SERVICE_LOCAL PolymarkerTool *CreatePolymarkerToolFromJSON (PolymarkerServiceJob *job_p, const PolymarkerSequence *sequence_p, PolymarkerServiceData *data_p, const json_t *service_job_json_p);
197 
207 
208 
219 
220 
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 
226 #endif /* SERVER_SRC_SERVICES_POLYMARKER_INCLUDE_POLYMARKER_TOOL_HPP_ */
CreatePolymarkerToolFromJSON
PolymarkerTool * CreatePolymarkerToolFromJSON(PolymarkerServiceJob *job_p, const PolymarkerSequence *sequence_p, PolymarkerServiceData *data_p, const json_t *service_job_json_p)
CreatePolymarkerTool
PolymarkerTool * CreatePolymarkerTool(PolymarkerServiceJob *job_p, const PolymarkerSequence *sequence_p, PolymarkerServiceData *data_p)
PolymarkerFormatter
Definition: polymarker_formatter.hpp:33
parameter_set.h
PolymarkerTool::pt_service_job_p
PolymarkerServiceJob * pt_service_job_p
The PolymarkerServiceJob that this PolymarkerTool will run.
Definition: polymarker_tool.hpp:158
PolymarkerTool::pt_seq_p
const PolymarkerSequence * pt_seq_p
The PolymarkerSequence that this PolymarkerTool's ServiceJob will be running against.
Definition: polymarker_tool.hpp:164
PolymarkerTool::RunPolymarkerTool
OperationStatus RunPolymarkerTool(PolymarkerTool *tool_p)
Run a given PolymarkerTool.
PolymarkerSequence
A datatype that stores the information of sequence data that the PolymarkerService can run with.
Definition: polymarker_service.h:106
primer3_prefs.h
PolymarkerToolType
PolymarkerToolType
An enum listing the different types of PolymarkerTool that are available.
Definition: polymarker_service.h:86
polymarker_service.h
PolymarkerServiceData
The ServiceData used for the PolymarkerService.
Definition: polymarker_service.h:129
PolymarkerTool::FreePolymarkerTool
void FreePolymarkerTool(PolymarkerTool *tool_p)
Free a given PolymarkerTool.
PolymarkerServiceJob
A datatype for storing a ServiceJob for the PolymarkerService with its extra associated fields.
Definition: polymarker_service_job.h:40
PolymarkerTool::PT_JOB_DIR_S
static const char *const PT_JOB_DIR_S
The key used for specifying the PolymarkerTool's job directory within and JSON-based serialisations o...
Definition: polymarker_tool.hpp:181
OperationStatus
OperationStatus
The current status of an Operation.
Definition: operation.h:96
service_job.h
polymarker_service_job.h
PolymarkerTool::pt_service_data_p
const PolymarkerServiceData * pt_service_data_p
The PolymarkerServiceData for the PolymarkerService that will be running this PolymarkerTool.
Definition: polymarker_tool.hpp:170
PolymarkerTool::pt_job_dir_s
char * pt_job_dir_s
The local directory where the results and logging data will be stored.
Definition: polymarker_tool.hpp:175
POLYMARKER_SERVICE_LOCAL
#define POLYMARKER_SERVICE_LOCAL
Definition: polymarker_service.h:48
ParameterSet
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46
PolymarkerTool
The base class for the object that will actually run the Polymarker application.
Definition: polymarker_tool.hpp:42
uuid_t
Definition: windows_uuid.h:43