GestureRecognitionToolkit  Version: 0.1.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
Gate.h
1 /*
2  GRT MIT License
3  Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>
4 
5  Permission is hereby granted, free of charge, to any person obtaining a copy of this software
6  and associated documentation files (the "Software"), to deal in the Software without restriction,
7  including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
9  subject to the following conditions:
10 
11  The above copyright notice and this permission notice shall be included in all copies or substantial
12  portions of the Software.
13 
14  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15  LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19  */
20 
21 #ifndef GRT_GATE_HEADER
22 #define GRT_GATE_HEADER
23 
24 #include "../Util/GRTCommon.h"
25 #include "../CoreModules/Context.h"
26 
27 GRT_BEGIN_NAMESPACE
28 
29 class Gate : public Context{
30 public:
31  Gate(bool gateOpen=true);
32  virtual ~Gate(void);
33 
34  //Override the base class methods
35  virtual bool deepCopyFrom(const Context *context){
36 
37  if( context == NULL ) return false;
38 
39  if( this->getContextType() == context->getContextType() ){
40 
41  Gate *ptr = (Gate*)context;
42  //Clone the Gate values
43  this->gateOpen = ptr->gateOpen;
44 
45  //Clone the base variables
46  return copyBaseVariables( context );
47  }
48  return false;
49  }
50 
51  virtual bool process(VectorDouble inputVector);
52  virtual bool reset();
53 
54  bool updateContext(bool value){
55  gateOpen = value;
56  okToContinue = value;
57  return true;
58  }
59 
60  //Setters
61  void setGateStatus(bool gateOpen){ this->gateOpen = gateOpen; }
62 
63  //Getters
64  bool getGateStatus(){ return gateOpen; }
65 
66 protected:
67  bool gateOpen;
68 
69  static RegisterContextModule< Gate > registerModule;
70 };
71 
72 GRT_END_NAMESPACE
73 
74 #endif //GRT_GATE_HEADER
virtual bool reset()
Definition: Gate.cpp:47
Definition: Gate.h:29