MNE-CPP  beta 1.0
newmeasurement.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef NEWMEASUREMENT_H
37 #define NEWMEASUREMENT_H
38 
39 //*************************************************************************************************************
40 //=============================================================================================================
41 // INCLUDES
42 //=============================================================================================================
43 
44 #include "xmeas_global.h"
45 
46 
47 
48 //*************************************************************************************************************
49 //=============================================================================================================
50 // Qt INCLUDES
51 //=============================================================================================================
52 
53 #include <QObject>
54 #include <QSharedPointer>
55 #include <QMutex>
56 #include <QMutexLocker>
57 
58 
59 //*************************************************************************************************************
60 //=============================================================================================================
61 // DEFINE NAMESPACE XMEASLIB
62 //=============================================================================================================
63 
64 namespace XMEASLIB
65 {
66 
67 class XMEASSHARED_EXPORT NewMeasurement : public QObject
68 {
69  Q_OBJECT
70 public:
71  typedef QSharedPointer<NewMeasurement> SPtr;
72  typedef QSharedPointer<const NewMeasurement> ConstSPtr;
74  //=========================================================================================================
81  explicit NewMeasurement(int type = QMetaType::UnknownType, QObject *parent = 0);
82 
83  //=========================================================================================================
87  virtual ~NewMeasurement();
88 
89  //=========================================================================================================
95  inline const QString& getName() const;
96 
97  //=========================================================================================================
103  inline void setName(const QString& name);
104 
105  //=========================================================================================================
111  inline bool isVisible() const;
112 
113  //=========================================================================================================
119  inline void setVisibility(bool visibility);
120 
121  //=========================================================================================================
127  inline int type() const;
128 
129 signals:
130  void notify();
131 
132 protected:
133  //=========================================================================================================
139  inline void setType(int type);
140 
141 private:
142  mutable QMutex m_qMutex;
143  int m_iMetaTypeId;
144  QString m_qString_Name;
145  bool m_bVisibility;
146 };
147 
148 
149 //*************************************************************************************************************
150 //=============================================================================================================
151 // INLINE DEFINITIONS
152 //=============================================================================================================
153 
154 inline const QString& NewMeasurement::getName() const
155 {
156  QMutexLocker locker(&m_qMutex);
157  return m_qString_Name;
158 }
159 
160 
161 //*************************************************************************************************************
162 
163 inline void NewMeasurement::setType(int type)
164 {
165  QMutexLocker locker(&m_qMutex);
166  m_iMetaTypeId = type;
167 }
168 
169 
170 //*************************************************************************************************************
171 
172 inline void NewMeasurement::setName(const QString& name)
173 {
174  QMutexLocker locker(&m_qMutex);
175  m_qString_Name = name;
176 }
177 
178 
179 //*************************************************************************************************************
180 
181 inline bool NewMeasurement::isVisible() const
182 {
183  QMutexLocker locker(&m_qMutex);
184  return m_bVisibility;
185 }
186 
187 
188 //*************************************************************************************************************
189 
190 inline void NewMeasurement::setVisibility(bool visibility)
191 {
192  QMutexLocker locker(&m_qMutex);
193  m_bVisibility = visibility;
194 }
195 
196 
197 //*************************************************************************************************************
198 
199 inline int NewMeasurement::type() const
200 {
201  QMutexLocker locker(&m_qMutex);
202  return m_iMetaTypeId;
203 }
204 
205 } //NAMESPACE
206 
207 Q_DECLARE_METATYPE(XMEASLIB::NewMeasurement::SPtr)
208 
209 #endif // NEWMEASUREMENT_H
void setName(const QString &name)
#define XMEASSHARED_EXPORT
Definition: xmeas_global.h:54
void setVisibility(bool visibility)
const QString & getName() const
QSharedPointer< const NewMeasurement > ConstSPtr
QSharedPointer< NewMeasurement > SPtr
Contains the xMeas library export/import macros.