GestureRecognitionToolkit  Version: 0.2.5
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
Gate.cpp
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 #define GRT_DLL_EXPORTS
22 #include "Gate.h"
23 
24 GRT_BEGIN_NAMESPACE
25 
26 //Define the string that will be used to identify the object
27 const std::string Gate::id = "Gate";
28 std::string Gate::getId() { return Gate::id; }
29 
30 //Register the Gate module with the Context base class
31 RegisterContextModule< Gate > Gate::registerModule( Gate::getId() );
32 
33 Gate::Gate(const bool gateOpen) : Context( Gate::getId() )
34 {
35  this->gateOpen = gateOpen;
36  initialized = true;
37 }
38 
39 Gate::Gate(const Gate &rhs) : Context( Gate::getId() )
40 {
41  *this = rhs;
42 }
43 
45 
46 }
47 
49 {
50  if( this != &rhs )
51  {
52  this->gateOpen = rhs.gateOpen;
53 
54  //Clone the context base variables
55  copyBaseVariables( dynamic_cast<const Context*>( &rhs ) );
56  }
57  return *this;
58 }
59 
60 bool Gate::deepCopyFrom(const Context *context){
61 
62  if( context == NULL ) return false;
63 
64  if( this->getId() == context->getId() ){
65 
66  const Gate *ptr = dynamic_cast<const Gate*>(context);
67 
68  //Clone the Gate values
69  this->gateOpen = ptr->gateOpen;
70 
71  //Clone the base variables
72  return copyBaseVariables( context );
73  }
74  return false;
75 }
76 
77 bool Gate::process(VectorDouble inputVector){
78  data = inputVector;
79  okToContinue = gateOpen;
80  return true;
81 }
82 
83 bool Gate::reset(){
84  return true;
85 }
86 
87 GRT_END_NAMESPACE
std::string getId() const
Definition: GRTBase.cpp:85
Gate & operator=(const Gate &rhs)
Definition: Gate.cpp:48
virtual bool reset()
Definition: Gate.cpp:83
Gate(const bool gateOpen=true)
Definition: Gate.cpp:33
virtual ~Gate()
Definition: Gate.cpp:44
static std::string getId()
Definition: Gate.cpp:28
virtual bool deepCopyFrom(const Context *context)
Definition: Gate.cpp:60
Definition: Gate.h:29