Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75208 - sandbox/variadic_templates/boost/utility
From: cppljevans_at_[hidden]
Date: 2011-11-01 07:58:08


Author: cppljevans
Date: 2011-11-01 07:58:04 EDT (Tue, 01 Nov 2011)
New Revision: 75208
URL: http://svn.boost.org/trac/boost/changeset/75208

Log:
utilities for tracing scope to std::cout

Added:
   sandbox/variadic_templates/boost/utility/
   sandbox/variadic_templates/boost/utility/indent_scope.hpp (contents, props changed)
   sandbox/variadic_templates/boost/utility/trace_scope.hpp (contents, props changed)

Added: sandbox/variadic_templates/boost/utility/indent_scope.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/utility/indent_scope.hpp 2011-11-01 07:58:04 EDT (Tue, 01 Nov 2011)
@@ -0,0 +1,37 @@
+#ifndef UTILITY_INDENT_SCOPE_HPP
+#define UTILITY_INDENT_SCOPE_HPP
+#include <boost/iostreams/utility/indent_scoped_ostreambuf.hpp>
+#include <string>
+namespace boost
+{
+ template
+ < typename Enter=std::string
+ , typename Exit=Enter
+ >
+ class
+indent_scope
+ //Purpose:
+ // Indicate on cout when a scope entered and exited.
+ {
+ public:
+ indent_scope
+ ( Enter a_enter=""
+ , Exit a_exit=""
+ )
+ : my_exit(a_exit)
+ {
+ ; std::cout<<a_enter
+ ; std::cout<<indent_buf_in
+ ;}
+ ~indent_scope(void)
+ {
+ ; std::cout<<indent_buf_out
+ ; std::cout<<my_exit
+ ;}
+ private:
+ Exit
+ my_exit
+ ;
+ };//end indent_scope class
+}//exit boost namespace
+#endif

Added: sandbox/variadic_templates/boost/utility/trace_scope.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/utility/trace_scope.hpp 2011-11-01 07:58:04 EDT (Tue, 01 Nov 2011)
@@ -0,0 +1,25 @@
+#ifndef UTILITY_TRACE_SCOPE_HPP
+#define UTILITY_TRACE_SCOPE_HPP
+#include <boost/utility/indent_scope.hpp>
+namespace boost
+{
+ class
+trace_scope
+ //Purpose:
+ // Indicate on cout when a scope entered and exited.
+ : indent_scope<>
+ {
+ public:
+ template
+ < typename ScopeName
+ >
+ trace_scope(ScopeName a_scopeName)
+ : indent_scope<>
+ ( std::string("===>Enter:{{")+a_scopeName+"\n"
+ , std::string("===>Exit:}}")+a_scopeName+"\n"
+ )
+ {
+ }
+ };//end trace_scope class
+}//exit boost namespace
+#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk