TUM-Logo

libRASCH

 

Home
 

General

About libRASCH/News
Design
Screen shots
Sample programs (with source code)
License
 

Download

libRASCH
Tools
 

Documentation

User
Developer
 

Resources

Mailing list
Supported Formats
Plugins
Status
Links
 
Contact
About this site
 
Last updated
Tue Mar 27 23:03:52 2007
libRASCH: ra_priv.h Source File

ra_priv.h

Go to the documentation of this file.
00001 
00010 /*----------------------------------------------------------------------------
00011  *
00012  * Copyright (C) 2002-2005, Raphael Schneider
00013  * See the file COPYING for information on usage and redistribution.
00014  *
00015  * $Id: ra_priv.h 797 2005-05-10 08:37:10Z rasch $
00016  *
00017  *--------------------------------------------------------------------------*/
00018 
00019 #ifndef _RA_PRIV_H
00020 #define _RA_PRIV_H
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 /* do gettext defines first */
00027 #include <libintl.h>
00028 #define _(String) gettext (String)
00029 #define gettext_noop(String) String
00030 #define N_(String) gettext_noop (String)
00031 
00032 /*
00033 #define _(String) (String)
00034 #define N_(String) String
00035 #define textdomain(Domain)
00036   #define bindtextdomain(Package, Directory)*/
00037 
00038 
00039 #include <ra_defines.h>
00040 
00041 /* handles evaluations */
00042 #include <ra_eval.h>
00043 
00044 #include <ra_pl_comm.h>
00045 
00046 
00047 /* ------------------------------ globals ------------------------------ */
00048 /* This variable (set in libRASCH init-function()) controls if 
00049    debug-infos will be send to stderr. The variable will be set to 1
00050    if the environment variable "LIBRASCH_DEBUG" exists. */
00051 extern int ra_print_debug_infos;
00052 
00053 /* variables for i18n */
00054 #define MAX_I18N_LEN  250
00055 extern char ra_i18n_codeset[MAX_I18N_LEN];
00056 
00057 
00058 /* ------------------------------ defines ------------------------------ */
00059 /* standard functions in plugin which _must_ be available in plugin */
00060 #define LOAD_PLUGIN_FUNC  "load_ra_plugin"
00061 #define INIT_PLUGIN_FUNC  "init_ra_plugin"
00062 #define FINI_PLUGIN_FUNC  "fini_ra_plugin"
00063 
00064 /* license types for plugins */
00065 #define LICENSE_GPL            0
00066 #define LICENSE_LGPL           1
00067 #define LICENSE_PROPRIETARY    2
00068 #define LICENSE_NOT_CHOOSEN    3
00069 
00070 #define _ra_set_error(h, nr, str)  _ra_set_error_int(h, nr, str, __FILE__, __LINE__)
00071 
00072 
00073 /* ------------------------------ struct's ------------------------------ */
00074 /* forward declarations */
00075 struct librasch;
00076 struct ra_meas;
00077 
00089 struct ra_rec
00090 {
00091         unsigned short handle_id;
00092 
00093         struct ra_rec *next;
00094         struct ra_rec *prev;
00095         struct ra_rec *child;
00096         struct ra_rec *parent;
00097 
00098         struct ra_meas *meas;
00099 
00100         void *private_data;     /* can be used to store rec. specific info */
00101 }; /* struct ra_rec */
00102 
00103 
00111 struct ra_session
00112 {
00113         char name[RA_VALUE_NAME_MAX];
00114         char desc[RA_VALUE_DESC_MAX];
00115 
00116         struct ra_rec *root_rec;
00117 }; /* struct ra_session */
00118 
00119 
00128 struct find_meas
00129 {
00130         unsigned short handle_id;
00131 
00132         int num;
00133         int curr;
00134 
00135         char **names;
00136 }; /* struct find_meas */
00137 
00138 
00159 struct plugin_infos
00160 {
00161         char name[RA_VALUE_NAME_MAX];
00162         char desc[RA_VALUE_DESC_MAX];
00163         char file[MAX_PATH_RA];
00164 
00165         int use_plugin;
00166 
00167         unsigned long type;
00168 
00169         char version[10];
00170         char build_ts[50];
00171         int license;
00172 
00173         long num_options;
00174         struct ra_option_infos *opt;
00175 
00176         long num_results;
00177         struct ra_result_infos *res;
00178 
00179         long num_create_class;
00180         struct ra_auto_create_class *create_class;
00181 
00182         long num_create_prop;
00183         struct ra_auto_create_prop *create_prop;
00184 }; /* struct plugin_infos */
00185 
00186 
00219 struct plugin_access_func
00220 {
00221         /* check if measurement name is handled by this plugin */
00222         int (*check_meas) (const char *name);
00223 
00224         int (*find_meas) (const char *dir, struct find_meas * f);
00225 
00226         meas_handle (*open_meas) (ra_handle ra, const char *name);
00227         meas_handle (*new_meas) (const char *dir, const char *name);
00228         int (*save_meas) (meas_handle mh);
00229         int (*close_meas) (meas_handle mh);
00230 
00231         int (*get_info_id) (any_handle h, int id, value_handle vh);
00232         int (*get_info_idx) (any_handle h, int info_type, int idx, value_handle vh);
00233 
00234         int (*set_info) (any_handle h, value_handle vh);
00235 
00236         rec_handle (*rec_add)(meas_handle mh, rec_handle parent);
00237         int (*dev_add)(rec_handle rh);
00238         int (*ch_add)(rec_handle rh);
00239 
00240         int (*session_new)(meas_handle mh);
00241 
00242         size_t(*add_raw)(meas_handle mh, int channel, value_handle vh);
00243 
00244         size_t(*get_raw) (meas_handle mh, rec_handle rh, int ch, size_t start, size_t num_data, DWORD *data, DWORD *data_high);
00245         size_t(*get_raw_unit) (meas_handle mh, rec_handle rh, int ch, size_t start, size_t num_data, double *data);
00246 
00247         int (*get_eval_info)(meas_handle mh, value_handle vh_name, value_handle vh_desc);
00248         long (*get_class_num)(meas_handle mh);
00249         int (*get_class_info)(meas_handle mh, long class_num, value_handle vh_id, value_handle vh_name, value_handle vh_desc);
00250         long (*get_prop_num)(class_handle clh);
00251         int (*get_prop_info)(class_handle clh, long prop_num, value_handle vh_id, value_handle vh_type,
00252                              value_handle vh_len, value_handle vh_name, value_handle vh_desc, value_handle vh_unit,
00253                              value_handle vh_use_minmax, value_handle vh_min, value_handle vh_max);
00254         int (*get_ev_info)(prop_handle ph, value_handle vh_start, value_handle vh_end);
00255         int (*get_ev_value)(prop_handle ph, long event, value_handle vh_value, value_handle vh_ch);
00256 
00257         long (*get_sum_num)(class_handle clh);
00258         int (*get_sum_info)(class_handle clh, long sum_num, value_handle vh_id, value_handle vh_ch, 
00259                             value_handle vh_name, value_handle vh_desc);
00260         int (*get_sum_ch_info)(class_handle clh, long sum_num, long ch, value_handle vh_fid_offset,
00261                                value_handle vh_dim_unit, value_handle vh_dim_name);
00262         int (*get_sum_events)(sum_handle sh, value_handle vh_events);
00263         int (*get_sum_part_data)(sum_handle sh, long ch, long dim, value_handle vh);
00264 }; /* struct plugin_access_func */
00265 
00266 
00275 struct plugin_process_func
00276 {
00277         int (*get_info_id) (int id, value_handle vh);
00278 
00279         proc_handle (*get_proc_handle)(plugin_handle pl);
00280         void (*free_proc_handle)(proc_handle proc);
00281 
00282         int (*do_processing)(proc_handle proc);
00283 }; /* struct plugin_process_func */
00284 
00285 
00293 struct plugin_view_func
00294 {
00295         int (*check_channels) (rec_handle rh, long ch);
00296         int (*check_plugin_usage) (const char *pl_name);
00297 
00298         int (*get_view) (view_handle vh);
00299 }; /* struct plugin_view_func */
00300 
00301 
00319 struct plugin_struct
00320 {
00321         unsigned short handle_id;
00322 
00323         struct plugin_struct *next;
00324         struct plugin_struct *prev;
00325         void *dl;
00326 
00327         ra_handle ra;
00328 
00329         struct plugin_infos info;       /* definition in ra_defines.h; will be set _in_ plugin;
00330                                            will be used for get plugin infos */
00331 
00332         struct plugin_access_func access;
00333         struct plugin_process_func proc;
00334         struct plugin_view_func view;
00335 
00336         /* pointer to function calling gui (e.g. dialogs); this must be available for all type
00337            of plugins */
00338         int (*call_gui) (any_handle h);
00339 
00340         /* for inter-plugin communication */
00341         void (*handle_signal) (meas_handle mh, dest_handle dh, const char *sig_name, int num_para, struct comm_para * p);
00342 
00343         /* for setting/getting options (no longer used, but perhaps when options used by other plugins,
00344            the functions can be useful; therefore they will stay here) */
00345         int (*set_option) (proc_handle proc, char *opt_name, value_handle vh);
00346         int (*get_option) (proc_handle proc, char *opt_name, value_handle vh);
00347 }; /* struct plugin_struct */
00348 
00349 
00355 struct plugin_helpers
00356 {
00357         struct plugin_struct *(*get_plugin)(struct librasch *ra, const char *name);
00358 }; /* struct plugin_helpers */
00359 
00360 
00367 struct config_info
00368 {
00369         char plugin_dir[MAX_PATH_RA];
00370         char po_dir[MAX_PATH_RA];
00371 }; /* struct config_info */
00372 
00373 
00386 struct librasch
00387 {
00388         unsigned short handle_id;
00389 
00390         struct config_info config;
00391         struct plugin_struct *pl_head;  /* linked list to all plugins */
00392         struct plugin_helpers hf;       /* structure with helper functions */
00393 
00394         /* error number:
00395            - negative values: os/c-lib specific errors
00396            - postive values:  libRASCH specific errors */
00397         long error_number;
00398         /* a short desc where the error comes from (e.g. libRASCH, plugin-oxford, plugin-hrt)
00399            and the name of the source-file (incl. line number) where the error was set */
00400         char *error_from;
00401         long err_number_lib;
00402         char *err_desc_lib;
00403 }; /* struct librasch */
00404 
00405 
00413 struct eval_info
00414 {
00415         char filename[MAX_PATH_RA];
00416 
00417         struct eval_attribute *attribute;
00418 
00419         struct eval *evaluations;
00420 }; /* struct eval_info */
00421 
00422 
00423 /* measurement specific structure
00424    contains pointers to
00425    - plugin which handles measurement,
00426    - plugin-private-infos
00427    - array with pointers to sessions (which include pointers to recordings)
00428    - evaluation(s) of measurement
00429    - communication between plugins
00430    - scaling-factors for x-axis
00431 */
00447 struct ra_meas
00448 {
00449         unsigned short handle_id;
00450 
00451         struct librasch *ra;
00452 
00453         struct plugin_struct *p;        /* plugin which handles measurement */
00454 
00455         /* plugin-specific infos about this measurement */
00456         void *priv;
00457 
00458         int num_sessions;
00459         struct ra_session *sessions;
00460 
00461         struct eval_info eval;
00462 
00463         struct plugin_comm plc;
00464 
00465         /* scaling factors for the x-axis for every single channel;
00466            needed for calculating the position if measurement has
00467            different sampling rates */
00468         long num_ch;  /* for parameter checking in func ra_get_ch_x_scale() */
00469         double *x_scale;
00470         double max_samplerate;
00471 }; /* struct ra_meas */
00472 
00473 
00474 /* Plugins which have options and want to support the getting/setting of options
00475    with function calls, can use this structure to store the information. */
00485 struct ra_option_infos
00486 {
00487         char *name;
00488         char *desc;
00489         long type;
00490         long offset;
00491         /* The next element is only needed when the option-type is an array.
00492            The variable described will hold the number of elements in the array.
00493            It must be from type long. */
00494         long num_offset;        /* offset of variable where #elements can be found */
00495 }; /* struct ra_option_infos */
00496 
00497 
00506 struct ra_result_infos
00507 {
00508         char *name;
00509         char *desc;
00510         int type;
00511         int def;
00512 }; /* struct ra_result_infos */
00513 
00514 
00530 struct proc_info
00531 {
00532         unsigned short handle_id;
00533 
00534         plugin_handle plugin;
00535 
00536         ra_handle ra;
00537         meas_handle mh;
00538         rec_handle rh;
00539 
00540         void (*callback) (const char *text, int percent);
00541 
00542         long num_options;
00543         void *options;
00544 
00545         long num_result_sets;
00546         long num_results;
00547         value_handle *results;
00548 };  /* struct proc_info */
00549 
00550 
00551 
00552 /* ---------- prototypes ---------- */
00553 /* "external" interface but should only be used from libRASCH or plugin code */
00554 LIBRAAPI void _ra_set_error_int(any_handle h, long error, const char *error_from, const char *src_file, int src_line);
00555 
00556 LIBRAAPI int ra_eval_save_result(eval_handle eh, class_handle clh, prop_handle ph, proc_handle proc, long res_set);
00557 
00558 void get_error_text(long err, char *text, int len); /* os specific function; get os/c-lib error
00559                                                        or calls get_error_text_ra() */
00560 void get_error_text_ra(long err, char *text, int len);
00561 
00562 void set_endian_type();
00563 LIBRAAPI int get_endian_type();
00564 
00565 void init_i18n(struct librasch *ra);
00566 LIBRAAPI int local_to_utf8(const char *src, char *dest, size_t dest_size);
00567 LIBRAAPI int local_to_utf8_inplace(char *string, size_t buf_size);
00568 LIBRAAPI int utf8_to_local(const char *src, char *dest, size_t dest_size);
00569 LIBRAAPI int utf8_to_local_inplace(char *string, size_t buf_size);
00570 
00571 int read_config(struct librasch *ra);
00572 void init_config(struct config_info *conf);
00573 #ifdef WIN32
00574 int read_win32_registry(struct librasch *ra);
00575 #endif
00576 int find_config_file(char *fn);
00577 int read_modules(struct librasch *ra);
00578 int dload_module(struct librasch *ra, char *file);
00579 void close_modules(struct librasch *ra);
00580 struct plugin_struct *get_plugin(struct librasch *ra, int index);
00581 struct plugin_struct *get_plugin_by_name(struct librasch *r, const char *name);
00582 int calc_x_scales(struct ra_meas *meas);
00583 
00584 int check_handle_type(any_handle h, int id);
00585 int get_lib_info(ra_handle ra, int id, value_handle vh);
00586 int get_plugin_info(plugin_handle pl, int id, value_handle vh);
00587 int get_meas_general_info(meas_handle meas, int id, value_handle vh);
00588 int get_session_info(any_handle h, int id, value_handle vh);
00589 int get_proc_info(any_handle h, int id, value_handle vh);
00590 
00591 struct plugin_struct *get_plugin_from_handle(any_handle h);
00592 
00593 void free_mem(struct ra_value *v);
00594 
00595 int find_option(const char *name, struct ra_option_infos *infos, int num_opt);
00596 int get_option(void *options, struct ra_option_infos *opt_info, value_handle vh, long num_offset);
00597 int set_option(void *options, struct ra_option_infos *opt_info, value_handle vh, long num_offset);
00598 
00599 int valid_value_handle(value_handle vh, int line_num);
00600 LIBRAAPI int set_meta_info(value_handle vh, const char *name, const char *desc, int id);
00601 
00602 int copy_move_meas(meas_handle mh, const char *dest_dir, int copy);
00603 
00604 int create_auto_class(eval_handle eh, struct ra_auto_create_class *acc, value_handle *res, long res_offset);
00605 int create_auto_prop(eval_handle eh, class_handle clh, struct proc_info *pi, struct ra_auto_create_class *acc,
00606                      struct ra_auto_create_prop *acp, value_handle *res, long res_offset);
00607 
00608 #ifdef __cplusplus
00609 }
00610 #endif
00611 
00612 #endif /* _RA_PRIV_H */

Generated on Fri May 27 11:32:39 2005 for libRASCH by  doxygen 1.4.2