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.
GRTBase.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 #include "GRTBase.h"
22 
23 GRT_BEGIN_NAMESPACE
24 
25 GRTBase::GRTBase(void):classType(""),debugLog("[DEBUG]"),errorLog("[ERROR]"),trainingLog("[TRAINING]"),testingLog("[TESTING]"),warningLog("[WARNING]"){
26 
27 }
28 
30 }
31 
33 
34  if( base == NULL ){
35  errorLog << "copyBaseVariables(const GRTBase *base) - base pointer is NULL!" << std::endl;
36  return false;
37  }
38 
39  this->classType = base->classType;
40  this->debugLog = base->debugLog;
41  this->errorLog = base->errorLog;
42  this->infoLog = base->infoLog;
43  this->trainingLog = base->trainingLog;
44  this->testingLog = base->testingLog;
45  this->warningLog = base->warningLog;
46 
47  return true;
48 }
49 
50 std::string GRTBase::getLastWarningMessage() const {
51  return warningLog.getLastMessage();
52 }
53 
54 std::string GRTBase::getLastErrorMessage() const {
55  return errorLog.getLastMessage();
56 }
57 
58 std::string GRTBase::getLastInfoMessage() const {
59  return infoLog.getLastMessage();
60 }
61 
62 std::string GRTBase::getGRTVersion(bool returnRevision){
63  std::string version = GRT_VERSION;
64  if( returnRevision ) version += " revision: " + getGRTRevison();
65  return version;
66 }
67 
68 std::string GRTBase::getGRTRevison(){
69  return GRT_REVISION;
70 }
71 
72 std::string GRTBase::getClassType() const{
73  return classType;
74 }
75 
77  return this;
78 }
79 
81  return this;
82 }
83 
84 bool GRTBase::setInfoLoggingEnabled(const bool loggingEnabled){
85  infoLog.setEnableInstanceLogging( loggingEnabled );
86  return true;
87 }
88 
89 bool GRTBase::setWarningLoggingEnabled(const bool loggingEnabled){
90  warningLog.setEnableInstanceLogging( loggingEnabled );
91  return true;
92 }
93 
94 bool GRTBase::setErrorLoggingEnabled(const bool loggingEnabled){
95  errorLog.setEnableInstanceLogging( loggingEnabled );
96  return true;
97 }
98 
99 GRT_END_NAMESPACE
100 
101 
GRTBase * getGRTBasePointer()
Definition: GRTBase.cpp:76
virtual ~GRTBase(void)
Definition: GRTBase.cpp:29
static std::string getGRTRevison()
Definition: GRTBase.cpp:68
bool setErrorLoggingEnabled(const bool loggingEnabled)
Definition: GRTBase.cpp:94
std::string getLastErrorMessage() const
Definition: GRTBase.cpp:54
std::string getLastWarningMessage() const
Definition: GRTBase.cpp:50
std::string getLastInfoMessage() const
Definition: GRTBase.cpp:58
bool setInfoLoggingEnabled(const bool loggingEnabled)
Definition: GRTBase.cpp:84
This file contains the GRTBase class. This is the core base class for all the GRT modules...
bool copyGRTBaseVariables(const GRTBase *GRTBase)
Definition: GRTBase.cpp:32
bool setWarningLoggingEnabled(const bool loggingEnabled)
Definition: GRTBase.cpp:89
static std::string getGRTVersion(bool returnRevision=true)
Definition: GRTBase.cpp:62
GRTBase(void)
Definition: GRTBase.cpp:25
std::string getClassType() const
Definition: GRTBase.cpp:72