- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Search for |

# impl_base.hpp

Go to the documentation of this file.

    00001 //  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
    00002 //  Copyright (c) 2005-2009 Hartmut Kaiser
    00003 //  Copyright (c) 2005 Michel Zandstra (michelzandstra@gmail.com)
    00004 //
    00005 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
    00006 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
    00007
    00008 #ifndef SAGA_IMPL_ENGINE_BASE_HPP
    00009 #define SAGA_IMPL_ENGINE_BASE_HPP
    00010
    00011 #include <cstdlib>
    00012 #include <cstddef>
    00013
    00014 #include <saga/saga/export_definitions.hpp>
    00015
    00017 #define SAGA_CPIVERSION_1_0       0x0100
    00018 #define SAGA_CPIVERSION_MINORMASK 0x000F
    00019 #define SAGA_CPIVERSION_LATEST    SAGA_CPIVERSION_1_0
    00020
    00022
    00024
    00025 namespace saga
    00026 {
    00027   namespace adaptors
    00028   {
    00029     class task;
    00030     class attribute;
    00031     class metric;
    00032     class exception;
    00033   }
    00034
    00035   // forward declaration for implementation
    00036   namespace impl
    00037   {
    00038     struct runtime;
    00039     struct job_runtime;
    00040     class exception;
    00041
    00042     class url;
    00043     class uuid;
    00044     class const_buffer;
    00045     class buffer;
    00046
    00047     class object;
    00048     class session;
    00049     class context;
    00050     class attribute;
    00051     class permissions;
    00052     struct permissions_interface;
    00053
    00054     struct task_interface;
    00055     class task_base;
    00056     class task_container;
    00057     class adaptor_selector_state;
    00058
    00059     class namespace_entry;
    00060     class namespace_dir;
    00061
    00062     class directory;
    00063     class file;
    00064     class const_iovec;
    00065     class iovec;
    00066
    00067     class logical_directory;
    00068     class logical_file;
    00069
    00070     class advert;
    00071     class advert_directory;
    00072
    00073     class rpc;
    00074     class parameter;
    00075
    00076     class stream;
    00077     class server;
    00078
    00079     class job;
    00080     class self;
    00081     class job_service;
    00082     class description;
    00083     class istream_interface;
    00084     class ostream_interface;
    00085
    00086     class service_description;
    00087     class service_data;
    00088     class discoverer;
    00089
    00090     class cpr_job;
    00091     class cpr_job_service;
    00092     class cpr_checkpoint;
    00093     class cpr_directory;
    00094     class cpr_job_description;
    00095
    00096     class metric;
    00097 //  class monitor;
    00098 //  class actor;
    00099
    00100     class adaptor_selector;
    00101
    00102     class proxy;
    00103
    00104     namespace v1_0
    00105     {
    00106       class cpi;
    00107       class cpi_info;
    00108       class op_info;
    00109     }
    00110
    00111     // interfaces
    00112     class attribute;
    00113     class monitorable;
    00114     class steerable;
    00115     struct task_interface;
    00116
    00117     // exception handling
    00118     class exception_list;
    00119
    00120     // special void class
    00121     struct void_t {};
    00122
    00123   } // namespace impl
    00124
    00126     // define a thread safe getenv() function (use this instead of direct calls
    00127     // to getenv
    00128
    00130
    00131     SAGA_EXPORT char* safe_getenv(const char *);
    00133
    00134 } // namespace saga
    00135
    00137
    00139 //
    00140 // Macros for verbose and debug output
    00141 //
    00142
    00143 #ifdef SAGA_LOG_FACILITY
    00144 #  define SAGA_VERBOSE_LOG_FACILITY SAGA_LOG_FACILITY
    00145 #else
    00146 #  define SAGA_VERBOSE_LOG_FACILITY __FILE__
    00147 #endif
    00148
    00150 #define SAGA_VERBOSE(x)                                                       \
    00151         if ( NULL !=       saga::safe_getenv ("SAGA_VERBOSE")  &&             \
    00152                 x <= atoi (saga::safe_getenv ("SAGA_VERBOSE")) )              \
    00153
    00154
    00155 #define SAGA_LOG(level,msg)                                                   \
    00156        SAGA_VERBOSE (level)                                                   \
    00157        {                                                                      \
    00158           fprintf (stderr, "%-10s : %-25s : %s\n",                            \
    00159                    level ## _MSG, SAGA_VERBOSE_LOG_FACILITY, msg);            \
    00160        }                                                                      \
    00161
    00162
    00163 #define SAGA_LOG_ALWAYS(msg)                                                \
    00164         SAGA_LOG (SAGA_VERBOSE_LEVEL_ALWAYS,msg)                            \
    00165
    00166
    00167 #define SAGA_LOG_CRITICAL(msg)                                                \
    00168         SAGA_LOG (SAGA_VERBOSE_LEVEL_CRITICAL,msg)                            \
    00169
    00170
    00171 #define SAGA_LOG_ERROR(msg)                                                   \
    00172         SAGA_LOG (SAGA_VERBOSE_LEVEL_ERROR,msg)                               \
    00173
    00174
    00175 #define SAGA_LOG_WARN(msg)                                                    \
    00176         SAGA_LOG (SAGA_VERBOSE_LEVEL_WARNING,msg)                             \
    00177
    00178
    00179 #define SAGA_LOG_INFO(msg)                                                    \
    00180         SAGA_LOG (SAGA_VERBOSE_LEVEL_INFO,msg)                                \
    00181
    00182
    00183 #define SAGA_LOG_DEBUG(msg)                                                   \
    00184         SAGA_LOG (SAGA_VERBOSE_LEVEL_DEBUG,msg)                               \
    00185
    00186
    00187 #define SAGA_LOG_BLURB(msg)                                                   \
    00188         SAGA_LOG (SAGA_VERBOSE_LEVEL_BLURB,msg)                               \
    00189
    00190
    00191 char const* const SAGA_VERBOSE_LEVEL_ALWAYS_MSG        = "LOG";
    00192 char const* const SAGA_VERBOSE_LEVEL_CRITICAL_MSG      = "CRITICAL";
    00193 char const* const SAGA_VERBOSE_LEVEL_ERROR_MSG         = "ERROR";
    00194 char const* const SAGA_VERBOSE_LEVEL_WARNING_MSG       = "WARNING";
    00195 char const* const SAGA_VERBOSE_LEVEL_INFO_MSG          = "INFO";
    00196 char const* const SAGA_VERBOSE_LEVEL_DEBUG_MSG         = "DEBUG";
    00197 char const* const SAGA_VERBOSE_LEVEL_BLURB_MSG         = "BLURB";
    00198
    00199 #define SAGA_VERBOSE_LEVEL_ALWAYS         0
    00200 #define SAGA_VERBOSE_LEVEL_CRITICAL       1
    00201 #define SAGA_VERBOSE_LEVEL_ERROR          2
    00202 #define SAGA_VERBOSE_LEVEL_WARNING        3
    00203 #define SAGA_VERBOSE_LEVEL_INFO           4
    00204 #define SAGA_VERBOSE_LEVEL_DEBUG          5
    00205 #define SAGA_VERBOSE_LEVEL_BLURB          6
    00206
    00208 // Helper macros/functions to overcome the lack of stringstream on certain
    00209 // architectures
    00210 #ifdef BOOST_NO_STRINGSTREAM
    00211 # include <strstream>
    00212   inline std::string SAGA_OSSTREAM_GETSTRING (std::ostrstream & ss)
    00213   {
    00214     ss << std::ends;
    00215     std::string rval = ss.str ();
    00216     ss.freeze (false);
    00217     return (rval);
    00218   }
    00219 # define SAGA_OSSTREAM std::ostrstream
    00220 # define SAGA_ISSTREAM std::istrstream
    00221 #else
    00222 # include <sstream>
    00223 # define SAGA_OSSTREAM_GETSTRING(ss) ss.str()
    00224 # define SAGA_OSSTREAM std::ostringstream
    00225 # define SAGA_ISSTREAM std::istringstream
    00226 #endif
    00227
    00229 #if defined(__AIX__) && defined(__GNUC__)
    00230 // we must call the initialization functions of the shared libraries ourselves,
    00231 // because AIX's dlopen() system call does not know about it.
    00232 extern "C" {
    00233     void _GLOBAL__DI();   // call constructors of all global objects
    00234     void _GLOBAL__DD();   // call destructors of all global objects
    00235 }
    00236 #endif
    00237
    00238 #endif // SAGA_IMPL_ENGINE_BASE_HPP
    00239
    00240