7 #ifndef __FWJOBS_AGGREGATOR_HPP__ 8 #define __FWJOBS_AGGREGATOR_HPP__ 10 #include "fwJobs/config.hpp" 11 #include "fwJobs/IJob.hpp" 15 #include <boost/multi_index_container.hpp> 16 #include <boost/multi_index/hashed_index.hpp> 17 #include <boost/multi_index/ordered_index.hpp> 18 #include <boost/multi_index/random_access_index.hpp> 19 #include <boost/multi_index/identity.hpp> 20 #include <boost/multi_index/member.hpp> 44 ::
boost::multi_index::indexed_by<
45 ::
boost::multi_index::random_access<>,
46 ::
boost::multi_index::hashed_unique<
60 FWJOBS_API static sptr New(const
std::
string& name = "");
70 FWJOBS_API Aggregator(const
std::
string& name);
80 FWJOBS_API
void add(const ::
fwJobs::
IJob::sptr & iJob,
double weight = 1.);
87 FWJOBS_API
IJobSeq getSubJobs();
107 std::uint64_t doneWork;
108 std::uint64_t totalWork;
109 std::uint64_t lastValue;
111 JobInfo() : doneWork(0), totalWork(0), lastValue(0)
115 JobInfo(std::uint64_t d, std::uint64_t t) :
122 JobInfo(
const IJob &iJob ) :
129 double progress()
const 131 return ( 0 == totalWork ) ? 1. : double(doneWork)/totalWork;
136 typedef std::map< fwJobs::IJob*, JobInfo > JobInfoMap;
139 JobInfoMap m_jobInfo;
144 #endif //__FWJOBS_AGGREGATOR_HPP__
std::weak_ptr< ::fwJobs::Aggregator > wptr
Aggregator container type.
This class is an interface for class managing job.
std::shared_future< void > SharedFuture
Future type.
This file defines fwCore base macros.
::boost::multi_index_container< ::fwJobs::IJob::sptr,::boost::multi_index::indexed_by< ::boost::multi_index::random_access<>,::boost::multi_index::hashed_unique< ::boost::multi_index::identity< ::fwJobs::IJob::sptr > > > > IJobSeq
Aggregator container type.
std::shared_ptr< ::fwJobs::Aggregator > sptr
Aggregator container type.
FWJOBS_API std::uint64_t getDoneWorkUnits() const
Getter on the number of done work units.
This class manages an aggregation of IJob.
FWJOBS_API std::uint64_t getTotalWorkUnits() const
Getter on the total number of work units.
This namespace fwJobs provides jobs management.