SAGA C++ API 1.6
monitorable.cpp
Go to the documentation of this file.
00001 //  Copyright (c) 2005-2009 Hartmut Kaiser
00002 // 
00003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00005 
00006 #include <saga/saga/exception.hpp>
00007 #include <saga/saga/object.hpp>
00008 #include <saga/saga/monitorable.hpp>
00009 #include <saga/saga/metric.hpp>
00010 
00011 #include <saga/impl/engine/object.hpp>
00012 #include <saga/impl/engine/monitorable.hpp> 
00013 
00014 namespace saga 
00015 {
00016   monitorable::monitorable (saga::object rhs)
00017     : impl_ (rhs.get_impl_sp())
00018   {
00019   }
00020 
00021   monitorable::monitorable (saga::impl::object *impl)
00022     : impl_ (impl->shared_from_this())
00023   {
00024   }
00025 
00026   monitorable::~monitorable (void)
00027   {
00028   }
00029 
00030   saga::impl::monitorable* monitorable::get_monitorable (void) 
00031   { 
00032     return impl_->get_monitorable(); 
00033   }
00034   saga::impl::monitorable const* monitorable::get_monitorable (void) const 
00035   { 
00036     return impl_->get_monitorable(); 
00037   }
00038 
00039   // introspection
00040   std::vector<saga::metric> monitorable::list_metrics (void) const
00041   {
00042     return get_monitorable()->list_metrics();
00043   }
00044 
00045   saga::metric monitorable::get_metric (std::string name) const
00046   {
00047     return get_monitorable()->get_metric(name);
00048   }
00049 
00050   // callback handling
00051   saga::monitorable::cookie_handle 
00052   monitorable::add_callback(std::string name, saga::callback cb)
00053   {
00054     return get_monitorable()->add_callback(name, cb);
00055   }
00056   
00057   void monitorable::remove_callback(std::string name, cookie_handle cookie)
00058   {
00059     get_monitorable()->remove_callback(name, cookie);
00060   }
00061   
00063   steerable::steerable (saga::object rhs)
00064     : monitorable(rhs)
00065   {
00066   }
00067 
00068   steerable::steerable (saga::impl::object *impl)
00069     : monitorable(impl)
00070   {
00071   }
00072 
00073   steerable::~steerable (void)
00074   {
00075   }
00076 
00077   saga::impl::steerable* steerable::get_steerable (void) 
00078   { 
00079     return impl_->get_steerable(); 
00080   }
00081   saga::impl::steerable const* steerable::get_steerable (void) const 
00082   { 
00083     return impl_->get_steerable(); 
00084   }
00085 
00086   // metric handling
00087   bool steerable::add_metric (saga::metric m)
00088   {
00089     return get_steerable()->add_metric(m);
00090   }
00091   
00092   void steerable::remove_metric (std::string name)
00093   {
00094     get_steerable()->remove_metric(name);
00095   }
00096   
00097   void steerable::fire_metric (std::string name)
00098   {
00099     get_steerable()->fire_metric(name);
00100   }
00101   
00103 } // namespace saga
00104 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines