NCBI C++ ToolKit
basic_sample_lib_test.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

00001 /*  $Id: basic_sample_lib_test.cpp 66574 2015-03-12 15:02:10Z ivanov $
00002  * ===========================================================================
00003  *
00004  *                            PUBLIC DOMAIN NOTICE
00005  *               National Center for Biotechnology Information
00006  *
00007  *  This software/database is a "United States Government Work" under the
00008  *  terms of the United States Copyright Act.  It was written as part of
00009  *  the author's official duties as a United States Government employee and
00010  *  thus cannot be copyrighted.  This software/database is freely available
00011  *  to the public for use. The National Library of Medicine and the U.S.
00012  *  Government have not placed any restriction on its use or reproduction.
00013  *
00014  *  Although all reasonable efforts have been taken to ensure the accuracy
00015  *  and reliability of the software and data, the NLM and the U.S.
00016  *  Government do not and cannot warrant the performance or results that
00017  *  may be obtained by using this software or data. The NLM and the U.S.
00018  *  Government disclaim all warranties, express or implied, including
00019  *  warranties of performance, merchantability or fitness for any particular
00020  *  purpose.
00021  *
00022  *  Please cite the author in any work or product based on this material.
00023  *
00024  * ===========================================================================
00025  *
00026  * Authors:  Denis Vakatov, Vladimir Ivanov
00027  *
00028  * File Description:
00029  *   Test for sample library
00030  *
00031  */
00032 
00033 #include <ncbi_pch.hpp>
00034 #include <sample/lib/basic/sample_lib_basic.hpp>
00035 
00036 USING_NCBI_SCOPE;
00037 
00038 
00039 /////////////////////////////////////////////////////////////////////////////
00040 //  CSampleLibtestApplication::
00041 
00042 
00043 class CSampleLibtestApplication : public CNcbiApplication
00044 {
00045 private:
00046     virtual void Init(void);
00047     virtual int  Run(void);
00048 };
00049 
00050 
00051 void CSampleLibtestApplication::Init(void)
00052 {
00053     // Create command-line argument descriptions
00054     auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
00055 
00056     // Specify USAGE context
00057     arg_desc->SetUsageContext(
00058         GetArguments().GetProgramBasename(),
00059         "Test program: find files in PATH by mask");
00060 
00061     arg_desc->AddPositional(
00062         "mask", "File name mask to search for",
00063         CArgDescriptions::eString);
00064 
00065     // Setup arg.descriptions for this application
00066     SetupArgDescriptions(arg_desc.release());
00067 }
00068 
00069 int CSampleLibtestApplication::Run(void)
00070 {
00071     // Get arguments
00072     const CArgs& args = GetArgs();
00073 
00074     list<string> found;
00075     if (CSampleLibraryObject().FindInPath( found, args["mask"].AsString() )) {
00076         ITERATE( list<string>, f, found) {
00077             cout << *f << endl;
00078         }
00079         return 0;
00080     }
00081     return 1;
00082 }
00083 
00084 int main(int argc, const char* argv[])
00085 {
00086     return CSampleLibtestApplication().AppMain(argc, argv);
00087 }
Modified on Thu May 28 14:05:23 2015 by modify_doxy.py rev. 426318