Graphite  Version 3
An experimental 3D geometry processing program
common.h
Go to the documentation of this file.
1 /*
2  * Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000-2015 Bruno Levy
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 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU 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., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 #ifndef H_OGF_BASIC_COMMON_COMMON_H
38 #define H_OGF_BASIC_COMMON_COMMON_H
39 
45 #include <geogram/basic/common.h>
46 #include <geogram/basic/assert.h>
47 #include <geogram/basic/argused.h>
48 #include <geogram/basic/memory.h>
49 #include <geogram/basic/numeric.h>
50 #include <geogram/basic/string.h>
52 #include <geogram/basic/counted.h>
53 #include <geogram/basic/logger.h>
54 #include <iostream>
55 #include <stdlib.h>
56 
57 #define OGF_EXPORT GEO_EXPORT
58 #define OGF_IMPORT GEO_IMPORT
59 
60 #ifdef basic_EXPORTS
61 # define BASIC_API OGF_EXPORT
62 #else
63 # define BASIC_API OGF_IMPORT
64 #endif
65 
66 #define ogf_assert(x) geo_assert(x)
67 #define ogf_debug_assert(x) geo_debug_assert(x)
68 #define ogf_assert_not_reached geo_assert_not_reached
69 #define ogf_argused(x) ::GEO::geo_argused(x)
70 #define ogf_range_assert(x,xmin,xmax) geo_assert((x) >= (xmin) && (x) <= (xmax))
71 
76 namespace OGF {
77  using namespace GEO;
78  template <class T> Sign ogf_sgn(const T& x) {
79  return geo_sgn(x);
80  }
81  template <class T> void ogf_clamp(T& x, T xmin, T xmax) {
82  geo_clamp(x,xmin,xmax);
83  }
84  template <class T> T ogf_sqr(const T& x) {
85  return geo_sqr(x);
86  }
87 }
88 
89 namespace OGF {
90 
91  static class BASIC_API basic_libinit {
92  public:
93  basic_libinit() ;
94  ~basic_libinit() ;
95 
96  static void increment_users() ;
97  static void decrement_users() ;
98 
99  private:
100  static void initialize() ;
101  static void terminate() ;
102  static int count_ ;
103  } basic_libinit_instance ;
104 
105 }
106 
107 #endif
A function to suppress unused parameters compilation warnings.
Assertion checking mechanism.
Base class of reference-counted objects, to be used with smart pointers.
Common include file, providing basic definitions. Should be included before anything else by all head...
Types and functions for memory manipulation.
Global Vorpaline namespace.
T geo_sqr(T x)
Gets the square value of a value.
Definition: numeric.h:301
void geo_clamp(T &x, T min, T max)
Clamps a value to a range.
Definition: numeric.h:314
Sign geo_sgn(const T &x)
Gets the sign of a value.
Definition: numeric.h:90
Sign
Integer constants that represent the sign of a value.
Definition: numeric.h:68
Global Graphite namespace.
Definition: common.h:76
Types and functions for numbers manipulation.
Pointers with automatic reference counting.
Functions for string manipulation.