summaryrefslogtreecommitdiff
path: root/src/events_ds.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-02-16 21:36:24 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2020-02-23 13:45:25 +0100
commit43da08a1e3620cc296d27ef5cdf387693b063c68 (patch)
tree74f75cafd661c0748f3c5856697cec12acdb39e1 /src/events_ds.h
parentcdc96aae4393f0cba0e274efcccc95bc25c5bbdd (diff)
Fix style, minor code fixes, and add review comments.
Diffstat (limited to 'src/events_ds.h')
-rw-r--r--src/events_ds.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/events_ds.h b/src/events_ds.h
index 4a31f47..1b3a4b6 100644
--- a/src/events_ds.h
+++ b/src/events_ds.h
@@ -38,38 +38,47 @@
#include "range.h"
#include "instrument.h"
+//! TODO: document class as a whole
+//! TODO: What s does DS stand for?
// TODO: make it possible to choose sizes
-
-struct EventsDS
+class EventsDS
{
- //
- // member functions
- //
- EventsDS() = default;
+public:
+ EventsDS() = default; // TODO: Is this needed?
+ //! TODO: document all the (public) things!
template <typename T, typename... Args>
T& emplace(int ch, Args&&... args);
+ //! TODO: document all the (public) things!
void remove(EventID event_id);
+ //! TODO: document all the (public) things!
std::size_t numberOfEvents(int ch) const;
+ //! TODO: document all the (public) things!
template <typename T>
ContainerRange<std::vector<T>> iterateOver(int ch);
- EventGroupIDs const& getSampleEventGroupIDsOf(InstrumentID instrument_id) const;
- EventIDs const& getEventIDsOf(EventGroupID event_group_id) const;
+ //! TODO: document all the (public) things!
+ const EventGroupIDs& getSampleEventGroupIDsOf(InstrumentID instrument_id) const;
+
+ //! TODO: document all the (public) things!
+ const EventIDs& getEventIDsOf(EventGroupID event_group_id) const;
+ //! TODO: document all the (public) things!
void startAddingNewGroup(InstrumentID instrument_id = InstrumentID());
private:
- struct ChannelData {
+ struct ChannelData
+ {
std::vector<SampleEvent> sample_events;
};
using ChannelEventIndex = std::size_t;
- struct EventInfo {
+ struct EventInfo
+ {
Event::Type type;
int ch;
ChannelEventIndex channel_event_index;
@@ -77,7 +86,9 @@ private:
EventInfo(Event::Type type, int ch, ChannelEventIndex channel_event_index)
: type(type), ch(ch), channel_event_index(channel_event_index) {}
};
- struct GroupData {
+
+ struct GroupData
+ {
EventIDs event_ids;
Event::Type type;
@@ -121,7 +132,7 @@ T& EventsDS::emplace(int ch, Args&&... args)
return sample_event;
}
- assert(false);
+ assert(false); // TODO: This should probably be a static_assert instead?
}
template <typename T>