AwCore
AnyWave core library
AwMarker.h
1 //
3 // Université d’Aix Marseille (AMU) -
4 // Institut National de la Santé et de la Recherche Médicale (INSERM)
5 // Copyright © 2013 AMU, INSERM
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation; either
10 // version 3 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Lesser General Public License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 //
22 //
23 // Author: Bruno Colombet – Laboratoire UMR INS INSERM 1106 - Bruno.Colombet@univ-amu.fr
24 //
26 #ifndef AWMARKER_H
27 #define AWMARKER_H
28 
29 #include <QStringList>
30 #include <QMetaType>
45 class AwMarker
46 {
47 public:
48  // Markers types.
49  enum MarkerType {Single = 2, Selection = 4};
50 
52  AwMarker();
54  AwMarker(AwMarker *marker);
55  virtual ~AwMarker() {}
56 
58  static int stringToType(const QString& s);
59 
61  static QString typeToString(qint32 t);
62 
64  static QStringList markersTypeList();
65 
67  inline QString& label() { return m_label; }
69  inline int type() { return m_type; }
71  inline qint16 value() { return m_code; }
72 
73  // TO BE DELETED IN FUTURE VERSIONS
74  inline QString& notes() { return m_notes; }
75  inline bool isEditable() { return m_editable; }
76  inline bool isVisible() { return m_visible; }
77  // ENd OF TO BE DELETED IN FUTURE VERSIONS
78 
80  inline float start() { return m_start; }
82  inline float duration() { return m_duration; }
84  inline float end() { return m_start + m_duration; }
87  inline QStringList& targetChannels() { return m_targetChannels; }
88 
89  inline void setLabel(const QString& label) { m_label = label; }
90  inline void setValue(qint16 value) { m_code = value; }
91  inline void setNotes(const QString& notes) { m_notes = notes; }
92  inline void setEditable(bool flag) { m_editable = flag; }
93  inline void setVisible(bool flag) { m_visible = flag; }
94  inline void setStart(float start) { m_start = start; }
95  inline void setDuration(float duration) { m_duration = duration; if (duration > 0) m_type = Selection; }
96  inline void setTargetChannels(const QStringList& targetChannels) { m_targetChannels = targetChannels; }
97  inline void addTargetChannel(const QString& channel) { m_targetChannels.append(channel); }
98 
99 protected:
100  QString m_label;
101  int m_type;
102  short m_code;
103  QString m_notes;
104  bool m_editable;
105  bool m_visible;
106  float m_start;
107  float m_duration;
108  QStringList m_targetChannels;
109 };
110 
111 typedef QList<AwMarker *> AwMarkerList;
112 Q_DECLARE_METATYPE(AwMarker)
113 Q_DECLARE_METATYPE(AwMarkerList)
114 
115 
116 #endif
float start()
Definition: AwMarker.h:80
int type()
Definition: AwMarker.h:69
float duration()
Definition: AwMarker.h:82
float end()
Definition: AwMarker.h:84
AwMarker()
Definition: AwMarker.cpp:31
static QString typeToString(qint32 t)
Definition: AwMarker.cpp:73
QString & label()
Definition: AwMarker.h:67
qint16 value()
Definition: AwMarker.h:71
static int stringToType(const QString &s)
Definition: AwMarker.cpp:58
QStringList & targetChannels()
Definition: AwMarker.h:87
static QStringList markersTypeList()
Definition: AwMarker.cpp:92
This class defines the AwMarker object.
Definition: AwMarker.h:45