CEBL  2.1
RealTimeClassification.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 
25 #ifndef REALTIMECLASSIFICATION_H
26 #define REALTIMECLASSIFICATION_H
27 
28 //std includes
29 #include <vector>
30 #include "TimeoutThread.hpp"
31 using namespace std;
32 
33 //forward declarations
34 class CEBLModel;
35 
37 {
38 private:
39  CEBLModel *model;
40 
41  std::vector<double> class_proportions;
42  std::vector<int> classification_queue;
43  int selected_class;
44  bool is_classifying;
45 
46  //train classifier thread
47  boost::thread * train_classifier_thread;
48  bool currently_training_classifier;
49  bool halt_training;
50  bool training_failed;
53 
54 public:
57 
58  //GETTING OPERATIONS
59 
60  bool isReady() const;
61  bool isClassifying() const;
62  bool lastTrainFailed() const { return training_failed; };
63  std::vector<int> readClassificationQueue();
64  std::vector<int> peekClassificationQueue() const;
65  std::vector<double> getClassProportions() { return class_proportions; }
66  int getSelectedClass() const { return selected_class; }
67  void clearSelectedClass() { selected_class = -1; }
68 
69  //SETTING OPERATIONS
70  void clearClassificationQueue();
71 
72  //CONTROL CLASSIFICATION
73  void trainClassifier();
74  void trainClassifierThreaded();
75  bool isTrainingClassifier();
76  void trainClassifierHalt();
77  void startClassifying();
78  void stopClassifying();
79 
80 
81  //function required by timeoutFunction interface
82  void timeoutFunction();
83 
84 };
85 
86 #endif
87