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