// $Id: IVIOAppl.cpp,v 1.12 2006/11/10 06:21:17 markus Rel $ //PROJECT : libYGP //SUBSYSTEM : Test/IVIOAppl //REFERENCES : //TODO : //BUGS : //REVISION : $Revision: 1.12 $ //AUTHOR : Markus Schwab //CREATED : 27.8.2001 //COPYRIGHT : Copyright (C) 2001 - 2005 // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef _MSC_VER #pragma warning(disable:4786) // disable warning about truncating debug info #endif #include #include #include #include #include #include #include #include "Test.h" class Application : public YGP::IVIOApplication { public: Application (const int argc, const char* argv[]) : YGP::IVIOApplication (argc, argv, lo), cOptions (0), cErrors (0) { } ~Application () { } protected: virtual bool handleOption (const char option); // Program-handling virtual int perform (int argc, const char* argv[]); virtual const char* name () const { return "Test/IVIOAppl"; } virtual const char* description () const { return PACKAGE_VERSION; } // Help-handling virtual void showHelp () const; private: // Prohobited manager functions Application (); Application (const Application&); const Application& operator= (const Application&); unsigned int cOptions; unsigned int cErrors; static const longOptions lo[]; }; const YGP::IVIOApplication::longOptions Application::lo[] = { { "help", 'h' }, { "stackdump", 'd' }, { "arg-opt", 'a' }, { "arg-mand", 'A' }, { NULL, '\0' } }; bool Application::handleOption (const char option) { ++cOptions; if ((option == 'a') || (option == 'A')) { const char* pValue = checkOptionValue (); Check1 (pValue == getOptionValue ()); if (option == 'A') check (pValue); TRACE1 ("Option param: " << pValue); } // endif special option if (option == 's') { std::cout << "Testing logging and stack-trace...\n"; YGP::Syslog log ("Test"); LOGDEBUG ("Test-Stacktrace:"); dumpStack (); } return true; } void Application::showHelp () const { std::cout << "Usage: " << name () << " [