PLearn 0.1
MemoryVMatrixNoSave.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // MemoryVMatrixNoSave.cc
00004 //
00005 // Copyright (C) 2007 Frederic Bastien
00006 //
00007 // Redistribution and use in source and binary forms, with or without
00008 // modification, are permitted provided that the following conditions are met:
00009 //
00010 //  1. Redistributions of source code must retain the above copyright
00011 //     notice, this list of conditions and the following disclaimer.
00012 //
00013 //  2. Redistributions in binary form must reproduce the above copyright
00014 //     notice, this list of conditions and the following disclaimer in the
00015 //     documentation and/or other materials provided with the distribution.
00016 //
00017 //  3. The name of the authors may not be used to endorse or promote
00018 //     products derived from this software without specific prior written
00019 //     permission.
00020 //
00021 // THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
00022 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00023 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
00024 // NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00025 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00026 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00027 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00028 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00029 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031 //
00032 // This file is part of the PLearn library. For more information on the PLearn
00033 // library, go to the PLearn Web site at www.plearn.org
00034 
00035 // Authors: Frederic Bastien
00036 
00040 #include "MemoryVMatrixNoSave.h"
00041 
00042 namespace PLearn {
00043 using namespace std;
00044 
00045 PLEARN_IMPLEMENT_OBJECT(
00046     MemoryVMatrixNoSave,
00047     "A MemoryVMatrix that will not save the data in memory with the object.",
00048     "It is supposed you can reconstruct the data from the source."
00049     );
00050 
00052 // MemoryVMatrixNoSave //
00054 MemoryVMatrixNoSave::MemoryVMatrixNoSave()
00055     : inherited()
00056 /* ### Initialize all fields to their default value here */
00057 {
00058     // ...
00059 
00060     // ### You may (or not) want to call build_() to finish building the object
00061     // ### (doing so assumes the parent classes' build_() have been called too
00062     // ### in the parent classes' constructors, something that you must ensure)
00063 }
00064 MemoryVMatrixNoSave::MemoryVMatrixNoSave(int l, int w)
00065     : inherited(l,w)
00066 {}
00067 MemoryVMatrixNoSave::MemoryVMatrixNoSave(const Mat& the_data)
00068     : inherited(the_data)
00069 {}
00070 MemoryVMatrixNoSave::MemoryVMatrixNoSave(VMat the_source)
00071     : inherited(the_source)
00072 {}
00073 
00075 // declareOptions //
00077 void MemoryVMatrixNoSave::declareOptions(OptionList& ol)
00078 {
00079     // ### Declare all of this object's options here.
00080     // ### For the "flags" of each option, you should typically specify
00081     // ### one of OptionBase::buildoption, OptionBase::learntoption or
00082     // ### OptionBase::tuningoption. If you don't provide one of these three,
00083     // ### this option will be ignored when loading values from a script.
00084     // ### You can also combine flags, for example with OptionBase::nosave:
00085     // ### (OptionBase::buildoption | OptionBase::nosave)
00086 
00087     // ### ex:
00088     // declareOption(ol, "myoption", &MemoryVMatrixNoSave::myoption,
00089     //               OptionBase::buildoption,
00090     //               "Help text describing this option");
00091     // ...
00092 
00093     // Now call the parent class' declareOptions
00094     inherited::declareOptions(ol);
00095     redeclareOption(ol, "data", &MemoryVMatrix::data,
00096                     OptionBase::buildoption|OptionBase::nosave,
00097                     "The external Mat source. Not saved");
00098 
00099 }
00100 
00102 // build //
00104 void MemoryVMatrixNoSave::build()
00105 {
00106     inherited::build();
00107     build_();
00108 }
00109 
00111 // build_ //
00113 void MemoryVMatrixNoSave::build_()
00114 {
00115     // ### This method should do the real building of the object,
00116     // ### according to set 'options', in *any* situation.
00117     // ### Typical situations include:
00118     // ###  - Initial building of an object from a few user-specified options
00119     // ###  - Building of a "reloaded" object: i.e. from the complete set of
00120     // ###    all serialised options.
00121     // ###  - Updating or "re-building" of an object after a few "tuning"
00122     // ###    options have been modified.
00123     // ### You should assume that the parent class' build_() has already been
00124     // ### called.
00125 }
00126 
00127 
00128 
00129 } // end of namespace PLearn
00130 
00131 
00132 /*
00133   Local Variables:
00134   mode:c++
00135   c-basic-offset:4
00136   c-file-style:"stroustrup"
00137   c-file-offsets:((innamespace . 0)(inline-open . 0))
00138   indent-tabs-mode:nil
00139   fill-column:79
00140   End:
00141 */
00142 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines