Skylark (Sketching Library)
0.1
|
00001 #ifndef SKYLARK_SKETCH_TRANSFORM_DATA_HPP 00002 #define SKYLARK_SKETCH_TRANSFORM_DATA_HPP 00003 00004 #ifndef SKYLARK_SKETCH_HPP 00005 #error "Include top-level sketch.hpp instead of including individuals headers" 00006 #endif 00007 00008 #include <vector> 00009 00010 #include "boost/foreach.hpp" 00011 #include "boost/property_tree/ptree.hpp" 00012 00013 namespace skylark { namespace sketch { 00014 00018 struct sketch_params_t { 00019 00020 }; 00021 00022 struct sketch_transform_data_t { 00023 00024 00028 virtual 00029 boost::property_tree::ptree to_ptree() const = 0; 00030 00031 virtual ~sketch_transform_data_t() { 00032 00033 } 00034 00035 static 00036 sketch_transform_data_t* from_ptree(const boost::property_tree::ptree& pt); 00037 00038 std::string get_type() { 00039 return _type; 00040 } 00041 00042 protected: 00043 00044 sketch_transform_data_t (int N, int S, const base::context_t& context, 00045 const std::string type) 00046 : _N(N), _S(S), _creation_context(context), _type(type) { 00047 00048 } 00049 00053 void add_common(boost::property_tree::ptree& pt) const { 00054 pt.put("skylark_object_type", "sketch"); 00055 pt.put("sketch_type", _type); 00056 pt.put("skylark_version", VERSION); 00057 pt.put("N", _N); 00058 pt.put("S", _S); 00059 pt.put_child("creation_context", _creation_context.to_ptree()); 00060 } 00061 00062 00063 int _N; 00064 int _S; 00066 00067 const base::context_t _creation_context; 00068 00069 std::string _type; 00071 00072 00073 base::context_t build() { 00074 return _creation_context; 00075 } 00076 }; 00077 00078 } } 00080 #endif