summaryrefslogtreecommitdiff
path: root/core/index_global.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/index_global.hpp')
-rw-r--r--core/index_global.hpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/core/index_global.hpp b/core/index_global.hpp
new file mode 100644
index 0000000..138c167
--- /dev/null
+++ b/core/index_global.hpp
@@ -0,0 +1,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
contact: Jan Huwald // Impressum