SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
message.h
Go to the documentation of this file.
1 // Copyright (C) 2015 F4EXB //
3 // written by Edouard Griffiths //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #ifndef INCLUDE_MESSAGE_H
20 #define INCLUDE_MESSAGE_H
21 
22 #include <stdlib.h>
23 #include "export.h"
24 
26 public:
27  Message();
28  virtual ~Message();
29 
30  virtual const char* getIdentifier() const;
31  virtual bool matchIdentifier(const char* identifier) const;
32  static bool match(const Message* message);
33 
34  void* getDestination() const { return m_destination; }
35  void setDestination(void *destination) { m_destination = destination; }
36 
37 protected:
38  // addressing
39  static const char* m_identifier;
41 };
42 
43 #define MESSAGE_CLASS_DECLARATION \
44  public: \
45  const char* getIdentifier() const; \
46  bool matchIdentifier(const char* identifier) const; \
47  static bool match(const Message& message); \
48  protected: \
49  static const char* m_identifier; \
50  private:
51 
52 #define MESSAGE_CLASS_DEFINITION(Name, BaseClass) \
53  const char* Name::m_identifier = #Name; \
54  const char* Name::getIdentifier() const { return m_identifier; } \
55  bool Name::matchIdentifier(const char* identifier) const {\
56  return (m_identifier == identifier) ? true : BaseClass::matchIdentifier(identifier); \
57  } \
58  bool Name::match(const Message& message) { return message.matchIdentifier(m_identifier); }
59 
60 #endif // INCLUDE_MESSAGE_H
void * m_destination
Definition: message.h:40
void * getDestination() const
Definition: message.h:34
static const char * m_identifier
Definition: message.h:39
void setDestination(void *destination)
Definition: message.h:35
#define SDRBASE_API
Definition: export.h:40