apputils.h

Go to the documentation of this file.
00001 // OSB library ************************************************ -*- C++ -*-
00006 /*
00007   AUTHOR(S): Stephan Broennimann (vb)
00008 
00009   RCS information
00010    $Name: OSB_060808 $
00011    $Revision: 1.9 $
00012 
00013   License
00014    OSB rating and billing library for communication networks
00015    Copyright (C) 2004, 2005, 2006  OSB systems
00016 
00017    This file may be distributed and/or modify under the terms of the
00018    GNU General Public License (GPL) as published by the Free Software
00019    Foundation which is provided in the file LICENSE.GPL included in the
00020    packaging of this file.
00021 
00022    The file is distributed in the hope that it will be useful, but WITHOUT
00023    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00024    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00025    for more details.
00026 
00027    Holders of a OSB Commercial License may use this file under the terms
00028    and conditions of this commercial license.
00029  */
00030 #ifndef _APPUTILS_H_
00031 #define _APPUTILS_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <iosfwd>
00037 #include <string>
00038 #include <vector>
00039 
00040 // + libraries
00041 
00042 // + local headers
00043 
00044 // + class declarations
00045 
00046 // ************************************************************************
00047 // namespace extensions
00048 namespace OSB_APP {
00049 
00050 // ************************************************************************
00051 // class definitions
00060     class ArgList {
00061     public:
00063         ArgList();
00069         ArgList(int argc, char* const argv[]);
00071         ~ArgList();
00072     private:
00074         ArgList(const ArgList&);
00076         ArgList& operator=(const ArgList&);
00077     public:
00083         int argc() const;
00090         const char* operator[](int i) const;
00092         char** argv();
00094         const char* const* argv() const;
00095 
00097         ArgList& operator<<(const char* const arg);
00099         ArgList& operator<<(const std::string& arg);
00100 
00102         void remove(int i);
00109         void adjust(int newCount);
00110     public:
00112         void print(std::ostream& os) const;
00113     private:
00115         std::vector<char*> args_;
00116     };                                  // class ArgList
00117 
00118 // ************************************************************************
00119 // free functions
00125     void milliSleep(unsigned long msec);
00126 
00138     std::string keyValue(std::string keyString);
00139 
00145     std::string logTs();
00146 
00194     void logException(
00195         const std::string& appName,
00196               bool         catchAll
00197     );
00198 }                                       // namespace OSB_APP
00199 
00200 // ************************************************************************
00201 // inline definitions
00202 namespace OSB_APP {
00203 }                                       // namespace OSB_APP
00204 #endif                                  // #ifndef _APPUTILS_H_

Generated on Sat Sep 2 14:17:18 2006 for OSB Library by  doxygen 1.4.7