Go to the documentation of this file.00001
00002
00003
00004
00005
00006
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 #include <saga/saga/detail.hpp>
00016 #include <saga/saga/detail/module_needs_logging.hpp>
00017
00018 #include <boost/preprocessor/stringize.hpp>
00019 #include <boost/logging/format/named_write.hpp>
00020 #include <boost/logging/format_fwd.hpp>
00021
00022 BOOST_LOG_FORMAT_MSG(optimize::cache_string_one_str<>)
00023
00024
00025 #define SAGA_CPIVERSION_1_0 0x0100
00026 #define SAGA_CPIVERSION_MINORMASK 0x000F
00027 #define SAGA_CPIVERSION_LATEST SAGA_CPIVERSION_1_0
00028
00030
00032
00033 namespace saga
00034 {
00035 namespace adaptors
00036 {
00037 class task;
00038 class attribute;
00039 class metric;
00040 class exception;
00041 }
00042
00043
00044 namespace impl
00045 {
00046 struct runtime;
00047 struct job_runtime;
00048 class exception;
00049
00050 class url;
00051 class uuid;
00052 class const_buffer;
00053 class buffer;
00054
00055 class object;
00056 class session;
00057 class context;
00058 class attribute;
00059 class permissions;
00060 struct permissions_interface;
00061
00062 struct task_interface;
00063 class task_base;
00064 class task_container;
00065 class adaptor_selector_state;
00066
00067 class namespace_entry;
00068 class namespace_dir;
00069
00070 class directory;
00071 class file;
00072 class const_iovec;
00073 class iovec;
00074
00075 class logical_directory;
00076 class logical_file;
00077
00078 class advert;
00079 class advert_directory;
00080
00081 class rpc;
00082 class parameter;
00083
00084 class stream;
00085 class server;
00086
00087 class job;
00088 class self;
00089 class job_service;
00090 class description;
00091 class istream_interface;
00092 class ostream_interface;
00093
00094 class service_description;
00095 class service_data;
00096 class discoverer;
00097
00098 class cpr_job;
00099 class cpr_job_service;
00100 class cpr_checkpoint;
00101 class cpr_directory;
00102 class cpr_job_description;
00103
00104 class metric;
00105
00106
00107
00108 class adaptor_selector;
00109
00110 class proxy;
00111
00112 namespace v1_0
00113 {
00114 class cpi;
00115 class cpi_info;
00116 class op_info;
00117 }
00118
00119
00120 class attribute;
00121 class monitorable;
00122 class steerable;
00123 struct task_interface;
00124
00125
00126 class exception_list;
00127
00128
00129 struct void_t {};
00130 }
00131
00132 namespace ini
00133 {
00134 class section;
00135 }
00136 }
00137
00139
00141
00142
00143
00144
00145 namespace saga { namespace impl
00146 {
00148 SAGA_EXPORT std::string levelname(int level);
00149 SAGA_EXPORT std::string logging_filename(char const* filename, int lineno);
00150 SAGA_EXPORT std::vector<std::string> const& get_logging_init_data();
00151 SAGA_EXPORT void init_logging(saga::ini::section const& ini);
00152
00154 typedef boost::logging::named_logger<>::type logger_type;
00155 typedef boost::logging::level::holder filter_type;
00156
00158 SAGA_EXPORT BOOST_DECLARE_LOG_FILTER(logger_level, filter_type)
00159 SAGA_EXPORT BOOST_DECLARE_LOG(logger, logger_type)
00160 }}
00161
00163 #define SAGA_LOG_USE_LOG_IF_LEVEL_AND_MDOULE(l, holder, the_level) \
00164 BOOST_LOG_USE_LOG(l, read_msg().gather().out(), \
00165 holder->is_enabled(::boost::logging::level::the_level) && \
00166 saga::detail::module_needs_logging( \
00167 BOOST_PP_STRINGIZE(SAGA_MANGLED_MODULE_NAME))) \
00168
00169
00171 #define SAGA_LOG(lvl) SAGA_LOG_USE_LOG_IF_LEVEL_AND_MDOULE( \
00172 saga::impl::logger(), saga::impl::logger_level(), lvl) \
00173 << BOOST_PP_STRINGIZE(SAGA_MODULE_NAME) << ": " \
00174 << saga::impl::levelname(::boost::logging::level::lvl) << ": " \
00175 << saga::impl::logging_filename(__FILE__, __LINE__) << " " \
00176
00177
00178 #define SAGA_VERBOSE(lvl) \
00179 if (saga::impl::logger_level()->is_enabled(::boost::logging::level::lvl) \
00180 && saga::detail::module_needs_logging( \
00181 BOOST_PP_STRINGIZE(SAGA_MANGLED_MODULE_NAME))) \
00182
00183
00185 #define SAGA_LOG_ALWAYS(msg) \
00186 SAGA_LOG(SAGA_VERBOSE_LEVEL_ALWAYS) << msg; \
00187
00188
00189 #define SAGA_LOG_CRITICAL(msg) \
00190 SAGA_LOG(SAGA_VERBOSE_LEVEL_CRITICAL) << msg; \
00191
00192
00193 #define SAGA_LOG_ERROR(msg) \
00194 SAGA_LOG(SAGA_VERBOSE_LEVEL_ERROR) << msg; \
00195
00196
00197 #define SAGA_LOG_WARN(msg) \
00198 SAGA_LOG(SAGA_VERBOSE_LEVEL_WARNING) << msg; \
00199
00200
00201 #define SAGA_LOG_INFO(msg) \
00202 SAGA_LOG(SAGA_VERBOSE_LEVEL_INFO) << msg; \
00203
00204
00205 #define SAGA_LOG_DEBUG(msg) \
00206 SAGA_LOG(SAGA_VERBOSE_LEVEL_DEBUG) << msg; \
00207
00208
00209 #define SAGA_LOG_BLURB(msg) \
00210 SAGA_LOG(SAGA_VERBOSE_LEVEL_BLURB) << msg; \
00211
00212
00213 #define SAGA_VERBOSE_LEVEL_ALWAYS enable_all
00214 #define SAGA_VERBOSE_LEVEL_CRITICAL fatal
00215 #define SAGA_VERBOSE_LEVEL_ERROR error
00216 #define SAGA_VERBOSE_LEVEL_WARNING warning
00217 #define SAGA_VERBOSE_LEVEL_INFO info
00218 #define SAGA_VERBOSE_LEVEL_DEBUG debug
00219 #define SAGA_VERBOSE_LEVEL_BLURB debug
00220
00222
00223
00224 #ifdef BOOST_NO_STRINGSTREAM
00225 # include <strstream>
00226 inline std::string SAGA_OSSTREAM_GETSTRING (std::ostrstream & ss)
00227 {
00228 ss << std::ends;
00229 std::string rval = ss.str ();
00230 ss.freeze (false);
00231 return (rval);
00232 }
00233 # define SAGA_OSSTREAM std::ostrstream
00234 # define SAGA_ISSTREAM std::istrstream
00235 #else
00236 # include <sstream>
00237 # define SAGA_OSSTREAM_GETSTRING(ss) ss.str()
00238 # define SAGA_OSSTREAM std::ostringstream
00239 # define SAGA_ISSTREAM std::istringstream
00240 #endif
00241
00243 #if defined(__AIX__) && defined(__GNUC__)
00244
00245
00246 extern "C" {
00247 void _GLOBAL__DI();
00248 void _GLOBAL__DD();
00249 }
00250 #endif
00251
00252 #endif // SAGA_IMPL_ENGINE_BASE_HPP
00253
00254