SAGA C++ API 1.6
task_container.hpp
Go to the documentation of this file.
00001 //  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
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_TASK_CONTAINER_HPP
00008 #define _SAGA_TASK_CONTAINER_HPP
00009 
00010 // include stl
00011 #include <vector>
00012 
00013 // include dependent spec sections
00014 #include <saga/saga/base.hpp>
00015 #include <saga/saga/task.hpp>
00016 
00017 #include <saga/saga/detail/monitorable.hpp>
00018 
00019 // suppress warnings about dependent classes not being exported from the dll
00020 #if defined(BOOST_MSVC)
00021 #pragma warning(push)
00022 #pragma warning(disable: 4251 4231 4275 4660)
00023 #endif
00024 
00026 namespace saga
00027 {
00034   class SAGA_EXPORT task_container
00035     : public saga::object,
00036       public saga::detail::monitorable<task_container>
00037   {
00038     private:
00040 
00041       TR1::shared_ptr<saga::impl::task_container> get_impl_sp (void) const;
00042       saga::impl::task_container* get_impl (void) const;
00043 
00044       friend struct impl::runtime;
00045       friend struct saga::detail::monitorable <task_container>; // needs to access get_impl()
00047       
00048     public:
00052       enum wait_mode 
00053       {
00054           All = 1,      
00055 
00056           Any = 2       
00057 
00058       };
00059 
00064       task_container (void);
00065 
00070       ~task_container (void);
00071 
00076       void run ();
00077       
00084       void add_task (task t);
00085       
00092       void remove_task (task t);
00093 
00099       std::vector <task> list_tasks  (void) const;
00100  
00106       std::vector <task_base::state> get_states  (void) const; 
00107 
00113       void cancel (void);
00114       
00120       std::vector <task> wait (wait_mode mode = All, float timeout = -1.0);
00121   };
00122 
00124 } // namespace saga
00125 
00126 // re-enable warnings about dependent classes not being exported from the dll
00127 #if defined(BOOST_MSVC)
00128 #pragma warning(pop)
00129 #endif
00130 
00131 #endif // _SAGA_TASK_CONTAINER_HPP
00132 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines