TrueReality  v0.1.1912
MessageBase.h
Go to the documentation of this file.
1 /*
2 * True Reality Open Source Game and Simulation Engine
3 * Copyright © 2021 Acid Rain Studios LLC
4 *
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License as published by the Free
7 * Software Foundation; either version 3.0 of the License, or (at your option)
8 * any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * @author Maxim Serebrennik
20 */
21 
22 #pragma once
23 
24 #include <trManager/Export.h>
25 
26 #include <trUtil/StringUtils.h>
27 #include <trUtil/RefStr.h>
28 #include <trBase/ObsrvrPtr.h>
29 #include <trBase/SmrtClass.h>
30 #include <trBase/UniqueId.h>
31 
32 #include <string>
33 
34 namespace trManager
35 {
41  {
42  public:
43 
45 
47 
58  MessageBase(const trBase::UniqueId* fromActorID, const trBase::UniqueId* aboutActorID = NULL, const bool isDirect = false, const std::string &messageFilter = trUtil::StringUtils::STR_BLANK);
59 
60  bool operator==(const MessageBase& msg) const;
61  bool operator!=(const MessageBase& msg) const { return !(*this == msg); }
62 
70  virtual const std::string& GetMessageType() const = 0;
71 
79  virtual const trBase::UniqueId* GetFromActorID() const;
80 
89  virtual const trBase::UniqueId* GetAboutActorID() const;
90 
98  virtual const bool& GetIsDirect() const;
99 
107  virtual const std::string& GetMessageFilter();
108 
109  protected:
110 
116  ~MessageBase();
117 
125  virtual const std::string& GetType() const override;
126 
127  private:
128 
130  bool mIsDirect;
131  const std::string *mMessageFilter;
133  };
134 }
135 
136 
137 
trBase::UniqueId mId
Definition: MessageBase.h:132
bool operator==(const std::string &s1, const RefStr &s2)
Definition: RefStr.h:187
This class creates a GUID, or a Unique ID that is used through out TR to identify and distinguish one...
Definition: UniqueId.h:42
A string wrapper that will make sure that all of the strings with the same value will point to the sa...
Definition: RefStr.h:50
static const std::string STR_BLANK("")
Constant value for a blank String.
const std::string * mMessageFilter
Definition: MessageBase.h:131
This class is part of the internal garbage collection system.
Definition: SmrtClass.h:38
static const trUtil::RefStr MESSAGE_TYPE
Adds an easy and swappable access to the base class.
Definition: MessageBase.h:46
trBase::ObsrvrPtr< const trBase::UniqueId > mFromActorID
Definition: MessageBase.h:129
bool operator!=(const MessageBase &msg) const
Definition: MessageBase.h:61
osg::Referenced BaseClass
Definition: SmrtClass.h:42
This is the base class for all the messages in TR.
Definition: MessageBase.h:40
#define TR_MANAGER_EXPORT