#pragma once #include #include #include #include #include #include struct BasicRulesBase { unsigned int min_size; private: friend class boost::serialization::access; template void serialize(Archive & ar, const unsigned int /*version*/){ ar & min_size; } }; template struct Solutions { using Trace = std::vector; std::vector traces; private: friend class boost::serialization::access; template void serialize(Archive & ar, const unsigned int /*version*/){ ar & traces; } }; template struct AnalyzedGrid { Grid grid; Solutions solutions; BasicRulesBase rules; private: friend class boost::serialization::access; template void serialize(Archive & ar, const unsigned int /*version*/){ ar & grid & solutions & rules; } }; struct DynamicGridBase { using Position = std::pair; int W; int H; std::vector grid; std::vector positions; DynamicGridBase() = default; DynamicGridBase(int width, int height, std::vector && data) : W(width), H(height), grid(std::move(data)) {} private: friend class boost::serialization::access; template void serialize(Archive & ar, const unsigned int /*version*/){ ar & W & H & grid & positions; // archiving positions is redundant (I'm being lazy here) // consider make_nvp for readable json } }; struct DynamicGrid; AnalyzedGrid grid_from_file(std::string file_path); void grid_to_file(AnalyzedGrid const & grid, std::string file_path);