TrueReality  v0.1.1912
NodeBase.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 "Export.h"
25 
27 #include <trBase/SmrtPtr.h>
28 #include <trBase/Base.h>
29 #include <trUtil/RefStr.h>
30 
31 #include <osg/Node>
32 
33 namespace trBase
34 {
35 
41  {
42  public:
43 
45 
46  const static trUtil::RefStr CLASS_TYPE;
47 
61  using NodeMask = osg::Node::NodeMask;
62 
66  NodeBase(const std::string name = CLASS_TYPE);
67 
71  virtual const std::string& GetType() const override;
72 
76  virtual void SetName(const std::string& name);
77 
81  virtual osg::Node* AsOSGNode();
82 
86  virtual const osg::Node* AsOSGNode() const;
87 
92  virtual trBase::UserDataContainer* GetUserData();
93 
98  virtual const trBase::UserDataContainer* GetUserData() const;
99 
103  virtual void SetUserData(trBase::UserDataContainer* data);
104 
105  protected:
106 
108 
112  ~NodeBase();
113 
114  private:
115 
117  };
118 }
119 
#define TR_BASE_EXPORT
Definition: trBase/Export.h:34
trBase::SmrtPtr< osg::Node > mNode
Definition: NodeBase.h:107
This class hold custom user data.
osg::Node::NodeMask NodeMask
Holds the class type name for efficient comparisons.
Definition: NodeBase.h:61
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
trBase::SmrtPtr< trBase::UserDataContainer > mUserData
Definition: NodeBase.h:116
This class is part of the internal garbage collection system.
Definition: SmrtClass.h:38
Base class for creating all the scenegraphs nodes.
Definition: NodeBase.h:40
This is a Base class that carries the Class name and Unique ID of all the derived classes...
Definition: trBase/Base.h:36
static const trUtil::RefStr CLASS_TYPE
Adds an easy and swappable access to the base class.
Definition: NodeBase.h:46