PLearn 0.1
|
00001 // -*- C++ -*- 00002 00003 // PLLogTest.cc 00004 // 00005 // Copyright (C) 2005 Nicolas Chapados 00006 // Copyright (C) 2005 Olivier Delalleau 00007 // 00008 // Redistribution and use in source and binary forms, with or without 00009 // modification, are permitted provided that the following conditions are met: 00010 // 00011 // 1. Redistributions of source code must retain the above copyright 00012 // notice, this list of conditions and the following disclaimer. 00013 // 00014 // 2. Redistributions in binary form must reproduce the above copyright 00015 // notice, this list of conditions and the following disclaimer in the 00016 // documentation and/or other materials provided with the distribution. 00017 // 00018 // 3. The name of the authors may not be used to endorse or promote 00019 // products derived from this software without specific prior written 00020 // permission. 00021 // 00022 // THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 00023 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00024 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 00025 // NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00027 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00028 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00029 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00030 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00031 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 // 00033 // This file is part of the PLearn library. For more information on the PLearn 00034 // library, go to the PLearn Web site at www.plearn.org 00035 00036 /* ******************************************************* 00037 * $Id: .pyskeleton_header 544 2003-09-01 00:05:31Z plearner $ 00038 ******************************************************* */ 00039 00040 // Authors: Nicolas Chapados, Olivier Delalleau 00041 00045 #include "PLLogTest.h" 00046 #include <plearn/io/pl_log.h> 00047 00048 namespace PLearn { 00049 using namespace std; 00050 00051 PLEARN_IMPLEMENT_OBJECT( 00052 PLLogTest, 00053 "Test the PLearn logging system.", 00054 "" 00055 ); 00056 00058 // PLLogTest // 00060 PLLogTest::PLLogTest() 00061 /* ### Initialize all fields to their default value */ 00062 { 00063 // ... 00064 00065 // ### You may (or not) want to call build_() to finish building the object 00066 // ### (doing so assumes the parent classes' build_() have been called too 00067 // ### in the parent classes' constructors, something that you must ensure) 00068 } 00069 00071 // build // 00073 void PLLogTest::build() 00074 { 00075 inherited::build(); 00076 build_(); 00077 } 00078 00080 // makeDeepCopyFromShallowCopy // 00082 void PLLogTest::makeDeepCopyFromShallowCopy(CopiesMap& copies) 00083 { 00084 inherited::makeDeepCopyFromShallowCopy(copies); 00085 00086 // ### Call deepCopyField on all "pointer-like" fields 00087 // ### that you wish to be deepCopied rather than 00088 // ### shallow-copied. 00089 // ### ex: 00090 // deepCopyField(trainvec, copies); 00091 00092 // ### Remove this line when you have fully implemented this method. 00093 PLERROR("PLLogTest::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); 00094 } 00095 00097 // declareOptions // 00099 void PLLogTest::declareOptions(OptionList& ol) 00100 { 00101 // ### Declare all of this object's options here 00102 // ### For the "flags" of each option, you should typically specify 00103 // ### one of OptionBase::buildoption, OptionBase::learntoption or 00104 // ### OptionBase::tuningoption. Another possible flag to be combined with 00105 // ### is OptionBase::nosave 00106 00107 // ### ex: 00108 // declareOption(ol, "myoption", &PLLogTest::myoption, OptionBase::buildoption, 00109 // "Help text describing this option"); 00110 // ... 00111 00112 // Now call the parent class' declareOptions 00113 inherited::declareOptions(ol); 00114 } 00115 00117 // build_ // 00119 void PLLogTest::build_() 00120 { 00121 // ### This method should do the real building of the object, 00122 // ### according to set 'options', in *any* situation. 00123 // ### Typical situations include: 00124 // ### - Initial building of an object from a few user-specified options 00125 // ### - Building of a "reloaded" object: i.e. from the complete set of all serialised options. 00126 // ### - Updating or "re-building" of an object after a few "tuning" options have been modified. 00127 // ### You should assume that the parent class' build_() has already been called. 00128 } 00129 00131 // perform // 00133 void PLLogTest::perform() 00134 { 00135 PL_Log::instance().verbosity(5); 00136 PL_LOG(1) << plsep << "Ceci est une chaine idiote au niveau 1" << endl; 00137 PL_LOG(10) << plsep << "Ceci est une chaine idiote au niveau 10" << endl; 00138 PL_LOG(5) << plsep << "Ceci est une chaine idiote au niveau 5" << endl; 00139 PL_LOG(5) << plhead("Titre cool") << endl; 00140 } 00141 00142 } // end of namespace PLearn 00143 00144 00145 /* 00146 Local Variables: 00147 mode:c++ 00148 c-basic-offset:4 00149 c-file-style:"stroustrup" 00150 c-file-offsets:((innamespace . 0)(inline-open . 0)) 00151 indent-tabs-mode:nil 00152 fill-column:79 00153 End: 00154 */ 00155 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :