void log_time_differences (bool flag);
/**
- * Output a constant something through
- * this stream.
+ * Output a constant something
+ * through this stream.
*/
template <typename T>
LogStream & operator << (const T &t);
* the contents of the prefix stack.
*/
void print_line_head();
+
+ /**
+ * Actually do the work of
+ * writing output. This function
+ * unifies the work that is
+ * common to the two
+ * @p{operator<<} functions.
+ */
+ template <typename T>
+ void print (const T &t);
};
LogStream &
LogStream::operator<< (const T& t)
{
- // if the previous command was an
- // @p{std::endl}, print the topmost prefix
- // and a colon
- if (was_endl)
- {
- print_line_head();
- was_endl = false;
- };
-
- // print the rest of the message
- if (prefixes.size() <= std_depth)
- *std_out << t;
-
- if (file && (prefixes.size() <= file_depth))
- *file << t;
-
+ // do the work that is common to
+ // the two operator<< functions
+ print (t);
return *this;
-}
+};
LogStream &
LogStream::operator<< (std::ostream& (*p) (std::ostream&))
{
- // first pass on to the other
- // (templatized function)
- this->template operator<< <std::ostream & (*)(std::ostream&)> (p);
+ // do the work that is common to
+ // the two operator<< functions
+ print (p);
// next check whether this is the
// @p{endl} manipulator, and if so
+template <class T>
+inline
+void
+LogStream::print (const T &t)
+{
+ // if the previous command was an
+ // @p{std::endl}, print the topmost
+ // prefix and a colon
+ if (was_endl)
+ {
+ print_line_head();
+ was_endl = false;
+ };
+
+ // print the rest of the message
+ if (prefixes.size() <= std_depth)
+ *std_out << t;
+
+ if (file && (prefixes.size() <= file_depth))
+ *file << t;
+}
+
+
+
/**
* The standard log object of DEAL.
*