SAGA Adaptor CPI v.1.0
|
00001 // Copyright (c) 2005-2009 Hartmut Kaiser 00002 // Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu) 00003 // 00004 // Distributed under the Boost Software License, Version 1.0. (See accompanying 00005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00006 00007 #ifndef SAGA_MONITORABLE_HPP 00008 #define SAGA_MONITORABLE_HPP 00009 00010 // include STL 00011 #include <string> 00012 #include <vector> 00013 00014 // include dependent spec sections 00015 #include <saga/saga/util.hpp> 00016 #include <saga/saga/base.hpp> 00017 00018 // suppress warnings about dependent classes not being exported from the dll 00019 #if defined(BOOST_MSVC) 00020 #pragma warning(push) 00021 #pragma warning(disable : 4251 4231 4660) 00022 #endif 00023 00025 namespace saga 00026 { 00028 00029 typedef bool callback_function_type(saga::object, saga::metric, saga::context); 00030 typedef TR1::function<callback_function_type> callback; 00032 00041 class SAGA_EXPORT monitorable 00042 { 00043 protected: 00045 00046 TR1::shared_ptr <saga::impl::object> impl_; 00047 00048 saga::impl::monitorable* get_monitorable (void); 00049 saga::impl::monitorable const* get_monitorable (void) const; 00051 00052 public: 00057 typedef unsigned int cookie_handle; 00058 00063 monitorable (saga::object rhs); 00064 00069 explicit monitorable (saga::impl::object *impl); // adaptor interface 00070 00075 virtual ~monitorable (void); 00076 00081 virtual std::vector<saga::metric> list_metrics (void) const; 00082 00089 virtual saga::metric get_metric (std::string name) const; 00090 00098 virtual cookie_handle add_callback (std::string name, saga::callback cb); 00099 00106 virtual void remove_callback (std::string name, cookie_handle cookie); 00107 }; 00108 00117 class SAGA_EXPORT steerable 00118 : public monitorable 00119 { 00120 protected: 00122 00123 saga::impl::steerable* get_steerable (void); 00124 saga::impl::steerable const* get_steerable (void) const; 00126 00127 public: 00132 steerable (saga::object rhs); 00133 00138 explicit steerable (saga::impl::object *impl); // adaptor interface 00139 00144 virtual ~steerable (void); 00145 00152 virtual bool add_metric (saga::metric m); 00153 00159 virtual void remove_metric (std::string name); 00160 00166 virtual void fire_metric (std::string name); 00167 }; 00168 00170 } // namespace saga 00171 00172 #if defined(BOOST_MSVC) 00173 #pragma warning(pop) 00174 #endif 00175 00176 #endif // SAGA_MONITORABLE_HPP 00177