Nuitrack  1.6.0
3D Skeleton Tracking Middleware
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Events Groups Pages
IssuesData.h
1 #ifndef NUITRACK_MIDDLEWARE_ISSUES_DATA_H_
2 #define NUITRACK_MIDDLEWARE_ISSUES_DATA_H_
3 
4 #include <map>
5 #include <memory>
6 #include <string.h>
7 
8 #include "nuitrack/capi/IssueTracker_CAPI.h"
9 #include "nuitrack/types/ObjectData.h"
10 #include "nuitrack/types/Issue.h"
11 #include "nuitrack/types/Export.h"
12 #include "nuitrack/types/FrameBorderIssue.h"
13 #include "nuitrack/types/OcclusionIssue.h"
14 #include "nuitrack/types/SensorIssue.h"
15 
16 namespace tdv
17 {
18 namespace nuitrack
19 {
25 {
26 public:
28  IssuesData(IssueTrackerData* pimpl)
29  {
30  _pimpl = pimpl;
31  nuitrack_AddIssueTrackerDataRef(pimpl);
32  }
33 
34  virtual ~IssuesData()
35  {
36  nuitrack_DestroyIssueTrackerData(_pimpl);
37  }
38 
42  typedef std::shared_ptr<IssuesData> Ptr;
43 
49  template<typename T> std::shared_ptr<T> NUITRACK_LOCAL getIssue() const
50  {
51  std::shared_ptr<T> result;
52  if(strcmp(T::getType().c_str(), "SensorIssue") == 0)
53  {
54  Issue* issue = NULL;
55 
56  int bufferSize = 300;
57  char* buffer = new char[bufferSize];
58  if(nuitrack_GetSensorIssue(_pimpl, buffer, bufferSize))
59  {
60  issue = new SensorIssue(SENSOR_ISSUE, std::string(buffer));
61  }
62 
63  delete[] buffer;
64  result = std::shared_ptr<T>(static_cast<T*>(issue));
65  }
66  return result;
67  }
68 
75  template<typename T> std::shared_ptr<T> NUITRACK_LOCAL getUserIssue(int userId) const
76  {
77  std::shared_ptr<T> result;
78 
79  if(strcmp(T::getType().c_str(), "OcclusionIssue") == 0)
80  {
81  bool occlusion = nuitrack_GetOcclusionIssue(_pimpl, userId);
82  Issue* issue = NULL;
83  if(occlusion)
84  {
85  issue = new OcclusionIssue();
86  }
87  result = std::shared_ptr<T>(static_cast<T*>(issue));
88  }
89 
90  if(strcmp(T::getType().c_str(), "FrameBorderIssue") == 0)
91  {
92  bool left = false;
93  bool right = false;
94  bool top = false;
95  nuitrack_GetFrameBorderIssue(_pimpl, userId, &left, &right, &top);
96  Issue* issue = NULL;
97  if(left || right || top)
98  {
99  issue = new FrameBorderIssue(left, right, top);
100  }
101  result = std::shared_ptr<T>(static_cast<T*>(issue));
102  }
103  return result;
104  }
105 
106 protected:
108  IssueTrackerData* _pimpl;
109 };
110 
111 
112 } /* namespace nuitrack */
113 } /* namespace tdv */
114 
115 #endif /* NUITRACK_MIDDLEWARE_ISSUES_DATA_H_ */
IssueTrackerData * _pimpl
Definition: IssuesData.h:108
std::shared_ptr< T > NUITRACK_LOCAL getUserIssue(int userId) const
Returns information about user related issue detected.
Definition: IssuesData.h:75
Represents the sensor issue.
Definition: SensorIssue.h:18
IssuesData(IssueTrackerData *pimpl)
Definition: IssuesData.h:28
Stores general information about a issue.
Definition: Issue.h:30
Represents the occlusion issue.
Definition: OcclusionIssue.h:14
std::shared_ptr< T > NUITRACK_LOCAL getIssue() const
Returns information about sensor related issue detected.
Definition: IssuesData.h:49
Stores results of issue detection.
Definition: IssuesData.h:24
std::shared_ptr< IssuesData > Ptr
Smart pointer to access the IssuesData instance.
Definition: IssuesData.h:42
Represents the frame bodrer issue.
Definition: FrameBorderIssue.h:19