00001 /* -*- c++ -*- 00002 * $Id: TraceObject.h.in,v 1.2 2006/04/03 19:43:46 brook Exp $ 00003 */ 00004 00005 /* 00006 * ClearSilver++ Software License. 00007 * 00008 * Copyright (c) 2006 Brook Milligan <brook@nmsu.edu> 00009 * All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions 00013 * are met: 00014 * 00015 * 1. Redistributions of source code must retain the above copyright 00016 * notice, this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above 00018 * copyright notice, this list of conditions and the following 00019 * disclaimer in the documentation and/or other materials provided 00020 * with the distribution. 00021 * 3. The name of the author may not be used to endorse or promote 00022 * products derived from this software without specific prior 00023 * written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 00026 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00027 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00028 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00029 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00031 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00032 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00033 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 */ 00037 00038 #ifndef TraceObject_h_ 00039 #define TraceObject_h_ 1 00040 00041 #include <string> 00042 00043 #ifndef HAVE_OBJECT_TRACING 00044 #define HAVE_OBJECT_TRACING 0 00045 #endif 00046 00056 namespace ClearSilver 00057 { 00084 #if HAVE_OBJECT_TRACING 00085 00086 class TraceObject 00087 { 00088 public: 00089 TraceObject (bool, const std::string&); 00090 TraceObject (bool, const std::string&, const std::string&); 00091 TraceObject (const TraceObject&); 00092 virtual ~TraceObject () throw(); 00093 TraceObject& operator = (const TraceObject&); 00094 void swap (TraceObject&) throw(); 00095 static bool& log_messages(); 00096 static bool& stream_messages(); 00097 00098 private: 00099 bool debug_; 00100 std::string name_; 00101 }; 00102 00103 #else // HAVE_OBJECT_TRACING 00104 00105 class TraceObject 00106 { 00107 public: 00108 TraceObject (bool, const std::string&) {} 00109 TraceObject (bool, const std::string&, const std::string&) {} 00110 TraceObject (const TraceObject&) {} 00111 virtual ~TraceObject () throw() {} 00112 TraceObject& operator = (const TraceObject&) {} 00113 void swap (TraceObject&) throw() {} 00114 static bool& log_messages(); 00115 static bool& stream_messages(); 00116 }; 00117 00118 #endif // HAVE_OBJECT_TRACING 00119 00120 }; // namespace ClearSilver 00121 00122 #endif
1.4.5