vfs: check userland buffers before reading them.
[haiku.git] / src / apps / patchbay / CountEventConsumer.h
blob3f8c5746c6f39a556e55946aae04e593f34abe80
1 /* CountEventConsumer.h
2 * --------------------
3 * A simple MIDI consumer that counts incoming MIDI events.
5 * Copyright 2013, Haiku, Inc. All rights reserved.
6 * Distributed under the terms of the MIT License.
8 * Revisions by Pete Goodeve
10 * Copyright 1999, Be Incorporated. All Rights Reserved.
11 * This file may be used under the terms of the Be Sample Code License.
13 #ifndef COUNTEVENTCONSUMER_H
14 #define COUNTEVENTCONSUMER_H
16 #include <MidiConsumer.h>
17 #include <SupportDefs.h>
19 class CountEventConsumer : public BMidiLocalConsumer
21 public:
22 CountEventConsumer(const char* name)
24 BMidiLocalConsumer(name),
25 fEventCount(0)
27 void Reset()
29 fEventCount = 0;
31 int32 CountEvents()
33 return fEventCount;
36 void Data(uchar*, size_t, bool, bigtime_t)
38 atomic_add(&fEventCount, 1);
41 private:
42 int32 fEventCount;
45 #endif /* COUNTEVENTCONSUMER_H */