00001
00002
00003
00004
00005
00006 #ifndef SAGA_SAGA_DETAIL_MONITORABLE_HPP
00007 #define SAGA_SAGA_DETAIL_MONITORABLE_HPP
00008
00009
00010 #include <vector>
00011 #include <string>
00012
00013
00014 #include <saga/saga/util.hpp>
00015 #include <saga/saga/base.hpp>
00016 #include <saga/saga/monitorable.hpp>
00017
00018
00019 #include <saga/saga-defs.hpp>
00020
00021
00022 #if defined(BOOST_MSVC)
00023 #pragma warning(push)
00024 #pragma warning(disable : 4251 4231 4660)
00025 #endif
00026
00028
00029 #if !defined (SAGA_CREATE_PREPROCESSED_FILES) && !defined(SAGA_EXPORT_MONITORABLE)
00030
00031 # if defined(SAGA_ENGINE_EXPORTS) || defined(SAGA_MONITORABLE_EXPORTS)
00032 # define SAGA_EXPORT_MONITORABLE SAGA_SYMBOL_EXPORT
00033 # elif !defined (SAGA_NO_IMPORT_MONITORABLE) && !defined(BUILD_SAGA_LITE)
00034 # define SAGA_EXPORT_MONITORABLE SAGA_SYMBOL_IMPORT
00035 # else
00036 # define SAGA_EXPORT_MONITORABLE
00037 # endif
00038
00039 #endif // !SAGA_CREATE_PREPROCESSED_FILES
00040
00042 namespace saga
00043 {
00044 namespace detail
00045 {
00046
00051 template <typename Derived>
00052 struct SAGA_EXPORT_MONITORABLE monitorable
00053 {
00058 typedef saga::monitorable::cookie_handle cookie_handle;
00059
00061 void init (std::vector <saga::metric> const & metrics);
00062
00063 Derived & derived (void)
00064 {
00065 return static_cast <Derived&> (*this);
00066 }
00067
00068 Derived const & derived (void) const
00069 {
00070 return static_cast <Derived const &> (*this);
00071 }
00073
00080 std::vector <saga::metric> list_metrics (void) const;
00081
00089 saga::metric get_metric (std::string name) const;
00090
00099 cookie_handle add_callback (std::string name, saga::callback cb);
00100
00108 void remove_callback (std::string name, cookie_handle cookie);
00109 };
00110 }
00111 }
00113
00114 #if defined(BOOST_MSVC)
00115 #pragma warning(pop)
00116 #endif
00117
00118 #endif // SAGA_SAGA_DETAIL_MONITORABLE_HPP
00119