]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add functions for getting access to the std_out and the file stream, put some inline...
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Jan 2000 10:18:09 +0000 (10:18 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Jan 2000 10:18:09 +0000 (10:18 +0000)
git-svn-id: https://svn.dealii.org/trunk@2246 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/logstream.h
deal.II/base/source/log.cc

index c9d04b6c5d9a07cb86c427ac75c48bc34f4a944a..ee191480e55fc2dda77fc87c533f2c6196bd5df5 100644 (file)
@@ -5,6 +5,8 @@
 /*----------------------------   logstream.h     ---------------------------*/
 
 
+#include <base/exceptions.h>
+
 #include <string>
 #include <stack>
 #include <iostream>
@@ -120,8 +122,16 @@ class LogStream
                                      * previously attached to this object.
                                      */
     void detach();
-    
 
+                                    /**
+                                     * Gives the default stream (#std_out#).
+                                     */
+    ostream& get_console();
+
+                                    /**
+                                     * Gives the file stream.
+                                     */
+    ostream& get_file_stream();
     
                                     /**
                                      * Push another prefix on the
@@ -199,6 +209,12 @@ class LogStream
                                      * Declare this function as a friend.
                                      */
     friend void endl (LogStream &);
+
+                                    /**
+                                     * Exception
+                                     */
+    DeclException0 (ExcNoFileStreamGiven);
+
 private:
                                      /**
                                      * Print head of line. This prints
@@ -214,27 +230,6 @@ private:
 /* ----------------------------- Inline functions and templates ---------------- */
 
 
-inline
-void
-LogStream::push (const string& text)
-{
-                                  // strange enough: if make this
-                                  // function non-inline with
-                                  // gcc2.8, we get very strange
-                                  // compiler errors...
-  string pre=prefixes.top();
-  pre += text;
-  pre += string(":");
-  prefixes.push(pre);
-}
-
-inline
-void
-LogStream::log_execution_time(bool flag)
-{
-  print_utime = flag;
-}
-
 // sorry for the weird following declaration spanning 5 lines, but
 // doc++ gets confused if we be more compact :-(
 
index 05bc76f9f18d086e07630a90e50e889d2b35a24e..2712707bccedec3c1092a1fc9a8f2c56b9d1214b 100644 (file)
@@ -35,12 +35,42 @@ LogStream::attach(ostream& o)
 void LogStream::detach ()
 {
   file = 0;
+};
+
+
+
+ostream&
+LogStream::get_console()
+{
+  return *std_out;
+}
+
+
+
+ostream&
+LogStream::get_file_stream()
+{
+  Assert(file, ExcNoFileStreamGiven());
+  return *file;
 }
 
 
 
 void
-LogStream::pop ()
+LogStream::push (const string& text)
+{
+                                  // strange enough: if make this
+                                  // function non-inline with
+                                  // gcc2.8, we get very strange
+                                  // compiler errors...
+  string pre=prefixes.top();
+  pre += text;
+  pre += string(":");
+  prefixes.push(pre);
+}
+
+
+void LogStream::pop ()
 {
   prefixes.pop();
 }
@@ -51,7 +81,7 @@ void
 LogStream::depth_console(unsigned n)
 {
   std_depth = n;
-}
+};
 
 
 
@@ -59,9 +89,18 @@ void
 LogStream::depth_file(unsigned n)
 {
   file_depth = n;
+};
+
+
+
+void
+LogStream::log_execution_time(bool flag)
+{
+  print_utime = flag;
 }
 
 
+
 void
 LogStream::print_line_head()
 {
@@ -93,9 +132,13 @@ LogStream::print_line_head()
 }
 
 
+
 LogStream&
 LogStream::operator << (void (f)(LogStream &))
 {
   f(*this);
   return *this;
 }
+
+
+

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.