TrueReality  v0.1.1912
Base.cpp
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 #include <trBase/Base.h>
23 
24 #include <trUtil/Logging/Log.h>
25 
26 namespace trBase
27 {
28  const trUtil::RefStr Base::CLASS_TYPE = trUtil::RefStr("trBase::Base");
29 
31  Base::Base(const std::string& name) : mName(name)
32  {
33  LOG_D("Creating class with the name: " + GetName())
34  }
35 
38  {
39  LOG_D("Destroying class with the name: " + GetName())
40  }
41 
43  void Base::SetName(const std::string& name)
44  {
45  mName = name;
46  }
47 
49  const std::string& Base::GetName()
50  {
51  return mName;
52  }
53 
55  const std::string & Base::GetName() const
56  {
57  return mName;
58  }
59 
62  {
63  mId = id;
64  }
65 
68  {
69  return mId;
70  }
71 }
trUtil::RefStr mName
Definition: trBase/Base.h:119
virtual const std::string & GetName()
Returns this instances name.
Definition: Base.cpp:49
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
virtual void SetUUID(const trBase::UniqueId &id)
Overwrites the default internal UUID with the passed in one.
Definition: Base.cpp:61
~Base()
Base destructor.
Definition: Base.cpp:37
virtual const trBase::UniqueId & GetUUID(void)
Returns the instances Universally Unique ID.
Definition: Base.cpp:67
virtual void SetName(const std::string &name)
Sets this instances name.
Definition: Base.cpp:43
static const trUtil::RefStr CLASS_TYPE
Adds an easy and swappable access to the base class.
Definition: trBase/Base.h:42
Base(const std::string &name=CLASS_TYPE)
Holds the class type name for efficient comparisons.
Definition: Base.cpp:31
#define LOG_D(msg)
Log a DEBUG message.
Definition: Log.h:138
trBase::UniqueId mId
Definition: trBase/Base.h:120