common.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /****************************************************************************
  2. *
  3. * MODULE: r.terraflow
  4. *
  5. * COPYRIGHT (C) 2007 Laura Toma
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. *****************************************************************************/
  18. #ifndef COMMON_H
  19. #define COMMON_H
  20. #include <sys/types.h>
  21. #include <iostream>
  22. #include <grass/iostream/ami.h>
  23. #include "stats.h"
  24. #include "option.h"
  25. #include "types.h" /* for dimension_type */
  26. extern "C" {
  27. #include <grass/gis.h>
  28. }
  29. extern statsRecorder *stats; /* stats file */
  30. extern userOptions *opt; /* command-line options */
  31. extern struct Cell_head *region; /* header of the region */
  32. extern dimension_type nrows, ncols;
  33. #define MARKER(s) (stats->comment(__FILE__ ":" s))
  34. #define STRACE(s) MARKER(s)
  35. size_t parse_number(const char *s);
  36. #define LM_HIST 22
  37. #ifdef USE_LARGEMEM
  38. class LargeMemory {
  39. static void *ptr[LM_HIST];
  40. static size_t len[LM_HIST];
  41. static int next;
  42. public:
  43. static void *alloc(size_t);
  44. static void free(void *);
  45. };
  46. #endif /* USE_LARGEMEM */
  47. #endif