DataFlowManager.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_DATAFLOWMANAGER_H
2 #define GAUDIHIVE_DATAFLOWMANAGER_H
3 
4 // FW includes
5 #include "GaudiKernel/IAlgorithm.h"
6 #include <GaudiKernel/SmartIF.h>
7 
8 // boost
9 #include "boost/dynamic_bitset.hpp"
10 
11 // std includes
12 #include <list>
13 #include <vector>
14 #include <string>
15 #include <unordered_map>
16 
27 
28 public:
29 
31  typedef boost::dynamic_bitset<> dependency_bitset;
32 
33  typedef std::vector<std::vector<std::string>> algosDependenciesCollection;
35  DataFlowManager(const std::list<IAlgorithm*>& /*algos*/):
37 
39  DataFlowManager(algosDependenciesCollection algoDependencies);
40 
42  bool canAlgorithmRun(unsigned int iAlgo);
43 
45  void updateDataObjectsCatalog(const std::vector<std::string>& newProducts);
46 
48  void reset();
49 
51  std::vector<std::string> content() const;
52 
54  std::vector<std::string> dataDependencies(unsigned int iAlgo) const;
55 
56 private:
58  dependency_bitset m_dataObjectsCatalog;
60  static std::vector< dependency_bitset > m_algosRequirements;
62  static std::vector<std::string> m_productName_vec;
64  static std::unordered_map<std::string,long int> m_productName_index_map;
66  inline long int productName2index(const std::string& productName){return m_productName_index_map.count(productName)>0 ? m_productName_index_map[productName]: -1 ;};
68  inline std::string& index2productName(const unsigned int i){return m_productName_vec[i];};
69 
70 };
71 
72 #endif
boost::dynamic_bitset dependency_bitset
Type holding the dependencies for one single algorithm.
The DataFlowManager takes care of keeping track of the dependencies of the algorithms in terms of dat...
std::vector< std::vector< std::string > > algosDependenciesCollection
std::vector< std::string > content() const
Get the content of the catalog.
std::vector< std::string > dataDependencies(unsigned int iAlgo) const
Get the dependencies of a single algo;.
long int productName2index(const std::string &productName)
Simple helper method to convert the product name into an index.
static std::vector< dependency_bitset > m_algosRequirements
Requirements of algos. Static since the same for all events.
void updateDataObjectsCatalog(const std::vector< std::string > &newProducts)
Update the catalog of available products in the slot.
static std::unordered_map< std::string, long int > m_productName_index_map
Track the products, assigning an index to them. Static since the same for all events.
static std::vector< std::string > m_productName_vec
Track the products, assigning an index to them. Static since the same for all events.
void reset()
Reset to default values.
dependency_bitset m_dataObjectsCatalog
Catalog of the products in the whiteboard.
DataFlowManager(const std::list< IAlgorithm * > &)
Constructor.
bool canAlgorithmRun(unsigned int iAlgo)
Needed data products are available.
list i
Definition: ana.py:128
std::string & index2productName(const unsigned int i)
Simple helper method to convert an index to a product name.