diff --git a/src/common/otable.cpp b/src/common/otable.cpp index 0eb6ec1..ef4be1c 100644 --- a/src/common/otable.cpp +++ b/src/common/otable.cpp @@ -547,6 +547,13 @@ std::ostream& otable::serialize_header(std::ostream &out) (*i)->serialize_def(out); out << " "; } + + // serialize version information + if(!galfast_version.empty()) + { + out << "\n# generated with galfast version " << galfast_version; + } + return out; } @@ -703,8 +710,10 @@ otable::columndef &otable::use_column_by_cloning(const std::string &newColumnNam return *col; } -void otable::init() +void otable::init(const std::string &galfast_version) { + this->galfast_version = galfast_version; + // definition of built-in classes and column defaults parse( "(class) default {fmt=% 7.3f;}" // NOTE: This class must come be defined before any columns are ever instantiated diff --git a/src/common/otable.h b/src/common/otable.h index 337af5a..3b077f4 100644 --- a/src/common/otable.h +++ b/src/common/otable.h @@ -194,6 +194,7 @@ class otable } }; + std::string galfast_version; public: struct columndef : public kv { @@ -383,7 +384,7 @@ class otable struct parse_callback { virtual bool operator()(kv *kvobj) = 0; }; protected: - void init(); + void init(const std::string &galfast_version); kv *parse(const std::string &defs, parse_callback *cback = NULL); void getColumnsForOutput(std::vector &cols) const; // aux helper @@ -421,12 +422,12 @@ class otable } // bool del_column(const std::string &name); - otable(const size_t len) + otable(const size_t len, const std::string &galfast_version_) { nrows_capacity = len; nrows = 0; - init(); + init(galfast_version_); } struct mask_functor { virtual bool shouldOutput(int row) const = 0; }; diff --git a/src/pipeline.cpp b/src/pipeline.cpp index 4ee8192..a7fd96e 100644 --- a/src/pipeline.cpp +++ b/src/pipeline.cpp @@ -20,6 +20,7 @@ #include "config.h" +#include "version.h" #include "analysis.h" #include "io.h" #include "pipeline.h" @@ -1248,7 +1249,12 @@ void generate_catalog(int seed, size_t maxstars, size_t nstars, const std::set