Permalink
Browse files

samplesource: Expose sample type

  • Loading branch information...
1 parent df50efa commit 0c8371ccb6e08dad7f944d161dad99c96ac8938b @miek committed Apr 14, 2016
Showing with 9 additions and 0 deletions.
  1. +2 −0 abstractsamplesource.h
  2. +6 −0 samplesource.cpp
  3. +1 −0 samplesource.h
@@ -21,10 +21,12 @@
#include <complex>
#include <memory>
+#include <typeindex>
class AbstractSampleSource
{
public:
virtual ~AbstractSampleSource() {};
+ virtual std::type_index sampleType() = 0;
};
View
@@ -26,6 +26,12 @@ void SampleSource<T>::subscribe(Subscriber *subscriber)
}
template<typename T>
+std::type_index SampleSource<T>::sampleType()
+{
+ return typeid(T);
+}
+
+template<typename T>
void SampleSource<T>::invalidate()
{
for (auto subscriber : subscribers) {
View
@@ -36,6 +36,7 @@ class SampleSource : public AbstractSampleSource
virtual void invalidateEvent() { };
virtual off_t count() = 0;
virtual off_t rate() = 0;
+ std::type_index sampleType() override;
void subscribe(Subscriber *subscriber);
void unsubscribe(Subscriber *subscriber);

0 comments on commit 0c8371c

Please sign in to comment.