Main MRPT website > C++ reference
MRPT logo

VersionVisitor.h

Go to the documentation of this file.
00001 
00002 /****************************************************************************** 
00003  * 
00004  *  file:  VersionVisitor.h
00005  * 
00006  *  Copyright (c) 2003, Michael E. Smoot .
00007  *  All rights reverved.
00008  * 
00009  *  See the file COPYING in the top directory of this distribution for
00010  *  more information.
00011  *  
00012  *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 
00013  *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
00014  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
00015  *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
00016  *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
00017  *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
00018  *  DEALINGS IN THE SOFTWARE.  
00019  *  
00020  *****************************************************************************/ 
00021 
00022 
00023 #ifndef TCLAP_VERSION_VISITOR_H
00024 #define TCLAP_VERSION_VISITOR_H
00025 
00026 #include <mrpt/otherlibs/tclap/CmdLineInterface.h>
00027 #include <mrpt/otherlibs/tclap/CmdLineOutput.h>
00028 #include <mrpt/otherlibs/tclap/Visitor.h>
00029 
00030 namespace TCLAP {
00031 
00032 /**
00033  * A Vistor that will call the version method of the given CmdLineOutput
00034  * for the specified CmdLine object and then exit.
00035  */
00036 class VersionVisitor: public Visitor
00037 {
00038         protected:
00039 
00040                 /**
00041                  * The CmdLine of interest.
00042                  */
00043                 CmdLineInterface* _cmd;
00044 
00045                 /**
00046                  * The output object. 
00047                  */
00048                 CmdLineOutput** _out;
00049 
00050         public:
00051 
00052                 /**
00053                  * Constructor.
00054                  * \param cmd - The CmdLine the output is generated for. 
00055                  * \param out - The type of output. 
00056                  */
00057                 VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out ) 
00058                                 : Visitor(), _cmd( cmd ), _out( out ) { }
00059 
00060                 /**
00061                  * Calls the version method of the output object using the
00062                  * specified CmdLine.
00063                  */
00064                 void visit() { (*_out)->version(*_cmd); throw ActionDoneException(); }
00065 
00066 };
00067 
00068 }
00069 
00070 #endif



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011