Falcon
Loading...
Searching...
No Matches
muadata.hpp
1// ---------------------------------------------------------------------
2// This file is part of falcon-core.
3//
4// Copyright (C) 2015, 2016, 2017 Neuro-Electronics Research Flanders
5//
6// Falcon-server is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10//
11// Falcon-server is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with falcon-core. If not, see <http://www.gnu.org/licenses/>.
18// ---------------------------------------------------------------------
19
20#pragma once
21
22#include <string>
23
24#include "idata.hpp"
25
26namespace nsMUAType {
27
28using ParentType = AnyType;
29
30struct Parameters {
31 Parameters(double bin = 0) : bin_size(bin) {}
32 double bin_size;
33};
34
35class Data : public IData<Data, ParentType> {
36 public:
37 using BaseClass = IData<Data, ParentType>;
38 Data(double bin_size);
39 Data(const Parameters& parameters);
40
41 static const std::string static_datatype() { return "mua"; }
42 static const std::string static_dataname() { return "mua"; }
43
44 Parameters parameters() const { return Parameters(bin_size_); }
45
46 void ClearData();
47 void set_n_spikes(unsigned int n_spikes);
48 double mua() const;
49 void set_bin_size(double bin_size);
50 double bin_size() const;
51 unsigned int n_spikes();
52
53 void SerializeBinary(std::ostream& stream,
54 Serialization::Format format = Serialization::Format::FULL) const;
55
56 void SerializeYAML(YAML::Node& node,
57 Serialization::Format format = Serialization::Format::FULL) const;
58
59 void YAMLDescription(YAML::Node& node,
60 Serialization::Format format = Serialization::Format::FULL) const;
61
62 void SerializeFlatBuffer(flexbuffers::Builder& flex_builder);
63
64 protected:
65 double bin_size_; // in ms
66 unsigned int n_spikes_;
67};
68
69using Capabilities = ParentType::Capabilities;
70
71} // namespace nsMUAType
72
73using MUAType =
Convenient template class to define data types.
Definition idata.hpp:75
Base class of all data object classes.
Definition idata.hpp:95
Definition muadata.hpp:30