MGF Server  2.1
Multigaze framework server
 All Classes Functions
GDEntry.h
1 #pragma once
2 
3 #include <string>
4 #include <sstream>
5 
6 #include <boost\shared_ptr.hpp>
7 #include "gdtypes.h"
8 #include "IGDEntry.h"
9 
10 template<typename T>
11 class GDEntry : public IGDEntry<T>
12 { };
13 
14 /****************************************************************************/
15 template<>
17  public IGDEntry<gdBlink>
18 {
19 public:
20  GDEntry(gdBlink entry):IGDEntry<gdBlink>(entry) { }
21  virtual ~GDEntry() { }
22 
23  virtual gdElementType type(){ return GDT_BLINK; }
24  virtual long duration(){ return mData.duration; }
25  virtual short eye(){ return mData.eye; }
26 
27  virtual string toString()
28  {
29  stringstream stream;
30 
31  stream << time() << "\t";
32  stream << number() << "\t";
33  stream << -1 << "\t";
34  stream << -1 << "\t";
35  stream << duration() << "\t";
36  stream << eye() << "\t";
37  stream << -1 << "\t";
38  stream << type() << "\t";
39 
40  return stream.str();
41  }
42 };
43 
45 typedef boost::shared_ptr<GDBlink> GDBlinkPtr;
46 /****************************************************************************/
47 
48 /****************************************************************************/
49 template<>
51  public IGDEntry<gdFixation>
52 {
53 public:
54  GDEntry(gdFixation entry):IGDEntry<gdFixation>(entry) { }
55  virtual ~GDEntry() { }
56 
57  virtual gdElementType type(){ return GDT_FIXATION; }
58  virtual long duration(){ return mData.duration; }
59  virtual short eye(){ return mData.eye; }
60  virtual long x(){ return mData.x; }
61  virtual long y(){ return mData.y; }
62 
63  virtual string toString()
64  {
65  stringstream stream;
66 
67  stream << time() << "\t";
68  stream << number() << "\t";
69  stream << x() << "\t";
70  stream << y() << "\t";
71  stream << duration() << "\t";
72  stream << eye() << "\t";
73  stream << -1 << "\t";
74  stream << type() << "\t";
75 
76  return stream.str();
77  }
78 };
79 
81 typedef boost::shared_ptr<GDFixation> GDFixationPtr;
82 /****************************************************************************/
83 
84 /****************************************************************************/
85 template<>
87  public IGDEntry<gdSingleSample>
88 {
89 public:
91  virtual ~GDEntry() { }
92 
93  virtual gdElementType type(){ return GDT_FIXATION; }
94  virtual long pupil(){ return mData.pupil; }
95  virtual short eye(){ return mData.eye; }
96  virtual long x(){ return mData.x; }
97  virtual long y(){ return mData.y; }
98 
99  virtual string toString()
100  {
101  stringstream stream;
102 
103  stream << time() << "\t";
104  stream << number() << "\t";
105  stream << x() << "\t";
106  stream << y() << "\t";
107  stream << -1 << "\t";
108  stream << eye() << "\t";
109  stream << pupil() << "\t";
110  stream << type() << "\t";
111 
112  return stream.str();
113  }
114 };
115 
117 typedef boost::shared_ptr<GDSingleSample> GDSingleSamplePtr;
118 /****************************************************************************/