last-svn-commit-5-g7e6c289 Add MLN_WO_GLOBAL_VARS directive that prevents globals vars to be included.

* mln/border/thickness.hh, * mln/core/alias/dpoint1d.hh, * mln/core/alias/dpoint2d.hh, * mln/core/alias/dpoint3d.hh, * mln/fun/v2v/hsl_to_rgb.hh, * mln/literal/black.hh, * mln/literal/colors.hh, * mln/literal/identity.hh, * mln/literal/one.hh, * mln/literal/origin.hh, * mln/literal/white.hh, * mln/literal/zero.hh, * mln/tag/init.hh, * mln/trace/entering.hh, * mln/trace/quiet.hh, * mln/trait/ch_value.hh, * mln/util/ctree/node.hh, * mln/value/sign.hh : Add MLN_WO_GLOBAL_VARS define. --- milena/ChangeLog | 24 ++++++++++++++++++++++++ milena/mln/border/thickness.hh | 4 ++++ milena/mln/core/alias/dpoint1d.hh | 4 ++++ milena/mln/core/alias/dpoint2d.hh | 4 ++++ milena/mln/core/alias/dpoint3d.hh | 4 ++++ milena/mln/fun/v2v/hsl_to_rgb.hh | 3 +++ milena/mln/literal/black.hh | 4 ++++ milena/mln/literal/colors.hh | 4 ++++ milena/mln/literal/identity.hh | 4 ++++ milena/mln/literal/one.hh | 3 +++ milena/mln/literal/origin.hh | 6 +++++- milena/mln/literal/white.hh | 4 ++++ milena/mln/literal/zero.hh | 4 ++++ milena/mln/tag/init.hh | 4 ++++ milena/mln/trace/entering.hh | 3 +++ milena/mln/trace/quiet.hh | 5 ++++- milena/mln/trait/ch_value.hh | 8 ++++++++ milena/mln/util/ctree/node.hh | 14 ++++++++++++++ milena/mln/value/sign.hh | 10 +++++++--- 19 files changed, 111 insertions(+), 5 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index bb30678..d07d036 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,27 @@ +2010-05-21 edwin carlinet <carlinet@lrde.epita.fr> + + Add MLN_WO_GLOBAL_VARS directive that prevents globals vars to be + included. + + * mln/border/thickness.hh, + * mln/core/alias/dpoint1d.hh, + * mln/core/alias/dpoint2d.hh, + * mln/core/alias/dpoint3d.hh, + * mln/fun/v2v/hsl_to_rgb.hh, + * mln/literal/black.hh, + * mln/literal/colors.hh, + * mln/literal/identity.hh, + * mln/literal/one.hh, + * mln/literal/origin.hh, + * mln/literal/white.hh, + * mln/literal/zero.hh, + * mln/tag/init.hh, + * mln/trace/entering.hh, + * mln/trace/quiet.hh, + * mln/trait/ch_value.hh, + * mln/util/ctree/node.hh, + * mln/value/sign.hh : Add MLN_WO_GLOBAL_VARS define. + 2010-05-04 edwin carlinet <carlinet@lrde.epita.fr> Tree build algorithms and tree management routines diff --git a/milena/mln/border/thickness.hh b/milena/mln/border/thickness.hh index cb1d913..1466e0c 100644 --- a/milena/mln/border/thickness.hh +++ b/milena/mln/border/thickness.hh @@ -43,8 +43,12 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + unsigned thickness = 3; +# endif // !MLN_WO_GLOBAL_VARS + # endif // !MLN_INCLUDE_ONLY } // end of namespace mln::border diff --git a/milena/mln/core/alias/dpoint1d.hh b/milena/mln/core/alias/dpoint1d.hh index 02da6b0..7ebd790 100644 --- a/milena/mln/core/alias/dpoint1d.hh +++ b/milena/mln/core/alias/dpoint1d.hh @@ -68,12 +68,16 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + const dpoint1d before = dpoint1d( -1 ); const dpoint1d after = dpoint1d( +1 ); const dpoint1d ind_dec = before; const dpoint1d ind_inc = after; +# endif // !MLN_WO_GLOBAL_VARS + # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/core/alias/dpoint2d.hh b/milena/mln/core/alias/dpoint2d.hh index 2dbd864..1120154 100644 --- a/milena/mln/core/alias/dpoint2d.hh +++ b/milena/mln/core/alias/dpoint2d.hh @@ -71,6 +71,8 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + const dpoint2d up = dpoint2d( -1, 0 ); const dpoint2d down = dpoint2d( +1, 0 ); const dpoint2d left = dpoint2d( 0, -1 ); @@ -81,6 +83,8 @@ namespace mln const dpoint2d down_left = dpoint2d( +1, -1 ); const dpoint2d down_right = dpoint2d( +1, +1 ); +# endif // !MLN_WO_GLOBAL_VARS + # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/core/alias/dpoint3d.hh b/milena/mln/core/alias/dpoint3d.hh index 3562aad..3d137fc 100644 --- a/milena/mln/core/alias/dpoint3d.hh +++ b/milena/mln/core/alias/dpoint3d.hh @@ -67,6 +67,8 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + const dpoint3d sagittal_dec = dpoint3d( 0, 0, -1); const dpoint3d sagittal_inc = dpoint3d( 0, 0, +1); const dpoint3d axial_dec = dpoint3d( 0, -1, 0); @@ -74,6 +76,8 @@ namespace mln const dpoint3d coronal_dec = dpoint3d(-1, 0, 0); const dpoint3d coronal_inc = dpoint3d(+1, 0, 0); +# endif // !MLN_WO_GLOBAL_VARS + # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/fun/v2v/hsl_to_rgb.hh b/milena/mln/fun/v2v/hsl_to_rgb.hh index c26375e..7d66d31 100644 --- a/milena/mln/fun/v2v/hsl_to_rgb.hh +++ b/milena/mln/fun/v2v/hsl_to_rgb.hh @@ -85,11 +85,14 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + /// Global variables. /// \{ f_hsl_to_rgb_3x8_t f_hsl_to_rgb_3x8; f_hsl_to_rgb_3x16_t f_hsl_to_rgb_3x16; /// \} +# endif // !MLN_WO_GLOBAL_VARS /// This method implements the conversion from HSL to RGB as described by diff --git a/milena/mln/literal/black.hh b/milena/mln/literal/black.hh index 6ae33f7..ab05cae 100644 --- a/milena/mln/literal/black.hh +++ b/milena/mln/literal/black.hh @@ -55,8 +55,12 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + const black_t& black = black_t(); +# endif + # ifdef MLN_NEW_VALUE_TYPES inline black_t::operator float() const diff --git a/milena/mln/literal/colors.hh b/milena/mln/literal/colors.hh index 8355174..d2f5ee2 100644 --- a/milena/mln/literal/colors.hh +++ b/milena/mln/literal/colors.hh @@ -152,6 +152,8 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + const red_t& red = red_t(); const green_t& green = green_t(); @@ -180,6 +182,8 @@ namespace mln const olive_t& olive = olive_t(); +# endif + # endif } // end of namespace mln::literal diff --git a/milena/mln/literal/identity.hh b/milena/mln/literal/identity.hh index 535ee0a..f07081f 100644 --- a/milena/mln/literal/identity.hh +++ b/milena/mln/literal/identity.hh @@ -49,8 +49,12 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + const identity_t& identity = identity_t(); +# endif // !MLN_WO_GLOBAL_VARS + # endif } // end of namespace mln::literal diff --git a/milena/mln/literal/one.hh b/milena/mln/literal/one.hh index 2db3551..94babc7 100644 --- a/milena/mln/literal/one.hh +++ b/milena/mln/literal/one.hh @@ -64,9 +64,12 @@ namespace mln return 1; } +# ifndef MLN_WO_GLOBAL_VARS const one_t& one = one_t(); +# endif // !MLN_WO_GLOBAL_VARS + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::literal diff --git a/milena/mln/literal/origin.hh b/milena/mln/literal/origin.hh index 9313189..369ffff 100644 --- a/milena/mln/literal/origin.hh +++ b/milena/mln/literal/origin.hh @@ -50,9 +50,13 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + const origin_t& origin = origin_t(); -# endif +# endif // !MLN_WO_GLOBAL_VARS + +# endif // !MLN_INCLUDE_ONLY } // end of namespace mln::literal diff --git a/milena/mln/literal/white.hh b/milena/mln/literal/white.hh index ada172d..9f19f3a 100644 --- a/milena/mln/literal/white.hh +++ b/milena/mln/literal/white.hh @@ -55,8 +55,12 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + const white_t& white = white_t(); +# endif + # ifdef MLN_NEW_VALUE_TYPES inline white_t::operator float() const diff --git a/milena/mln/literal/zero.hh b/milena/mln/literal/zero.hh index 07af50b..4d3a13b 100644 --- a/milena/mln/literal/zero.hh +++ b/milena/mln/literal/zero.hh @@ -64,8 +64,12 @@ namespace mln return 0; } +# ifndef MLN_WO_GLOBAL_VARS + const zero_t& zero = zero_t(); +# endif // !MLN_GLOBAL_VARS + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::literal diff --git a/milena/mln/tag/init.hh b/milena/mln/tag/init.hh index 455d2b5..c1db35c 100644 --- a/milena/mln/tag/init.hh +++ b/milena/mln/tag/init.hh @@ -54,6 +54,8 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + bbox_t bbox; border_t border; domain_t domain; @@ -61,6 +63,8 @@ namespace mln function_t function; image_t image; +# endif // !MLN_WO_GLOBAL_VARS + # endif // !MLN_INCLUDE_ONLY } // end of namespace mln::tag diff --git a/milena/mln/trace/entering.hh b/milena/mln/trace/entering.hh index 4afac25..d901971 100644 --- a/milena/mln/trace/entering.hh +++ b/milena/mln/trace/entering.hh @@ -53,9 +53,12 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + std::stack<std::clock_t> start_times; std::stack<std::string> scopes; +# endif // !MLN_WO_GLOBAL_VARS inline void entering(const std::string& scope) diff --git a/milena/mln/trace/quiet.hh b/milena/mln/trace/quiet.hh index c84a319..f76e8d2 100644 --- a/milena/mln/trace/quiet.hh +++ b/milena/mln/trace/quiet.hh @@ -57,6 +57,8 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + bool quiet = true; unsigned tab = 0; bool full_trace = false; @@ -68,9 +70,10 @@ namespace mln unsigned max_tab = 0; timeval start_time; bool is_quiet = quiet; - } // end of namespace mln::trace::internal +# endif // !MLN_WO_GLOBAL_VARS + # endif // !MLN_INCLUDE_ONLY } // end of namespace mln::trace diff --git a/milena/mln/trait/ch_value.hh b/milena/mln/trait/ch_value.hh index ae6e1d2..5dc3600 100644 --- a/milena/mln/trait/ch_value.hh +++ b/milena/mln/trait/ch_value.hh @@ -50,6 +50,7 @@ namespace mln template <typename G, typename F> class p_vertices; template <typename P, typename V, typename G> class vertex_image; template <typename P, typename V, typename G> class edge_image; + template <typename T, typename V> class attribute_image; template <typename I> class labeled_image; namespace pw { template <typename F, typename S> class image; } @@ -215,6 +216,13 @@ namespace mln typedef mln_ch_value(I,V) ret; }; + // Attribute image. + template <typename T, typename V1, typename V2> + struct ch_value_< attribute_image< tag::tree_<T>, tag::value_<V1> >, V2 > + { + typedef attribute_image<T, V2> ret; + }; + template < template <class, class> class M, typename T, typename S, typename V > diff --git a/milena/mln/util/ctree/node.hh b/milena/mln/util/ctree/node.hh index d22c48e..ebdc955 100644 --- a/milena/mln/util/ctree/node.hh +++ b/milena/mln/util/ctree/node.hh @@ -130,6 +130,12 @@ namespace mln bool operator!= (const node<T>& n1, const node<T>& n2); + /// Test if the node \p n1 is a descendant of \p n2 + /// + template <typename T> + bool + operator< (const node<T>& n1, const node<T>& n2); + } // end of namespace mln::util::ctree } // end of namespace mln::util @@ -273,6 +279,14 @@ namespace mln return n1.index() != n2.index(); } + template <typename T> + inline + bool + operator< (const node<T>& n1, const node<T>& n2) + { + return n1.index() > n2.index(); + } + } // end of namespace mln::util::ctree } // end of namespace mln::util diff --git a/milena/mln/value/sign.hh b/milena/mln/value/sign.hh index a59695d..bd69f39 100644 --- a/milena/mln/value/sign.hh +++ b/milena/mln/value/sign.hh @@ -108,6 +108,13 @@ namespace mln # ifndef MLN_INCLUDE_ONLY +# ifndef MLN_WO_GLOBAL_VARS + + const sign sign::zero = 0; + const sign sign::one = 1; + +# endif // !MLN_WO_GLOBAL_VARS + inline sign::sign() { @@ -172,9 +179,6 @@ namespace mln return *this; } - const sign sign::zero = 0; - - const sign sign::one = 1; inline std::ostream& operator<<(std::ostream& ostr, const sign& i) -- 1.5.6.5
participants (1)
-
edwin carlinet