SynchCout.h
Go to the documentation of this file.
00001 /*
00002  * SynchCout.h
00003  *
00004  *  Created on: Nov 14, 2013
00005  *      Author: dan
00006  */
00007 
00008 #ifndef SYNCHCOUT_H_
00009 #define SYNCHCOUT_H_
00010 
00011 #ifndef DISABLE_DECISION_MAKING_LOG
00012 
00013 #include <boost/thread.hpp>
00014 #include <deque>
00015 #include <boost/thread/mutex.hpp>
00016 #include <boost/thread/condition.hpp>
00017 #include <boost/foreach.hpp>
00018 
00019 using namespace std;
00020 
00021 
00022 struct Log{
00023         static boost::mutex& mutex(){ static boost::mutex LogMtx; return LogMtx; }
00024         boost::mutex::scoped_lock locker;
00025         Log():locker(mutex()){}
00026         template<class A>
00027         Log& operator<<(const A& a){ std::cout<<a; std::cout.flush(); return *this; }
00028         typedef void(*endl_t)();
00029         Log& operator<<(endl_t a){ std::cout<<std::endl; std::cout.flush(); return *this; }
00030 };
00031 inline void endl(){}
00032 
00033 #define cout Log()
00034 
00035 #define DMDEBUG(...) //__VA_ARGS__
00036 
00037 
00038 #endif /*DISABLE_DECISION_MAKING_LOG*/
00039 
00040 
00041 #endif /* SYNCHCOUT_H_ */


decision_making
Author(s):
autogenerated on Wed Aug 26 2015 11:16:53