From 123f5afbed84f526b1a0970bf139bc9fcd20b67b Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Tue, 19 Jun 2018 15:49:14 +0200
Subject: [PATCH] document global data

---
 alib2common/src/global/GlobalData.cpp |  5 ++
 alib2common/src/global/GlobalData.h   | 86 ++++++++++++++++++++++++++-
 2 files changed, 90 insertions(+), 1 deletion(-)

diff --git a/alib2common/src/global/GlobalData.cpp b/alib2common/src/global/GlobalData.cpp
index d718b0e344..64e9d63528 100644
--- a/alib2common/src/global/GlobalData.cpp
+++ b/alib2common/src/global/GlobalData.cpp
@@ -43,6 +43,11 @@ std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, std::
 	return os;
 }
 
+std::istream & operator >> ( ext::reference_wrapper < std::istream > & is, std::istream & ( * func ) ( std::istream & ) ) {
+	is.get () >> func;
+	return is;
+}
+
 std::istream & operator >> ( ext::reference_wrapper < std::istream > & is, std::ios_base & ( * func ) ( std::ios_base & ) ) {
 	is.get () >> func;
 	return is;
diff --git a/alib2common/src/global/GlobalData.h b/alib2common/src/global/GlobalData.h
index 2b5b9f8867..8cfa8e80cc 100644
--- a/alib2common/src/global/GlobalData.h
+++ b/alib2common/src/global/GlobalData.h
@@ -14,22 +14,76 @@
 
 namespace common {
 
+/**
+ * \brief
+ * Class to represent some global modifiers and data.
+ */
 class GlobalData {
 public:
+	/**
+	 * \brief
+	 * Verbose flag. Some algorithms print additional runtime information about internal datastructures or their trace. Set the variable to true to enable.
+	 */
 	static bool verbose;
+
+	/**
+	 * \brief
+	 * Measure flag. Some algorithms support measurements of runtime properties (time, memory, etc.) Set the variable to true to enable.
+	 */
 	static bool measure;
+
+	/**
+	 * Xml internal representation optimize flag. The xml representation of datatypes may contain references to previous nodes to remove duplicty. Set the variable to true to enable.
+	 */
 	static bool optimizeXml;
 
+	/**
+	 * \brief
+	 * The number of argument values as provided by the shell to the main function.
+	 */
 	static int argc;
+
+	/**
+	 * \brief
+	 * The agrument values as provided by the shell to the main function.
+	 */
 	static char * * argv;
 };
 
+/**
+ * \brief
+ * Aggregation class for various standard streams defined by the library.
+ */
 class Streams {
 public:
+	/**
+	 * \brief
+	 * Standard input stream. Mapped to descriptor 0.
+	 */
 	static ext::reference_wrapper < std::istream > in;
+
+	/**
+	 * \brief
+	 * Standard output stream. Mapped to descriptor 1.
+	 */
 	static ext::reference_wrapper < std::ostream > out;
+
+	/**
+	 * \brief
+	 * Standard error stream. Mapped to descriptor 2.
+	 */
 	static ext::reference_wrapper < std::ostream > err;
+
+	/**
+	 * \brief
+	 * Standard loging stream. Mapped to descriptor 4.
+	 */
 	static ext::reference_wrapper < std::ostream > log;
+
+	/**
+	 * \brief
+	 * Standard measurement stream. Mapped to descriptor 5.
+	 */
 	static ext::reference_wrapper < std::ostream > measure;
 };
 
@@ -37,30 +91,60 @@ public:
 
 namespace ext {
 
+/**
+ * \brief
+ * Overloaded function allowing same operations on wrapped output stream as on the actual output stream, specific for constant lvalue referenced objects.
+ */
 template < class T >
-std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, T & data ) {
+std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, const T & data ) {
 	os.get ( ) << data;
 	return os;
 }
 
+/**
+ * \brief
+ * Overloaded function allowing same operations on wrapped output stream as on the actual output stream, specific for rvalue referenced objects.
+ */
 template < class T >
 std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, T && data ) {
 	os.get ( ) << data;
 	return os;
 }
 
+/**
+ * \brief
+ * Overloaded function allowing same operations on wrapped output stream as on the actual output stream, specific for modifiers from inside of ostream class.
+ */
 std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, std::ostream & ( * func ) ( std::ostream & ) );
 
+/**
+ * \brief
+ * Overloaded function allowing same operations on wrapped output stream as on the actual output stream, specific for modifiers from inside of ios_base class.
+ */
 std::ostream & operator << ( ext::reference_wrapper < std::ostream > & os, std::ios_base & ( * func ) ( std::ios_base & ) );
 
 
 
+/**
+ * \brief
+ * Overloaded function allowing same operations on wrapped input stream as on the actual input stream, specific for lvalue referenced objects.
+ */
 template < class T >
 std::istream & operator >> ( ext::reference_wrapper < std::istream > & is, T & data ) {
 	is.get ( ) >> data;
 	return is;
 }
 
+/**
+ * \brief
+ * Overloaded function allowing same operations on wrapped input stream as on the actual input stream, specific for modifiers from inside of istream class.
+ */
+std::istream & operator >> ( ext::reference_wrapper < std::istream > & is, std::istream & ( * func ) ( std::istream & ) );
+
+/**
+ * \brief
+ * Overloaded function allowing same operations on wrapped input stream as on the actual input stream, specific for modifiers from inside of ios_base class.
+ */
 std::istream & operator >> ( ext::reference_wrapper < std::istream > & is, std::ios_base & ( * func ) ( std::ios_base & ) );
 
 } /* namespace ext */
-- 
GitLab