LAMA
/home/brandes/workspace/LAMA/src/lama/task/Task.hpp
Go to the documentation of this file.
00001 
00033 #ifndef LAMA_TASK_HPP_
00034 #define LAMA_TASK_HPP_
00035 
00036 // for dll_import
00037 #include <lama/config.hpp>
00038 
00039 // base classes
00040 #include <lama/Printable.hpp>
00041 
00042 // others
00043 #include <lama/task/LAMAThreadPool.hpp>
00044 
00045 // logging
00046 #include <logging/logging.hpp>
00047 
00048 // boost
00049 #include <boost/function.hpp>
00050 #include <boost/shared_ptr.hpp>
00051 
00052 namespace lama
00053 {
00054 
00083 class LAMA_DLL_IMPORTEXPORT Task : public  Printable
00084 {
00085 
00086 public:
00087 
00088     typedef unsigned int Id;
00089 
00101     Task( boost::function<void()> function, int numOmpThreads = 0  );
00102 
00106     ~Task();
00107 
00111     void synchronize();
00112 
00118     bool probe() const;
00119 
00123     Id getId() const;
00124 
00130     virtual void writeAt(std::ostream& stream) const;
00131 
00132 private:
00133 
00134     LAMA_LOG_DECL_STATIC_LOGGER( logger );
00135 
00138     static boost::shared_ptr<LAMAThreadPool> theThreadPool;
00139 
00140     static LAMAThreadPool& getThreadPool();
00141 
00142     boost::shared_ptr<LAMAThreadTask> mTask;
00143 };
00144 
00145 } // namespace lama
00146 
00147 #endif // LAMA_TASK_HPP_