Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Concepts
GlobalData.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <ext/functional>
9#include <ext/istream>
10#include <ext/ostream>
11
12namespace common {
13
19public:
24 static bool verbose;
25
30 static bool measure;
31
35 static bool optimizeXml;
36
41 static int argc;
42
47 static char * * argv;
48};
49
54class Streams {
55public:
61
67
73
79
85};
86
87} /* common */
88
89namespace ext {
90
95template < class T >
96std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, const T & data ) {
97 os.get ( ) << data;
98 return os;
99}
100
105template < class T >
106std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, T && data ) {
107 os.get ( ) << data;
108 return os;
109}
110
115template < class T >
117 os.get ( ) << data;
118 return os;
119}
120
125template < class T >
127 os.get ( ) << data;
128 return os;
129}
130
135std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, std::ostream & ( * func ) ( std::ostream & ) );
136
141std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, std::ios_base & ( * func ) ( std::ios_base & ) );
142
147ext::ostream & operator << ( ext::reference_wrapper < ext::ostream > & os, std::ostream & ( * func ) ( std::ostream & ) );
148
153ext::ostream & operator << ( ext::reference_wrapper < ext::ostream > & os, std::ios_base & ( * func ) ( std::ios_base & ) );
154
155
156
161template < class T >
163 is.get ( ) >> data;
164 return is;
165}
166
171std::istream & operator >> ( ext::reference_wrapper < std::istream > & is, std::istream & ( * func ) ( std::istream & ) );
172
177std::istream & operator >> ( ext::reference_wrapper < std::istream > & is, std::ios_base & ( * func ) ( std::ios_base & ) );
178
183ext::istream & operator >> ( ext::reference_wrapper < ext::istream > & is, std::istream & ( * func ) ( std::istream & ) );
184
189ext::istream & operator >> ( ext::reference_wrapper < ext::istream > & is, std::ios_base & ( * func ) ( std::ios_base & ) );
190
191} /* namespace ext */
192
Class to represent some global modifiers and data.
Definition: GlobalData.h:18
static char ** argv
The agrument values as provided by the shell to the main function.
Definition: GlobalData.h:47
static bool verbose
Verbose flag. Some algorithms print additional runtime information about internal datastructures or t...
Definition: GlobalData.h:24
static bool measure
Measure flag. Some algorithms support measurements of runtime properties (time, memory,...
Definition: GlobalData.h:30
static bool optimizeXml
Definition: GlobalData.h:35
static int argc
The number of argument values as provided by the shell to the main function.
Definition: GlobalData.h:41
Aggregation class for various standard streams defined by the library.
Definition: GlobalData.h:54
static ext::reference_wrapper< ext::ostream > err
Standard error stream. Mapped to descriptor 2.
Definition: GlobalData.h:72
static ext::reference_wrapper< ext::ostream > measure
Standard measurement stream. Mapped to descriptor 5.
Definition: GlobalData.h:84
static ext::reference_wrapper< ext::ostream > log
Standard loging stream. Mapped to descriptor 4.
Definition: GlobalData.h:78
static ext::reference_wrapper< ext::ostream > out
Standard output stream. Mapped to descriptor 1.
Definition: GlobalData.h:66
static ext::reference_wrapper< ext::istream > in
Standard input stream. Mapped to descriptor 0.
Definition: GlobalData.h:60
Definition: istream.h:32
Definition: ostream.h:14
Class extending the reference wrapper class from the standard library. Original reason is to allow it...
Definition: functional.hpp:108
Definition: Permutation.hpp:18
Definition: sigHandler.cpp:20
std::ostream & operator<<(ext::reference_wrapper< std::ostream > &os, std::ostream &(*const func)(std::ostream &))
Overloaded function allowing same operations on wrapped output stream as on the actual output stream,...
Definition: GlobalData.cpp:33
std::istream & operator>>(ext::reference_wrapper< std::istream > &is, std::istream &(*const func)(std::istream &))
Overloaded function allowing same operations on wrapped input stream as on the actual input stream,...
Definition: GlobalData.cpp:53