CEBL  2.1
DataSource.hpp
Go to the documentation of this file.
1 /*
2 * CEBL : CSU EEG Brain-Computer Interface Lab
3 *
4 * Author: Jeshua Bratman - jeshuabratman@gmail.com
5 *
6 * This file is part of CEBL.
7 *
8 * CEBL is free software; you can redistribute it and/or modify it.
9 * We only ask that if you use our code that you cite the source in
10 * your project or publication.
11 *
12 * EEG Group (www.cs.colostate.edu/eeg)
13 * Department of Computer Science
14 * Colorado State University
15 *
16 */
17 
27 #ifndef DATASOURCEMODEL_H
28 #define DATASOURCEMODEL_H
29 
30 #include "../CEBLIncludes.hpp"
31 #include "SessionManager.hpp"
32 #include "EEGData.hpp"
33 
34 //forward declarations
35 class CEBLModel;
36 class EEGDataStream;
37 
38 
40 {
41 private:
42  //make SessionManager a friend
43  friend class SessionManager;
44 
45  std::vector<string> source_names;
46  int selected_source;
47  int active_stream_type;
48 
49  //this flag indicates if a second copy of data
50  // should be stored as it is read out
51  bool data_store_flag;
52 
53  //this is a data buffer used ONLY if data_store flag is set
54  EEGData data_buffer;
55 
56  EEGDataStream *data_stream;
57  CEBLModel *model;
58 
61  void createDataStream();
62 
66  void setDataBuffer(EEGData buffer)
67  {
68  this->data_buffer = buffer;
69  }
70 
71 public:
72  DataSource(CEBLModel *model);
73  ~DataSource();
74 
75  //GETTING OPERATIONS
76  EEGData read(int samples);
77  EEGData readAll();
78  int samplesAvailable();
79  std::vector<string> getSources() { return source_names; }
80  int getSource() { return selected_source; }
81  bool sourceReady();
82  bool isStarted();
83  bool getStoreFlag();
84  int getStoreNumSamples();
86 
87  //SETTING OPERATIONS
88  void clearStoredData();
89  void setStoreFlag(bool flag);
90  void setSource(int source);
91  void setSource(string source);
92  void clearSamples();
93 
94  void start();
95  void stop();
96 
97 };
98 
99 
100 #endif