Nuitrack  1.11.2
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  const int bufferSize = 300;
57  std::string buffer;
58  buffer.resize(bufferSize);
59  if(nuitrack_GetSensorIssue(_pimpl, (char *)buffer.c_str(), bufferSize))
60  {
61  buffer.resize(strlen(buffer.c_str()));
62  issue = new SensorIssue(SENSOR_ISSUE, buffer);
63  }
64 
65  result = std::shared_ptr<T>(static_cast<T*>(issue));
66  }
67  return result;
68  }
69 
76  template<typename T> std::shared_ptr<T> NUITRACK_LOCAL getUserIssue(int userId) const
77  {
78  std::shared_ptr<T> result;
79 
80  if(strcmp(T::getType().c_str(), "OcclusionIssue") == 0)
81  {
82  bool occlusion = nuitrack_GetOcclusionIssue(_pimpl, userId);
83  Issue* issue = NULL;
84  if(occlusion)
85  {
86  issue = new OcclusionIssue();
87  }
88  result = std::shared_ptr<T>(static_cast<T*>(issue));
89  }
90 
91  if(strcmp(T::getType().c_str(), "FrameBorderIssue") == 0)
92  {
93  bool left = false;
94  bool right = false;
95  bool top = false;
96  nuitrack_GetFrameBorderIssue(_pimpl, userId, &left, &right, &top);
97  Issue* issue = NULL;
98  if(left || right || top)
99  {
100  issue = new FrameBorderIssue(left, right, top);
101  }
102  result = std::shared_ptr<T>(static_cast<T*>(issue));
103  }
104  return result;
105  }
106 
107 protected:
109  IssueTrackerData* _pimpl;
110 };
111 
112 
113 } /* namespace nuitrack */
114 } /* namespace tdv */
115 
116 #endif /* NUITRACK_MIDDLEWARE_ISSUES_DATA_H_ */
IssueTrackerData * _pimpl
Definition: IssuesData.h:109
std::shared_ptr< T > NUITRACK_LOCAL getUserIssue(int userId) const
Returns information about user related issue detected.
Definition: IssuesData.h:76
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