Geometrize  1.0
An application for geometrizing images into geometric primitives
imagetaskpreferencesdata.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <map>
4 #include <string>
5 
6 #include "cereal/cereal.hpp"
7 #include "cereal/types/map.hpp"
8 #include "cereal/types/vector.hpp"
9 
10 #include "geometrize/runner/imagerunneroptions.h"
11 
12 namespace geometrize
13 {
14 
15 template<typename Archive>
16 void serialize(Archive& ar, geometrize::ImageRunnerShapeBoundsOptions& bounds)
17 {
18  ar(cereal::make_nvp("enabled", bounds.enabled),
19  cereal::make_nvp("xMinPercent", bounds.xMinPercent),
20  cereal::make_nvp("yMinPercent", bounds.yMinPercent),
21  cereal::make_nvp("xMaxPercent", bounds.xMaxPercent),
22  cereal::make_nvp("yMaxPercent", bounds.yMaxPercent));
23 }
24 
25 namespace serialization
26 {
27 
32 {
33 public:
34  template<class Archive>
35  void archive(Archive& ar, geometrize::ImageRunnerOptions& options, bool& scriptsEnabled, std::map<std::string, std::string>& scripts)
36  {
37  ar(cereal::make_nvp(shapeAlphaKey, options.alpha));
38  ar(cereal::make_nvp(maxShapeMutationsKey, options.maxShapeMutations));
39  ar(cereal::make_nvp(shapeCountKey, options.shapeCount));
40  ar(cereal::make_nvp(shapeTypesKey, options.shapeTypes));
41  ar(cereal::make_nvp(randomSeedKey, options.seed));
42  ar(cereal::make_nvp(maxThreadsKey, options.maxThreads));
43  ar(cereal::make_nvp(shapeBounds, options.shapeBounds));
44  ar(cereal::make_nvp(scriptsEnabledKey, scriptsEnabled));
45  ar(cereal::make_nvp(scriptsKey, scripts));
46  }
47 
48 private:
49  const std::string shapeAlphaKey{"shapeAlpha"};
50  const std::string maxShapeMutationsKey{"maxShapeMutations"};
51  const std::string shapeCountKey{"shapeCount"};
52  const std::string shapeTypesKey{"shapeTypes"};
53  const std::string randomSeedKey{"randomSeed"};
54  const std::string maxThreadsKey{"maxThreads"};
55  const std::string shapeBounds{"shapeBounds"};
56 
57  const std::string scriptsEnabledKey{"scriptModeEnabled"};
58  const std::string scriptsKey{"scripts"};
59 };
60 
61 }
62 
63 }
geometrize::serialization::ImageTaskPreferencesData
The ImageTaskPreferencesData struct represents the preferences data for an image task.
Definition: imagetaskpreferencesdata.h:32
geometrize::serialization::ImageTaskPreferencesData::shapeTypesKey
const std::string shapeTypesKey
Definition: imagetaskpreferencesdata.h:52
geometrize::serialization::ImageTaskPreferencesData::shapeBounds
const std::string shapeBounds
Definition: imagetaskpreferencesdata.h:55
geometrize::serialization::ImageTaskPreferencesData::shapeAlphaKey
const std::string shapeAlphaKey
Definition: imagetaskpreferencesdata.h:49
geometrize::serialization::ImageTaskPreferencesData::archive
void archive(Archive &ar, geometrize::ImageRunnerOptions &options, bool &scriptsEnabled, std::map< std::string, std::string > &scripts)
Definition: imagetaskpreferencesdata.h:35
geometrize::serialization::ImageTaskPreferencesData::maxThreadsKey
const std::string maxThreadsKey
Definition: imagetaskpreferencesdata.h:54
geometrize::serialize
void serialize(Archive &ar, geometrize::ImageRunnerShapeBoundsOptions &bounds)
Definition: imagetaskpreferencesdata.h:16
geometrize
Definition: commandlineparser.cpp:73
geometrize::serialization::ImageTaskPreferencesData::shapeCountKey
const std::string shapeCountKey
Definition: imagetaskpreferencesdata.h:51
geometrize::serialization::ImageTaskPreferencesData::maxShapeMutationsKey
const std::string maxShapeMutationsKey
Definition: imagetaskpreferencesdata.h:50
geometrize::serialization::ImageTaskPreferencesData::scriptsKey
const std::string scriptsKey
Definition: imagetaskpreferencesdata.h:58
geometrize::serialization::ImageTaskPreferencesData::scriptsEnabledKey
const std::string scriptsEnabledKey
Definition: imagetaskpreferencesdata.h:57
geometrize::serialization::ImageTaskPreferencesData::randomSeedKey
const std::string randomSeedKey
Definition: imagetaskpreferencesdata.h:53