|
11 | 11 | #include "chimbuko/core/ad/ADNetClient.hpp" |
12 | 12 | #include "chimbuko/core/util/PerfStats.hpp" |
13 | 13 | #include "chimbuko/core/ad/ADDataInterface.hpp" |
| 14 | +#include "chimbuko/core/util/commandLineParser.hpp" |
14 | 15 |
|
15 | 16 | namespace chimbuko { |
16 | 17 | /** |
@@ -57,6 +58,31 @@ namespace chimbuko { |
57 | 58 | * @brief Equivalence operator |
58 | 59 | */ |
59 | 60 | bool operator==(const AlgoParams &r) const; |
| 61 | + |
| 62 | + /** |
| 63 | + * @brief Parser object that reads the data from a json file with provided filename |
| 64 | + */ |
| 65 | + class cmdlineParser: public optionalCommandLineArgBase{ |
| 66 | + private: |
| 67 | + std::string m_arg; /**< The argument, format "-a" */ |
| 68 | + std::string m_help_str; /**< The help string */ |
| 69 | + AlgoParams &member; |
| 70 | + public: |
| 71 | + cmdlineParser(AlgoParams &member, const std::string &arg, const std::string &help_str): m_arg(arg), m_help_str(help_str), member(member){} |
| 72 | + |
| 73 | + /** |
| 74 | + * @brief If the first string matches the internal arg string (eg "-help"), a number of strings are consumed from the array 'vals' and that number returned. |
| 75 | + * A value of -1 indicates the argument did not match. |
| 76 | + * |
| 77 | + * @param vals An array of strings |
| 78 | + * @param vals_size The length of the string array |
| 79 | + */ |
| 80 | + int parse(const std::string &arg, const char** vals, const int vals_size) override; |
| 81 | + /** |
| 82 | + * @brief Print the help string for this argument to the ostream |
| 83 | + */ |
| 84 | + void help(std::ostream &os) const override; |
| 85 | + }; |
60 | 86 | }; |
61 | 87 |
|
62 | 88 |
|
@@ -120,6 +146,10 @@ namespace chimbuko { |
120 | 146 | */ |
121 | 147 | void setGlobalModelSyncFrequency(int to){ m_global_model_sync_freq = to; } |
122 | 148 |
|
| 149 | + /** |
| 150 | + * @brief Return the algorithm name |
| 151 | + */ |
| 152 | + virtual std::string getAlgorithmName() const = 0; |
123 | 153 | protected: |
124 | 154 | /** @brief Synchronize the input model with the global model |
125 | 155 | * |
@@ -176,6 +206,11 @@ namespace chimbuko { |
176 | 206 |
|
177 | 207 | void run(ADDataInterface &data, int step=0) override; |
178 | 208 |
|
| 209 | + /** |
| 210 | + * @brief Return the algorithm name |
| 211 | + */ |
| 212 | + std::string getAlgorithmName() const override{ return "sstd"; } |
| 213 | + |
179 | 214 | protected: |
180 | 215 |
|
181 | 216 | /** |
@@ -234,6 +269,11 @@ namespace chimbuko { |
234 | 269 |
|
235 | 270 | void run(ADDataInterface &data, int step=0) override; |
236 | 271 |
|
| 272 | + /** |
| 273 | + * @brief Return the algorithm name |
| 274 | + */ |
| 275 | + std::string getAlgorithmName() const override{ return "hbos"; } |
| 276 | + |
237 | 277 | /** |
238 | 278 | * @brief Override the default threshold for a particular function |
239 | 279 | * @param func The function name |
@@ -307,6 +347,11 @@ namespace chimbuko { |
307 | 347 |
|
308 | 348 | void run(ADDataInterface &data, int step=0) override; |
309 | 349 |
|
| 350 | + /** |
| 351 | + * @brief Return the algorithm name |
| 352 | + */ |
| 353 | + std::string getAlgorithmName() const override{ return "copod"; } |
| 354 | + |
310 | 355 | /** |
311 | 356 | * @brief Override the default threshold for a particular function |
312 | 357 | * @param func The function name |
|
0 commit comments