TrueReality  v0.1.1912
UserDataContainer.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 <trBase/Export.h>
25 
26 #include <trBase/SmrtClass.h>
27 #include <trBase/SmrtPtr.h>
28 #include <trBase/Base.h>
29 #include <trUtil/RefStr.h>
30 
31 #include <string>
32 #include <vector>
33 
34 namespace trBase
35 {
42  {
43  public:
44 
46 
47  const static trUtil::RefStr CLASS_TYPE;
48 
52  UserDataContainer(const std::string name = CLASS_TYPE);
53 
57  virtual const std::string& GetType() const override;
58 
62  virtual trBase::SmrtClass* GetUserDataContainer();
63 
67  virtual const trBase::SmrtClass* GetUserDataContainer() const;
68 
72  virtual void SetUserDataContainer(trBase::SmrtClass* data);
73 
77  virtual std::vector<std::string> GetDescriptionList();
78 
82  virtual const std::vector<std::string> GetDescriptionList() const;
83 
87  virtual int GetDescriptionListCount();
88 
92  virtual std::string GetDescription(int index = 0);
93 
97  virtual const std::string GetDescription(int index = 0) const;
98 
102  virtual void AddDescription(std::string description);
103 
107  virtual void SetDescriptions(std::vector<std::string> descriptions);
108 
112  virtual std::vector<trBase::SmrtPtr<trBase::Base>> GetObjectList();
113 
117  virtual const std::vector<trBase::SmrtPtr<trBase::Base>> GetObjectList() const;
118 
122  virtual int GetObjectListCount();
123 
127  virtual trBase::SmrtPtr<trBase::Base> GetObject(int index = 0);
128 
132  virtual const trBase::SmrtPtr<trBase::Base> GetObject(int index = 0) const;
133 
137  virtual void AddObject(trBase::SmrtPtr<trBase::Base> obj);
138 
142  virtual void SetObjects(std::vector<trBase::SmrtPtr<trBase::Base>> objList);
143 
144  protected:
145 
147  std::vector<std::string> mDescriptionList;
148  std::vector<trBase::SmrtPtr<trBase::Base>> mObjectList;
149 
154  };
155 }
#define TR_BASE_EXPORT
Definition: trBase/Export.h:34
std::vector< trBase::SmrtPtr< trBase::Base > > mObjectList
static const trUtil::RefStr CLASS_TYPE
Adds an easy and swappable access to the base class.
This class hold custom user data.
Smart pointer for handling referenced counted objects.
Definition: SmrtPtr.h:36
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
This class is part of the internal garbage collection system.
Definition: SmrtClass.h:38
std::vector< std::string > mDescriptionList
trBase::SmrtPtr< trBase::SmrtClass > mUserDataContainer
This is a Base class that carries the Class name and Unique ID of all the derived classes...
Definition: trBase/Base.h:36