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.
InfoLog.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_INFO_LOG_HEADER
22 #define GRT_INFO_LOG_HEADER
23 
24 #include "Log.h"
25 #include "ObserverManager.h"
26 
27 GRT_BEGIN_NAMESPACE
28 
29 class GRT_API InfoLogMessage{
30 public:
31  InfoLogMessage(std::string proceedingText = "",std::string message = ""){
32  this->proceedingText = proceedingText;
33  this->message = message;
34  }
35  ~InfoLogMessage(){
36 
37  }
38 
39  std::string getProceedingText() const {
40  return proceedingText;
41  }
42 
43  std::string getMessage() const {
44  return message;
45  }
46 
47  std::string proceedingText;
48  std::string message;
49 };
50 
51 class GRT_API InfoLog : public Log{
52 public:
53  InfoLog(std::string proceedingText = ""){ setProceedingText(proceedingText); Log::loggingEnabledPtr = &infoLoggingEnabled; }
54 
55  virtual ~InfoLog(){}
56 
57  InfoLog& operator=(const InfoLog &rhs){
58  if( this != &rhs ){
59  this->proceedingText = rhs.proceedingText;
60  this->writeProceedingText = rhs.writeProceedingText;
61  this->loggingEnabledPtr = &infoLoggingEnabled;
62  this->writeProceedingTextPtr = &writeProceedingText;
63  }
64  return *this;
65  }
66 
67  //Getters
68  virtual bool loggingEnabled(){ return infoLoggingEnabled; }
69 
70  //Setters
71  static bool enableLogging(bool loggingEnabled);
72 
73  static bool registerObserver(Observer< InfoLogMessage > &observer);
74 
75  static bool removeObserver(Observer< InfoLogMessage > &observer);
76 
77 protected:
78  virtual void triggerCallback( const std::string &message ) const{
79  observerManager.notifyObservers( InfoLogMessage(proceedingText,message) );
80  return;
81  }
82 
83  static ObserverManager< InfoLogMessage > observerManager;
84  static bool infoLoggingEnabled;
85 };
86 
87 GRT_END_NAMESPACE
88 
89 #endif //GRT_INFO_LOG_HEADER
Definition: Log.h:34