From 24c2d5525d7849d490355c45a5a750c14b82c2cc Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 7 Nov 2017 17:12:18 +0100 Subject: [PATCH] change std::cout to common::Streams::out --- aaccess2/src/aaccess.cpp | 2 +- aarbology2/src/aarbology.cpp | 2 +- acompaction2/src/acompaction.cpp | 2 +- acompare2/src/acompare.cpp | 2 +- aepsilon2/src/aepsilon.cpp | 2 +- agenerate2/src/agenerate.cpp | 2 +- aintegral2/src/aintegral.cpp | 2 +- alangop2/src/alangop.cpp | 2 +- .../determinize/common/NFACommon.cpp | 2 +- .../simplify/RegExpOptimizeUnboundedPart.hpp | 4 +- .../properties/BadCharacterShiftTable.h | 4 +- alib2algo/src/stringology/exact/BoyerMoore.h | 2 +- .../stringology/exact/BoyerMooreHorspool.h | 2 +- .../exact/ReversedBoyerMooreHorspool.h | 2 +- .../src/tree/generate/RandomTreeFactory.cpp | 2 +- .../src/graph/generate/RandomGraphFactory.cpp | 2 +- .../src/graph/isomorphism/HopcroftDebug.h | 2 +- .../src/graph/isomorphism/HopcroftGraph.cpp | 34 +++---- .../src/graph/isomorphism/HopcroftImpl.cpp | 8 +- alib2aux/src/access/ExceptionAccess.cpp | 6 +- alib2cli/src/builtin/WriteFile.cpp | 3 +- .../command/AlgorithmsIntrospectionCommand.h | 2 +- .../src/command/CastsIntrospectionCommand.h | 4 +- .../command/DataTypesIntrospectionCommand.h | 2 +- alib2cli/src/command/HelpCommand.h | 96 +++++++++---------- .../command/OverloadsIntrospectionCommand.h | 28 +++--- alib2cli/src/command/SetCommand.h | 2 +- alib2common/src/debug/sigHandler.cpp | 9 +- alib2raw/src/factory/RawDataFactory.hpp | 3 +- alib2str/src/factory/StringDataFactory.hpp | 3 +- aminimize2/src/aminimize.cpp | 2 +- anormalize2/src/anormalize.cpp | 2 +- aql2/src/aql.cpp | 2 +- aquery2/src/aquery.cpp | 2 +- arand2/src/arand.cpp | 2 +- arename2/src/arename.cpp | 2 +- areverse2/src/areverse.cpp | 2 +- arun2/src/arun.cpp | 2 +- astat2/src/astat.cpp | 2 +- astringology2/src/astringology.cpp | 2 +- atrim2/src/atrim.cpp | 2 +- tniceprint/src/tniceprint.cpp | 4 +- 42 files changed, 134 insertions(+), 130 deletions(-) diff --git a/aaccess2/src/aaccess.cpp b/aaccess2/src/aaccess.cpp index dacb61676e..fb0f415ab8 100644 --- a/aaccess2/src/aaccess.cpp +++ b/aaccess2/src/aaccess.cpp @@ -215,7 +215,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/aarbology2/src/aarbology.cpp b/aarbology2/src/aarbology.cpp index 3a020142e9..29621e213e 100644 --- a/aarbology2/src/aarbology.cpp +++ b/aarbology2/src/aarbology.cpp @@ -228,7 +228,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/acompaction2/src/acompaction.cpp b/acompaction2/src/acompaction.cpp index 7988e0e841..c68f3b759a 100644 --- a/acompaction2/src/acompaction.cpp +++ b/acompaction2/src/acompaction.cpp @@ -67,7 +67,7 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch(const TCLAP::ArgException& exception) { - std::cout << exception.error() << std::endl; + common::Streams::out << exception.error() << std::endl; return 2; } catch(...) { return 127; diff --git a/acompare2/src/acompare.cpp b/acompare2/src/acompare.cpp index f45b898e34..e99503732b 100644 --- a/acompare2/src/acompare.cpp +++ b/acompare2/src/acompare.cpp @@ -80,7 +80,7 @@ int main ( int argc, char * * argv ) { std::string result = std::dynamic_pointer_cast < abstraction::ValueProvider < std::string > > ( environment.getVariable ( "output" ) )->getValue ( true ); if ( result != "" ) - std::cout << result << std::endl; + common::Streams::out << result << std::endl; measurements::end ( ); measurements::end ( ); diff --git a/aepsilon2/src/aepsilon.cpp b/aepsilon2/src/aepsilon.cpp index 8101346466..0c2206f242 100644 --- a/aepsilon2/src/aepsilon.cpp +++ b/aepsilon2/src/aepsilon.cpp @@ -96,7 +96,7 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch(const TCLAP::ArgException& exception) { - std::cout << exception.error() << std::endl; + common::Streams::out << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { common::Streams::err << "Exception caught: " << exception.what() << std::endl; diff --git a/agenerate2/src/agenerate.cpp b/agenerate2/src/agenerate.cpp index 2c6ab11256..47e2cba748 100644 --- a/agenerate2/src/agenerate.cpp +++ b/agenerate2/src/agenerate.cpp @@ -106,7 +106,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/aintegral2/src/aintegral.cpp b/aintegral2/src/aintegral.cpp index 7139720175..b458a14e10 100644 --- a/aintegral2/src/aintegral.cpp +++ b/aintegral2/src/aintegral.cpp @@ -75,7 +75,7 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch(const TCLAP::ArgException& exception) { - std::cout << exception.error() << std::endl; + common::Streams::out << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { common::Streams::err << "Exception caught: " << exception.what() << std::endl; diff --git a/alangop2/src/alangop.cpp b/alangop2/src/alangop.cpp index 46f2018c44..340ab5aacf 100644 --- a/alangop2/src/alangop.cpp +++ b/alangop2/src/alangop.cpp @@ -107,7 +107,7 @@ int main(int argc, char* argv[]) { alib::XmlDataFactory::toStdout( exception ); return 1; } catch(const TCLAP::ArgException& exception) { - std::cout << exception.error() << std::endl; + common::Streams::out << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { common::Streams::err << "Exception caught: " << exception.what() << std::endl; diff --git a/alib2algo/src/automaton/determinize/common/NFACommon.cpp b/alib2algo/src/automaton/determinize/common/NFACommon.cpp index bcbc44456b..db5d6cf32b 100644 --- a/alib2algo/src/automaton/determinize/common/NFACommon.cpp +++ b/alib2algo/src/automaton/determinize/common/NFACommon.cpp @@ -21,7 +21,7 @@ DefaultStateType createDFAState ( ext::set < DefaultStateType > nfaStates ) { } const ext::set < DefaultStateType > & recreateNFAStates ( const DefaultStateType & dfaState ) { - // std::cout << dfaState << std::endl; + // common::Streams::out << dfaState << std::endl; return static_cast < const DefaultStatesSetType & > ( dfaState.getData ( ) ); } diff --git a/alib2algo/src/regexp/simplify/RegExpOptimizeUnboundedPart.hpp b/alib2algo/src/regexp/simplify/RegExpOptimizeUnboundedPart.hpp index 4149f6f76b..ba743ec80f 100644 --- a/alib2algo/src/regexp/simplify/RegExpOptimizeUnboundedPart.hpp +++ b/alib2algo/src/regexp/simplify/RegExpOptimizeUnboundedPart.hpp @@ -877,10 +877,10 @@ bool RegExpOptimize::V9( UnboundedRegExpConcatenation < SymbolType > & node ) { continue; } - // std::cout << "xy" << std::endl; + // common::Streams::out << "xy" << std::endl; // UnboundedRegExpConcatenation < SymbolType >* tmp = new UnboundedRegExpConcatenation < SymbolType >( ); // tmp->insert( tmp->getChildren().end( ), std::next( it ), c1Iter ); - // std::cout << RegExp( tmp ) << std::endl; + // common::Streams::out << RegExp( tmp ) << std::endl; // copy the range <it;sth>, delete it and go back to the iter node ext::vector<ext::smart_ptr < UnboundedRegExpElement < SymbolType > > > copyRange; diff --git a/alib2algo/src/string/properties/BadCharacterShiftTable.h b/alib2algo/src/string/properties/BadCharacterShiftTable.h index 2683572f1d..fb51c42910 100644 --- a/alib2algo/src/string/properties/BadCharacterShiftTable.h +++ b/alib2algo/src/string/properties/BadCharacterShiftTable.h @@ -47,9 +47,9 @@ ext::map<SymbolType, size_t> BadCharacterShiftTable::bcs(const string::LinearStr /* for(const auto& kv: bcs) - std::cout << std::string(kv.first) << " " << kv.second << std::endl; + common::Streams::out << std::string(kv.first) << " " << kv.second << std::endl; for(const auto& s: string.getContent()) - std::cout << std::string(s);std::cout << std::endl; + common::Streams::out << std::string(s);common::Streams::out << std::endl; */ return bcs; diff --git a/alib2algo/src/stringology/exact/BoyerMoore.h b/alib2algo/src/stringology/exact/BoyerMoore.h index 86d699bc3c..e134f1eb34 100644 --- a/alib2algo/src/stringology/exact/BoyerMoore.h +++ b/alib2algo/src/stringology/exact/BoyerMoore.h @@ -56,7 +56,7 @@ ext::set<unsigned> BoyerMoore::match(const string::LinearString < SymbolType >& // Yay, there is match!!! if(i == 0) occ.insert(haystack_offset); haystack_offset += std::max ( bcs[string.getContent()[haystack_offset + pattern.getContent().size() - 1]], gss [ pattern.getContent ( ).size ( ) - i ] ); - //std::cout << haystack_offset << std::endl; + //common::Streams::out << haystack_offset << std::endl; } measurements::end ( ); diff --git a/alib2algo/src/stringology/exact/BoyerMooreHorspool.h b/alib2algo/src/stringology/exact/BoyerMooreHorspool.h index e0eb289532..f519160bb6 100644 --- a/alib2algo/src/stringology/exact/BoyerMooreHorspool.h +++ b/alib2algo/src/stringology/exact/BoyerMooreHorspool.h @@ -54,7 +54,7 @@ ext::set<unsigned> BoyerMooreHorspool::match(const string::LinearString < Symbol // Yay, there is match!!! if(i == 0) occ.insert(haystack_offset); haystack_offset += bcs[string.getContent()[haystack_offset + pattern.getContent().size() - 1]]; - //std::cout << haystack_offset << std::endl; + //common::Streams::out << haystack_offset << std::endl; } measurements::end ( ); diff --git a/alib2algo/src/stringology/exact/ReversedBoyerMooreHorspool.h b/alib2algo/src/stringology/exact/ReversedBoyerMooreHorspool.h index 9d74fe054a..7eca1b042b 100644 --- a/alib2algo/src/stringology/exact/ReversedBoyerMooreHorspool.h +++ b/alib2algo/src/stringology/exact/ReversedBoyerMooreHorspool.h @@ -52,7 +52,7 @@ ext::set < unsigned > ReversedBoyerMooreHorspool::match ( const string::LinearSt haystack_offset -= bcs[string.getContent ( )[haystack_offset]]; - // std::cout << haystack_offset << std::endl; + // common::Streams::out << haystack_offset << std::endl; } return occ; diff --git a/alib2algo/src/tree/generate/RandomTreeFactory.cpp b/alib2algo/src/tree/generate/RandomTreeFactory.cpp index 6603529287..154692440d 100644 --- a/alib2algo/src/tree/generate/RandomTreeFactory.cpp +++ b/alib2algo/src/tree/generate/RandomTreeFactory.cpp @@ -183,7 +183,7 @@ struct Node { } } - void nicePrint ( std::ostream & os = std::cout, const std::string & prefix = "", const bool last = true ) const { + void nicePrint ( std::ostream & os = common::Streams::out, const std::string & prefix = "", const bool last = true ) const { os << prefix; std::string nextPrefix ( prefix ); diff --git a/alib2algo_experimental/src/graph/generate/RandomGraphFactory.cpp b/alib2algo_experimental/src/graph/generate/RandomGraphFactory.cpp index b07e5e7bc7..888c711261 100644 --- a/alib2algo_experimental/src/graph/generate/RandomGraphFactory.cpp +++ b/alib2algo_experimental/src/graph/generate/RandomGraphFactory.cpp @@ -17,7 +17,7 @@ #include "../datastructs/Array.h" #ifndef NDEBUG -#define GEN_GRAPH(x) std::cout << x << std::endl; +#define GEN_GRAPH(x) common::Streams::out << x << std::endl; #else #define GEN_GRAPH(x) #endif diff --git a/alib2algo_experimental/src/graph/isomorphism/HopcroftDebug.h b/alib2algo_experimental/src/graph/isomorphism/HopcroftDebug.h index caf1ce258d..60ab79ef28 100644 --- a/alib2algo_experimental/src/graph/isomorphism/HopcroftDebug.h +++ b/alib2algo_experimental/src/graph/isomorphism/HopcroftDebug.h @@ -11,7 +11,7 @@ #ifndef NDEBUG #include <cassert> #define H_ASSERT(x) assert(x) -#define H_DEBUG(x) std::cout << std::boolalpha << x << std::endl +#define H_DEBUG(x) common::Streams::out << std::boolalpha << x << std::endl #else #define H_ASSERT(x) #define H_DEBUG(str) diff --git a/alib2algo_experimental/src/graph/isomorphism/HopcroftGraph.cpp b/alib2algo_experimental/src/graph/isomorphism/HopcroftGraph.cpp index e934d287b2..8c0a4c7563 100644 --- a/alib2algo_experimental/src/graph/isomorphism/HopcroftGraph.cpp +++ b/alib2algo_experimental/src/graph/isomorphism/HopcroftGraph.cpp @@ -530,39 +530,39 @@ void Graph::init(const UndirectedGraph &graph) void Graph::dump() { - std::cout << std::endl; - std::cout << "Vertices: " << vertices.size(); - std::cout << " Edges: " << edge_ends.size() / 2; - std::cout << std::endl; + common::Streams::out << std::endl; + common::Streams::out << "Vertices: " << vertices.size(); + common::Streams::out << " Edges: " << edge_ends.size() / 2; + common::Streams::out << std::endl; for (Vertex *v : vertices) { - std::cout << v->dump() << "(" << v->degree << "):"; + common::Streams::out << v->dump() << "(" << v->degree << "):"; v->forEachEdge([this](EdgeEnd *e) { - std::cout << e->dump() << " (" << std::distance(edge_ends.begin(), std::find(edge_ends.begin(), edge_ends.end(), e)) << ")"; + common::Streams::out << e->dump() << " (" << std::distance(edge_ends.begin(), std::find(edge_ends.begin(), edge_ends.end(), e)) << ")"; return true; }); - std::cout << std::endl; + common::Streams::out << std::endl; } - std::cout << std::endl; + common::Streams::out << std::endl; } void Graph::dumpLabels() { - std::cout << std::endl; - std::cout << "Vertices:" << std::endl; + common::Streams::out << std::endl; + common::Streams::out << "Vertices:" << std::endl; for (Vertex *v : vertices) - std::cout << " " << v->vlabel; - std::cout << std::endl; + common::Streams::out << " " << v->vlabel; + common::Streams::out << std::endl; - std::cout << "Edges:" << std::endl; + common::Streams::out << "Edges:" << std::endl; for (Vertex *v : vertices) { - std::cout << v->dump() << ":"; + common::Streams::out << v->dump() << ":"; v->forEachEdge([](EdgeEnd *e) { - std::cout << " " << e->elabel << "-" << e->otheredge->elabel; + common::Streams::out << " " << e->elabel << "-" << e->otheredge->elabel; return true; }); - std::cout << std::endl; + common::Streams::out << std::endl; } - std::cout << std::endl; + common::Streams::out << std::endl; } Vertex::Vertex() diff --git a/alib2algo_experimental/src/graph/isomorphism/HopcroftImpl.cpp b/alib2algo_experimental/src/graph/isomorphism/HopcroftImpl.cpp index 4c22ecde4c..ac9d4d6573 100644 --- a/alib2algo_experimental/src/graph/isomorphism/HopcroftImpl.cpp +++ b/alib2algo_experimental/src/graph/isomorphism/HopcroftImpl.cpp @@ -1484,19 +1484,19 @@ bool HopcroftImpl::isomorphism_mapping(ext::unordered_map<Vertex*, Vertex*> &map void HopcroftImpl::dumpGraphs() { - std::cout << "G1:"; + common::Streams::out << "G1:"; m_g1->dump(); - std::cout << "G2:"; + common::Streams::out << "G2:"; m_g2->dump(); } void HopcroftImpl::dumpLabels() { - std::cout << "G1:"; + common::Streams::out << "G1:"; m_g1->dumpLabels(); - std::cout << "G2:"; + common::Streams::out << "G2:"; m_g2->dumpLabels(); } diff --git a/alib2aux/src/access/ExceptionAccess.cpp b/alib2aux/src/access/ExceptionAccess.cpp index 8067d00cf7..9d0f936850 100644 --- a/alib2aux/src/access/ExceptionAccess.cpp +++ b/alib2aux/src/access/ExceptionAccess.cpp @@ -20,17 +20,17 @@ namespace dataAccess { void ExceptionAccess::access ( const exception::CommonException & exception, const ExceptionSettings::Settings & settings, const OperationSettings::Settings & operation ) { if ( settings == ExceptionSettings::Settings::CAUSE && operation == OperationSettings::Settings::GET ) { - std::cout << exception.getCause ( ); + common::Streams::out << exception.getCause ( ); return; } if ( settings == ExceptionSettings::Settings::BACKTRACE && operation == OperationSettings::Settings::GET ) { - std::cout << exception.getBacktrace ( ); + common::Streams::out << exception.getBacktrace ( ); return; } if ( settings == ExceptionSettings::Settings::COMMAND && operation == OperationSettings::Settings::GET ) { - std::cout << exception.getCommand ( ); + common::Streams::out << exception.getCommand ( ); return; } diff --git a/alib2cli/src/builtin/WriteFile.cpp b/alib2cli/src/builtin/WriteFile.cpp index b6369141f5..59538a2fe0 100644 --- a/alib2cli/src/builtin/WriteFile.cpp +++ b/alib2cli/src/builtin/WriteFile.cpp @@ -8,6 +8,7 @@ #include "WriteFile.h" #include <registration/AlgoRegistration.hpp> #include <fstream> +#include <global/GlobalData.h> namespace cli { @@ -15,7 +16,7 @@ namespace builtin { void WriteFile::write ( const std::string & filename, const std::string & data ) { if ( filename == "-" ) - std::cout << data; + common::Streams::out << data; else { std::ofstream t ( filename ); if ( ! t.is_open ( ) ) { diff --git a/alib2cli/src/command/AlgorithmsIntrospectionCommand.h b/alib2cli/src/command/AlgorithmsIntrospectionCommand.h index b4c844307a..8dc73efd2d 100644 --- a/alib2cli/src/command/AlgorithmsIntrospectionCommand.h +++ b/alib2cli/src/command/AlgorithmsIntrospectionCommand.h @@ -15,7 +15,7 @@ public: void printAlgos ( const ext::set < std::string > & algos ) const { for ( const std::string & algo : algos ) - std::cout << algo << std::endl; + common::Streams::out << algo << std::endl; } virtual Command::Result run ( Environment & environment ) const override { diff --git a/alib2cli/src/command/CastsIntrospectionCommand.h b/alib2cli/src/command/CastsIntrospectionCommand.h index 069d654b45..56fb4e0a75 100644 --- a/alib2cli/src/command/CastsIntrospectionCommand.h +++ b/alib2cli/src/command/CastsIntrospectionCommand.h @@ -17,12 +17,12 @@ public: void printTypes ( const ext::set < std::string > & types ) const { for ( const std::string & type : types ) - std::cout << type << std::endl; + common::Streams::out << type << std::endl; } void printCasts ( const ext::set < ext::pair < std::string, std::string > > & casts ) const { for ( const ext::pair < std::string, std::string > & cast : casts ) - std::cout << cast.first << ", " << cast.second << std::endl; + common::Streams::out << cast.first << ", " << cast.second << std::endl; } virtual Command::Result run ( Environment & environment ) const override { diff --git a/alib2cli/src/command/DataTypesIntrospectionCommand.h b/alib2cli/src/command/DataTypesIntrospectionCommand.h index 18c4e4e344..a5a9b53a29 100644 --- a/alib2cli/src/command/DataTypesIntrospectionCommand.h +++ b/alib2cli/src/command/DataTypesIntrospectionCommand.h @@ -17,7 +17,7 @@ public: void printTypes ( const ext::set < std::string > & types ) const { for ( const std::string & type : types ) - std::cout << type << std::endl; + common::Streams::out << type << std::endl; } virtual Command::Result run ( Environment & environment ) const override { diff --git a/alib2cli/src/command/HelpCommand.h b/alib2cli/src/command/HelpCommand.h index 491cf8026c..cae2b64cbb 100644 --- a/alib2cli/src/command/HelpCommand.h +++ b/alib2cli/src/command/HelpCommand.h @@ -19,56 +19,56 @@ public: command = m_command->eval ( environment ); if ( command == "execute" ) { - std::cout << "Execute command executes statements and either prints the result or writes the result to a file" << std::endl; - std::cout << "The qualification of the type of the result is remembered and when connecting statements together the compatibility with respective param is checked." << std::endl; - std::cout << "It is possible to use ^ symbol to move the result value of a statement to a parameter of another statement." << std::endl; - std::cout << "" << std::endl; - std::cout << "statement_list:" << std::endl; - std::cout << "statement ( | statement )* - at least one statement followed by a pipe separated sequence of other statements" << std::endl; - std::cout << "" << std::endl; - std::cout << "arg:" << std::endl; - std::cout << "value - immediate string value" << std::endl; - std::cout << "#value - string value from environmet variable" << std::endl; - std::cout << "" << std::endl; - std::cout << "param:" << std::endl; - std::cout << "[^] - - a value from the previous result (PreviousResultParam)" << std::endl; - std::cout << "[^] <( statement_list ) - a statement list serving as a param (StatementParam)" << std::endl; - std::cout << "[^] ( arg ) param - a casted parameter, type is given by arg value (CastParam)" << std::endl; - std::cout << "" << std::endl; - std::cout << "identifier - a string param - the value is a immediate string (ImmediateParam)" << std::endl; - std::cout << "number - a number param - the value is a immediate integer (ImmediateParam)" << std::endl; - std::cout << "#identifier - a string param - identified by an environment variable (ValueParam)" << std::endl; - std::cout << "[^] $arg - a value from a variable, name is given by arg value (VariableParam)" << std::endl; - std::cout << "" << std::endl; - std::cout << "<arg - a value from a xml file, filename is given by arg value (FileParam)" << std::endl; - std::cout << "" << std::endl; - std::cout << "statement:" << std::endl; - std::cout << "name ( param )* output_spec - a statement with params, name is an immediate value (SingleStatement)" << std::endl; - std::cout << "( type ) [^] statement - the result of a statement is casted, type is given by value (CastedStatement)" << std::endl; - std::cout << "{ :type ( statement ) * } - creates a set of type given by arg value with content values from individual statements" << std::endl; - std::cout << "" << std::endl; - std::cout << "#identifier - an immediate value from an environment (ValueStatement)" << std::endl; - std::cout << "$identifier - a value from a variable, identifier is an immediate value (VariableStatement)" << std::endl; - std::cout << "$#identifier - a value from a variable, identified by an environment variable (VariableStatement)" << std::endl; - std::cout << "" << std::endl; - std::cout << "< [:type] arg - a value from a xml file, identifier is given by arg value, type of the value can be hinted with optional parameter (FileStatement)" << std::endl; - std::cout << "" << std::endl; - std::cout << "output_spec:" << std::endl; - std::cout << ">arg - a value to a xml file, identifier is given by arg value (ResultFileStatement)" << std::endl; - std::cout << ">$arg - a value to a variable, identifier is given by arg value (ResultVariableStatement)" << std::endl; - std::cout << "> - a value is discarded" << std::endl; - std::cout << " - an empty output specifier prints the result to the stdout (ResultPrintStatement)" << std::endl; + common::Streams::out << "Execute command executes statements and either prints the result or writes the result to a file" << std::endl; + common::Streams::out << "The qualification of the type of the result is remembered and when connecting statements together the compatibility with respective param is checked." << std::endl; + common::Streams::out << "It is possible to use ^ symbol to move the result value of a statement to a parameter of another statement." << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "statement_list:" << std::endl; + common::Streams::out << "statement ( | statement )* - at least one statement followed by a pipe separated sequence of other statements" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "arg:" << std::endl; + common::Streams::out << "value - immediate string value" << std::endl; + common::Streams::out << "#value - string value from environmet variable" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "param:" << std::endl; + common::Streams::out << "[^] - - a value from the previous result (PreviousResultParam)" << std::endl; + common::Streams::out << "[^] <( statement_list ) - a statement list serving as a param (StatementParam)" << std::endl; + common::Streams::out << "[^] ( arg ) param - a casted parameter, type is given by arg value (CastParam)" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "identifier - a string param - the value is a immediate string (ImmediateParam)" << std::endl; + common::Streams::out << "number - a number param - the value is a immediate integer (ImmediateParam)" << std::endl; + common::Streams::out << "#identifier - a string param - identified by an environment variable (ValueParam)" << std::endl; + common::Streams::out << "[^] $arg - a value from a variable, name is given by arg value (VariableParam)" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "<arg - a value from a xml file, filename is given by arg value (FileParam)" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "statement:" << std::endl; + common::Streams::out << "name ( param )* output_spec - a statement with params, name is an immediate value (SingleStatement)" << std::endl; + common::Streams::out << "( type ) [^] statement - the result of a statement is casted, type is given by value (CastedStatement)" << std::endl; + common::Streams::out << "{ :type ( statement ) * } - creates a set of type given by arg value with content values from individual statements" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "#identifier - an immediate value from an environment (ValueStatement)" << std::endl; + common::Streams::out << "$identifier - a value from a variable, identifier is an immediate value (VariableStatement)" << std::endl; + common::Streams::out << "$#identifier - a value from a variable, identified by an environment variable (VariableStatement)" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "< [:type] arg - a value from a xml file, identifier is given by arg value, type of the value can be hinted with optional parameter (FileStatement)" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "output_spec:" << std::endl; + common::Streams::out << ">arg - a value to a xml file, identifier is given by arg value (ResultFileStatement)" << std::endl; + common::Streams::out << ">$arg - a value to a variable, identifier is given by arg value (ResultVariableStatement)" << std::endl; + common::Streams::out << "> - a value is discarded" << std::endl; + common::Streams::out << " - an empty output specifier prints the result to the stdout (ResultPrintStatement)" << std::endl; } else if ( command == "" ) { - std::cout << "Simple help for the query language" << std::endl; - std::cout << "" << std::endl; - std::cout << "command quit: quits the processor." << std::endl; - std::cout << "command help: shows this help." << std::endl; - std::cout << "command introspect: prints available algorithms, algorithm overloads, casts, and datatypes." << std::endl; - std::cout << "command execute: executes statements" << std::endl; - std::cout << "" << std::endl; - std::cout << "for details use help of individual command" << std::endl; + common::Streams::out << "Simple help for the query language" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "command quit: quits the processor." << std::endl; + common::Streams::out << "command help: shows this help." << std::endl; + common::Streams::out << "command introspect: prints available algorithms, algorithm overloads, casts, and datatypes." << std::endl; + common::Streams::out << "command execute: executes statements" << std::endl; + common::Streams::out << "" << std::endl; + common::Streams::out << "for details use help of individual command" << std::endl; } else { - std::cout << "The command " << command << " either does not exist or does not have a help entry." << std::endl; + common::Streams::out << "The command " << command << " either does not exist or does not have a help entry." << std::endl; } return Command::Result::OK; } diff --git a/alib2cli/src/command/OverloadsIntrospectionCommand.h b/alib2cli/src/command/OverloadsIntrospectionCommand.h index 4b67ad5093..060c74c088 100644 --- a/alib2cli/src/command/OverloadsIntrospectionCommand.h +++ b/alib2cli/src/command/OverloadsIntrospectionCommand.h @@ -18,45 +18,45 @@ public: ext::set < ext::tuple < abstraction::AlgorithmCategories::AlgorithmCategory, ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > >, ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > > > overloads = abstraction::Registry::listOverloads ( param ); for ( const ext::tuple < abstraction::AlgorithmCategories::AlgorithmCategory, ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > >, ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > > & overload : overloads ) { - std::cout << std::get < 0 > ( overload ) << ": "; + common::Streams::out << std::get < 0 > ( overload ) << ": "; { const ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > > & result = std::get < 1 > ( overload ); if ( std::get < 1 > ( result ).count ( abstraction::ParamQualifiers::ParamQualifier::CONST ) ) - std::cout << "const "; + common::Streams::out << "const "; - std::cout << std::get < 0 > ( result ); + common::Streams::out << std::get < 0 > ( result ); if ( std::get < 1 > ( result ).count ( abstraction::ParamQualifiers::ParamQualifier::LREF ) ) - std::cout << " &"; + common::Streams::out << " &"; if ( std::get < 1 > ( result ).count ( abstraction::ParamQualifiers::ParamQualifier::RREF ) ) - std::cout << " &&"; + common::Streams::out << " &&"; } - std::cout << " ("; + common::Streams::out << " ("; bool first = true; for ( const ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > & parameter : std::get < 2 > ( overload ) ) { if ( first ) first = false; else - std::cout << ","; + common::Streams::out << ","; if ( std::get < 1 > ( parameter ).count ( abstraction::ParamQualifiers::ParamQualifier::CONST ) ) - std::cout << " const "; + common::Streams::out << " const "; else - std::cout << " "; + common::Streams::out << " "; - std::cout << std::get < 0 > ( parameter ); + common::Streams::out << std::get < 0 > ( parameter ); if ( std::get < 1 > ( parameter ).count ( abstraction::ParamQualifiers::ParamQualifier::LREF ) ) - std::cout << " &"; + common::Streams::out << " &"; if ( std::get < 1 > ( parameter ).count ( abstraction::ParamQualifiers::ParamQualifier::RREF ) ) - std::cout << " &&"; + common::Streams::out << " &&"; - std::cout << " " << std::get < 2 > ( parameter ); + common::Streams::out << " " << std::get < 2 > ( parameter ); } - std::cout << " )" << std::endl; + common::Streams::out << " )" << std::endl; } return Command::Result::OK; diff --git a/alib2cli/src/command/SetCommand.h b/alib2cli/src/command/SetCommand.h index a2affbece4..5627ad91f4 100644 --- a/alib2cli/src/command/SetCommand.h +++ b/alib2cli/src/command/SetCommand.h @@ -23,7 +23,7 @@ public: } else if ( m_param == "optimizeXml" ) { common::GlobalData::optimizeXml = ext::from_string < bool > ( m_value ); } else { - std::cout << "The set parameter " << m_param << " does not exist." << std::endl; + common::Streams::out << "The set parameter " << m_param << " does not exist." << std::endl; } return Command::Result::OK; } diff --git a/alib2common/src/debug/sigHandler.cpp b/alib2common/src/debug/sigHandler.cpp index a3cfbb3ce4..e7a791c314 100644 --- a/alib2common/src/debug/sigHandler.cpp +++ b/alib2common/src/debug/sigHandler.cpp @@ -8,23 +8,24 @@ #include "simpleStacktrace.h" #include <iostream> +#include <global/GlobalData.h> namespace ext { void SigHandler::handler(int signal) { switch(signal) { case SIGSEGV: - std::cout << "Segmentation fault" << std::endl; + common::Streams::out << "Segmentation fault" << std::endl; break; case SIGINT: - std::cout << "Interrupted" << std::endl; + common::Streams::out << "Interrupted" << std::endl; break; default: - std::cout << "Unknown signal" << std::endl; + common::Streams::out << "Unknown signal" << std::endl; break; } #ifdef DEBUG - std::cout << ext::simpleStacktrace() << std::endl; + common::Streams::out << ext::simpleStacktrace() << std::endl; #endif exit(1); } diff --git a/alib2raw/src/factory/RawDataFactory.hpp b/alib2raw/src/factory/RawDataFactory.hpp index a2e38cfdcf..6f9c6aa9f0 100644 --- a/alib2raw/src/factory/RawDataFactory.hpp +++ b/alib2raw/src/factory/RawDataFactory.hpp @@ -13,6 +13,7 @@ #include <core/rawApi.hpp> #include <fstream> #include <sstream> +#include <global/GlobalData.h> namespace alib { @@ -110,7 +111,7 @@ public: template < class T > static void toStdout ( const T & data ) { - toStream < T > ( data, std::cout ); + toStream < T > ( data, common::Streams::out ); } template < class T > diff --git a/alib2str/src/factory/StringDataFactory.hpp b/alib2str/src/factory/StringDataFactory.hpp index f389987b07..886077cbcc 100644 --- a/alib2str/src/factory/StringDataFactory.hpp +++ b/alib2str/src/factory/StringDataFactory.hpp @@ -13,6 +13,7 @@ #include <core/stringApi.hpp> #include <fstream> #include <sstream> +#include <global/GlobalData.h> namespace alib { @@ -95,7 +96,7 @@ public: template < class T > static void toStdout ( const T & data ) { - toStream < T > ( data, std::cout ); + toStream < T > ( data, common::Streams::out ); } template < class T > diff --git a/aminimize2/src/aminimize.cpp b/aminimize2/src/aminimize.cpp index b35726b9c6..bf11c193bf 100644 --- a/aminimize2/src/aminimize.cpp +++ b/aminimize2/src/aminimize.cpp @@ -82,7 +82,7 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch (const TCLAP::ArgException& exception) { - std::cout << exception.error() << std::endl; + common::Streams::out << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { common::Streams::err << "Exception caught: " << exception.what() << std::endl; diff --git a/anormalize2/src/anormalize.cpp b/anormalize2/src/anormalize.cpp index ed7fd9b9a1..193e86da54 100644 --- a/anormalize2/src/anormalize.cpp +++ b/anormalize2/src/anormalize.cpp @@ -115,7 +115,7 @@ int main ( int argc, char * * argv ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/aql2/src/aql.cpp b/aql2/src/aql.cpp index 9d724b26b4..8c71ad1dc9 100644 --- a/aql2/src/aql.cpp +++ b/aql2/src/aql.cpp @@ -111,7 +111,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/aquery2/src/aquery.cpp b/aquery2/src/aquery.cpp index 72e95dbb29..92edd16193 100644 --- a/aquery2/src/aquery.cpp +++ b/aquery2/src/aquery.cpp @@ -137,7 +137,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/arand2/src/arand.cpp b/arand2/src/arand.cpp index 513fc477e8..aff120ba55 100644 --- a/arand2/src/arand.cpp +++ b/arand2/src/arand.cpp @@ -207,7 +207,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/arename2/src/arename.cpp b/arename2/src/arename.cpp index 001efb98af..096bf6b32a 100644 --- a/arename2/src/arename.cpp +++ b/arename2/src/arename.cpp @@ -82,7 +82,7 @@ int main ( int argc, char * * argv ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/areverse2/src/areverse.cpp b/areverse2/src/areverse.cpp index 59f00c1578..d25ef72f5a 100644 --- a/areverse2/src/areverse.cpp +++ b/areverse2/src/areverse.cpp @@ -70,7 +70,7 @@ int main(int argc, char** argv) { alib::XmlDataFactory::toStdout(exception); return 1; } catch(const TCLAP::ArgException& exception) { - std::cout << exception.error() << std::endl; + common::Streams::out << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { common::Streams::err << "Exception caught: " << exception.what() << std::endl; diff --git a/arun2/src/arun.cpp b/arun2/src/arun.cpp index f2a69ab3f6..a3c6165474 100644 --- a/arun2/src/arun.cpp +++ b/arun2/src/arun.cpp @@ -110,7 +110,7 @@ int main(int argc, char* argv[]) { alib::XmlDataFactory::toStdout( exception ); return 1; } catch (const TCLAP::ArgException& exception) { - std::cout << exception.error() << std::endl; + common::Streams::out << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { common::Streams::err << "Exception caught: " << exception.what() << std::endl; diff --git a/astat2/src/astat.cpp b/astat2/src/astat.cpp index c263424088..81bf2c53fc 100644 --- a/astat2/src/astat.cpp +++ b/astat2/src/astat.cpp @@ -85,7 +85,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/astringology2/src/astringology.cpp b/astringology2/src/astringology.cpp index 70691b793c..25b83d3976 100644 --- a/astringology2/src/astringology.cpp +++ b/astringology2/src/astringology.cpp @@ -232,7 +232,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( exception ); return 1; } catch ( const TCLAP::ArgException & exception ) { - std::cout << exception.error ( ) << std::endl; + common::Streams::out << exception.error ( ) << std::endl; return 2; } catch ( const std::exception & exception ) { common::Streams::err << "Exception caught: " << exception.what ( ) << std::endl; diff --git a/atrim2/src/atrim.cpp b/atrim2/src/atrim.cpp index 426d80f886..44fbb2d50e 100644 --- a/atrim2/src/atrim.cpp +++ b/atrim2/src/atrim.cpp @@ -134,7 +134,7 @@ int main(int argc, char* argv[]) { alib::XmlDataFactory::toStdout( exception ); return 1; } catch(const TCLAP::ArgException& exception) { - std::cout << exception.error() << std::endl; + common::Streams::out << exception.error() << std::endl; return 2; } catch (const std::exception& exception) { common::Streams::err << "Exception caught: " << exception.what() << std::endl; diff --git a/tniceprint/src/tniceprint.cpp b/tniceprint/src/tniceprint.cpp index 113f9d2368..bb2f53e466 100644 --- a/tniceprint/src/tniceprint.cpp +++ b/tniceprint/src/tniceprint.cpp @@ -50,14 +50,14 @@ int main(int argc, char** argv) { measurements::end(); measurements::start("Output write", measurements::Type::AUXILIARY); - tree.nicePrint(std::cout); + tree.nicePrint(common::Streams::out); } else if (alib::XmlDataFactory::first<tree::UnrankedTree < > >(tokens)) { tree::UnrankedTree < > tree = alib::XmlDataFactory::fromTokens (std::move(tokens)); measurements::end(); measurements::start("Output write", measurements::Type::AUXILIARY); - tree.nicePrint(std::cout); + tree.nicePrint(common::Streams::out); } else { throw exception::CommonException("no tree on input"); } -- GitLab