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
46
47
48
|
#ifndef Hiq32h5eXlWfeiJLSv6W9vFXUmc
#define Hiq32h5eXlWfeiJLSv6W9vFXUmc
#include <boost/tuple/tuple.hpp>
#include "simlimits.hpp"
#include "index.hpp"
#include "quant_types.hpp"
template <>
struct Index<GlobalMsg> : CommonIndex<Ptr<GlobalMsg>::ptr_t> {
typedef boost::tuple<> con_arg_t;
explicit Index(con_arg_t = con_arg_t())
: CommonIndex("index_globalmsg_time", maxSpikes),
eventTime("index_globalmsg_eventtime", maxSpikes),
maxEventTime("index_globalmsg_maxeventtime", Time::beforeAll())
{}
// writing
template<typename SrcQuant>
inline ptr_t add(Time time, Time eventTime, SrcQuant src);
virtual void sync() {
CommonIndex::sync();
eventTime.barrierRead() = eventTime.barrierWrite() = time.barrierWrite();
eventTime.sync();
maxEventTime.sync();
}
// data
Vector<Time> eventTime;
Checkpoint<Time, 1> maxEventTime;
};
template<typename IllegalImpl>
inline Index<GlobalMsg>::ptr_t Index<GlobalMsg>::add(Time, Time, IllegalImpl) {
DO_NOT_CALL;
}
template<>
inline Index<GlobalMsg>::ptr_t Index<GlobalMsg>::add(Time t_in, Time t_out, Global::instance_ptr_t) {
ptr_t ptr(CommonIndex::add(t_in));
eventTime.set(ptr, t_out);
maxEventTime.set(t_in, std::max(t_out, maxEventTime.getValue(t_in)));
return ptr;
}
#endif // Hiq32h5eXlWfeiJLSv6W9vFXUmc
|