From a066e50db06c3dd8b2a14b44e99b40a579a9f5c4 Mon Sep 17 00:00:00 2001
From: "w.klijn" <nonoice@gmail.com>
Date: Tue, 16 Aug 2016 17:16:39 +0200
Subject: [PATCH] Use a define for spike_export_function

---
 src/io/exporter_spike_file.hpp |  2 +-
 src/model.hpp                  | 17 +++++++----------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/io/exporter_spike_file.hpp b/src/io/exporter_spike_file.hpp
index 06f26c64..56269e29 100644
--- a/src/io/exporter_spike_file.hpp
+++ b/src/io/exporter_spike_file.hpp
@@ -56,7 +56,7 @@ public:
         for (auto spike : spikes) {
             char linebuf[45];
             auto n = std::snprintf(linebuf, sizeof(linebuf), "%u %.4f\n",
-                unsigned{spike.source.gid}, float{spike.time});
+                unsigned{spike.source.gid}, float(spike.time));
             file_handle_.write(linebuf, n);
         }
     }
diff --git a/src/model.hpp b/src/model.hpp
index 9c183d6a..4cba9ff4 100644
--- a/src/model.hpp
+++ b/src/model.hpp
@@ -28,6 +28,7 @@ public:
     using communicator_type = communication::communicator<time_type, communication::global_policy>;
     using sampler_function = typename cell_group_type::sampler_function;
     using spike_type = typename communicator_type::spike_type;
+    using spike_export_function = std::function<void(const std::vector<spike_type>&)>;
 
     struct probe_record {
         cell_member_type id;
@@ -180,22 +181,18 @@ public:
 
     // register a callback that will perform a export of the global
     // spike vector
-    void set_global_spike_callback(std::function<void(
-        const std::vector<spike_type>&)> global_export_callback)
+    void set_global_spike_callback(spike_export_function export_callback)
     {
-        global_export_callback_ = global_export_callback;
+        global_export_callback_ = export_callback;
     }
 
     // register a callback that will perform a export of the rank local
     // spike vector
-    void set_local_spike_callback(std::function<void(
-        const std::vector<spike_type>&)> local_export_callback)
+    void set_local_spike_callback(spike_export_function export_callback)
     {
-        local_export_callback_ = local_export_callback;
+        local_export_callback_ = export_callback;
     }
 
-
-
 private:
     cell_gid_type cell_from_;
     cell_gid_type cell_to_;
@@ -211,8 +208,8 @@ private:
     using local_spike_store_type = thread_private_spike_store<time_type>;
     util::double_buffer< local_spike_store_type > local_spikes_;
 
-    std::function<void(const std::vector<spike_type>&)> global_export_callback_;
-    std::function<void(const std::vector<spike_type>&)> local_export_callback_;
+    spike_export_function global_export_callback_;
+    spike_export_function local_export_callback_;
     // Convenience functions that map the spike buffers and event queues onto
     // the appropriate integration interval.
     //
-- 
GitLab