24#include "man-database.h"
25#include "man-pipeline.h"
30static void DatabaseBuild(
const DatabaseOptions &
values) {
32 std::cerr <<
"Narrowed catalog has " <<
narrowedCatalog.size() <<
" stars." << std::endl;
44 std::cerr <<
"Generated database with " <<
ser.buffer.size() <<
" bytes" << std::endl;
45 std::cerr <<
"Database flagged with " << std::bitset<8*sizeof(dbFlags)>(
dbFlags) << std::endl;
47 UserSpecifiedOutputStream
pos = UserSpecifiedOutputStream(
values.outputPath,
true);
48 pos.Stream().write((
char *)
ser.buffer.data(),
ser.buffer.size());
53static void PipelineRun(
const PipelineOptions &
values) {
109 if (
str ==
"1" ||
str ==
"true") {
112 if (
str ==
"0" ||
str ==
"false") {
122#define LOST_OPTIONAL_OPTARG() \
123 ((optarg == NULL && optind < argc && argv[optind][0] != '-') \
124 ? (bool) (optarg = argv[optind++]) \
128static int LostMain(
int argc,
char **
argv) {
131 std::cout <<
"Usage: ./lost database or ./lost pipeline" << std::endl
132 <<
"Use --help flag on those commands for further help" << std::endl;
142#define LOST_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg) prop,
144#undef LOST_CLI_OPTION
149#define LOST_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg) \
151 defaultArg == 0 ? required_argument : optional_argument, \
153 (int)DatabaseCliOption::prop},
155#undef LOST_CLI_OPTION
166#define LOST_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg) \
167 case (int)DatabaseCliOption::prop : \
168 if (defaultArg == 0) { \
169 databaseOptions.prop = converter; \
171 if (LOST_OPTIONAL_OPTARG()) { \
172 databaseOptions.prop = converter; \
174 databaseOptions.prop = defaultArg; \
179#undef LOST_CLI_OPTION
183 default :std::cout <<
"Illegal flag" << std::endl;
190 }
else if (
command ==
"pipeline") {
193#define LOST_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg) prop,
195#undef LOST_CLI_OPTION
200#define LOST_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg) \
202 defaultArg == 0 ? required_argument : optional_argument, \
204 (int)PipelineCliOption::prop},
206#undef LOST_CLI_OPTION
219#define LOST_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg) \
220 case (int)PipelineCliOption::prop : \
221 if (defaultArg == 0) { \
222 pipelineOptions.prop = converter; \
224 if (LOST_OPTIONAL_OPTARG()) { \
225 pipelineOptions.prop = converter; \
227 pipelineOptions.prop = defaultArg; \
232#undef LOST_CLI_OPTION
236 default :std::cout <<
"Illegal flag" << std::endl;
244 std::cout <<
"Usage: ./lost database or ./lost pipeline" << std::endl
245 <<
"Use --help flag on those commands for further help" << std::endl;
252int main(
int argc,
char **argv) {
253 return lost::LostMain(argc, argv);
The command line options passed when running a pipeline.
#define MULTI_DB_FLOAT_FLAG
A database that contains multiple databases This is almost always the database that is actually passe...
int main(int argc, char **argv)
const Catalog & CatalogRead()
Read and parse the full catalog from disk. If called multiple times, will re-use the first result.
decimal DegToRad(decimal deg)
Catalog NarrowCatalog(const Catalog &catalog, int maxMagnitude, int maxStars, decimal minSeparation)
Remove unwanted stars from an unfiltered catalog.
void SerializePrimitive(SerializeContext *ser, const T &val)
std::vector< MultiDatabaseEntry > MultiDatabaseDescriptor
MultiDatabaseDescriptor GenerateDatabases(const Catalog &catalog, const DatabaseOptions &values)
Appropriately create descriptors for all requested databases according to command-line options.
SerializeContext serFromDbValues(const DatabaseOptions &values)
std::vector< std::unique_ptr< PipelineInput > > PipelineInputList
PipelineInputList GetPipelineInput(const PipelineOptions &values)
Come up with a list of pipeline inputs based on command line options.
void SerializeMultiDatabase(SerializeContext *ser, const MultiDatabaseDescriptor &dbs, uint32_t flags)
void PipelineComparison(const PipelineInputList &expected, const std::vector< PipelineOutput > &actual, const PipelineOptions &values)
Print or otherwise analyze the results of (perhaps multiple) runs of a star tracking pipeline.
Pipeline SetPipeline(const PipelineOptions &values)
Create a pipeline from command line options.
bool atobool(const char *cstr)
Convert string to boolean.
std::vector< CatalogStar > Catalog