SAGA C++ API 1.6
steerable_impl.hpp
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 #ifndef SAGA_SAGA_DETAIL_STEERABLE_IMPL_HPP
00007 #define SAGA_SAGA_DETAIL_STEERABLE_IMPL_HPP
00008 
00009 // include stl
00010 #include <vector>
00011 #include <string>
00012 
00013 #include <saga/saga/metric.hpp>
00014 #include <saga/impl/exception.hpp>
00015 
00016 // include dependent spec sections
00017 #include <saga/saga/detail/steerable.hpp>
00018 #include <saga/impl/engine/monitorable.hpp>
00019 
00020 // suppress warnings about dependent classes not being exported from the dll
00021 #if defined(BOOST_MSVC)
00022 #pragma warning(push)
00023 #pragma warning(disable : 4251 4231 4660)
00024 #endif
00025 
00027 namespace saga { namespace detail
00028 {
00029     // the steerable API interface is implemented by this template
00030 
00031     // metric handling
00032     template <typename Derived>
00033     inline bool
00034     steerable<Derived>::add_metric (saga::metric m) 
00035     {
00036         if (!derived().is_impl_valid()) {
00037             SAGA_THROW("The object has not been properly initialized.",
00038                 saga::IncorrectState);
00039         }
00040         return derived().get_impl()->get_steerable()->add_metric(m);
00041     }
00042     
00043     template <typename Derived>
00044     inline void
00045     steerable<Derived>::remove_metric (std::string name)
00046     {
00047         if (!derived().is_impl_valid()) {
00048             SAGA_THROW("The object has not been properly initialized.",
00049                 saga::IncorrectState);
00050         }
00051         derived().get_impl()->get_steerable()->remove_metric(name);
00052     }
00053 
00054     template <typename Derived>
00055     inline void 
00056     steerable<Derived>::fire_metric(std::string name)
00057     {
00058         if (!derived().is_impl_valid()) {
00059             SAGA_THROW("The object has not been properly initialized.",
00060                 saga::IncorrectState);
00061         }
00062         derived().get_impl()->get_steerable()->fire_metric(name);
00063     }
00064   
00066 }}   // namespace saga::detail
00067 
00068 #endif // SAGA_SAGA_DETAIL_STEERABLE_IMPL_HPP
00069 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines