[MOAB-dev] r4164 - MOAB/trunk/src

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Mon Sep 27 15:07:31 CDT 2010


Author: kraftche
Date: 2010-09-27 15:07:31 -0500 (Mon, 27 Sep 2010)
New Revision: 4164

Modified:
   MOAB/trunk/src/DebugOutput.cpp
   MOAB/trunk/src/DebugOutput.hpp
Log:
fix copying of DebugOutput objects

Modified: MOAB/trunk/src/DebugOutput.cpp
===================================================================
--- MOAB/trunk/src/DebugOutput.cpp	2010-09-27 20:06:21 UTC (rev 4163)
+++ MOAB/trunk/src/DebugOutput.cpp	2010-09-27 20:07:31 UTC (rev 4164)
@@ -55,47 +55,75 @@
 
 
 DebugOutput::DebugOutput( DebugOutputStream* impl, unsigned verbosity )
-  : outputImpl(impl), deleteImpl(0), mpiRank(-1), verbosityLimit(verbosity) {}
+  : outputImpl(impl), mpiRank(-1), verbosityLimit(verbosity) 
+    { impl->referenceCount++; assert(impl->referenceCount > 1); }
 DebugOutput::DebugOutput( DebugOutputStream* impl, int rank, unsigned verbosity )
-  : outputImpl(impl), deleteImpl(0), mpiRank(rank), verbosityLimit(verbosity) {}
+  : outputImpl(impl), mpiRank(rank), verbosityLimit(verbosity)
+    { impl->referenceCount++; assert(impl->referenceCount > 1); }
 DebugOutput::DebugOutput( FILE* impl, unsigned verbosity )
-  : outputImpl(new FILEDebugStream(impl)), deleteImpl(outputImpl),
+  : outputImpl(new FILEDebugStream(impl)),
     mpiRank(-1), verbosityLimit(verbosity) {}
 DebugOutput::DebugOutput( FILE* impl, int rank, unsigned verbosity )
-  : outputImpl(new FILEDebugStream(impl)), deleteImpl(outputImpl),
+  : outputImpl(new FILEDebugStream(impl)),
     mpiRank(rank), verbosityLimit(verbosity) {}
 DebugOutput::DebugOutput( std::ostream& str, unsigned verbosity )
-  : outputImpl(new CxxDebugStream(str)), deleteImpl(outputImpl),
+  : outputImpl(new CxxDebugStream(str)),
     mpiRank(-1), verbosityLimit(verbosity) {}
 DebugOutput::DebugOutput( std::ostream& str, int rank, unsigned verbosity )
-  : outputImpl(new CxxDebugStream(str)), deleteImpl(outputImpl),
+  : outputImpl(new CxxDebugStream(str)),
     mpiRank(rank), verbosityLimit(verbosity) {}
 DebugOutput::DebugOutput( const char* pfx, DebugOutputStream* impl, unsigned verbosity )
-  : linePfx(pfx), outputImpl(impl), deleteImpl(0), 
-    mpiRank(-1), verbosityLimit(verbosity) {}
+  : linePfx(pfx), outputImpl(impl), mpiRank(-1), verbosityLimit(verbosity) 
+  { impl->referenceCount++; assert(impl->referenceCount > 1); }
 DebugOutput::DebugOutput( const char* pfx, DebugOutputStream* impl, int rank, unsigned verbosity )
-  : linePfx(pfx), outputImpl(impl), deleteImpl(0), 
-     mpiRank(rank), verbosityLimit(verbosity) {}
+  : linePfx(pfx), outputImpl(impl), mpiRank(rank), verbosityLimit(verbosity)
+  { impl->referenceCount++; assert(impl->referenceCount > 1); }
 DebugOutput::DebugOutput( const char* pfx, FILE* impl, unsigned verbosity )
-  : linePfx(pfx), outputImpl(new FILEDebugStream(impl)), deleteImpl(outputImpl),
+  : linePfx(pfx), outputImpl(new FILEDebugStream(impl)),
     mpiRank(-1), verbosityLimit(verbosity) {}
 DebugOutput::DebugOutput( const char* pfx, FILE* impl, int rank, unsigned verbosity )
-  : linePfx(pfx), outputImpl(new FILEDebugStream(impl)), deleteImpl(outputImpl),
+  : linePfx(pfx), outputImpl(new FILEDebugStream(impl)),
     mpiRank(rank), verbosityLimit(verbosity) {}
 DebugOutput::DebugOutput( const char* pfx, std::ostream& str, unsigned verbosity )
-  : linePfx(pfx), outputImpl(new CxxDebugStream(str)), deleteImpl(outputImpl),


More information about the moab-dev mailing list