Main Page | Modules | Data Structures | Directories | File List | Data Fields | Examples

libncat.h

00001 /*
00002  *  This library is free software; you can redistribute it and/or
00003  *  modify it under the terms of the GNU Lesser General Public
00004  *  License as published by the Free Software Foundation; either
00005  *  version 2 of the License, or (at your option) any later version.
00006  *
00007  *  This library is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00010  *  Lesser General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; if not, write to the Free Software
00014  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00015  *  
00016  *  Copyright (C) 2005 Liam Girdwood, Radu Corlan  
00017  */
00018 
00074 #ifndef __LIBNCAT_H
00075 #define __LIBNCAT_H
00076 
00077 #ifdef __cplusplus
00078 extern "C" {
00079 #endif
00080     
00081 #define LNC_PRELOAD                     0x1     
00082 #define LNC_PRECACHE            0x2     
00083 #define LNC_PREGET                      0x4     
00084 #define LNC_CACHE                       0x8         
00086 #define LNC_FLAG_MEM            0x0             
00087 #define LNC_FLAG_CACHE          0x1             
00088 #define LNC_FLAG_LOCAL          0x2             
00089 #define LNC_FLAG_ONLINE         0x3             
00091 typedef struct lnc_library lnc_library;
00092 typedef struct lnc_catalog lnc_catalog;
00093 typedef struct lnc_dataset lnc_dataset;
00094 typedef struct lnc_search lnc_search;
00095 typedef struct lnc_slist lnc_slist;
00096 typedef struct lnc_dlist lnc_dlist;
00097 
00103 typedef enum {
00104         CT_INT,                         
00105         CT_DOUBLE,                      
00106         CT_FLOAT,                       
00107         CT_STRING,                      
00108         CT_SIGN,                        
00109         CT_DOUBLE_HMS_HRS,      
00110         CT_DOUBLE_HMS_MINS, 
00111         CT_DOUBLE_HMS_SECS, 
00112         CT_DOUBLE_DMS_DEGS, 
00113         CT_DOUBLE_DMS_MINS, 
00114         CT_DOUBLE_DMS_SECS,     
00115     CT_DOUBLE_MPC,      
00116         CT_NULL,                        
00117 } lnc_ctype;
00118 
00119 
00125 typedef enum {
00126     LNC_OP_AND,     
00127     LNC_OP_OR       
00128 } lnc_operator;
00129 
00130 
00136 typedef enum  {
00137     LNC_COMP_LT,    
00138     LNC_COMP_GT,    
00139     LNC_COMP_EQ,    
00140     LNC_COMP_NE     
00141 } lnc_comparator;
00142 
00147 typedef struct {
00148         unsigned int flags:8;       /* LNC_FLAG_ status flag */
00149     unsigned int size:24;       /* number of elements in tile */
00150         void* micro_ta;                         /* ptr to micro tile array or NULL*/    
00151 } lnc_tile_status;
00152 
00153 struct ln_equ_posn
00154 {
00155     double ra;  
00156     double dec; 
00157 };
00158 
00159 #define OBJECT_ID_SIZE          12
00160 #define OBJECT_NAME_SIZE        12
00161 
00176 typedef struct {
00177         unsigned int type:8;                    
00178         unsigned int oclass:8;                  
00179         unsigned int reserved:16;               
00180         char id[OBJECT_ID_SIZE];                
00181         char name[OBJECT_NAME_SIZE];    
00182 } lnc_astro_object;
00183 
00203 typedef struct {
00204         lnc_astro_object aobject;               
00205         struct ln_equ_posn posn;                
00206         float Vmag;                                             
00207 } lnc_deep_object;
00208 
00222 typedef struct {
00223         char* name;                                             
00224         int records;                                    
00225         int length;                                             
00226         char* title;                                    
00227     lnc_dlist* byte_description;        
00228 } lnc_dset_info;
00229 
00230 
00245 typedef struct { 
00246     short start;        
00247     short end;          
00248     char* type;         
00249     char* units;        
00250     char* label;        
00251     char* explanation;  
00252 } lnc_dset_byte_desc;
00253 
00259 typedef struct {
00260         char* name;
00261         lnc_astro_object* base;
00262         int object_size;
00263         int (*add_element)(void* object, char* name, lnc_ctype ctype, char* value);
00264         lnc_ctype (*get_ctype) (void* object, char* field);
00265         int (*get_offset) (void* object, char* field);
00266 } lnc_object_class;
00267 
00271 typedef void (*lnc_progress) (float percent, char* msg, void* data);
00272 
00276 typedef void (*lnc_func)(void* data, void* user);
00277 
00282 lnc_library* lnc_lib_init(char *remote, char* local);
00283 
00288 void lnc_lib_free(lnc_library* lib);
00289 
00294 lnc_catalog* lnc_cat_create(lnc_library* lib, char* cclass, char* cnum, 
00295                                                                 double ra_min, double ra_max,
00296                                                                 double dec_min, double dec_max, 
00297                                                                 double mag_faint, double mag_bright, int flags);
00298 
00303 lnc_dlist* lnc_cat_query(lnc_catalog* cat);
00304 
00309 void lnc_cat_free (lnc_catalog* cat);
00310 
00315 const char *lnc_get_version(void);
00316 
00321 const char* lnc_get_last_err_msg(void);
00322 
00327 int lnc_get_last_err(void);
00328 
00333 int lnc_cat_register_class(lnc_object_class* cls);
00334         
00339 lnc_dataset* lnc_dset_create(lnc_catalog* cat, char* dset_name);
00340 
00345 int lnc_dset_init(lnc_dataset* dset, lnc_progress progress, int ra, int dec, int mag, 
00346                         unsigned int flags);
00347 
00352 void lnc_dset_free(lnc_dataset* dset);
00353 
00358 int lnc_dset_add_custom_field(lnc_dataset* dset, char* field);
00359 
00364 int lnc_dset_set_alt_index(lnc_dataset* dset, char* field, char* alt, int flags);
00365 
00370 void lnc_dset_clip_posn (lnc_dataset* dset, double min_ra, double min_dec, 
00371                                          double max_ra, double max_dec, double faint_mag,
00372                                          double bright_mag);
00373                      
00378 void lnc_dset_clip_dist (lnc_dataset* dset, double min_AU, double max_AU);
00379 
00384 void lnc_dset_unclip (lnc_dataset* dset);
00385 
00391 int lnc_dset_get_objects (lnc_dataset* dset, lnc_progress progress, lnc_slist **results, unsigned int flags); 
00392 
00397 void lnc_dset_put_objects (lnc_slist *results);
00398 
00399 /* some catalog management functionality to manage memory and access */
00400 
00406 int lnc_dset_prune(lnc_dataset* dset);
00407 
00413 int lnc_dset_get_size(lnc_dataset* dset);
00414 
00420 int lnc_dset_get_object_size(lnc_dataset* dset);
00421 
00426 void lnc_dset_set_status_posn (lnc_dataset* dset, double min_ra, double min_dec, 
00427                                          double max_ra, double max_dec, double faint_mag,
00428                                          double bright_mag, unsigned int status);
00429 
00434 void lnc_dset_set_status_dist (lnc_dataset* dset, double min_AU, double max_AU, 
00435                                                    unsigned int status);
00436 
00441 lnc_tile_status lnc_dset_get_status_posn (lnc_dataset* dset, double ra, double dec, double mag);
00442 
00447 lnc_tile_status lnc_dset_get_status_dist (lnc_dataset* dset, double AU);
00448 
00453 lnc_ctype lnc_dset_get_field_type(lnc_dataset* dset, char* field);
00454 
00459 int lnc_dset_get_field_offset(lnc_dataset* dset, char* field);
00460 
00465 int lnc_dset_for_results_do(lnc_slist* res, void(*func)(void* object, void* data), void* data);
00466 
00471 typedef int (*lnc_custom_comparator)(void* object);
00472 
00477 lnc_search* lnc_search_create(lnc_dataset* dset);
00478 
00483 void lnc_search_free(lnc_search* search);
00484 
00489 int lnc_search_add_operator(lnc_search* search, lnc_operator op);
00490 
00495 int lnc_search_add_comparator(lnc_search* search, char* field, lnc_comparator comp,
00496                        char* value);
00497                                            
00502 int lnc_search_add_custom_comparator(lnc_search* search, lnc_custom_comparator comp);                                      
00503 
00508 int lnc_search_get_results(lnc_search* search, lnc_progress progress, lnc_slist **result, unsigned int flags); 
00509 
00514 void lnc_search_put_results (lnc_slist *results);
00515 
00520 int lnc_search_get_hits(lnc_search* search);
00521 
00526 int lnc_search_get_tests(lnc_search* search);
00527 
00532 lnc_slist* lnc_slist_prepend(lnc_slist* s, void* object);
00533 
00538 lnc_slist* lnc_slist_append(lnc_slist* s, void* object);
00539 
00544 void lnc_slist_foreach(lnc_slist* sl , lnc_func func, void* user);
00545 
00550 void lnc_slist_foreach_free(lnc_slist* sl , lnc_func func, void* user);
00551 
00556 lnc_dlist* lnc_dlist_prepend(lnc_dlist* d, void* object);
00557 
00562 lnc_dlist* lnc_dlist_append(lnc_dlist* d, void* object);
00563 
00568 lnc_dlist* lnc_dlist_head(lnc_dlist* d);
00569 
00574 lnc_dlist* lnc_dlist_free_object(lnc_dlist* d, void* object);
00575 
00580 void lnc_dlist_foreach(lnc_dlist* dl , lnc_func func, void* user);
00581 
00586 void lnc_dlist_foreach_free(lnc_dlist* dl , lnc_func func, void* user);
00587 
00588 
00589 #ifdef __cplusplus
00590 };
00591 #endif
00592 
00593 #endif

Generated on Tue Jul 5 14:34:14 2005 for libncat by  doxygen 1.4.2