gsl_ntuple.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* histogram/ntuple.h
  2. *
  3. * Copyright (C) 2000 Simone Piccardi
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. *
  19. */
  20. /* Jan/2001 Modified by Brian Gough. Minor changes for GSL */
  21. #ifndef __GSL_NTUPLE_H__
  22. #define __GSL_NTUPLE_H__
  23. #include <stdlib.h>
  24. #include <stdio.h>
  25. #include "gsl_errno.h"
  26. #include "gsl_histogram.h"
  27. #undef __BEGIN_DECLS
  28. #undef __END_DECLS
  29. #ifdef __cplusplus
  30. # define __BEGIN_DECLS extern "C" {
  31. # define __END_DECLS }
  32. #else
  33. # define __BEGIN_DECLS /* empty */
  34. # define __END_DECLS /* empty */
  35. #endif
  36. __BEGIN_DECLS
  37. typedef struct {
  38. FILE * file;
  39. void * ntuple_data;
  40. size_t size;
  41. } gsl_ntuple;
  42. typedef struct {
  43. int (* function) (void * ntuple_data, void * params);
  44. void * params;
  45. } gsl_ntuple_select_fn;
  46. typedef struct {
  47. double (* function) (void * ntuple_data, void * params);
  48. void * params;
  49. } gsl_ntuple_value_fn;
  50. gsl_ntuple *
  51. gsl_ntuple_open (char * filename, void * ntuple_data, size_t size);
  52. gsl_ntuple *
  53. gsl_ntuple_create (char * filename, void * ntuple_data, size_t size);
  54. int gsl_ntuple_write (gsl_ntuple * ntuple);
  55. int gsl_ntuple_read (gsl_ntuple * ntuple);
  56. int gsl_ntuple_bookdata (gsl_ntuple * ntuple); /* synonym for write */
  57. int gsl_ntuple_project (gsl_histogram * h, gsl_ntuple * ntuple,
  58. gsl_ntuple_value_fn *value_func,
  59. gsl_ntuple_select_fn *select_func);
  60. int gsl_ntuple_close (gsl_ntuple * ntuple);
  61. __END_DECLS
  62. #endif /* __GSL_NTUPLE_H__ */