CMS 3D CMS Logo

IgLibraryPreloader.h

Go to the documentation of this file.
00001 #ifndef IGUANA_FRAMEWORK_IG_LIBRARY_PRELOADER_H
00002 # define IGUANA_FRAMEWORK_IG_LIBRARY_PRELOADER_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "Iguana/Framework/interface/config.h"
00007 # include "classlib/utils/SharedLibrary.h"
00008 # include "classlib/utils/Error.h"
00009 # include <iostream>
00010 # include <stdlib.h>
00011 
00012 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00013 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00014 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00015 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00016 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00017 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00018 
00019 class IGUANA_FRAMEWORK_API IgLibraryPreloader
00020 {
00021 public:
00022     // implicit copy constructor
00023     // implicit assignment operator
00024     // implicit destructor
00025     IgLibraryPreloader (const char *app, bool verbose);
00026     void        operator() (const std::string &name);
00027     int         status (void) const;
00028 
00029 private:
00030     const char  *m_app;
00031     bool        m_verbose;
00032     int         m_status;
00033 };
00034 
00035 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00036 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00037 
00038 inline
00039 IgLibraryPreloader::IgLibraryPreloader (const char *app, bool verbose)
00040     : m_app (app),
00041       m_verbose (verbose),
00042       m_status (EXIT_SUCCESS)
00043 {}
00044 
00045 inline void
00046 IgLibraryPreloader::operator() (const std::string &name)
00047 {
00048     try
00049     {
00050         if (m_verbose) std::cout << "preloading `" << name << "'.\n";
00051         lat::SharedLibrary::load (name);
00052     }
00053     catch (lat::Error &error)
00054     {
00055         std::cerr << m_app << ": cannot preload `" << name
00056                   << "':\n  " << error.explain () << "\n";
00057         m_status = EXIT_FAILURE;
00058     }
00059 }
00060 
00061 inline int
00062 IgLibraryPreloader::status (void) const
00063 { return m_status; }
00064 
00065 #endif // IGUANA_FRAMEWORK_IG_LIBRARY_PRELOADER_H

Generated on Tue Jun 9 17:38:16 2009 for CMSSW by  doxygen 1.5.4