1 /*
2  # This file is part of the Astrometry.net suite.
3  # Licensed under a 3-clause BSD style license - see LICENSE
4  */
5 
6 #ifndef ENGINE_H
7 #define ENGINE_H
8 
9 #include <stdio.h>
10 
11 #include "astrometry/blind.h"
12 #include "astrometry/bl.h"
13 #include "astrometry/an-bool.h"
14 #include "astrometry/index.h"
15 
16 struct engine {
17     // search paths (directories)
18     sl* index_paths;
19 
20     // contains "index_t" objects.
21     // if "inparallel" is not set, they will be "metadata-only" until
22     // they need to be loaded.
23     pl* indexes;
24 
25     // indexes that need to be freed
26     pl* free_indexes;
27     // multiindexes that need to be freed
28     pl* free_mindexes;
29 
30     il* ibiggest;
31     il* ismallest;
32     il* default_depths;
33     double sizesmallest;
34     double sizebiggest;
35     anbool inparallel;
36     double minwidth;
37     double maxwidth;
38     float cpulimit;
39     char* cancelfn;
40     char* solvedfn;
41 };
42 typedef struct engine engine_t;
43 
44 struct job_t {
45     dl* scales;
46     il* depths;
47     anbool include_default_scales;
48     double ra_center;
49     double dec_center;
50     double search_radius;
51     anbool use_radec_center;
52     blind_t bp;
53 };
54 typedef struct job_t job_t;
55 
56 engine_t* engine_new();
57 void engine_add_search_path(engine_t* engine, const char* path);
58 char* engine_find_index(engine_t*, const char* name);
59 // note that "path" must be a full path name.
60 int engine_add_index(engine_t* engine, char* path);
61 // look in all the search path directories for index files.
62 int engine_autoindex_search_paths(engine_t* engine);
63 int engine_parse_config_file_stream(engine_t* engine, FILE* fconf);
64 int engine_parse_config_file(engine_t* engine, const char* fn);
65 int engine_run_job(engine_t* engine, job_t* job);
66 void engine_free(engine_t* engine);
67 
68 job_t* engine_read_job_file(engine_t* engine, const char* jobfn);
69 int job_set_base_dir(job_t* job, const char* dir);
70 int job_set_input_base_dir(job_t* job, const char* dir);
71 int job_set_output_base_dir(job_t* job, const char* dir);
72 void job_set_cancel_file(job_t* job, const char* fn);
73 void job_set_solved_file(job_t* job, const char* fn);
74 void job_free(job_t* job);
75 
76 
77 #endif
78