forked from rmbianchi/concurrent_framework
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Context.h
45 lines (39 loc) · 1.06 KB
/
Context.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* Context.h
*
* Created on: Feb 8, 2012
* Author: [email protected] (Benedikt HEGNER)
*/
#ifndef CONTEXT_H_
#define CONTEXT_H_
// include c++
#include <list>
#include <vector>
#include <bitset>
// include tbb
#include "tbb/spin_mutex.h"
#include "tbb/concurrent_hash_map.h"
// include fwk
#include "ConcurrentTypes.h"
// forward declaration
class Whiteboard;
typedef std::bitset<1000> context_state_type;
class Context {
public:
Context(const int number, Whiteboard& wb);
virtual ~Context();
bool read(DataItem&, const std::string& label) const;
void write(const DataItem& item, const::std::string& algo_name, const::std::string& label);
void print_content() const;
void set_finished(){finished_=true;};
const bool is_finished() const {return finished_;};
const unsigned int get_slotnumber() const {return slotnumber_;};
void reset();
const context_state_type& get_state();
private:
const unsigned int slotnumber_;
bool finished_;
Whiteboard& wb_;
context_state_type state_;
};
#endif /* CONTEXT_H_ */