Fawkes API  Fawkes Development Version
FacialExpressionInterface.h
1 
2 /***************************************************************************
3  * FacialExpressionInterface.h - Fawkes BlackBoard Interface - FacialExpressionInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2009 Bahram Maleki-Fard
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __INTERFACES_FACIALEXPRESSIONINTERFACE_H_
25 #define __INTERFACES_FACIALEXPRESSIONINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(FacialExpressionInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  /** Action types for moving brows */
42  typedef enum {
43  BROWS_DEFAULT /**< Reset */,
44  BROWS_FROWN /**< Frown */,
45  BROWS_LIFT /**< Lift */
46  } brows_t;
47  const char * tostring_brows_t(brows_t value) const;
48 
49  /** Action types for moving eyes */
50  typedef enum {
51  EYES_DEFAULT /**< Reset */,
52  EYES_UP /**< Up */,
53  EYES_DOWN /**< Down */,
54  EYES_LEFT /**< Left */,
55  EYES_RIGHT /**< Right */,
56  EYES_COOL /**< Cool */,
57  EYES_CROSS /**< Cross */,
58  EYES_HEART /**< Heart */,
59  EYES_DOLLAR /**< Dollar */
60  } eyes_t;
61  const char * tostring_eyes_t(eyes_t value) const;
62 
63  /** Action types for moving jowl */
64  typedef enum {
65  JOWL_DEFAULT /**< Reset */,
66  JOWL_BLUSH /**< Blush */,
67  JOWL_TEARS /**< Tears */
68  } jowl_t;
69  const char * tostring_jowl_t(jowl_t value) const;
70 
71  /** Action types for moving mouth */
72  typedef enum {
73  MOUTH_DEFAULT /**< Reset */,
74  MOUTH_OPEN /**< Open */,
75  MOUTH_CLOSE /**< Close */,
76  MOUTH_SMILE /**< Smile */,
77  MOUTH_SCOWL /**< Scowl */
78  } mouth_t;
79  const char * tostring_mouth_t(mouth_t value) const;
80 
81  private:
82  /** Internal data storage, do NOT modify! */
83  typedef struct __attribute__((packed)) {
84  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
85  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
86  int32_t brows_action; /**< Type of action of brows */
87  int32_t eyes_action; /**< Type of action of eyes */
88  int32_t jowl_action; /**< Type of action of jown */
89  int32_t mouth_action; /**< Type of action of mouth */
90  } FacialExpressionInterface_data_t;
91 
92  FacialExpressionInterface_data_t *data;
93 
94  interface_enum_map_t enum_map_brows_t;
95  interface_enum_map_t enum_map_eyes_t;
96  interface_enum_map_t enum_map_jowl_t;
97  interface_enum_map_t enum_map_mouth_t;
98  public:
99  /* messages */
100  class MoveBrowsMessage : public Message
101  {
102  private:
103  /** Internal data storage, do NOT modify! */
104  typedef struct __attribute__((packed)) {
105  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
106  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
107  int32_t brows_action; /**< Type of action of brows */
108  } MoveBrowsMessage_data_t;
109 
110  MoveBrowsMessage_data_t *data;
111 
112  interface_enum_map_t enum_map_brows_t;
113  interface_enum_map_t enum_map_eyes_t;
114  interface_enum_map_t enum_map_jowl_t;
115  interface_enum_map_t enum_map_mouth_t;
116  public:
117  MoveBrowsMessage(const brows_t ini_brows_action);
119  ~MoveBrowsMessage();
120 
122  /* Methods */
123  brows_t brows_action() const;
124  void set_brows_action(const brows_t new_brows_action);
125  size_t maxlenof_brows_action() const;
126  virtual Message * clone() const;
127  };
128 
129  class MoveEyesMessage : public Message
130  {
131  private:
132  /** Internal data storage, do NOT modify! */
133  typedef struct __attribute__((packed)) {
134  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
135  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
136  int32_t eyes_action; /**< Type of action of eyes */
137  } MoveEyesMessage_data_t;
138 
139  MoveEyesMessage_data_t *data;
140 
141  interface_enum_map_t enum_map_brows_t;
142  interface_enum_map_t enum_map_eyes_t;
143  interface_enum_map_t enum_map_jowl_t;
144  interface_enum_map_t enum_map_mouth_t;
145  public:
146  MoveEyesMessage(const eyes_t ini_eyes_action);
147  MoveEyesMessage();
148  ~MoveEyesMessage();
149 
151  /* Methods */
152  eyes_t eyes_action() const;
153  void set_eyes_action(const eyes_t new_eyes_action);
154  size_t maxlenof_eyes_action() const;
155  virtual Message * clone() const;
156  };
157 
158  class MoveJowlMessage : public Message
159  {
160  private:
161  /** Internal data storage, do NOT modify! */
162  typedef struct __attribute__((packed)) {
163  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
164  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
165  int32_t jowl_action; /**< Type of action of jown */
166  } MoveJowlMessage_data_t;
167 
168  MoveJowlMessage_data_t *data;
169 
170  interface_enum_map_t enum_map_brows_t;
171  interface_enum_map_t enum_map_eyes_t;
172  interface_enum_map_t enum_map_jowl_t;
173  interface_enum_map_t enum_map_mouth_t;
174  public:
175  MoveJowlMessage(const jowl_t ini_jowl_action);
176  MoveJowlMessage();
177  ~MoveJowlMessage();
178 
180  /* Methods */
181  jowl_t jowl_action() const;
182  void set_jowl_action(const jowl_t new_jowl_action);
183  size_t maxlenof_jowl_action() const;
184  virtual Message * clone() const;
185  };
186 
187  class MoveMouthMessage : public Message
188  {
189  private:
190  /** Internal data storage, do NOT modify! */
191  typedef struct __attribute__((packed)) {
192  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
193  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
194  int32_t mouth_action; /**< Type of action of mouth */
195  } MoveMouthMessage_data_t;
196 
197  MoveMouthMessage_data_t *data;
198 
199  interface_enum_map_t enum_map_brows_t;
200  interface_enum_map_t enum_map_eyes_t;
201  interface_enum_map_t enum_map_jowl_t;
202  interface_enum_map_t enum_map_mouth_t;
203  public:
204  MoveMouthMessage(const mouth_t ini_mouth_action);
206  ~MoveMouthMessage();
207 
209  /* Methods */
210  mouth_t mouth_action() const;
211  void set_mouth_action(const mouth_t new_mouth_action);
212  size_t maxlenof_mouth_action() const;
213  virtual Message * clone() const;
214  };
215 
216  virtual bool message_valid(const Message *message) const;
217  private:
220 
221  public:
222  /* Methods */
223  brows_t brows_action() const;
224  void set_brows_action(const brows_t new_brows_action);
225  size_t maxlenof_brows_action() const;
226  eyes_t eyes_action() const;
227  void set_eyes_action(const eyes_t new_eyes_action);
228  size_t maxlenof_eyes_action() const;
229  jowl_t jowl_action() const;
230  void set_jowl_action(const jowl_t new_jowl_action);
231  size_t maxlenof_jowl_action() const;
232  mouth_t mouth_action() const;
233  void set_mouth_action(const mouth_t new_mouth_action);
234  size_t maxlenof_mouth_action() const;
235  virtual Message * create_message(const char *type) const;
236 
237  virtual void copy_values(const Interface *other);
238  virtual const char * enum_tostring(const char *enumtype, int val) const;
239 
240 };
241 
242 } // end namespace fawkes
243 
244 #endif
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
eyes_t
Action types for moving eyes.
size_t maxlenof_jowl_action() const
Get maximum length of jowl_action value.
const char * tostring_jowl_t(jowl_t value) const
Convert jowl_t constant to string.
MoveEyesMessage Fawkes BlackBoard Interface Message.
Fawkes library namespace.
jowl_t jowl_action() const
Get jowl_action value.
size_t maxlenof_eyes_action() const
Get maximum length of eyes_action value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
const char * tostring_eyes_t(eyes_t value) const
Convert eyes_t constant to string.
eyes_t eyes_action() const
Get eyes_action value.
size_t maxlenof_mouth_action() const
Get maximum length of mouth_action value.
void set_jowl_action(const jowl_t new_jowl_action)
Set jowl_action value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
MoveBrowsMessage Fawkes BlackBoard Interface Message.
mouth_t mouth_action() const
Get mouth_action value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
MoveJowlMessage Fawkes BlackBoard Interface Message.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
virtual Message * create_message(const char *type) const
Create message based on type name.
void set_brows_action(const brows_t new_brows_action)
Set brows_action value.
void set_mouth_action(const mouth_t new_mouth_action)
Set mouth_action value.
FacialExpressionInterface Fawkes BlackBoard Interface.
jowl_t
Action types for moving jowl.
mouth_t
Action types for moving mouth.
size_t maxlenof_brows_action() const
Get maximum length of brows_action value.
brows_t brows_action() const
Get brows_action value.
MoveMouthMessage Fawkes BlackBoard Interface Message.
void set_eyes_action(const eyes_t new_eyes_action)
Set eyes_action value.
brows_t
Action types for moving brows.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
Definition: types.h:53
const char * tostring_mouth_t(mouth_t value) const
Convert mouth_t constant to string.
const char * tostring_brows_t(brows_t value) const
Convert brows_t constant to string.