00001 // Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net) 00002 // 00003 // Use, modification and distribution is subject to the Boost Software 00004 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 00005 // http://www.boost.org/LICENSE_1_0.txt) 00006 00007 #include <utility> 00008 00009 #include <saga/saga/adaptors/task_declaration.hpp> 00010 #include <saga/saga/task_container.hpp> 00011 #include <saga/impl/engine/task_container.hpp> 00012 00013 #include <saga/saga/detail/monitorable_impl.hpp> 00014 00016 namespace saga { 00017 00018 task_container::task_container (void) 00019 : saga::object (new saga::impl::task_container()) 00020 { 00021 } 00022 00023 task_container::~task_container(void) 00024 { 00025 } 00026 00027 saga::impl::task_container* task_container::get_impl (void) const 00028 { 00029 typedef saga::object base_type; 00030 return static_cast<saga::impl::task_container*>(this->base_type::get_impl()); 00031 } 00032 00033 TR1::shared_ptr<saga::impl::task_container> task_container::get_impl_sp(void) const 00034 { 00035 typedef saga::object base_type; 00036 return TR1::static_pointer_cast<saga::impl::task_container>( 00037 this->base_type::get_impl_sp()); 00038 } 00039 00040 void task_container::add_task (task t) 00041 { 00042 get_impl()->add_task(t); 00043 } 00044 00045 void task_container::remove_task (task t) 00046 { 00047 get_impl()->remove_task(t); 00048 } 00049 00050 std::vector <task> task_container::list_tasks(void) const 00051 { 00052 return get_impl()->list_tasks(); 00053 } 00054 00055 std::vector <task_base::state> task_container::get_states(void) const 00056 { 00057 return get_impl()->get_states(); 00058 } 00059 00060 void task_container::cancel(void) 00061 { 00062 get_impl()->cancel(); 00063 } 00064 00065 std::vector <task> task_container::wait (wait_mode mode, float timeout) 00066 { 00067 return get_impl()->wait(mode, timeout); 00068 } 00069 00070 void task_container::run () 00071 { 00072 get_impl()->run(); 00073 } 00074 00075 namespace detail 00076 { 00078 // implement the monitorable functions (we need to explicitly specialize 00079 // the template because the functions are not implemented inline) 00080 template struct SAGA_EXPORT monitorable<task_container>; 00081 } 00082 00084 } // namespace saga