[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

utilities.hxx
1 /************************************************************************/
2 /* */
3 /* Copyright 1998-2002 by Ullrich Koethe */
4 /* */
5 /* This file is part of the VIGRA computer vision library. */
6 /* The VIGRA Website is */
7 /* http://hci.iwr.uni-heidelberg.de/vigra/ */
8 /* Please direct questions, bug reports, and contributions to */
9 /* ullrich.koethe@iwr.uni-heidelberg.de or */
10 /* vigra@informatik.uni-hamburg.de */
11 /* */
12 /* Permission is hereby granted, free of charge, to any person */
13 /* obtaining a copy of this software and associated documentation */
14 /* files (the "Software"), to deal in the Software without */
15 /* restriction, including without limitation the rights to use, */
16 /* copy, modify, merge, publish, distribute, sublicense, and/or */
17 /* sell copies of the Software, and to permit persons to whom the */
18 /* Software is furnished to do so, subject to the following */
19 /* conditions: */
20 /* */
21 /* The above copyright notice and this permission notice shall be */
22 /* included in all copies or substantial portions of the */
23 /* Software. */
24 /* */
25 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
26 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
27 /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
28 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
29 /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
30 /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
31 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
32 /* OTHER DEALINGS IN THE SOFTWARE. */
33 /* */
34 /************************************************************************/
35 
36 
37 #ifndef VIGRA_BASICS_HXX
38 #define VIGRA_BASICS_HXX
39 
40 #include "config.hxx"
41 #include "error.hxx"
42 #include "metaprogramming.hxx"
43 #include "tuple.hxx"
44 #include "diff2d.hxx"
45 #include "mathutil.hxx"
46 #include <string>
47 #include <sstream>
48 
49 namespace vigra {
50 
51 /** Convert a value to a string. Available for integral and floating point types
52  and void *.
53 */
54 doxygen_overloaded_function(template <class T> std::string asString(T t))
55 
56 #define VIGRA_AS_STRING(T) \
57 inline std::string asString(T t) \
58 { \
59  std::stringstream s; \
60  s << t; \
61  return s.str(); \
62 }
63 
64 VIGRA_AS_STRING(bool)
65 VIGRA_AS_STRING(signed char)
66 VIGRA_AS_STRING(unsigned char)
67 VIGRA_AS_STRING(signed short)
68 VIGRA_AS_STRING(unsigned short)
69 VIGRA_AS_STRING(signed long)
70 VIGRA_AS_STRING(unsigned long)
71 VIGRA_AS_STRING(signed long long)
72 VIGRA_AS_STRING(unsigned long long)
73 VIGRA_AS_STRING(signed int)
74 VIGRA_AS_STRING(unsigned int)
75 VIGRA_AS_STRING(float)
76 VIGRA_AS_STRING(double)
77 VIGRA_AS_STRING(long double)
78 VIGRA_AS_STRING(void *)
79 
80 #undef VIGRA_AS_STRING
81 
82 template <class T>
83 std::string & operator<<(std::string & s, T const & t)
84 {
85  std::stringstream ss;
86  ss << t;
87  return s += ss.str();
88 }
89 
90 } // namespace vigra
91 
92 /*! \page Utilities Utilities
93  Basic helper functionality needed throughout.
94 
95  <UL style="list-style-image:url(documents/bullet.gif)">
96  <LI> \ref vigra::ArrayVector
97  <BR>&nbsp;&nbsp;&nbsp;<em>replacement for std::vector (always uses consecutive memory)</em>
98  <LI> \ref vigra::BucketQueue and \ref vigra::MappedBucketQueue
99  <BR>&nbsp;&nbsp;&nbsp;<em>efficient priority queues for integer priorities</em>
100  <LI> \ref RangesAndPoints
101  <BR>&nbsp;&nbsp;&nbsp;<em>2-D and N-D positions, extents, and boxes</em>
102  <LI> \ref PixelNeighborhood
103  <BR>&nbsp;&nbsp;&nbsp;<em>4- and 8-neighborhood definitions and circulators</em>
104  <LI> \ref VoxelNeighborhood
105  <BR>&nbsp;&nbsp;&nbsp;<em>6- and 26-neighborhood definitions and circulators</em>
106  <LI> \ref vigra::IteratorAdaptor
107  <BR>&nbsp;&nbsp;&nbsp;<em>Quickly create STL-compatible 1D iterator adaptors</em>
108  <LI> \ref TupleTypes
109  <BR>&nbsp;&nbsp;&nbsp;<em>pair, triple, tuple4, tuple5</em>
110  <LI> \ref MathConstants
111  <BR>&nbsp;&nbsp;&nbsp;<em>M_PI, M_SQRT2</em>
112  <LI> \ref TimingMacros
113  <BR>&nbsp;&nbsp;&nbsp;<em>Macros for taking execution speed measurements</em>
114  </UL>
115 */
116 
117 #endif // VIGRA_BASICS_HXX

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.8.0 (Wed Sep 26 2012)