SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
smtk
session
polygon
internal
Entity.h
1
//=============================================================================
2
// Copyright (c) Kitware, Inc.
3
// All rights reserved.
4
// See LICENSE.txt for details.
5
//
6
// This software is distributed WITHOUT ANY WARRANTY; without even
7
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8
// PURPOSE. See the above copyright notice for more information.
9
//=============================================================================
10
#ifndef smtk_session_polygon_internal_Entity_h
11
#define smtk_session_polygon_internal_Entity_h
12
13
#include "
smtk/SharedFromThis.h
"
14
#include "smtk/session/polygon/Exports.h"
15
#include "smtk/session/polygon/PointerDefs.h"
16
#include "smtk/session/polygon/internal/Config.h"
17
18
namespace
smtk
19
{
20
namespace
session
21
{
22
namespace
polygon
23
{
24
namespace
internal
25
{
26
33
class
SMTKPOLYGONSESSION_EXPORT
entity
:
smtkEnableSharedPtr
(entity)
34
{
35
public
:
36
smtkTypeMacroBase
(
entity
);
37
38
Id
id()
const
{
return
m_id; }
39
void
setId(
const
Id
& i) { m_id = i; }
40
41
entity
* parent()
const
{
return
m_parent; }
42
void
setParent(
entity
* p) { m_parent = p; }
43
44
template
<
typename
T>
45
T* parentAs()
const
46
{
47
return
dynamic_cast<
T*
>
(m_parent);
48
}
49
50
protected
:
51
entity
() =
default
;
52
entity
(
const
Id
& uid,
entity
* p)
53
: m_parent(p)
54
, m_id(uid)
55
{
56
}
57
virtual
~
entity
() { m_parent =
nullptr
; }
58
59
entity
* m_parent{
nullptr
};
60
Id
m_id;
61
};
62
63
}
// namespace internal
64
}
// namespace polygon
65
}
// namespace session
66
}
// namespace smtk
67
68
#endif // smtk_session_polygon_internal_Entity_h
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition:
doc.h:33
smtk::common::UUID
Definition:
UUID.h:38
smtkEnableSharedPtr
#define smtkEnableSharedPtr(...)
An abbreviation for enabling shared pointers.
Definition:
SharedFromThis.h:214
smtk::session::polygon::internal::entity
A base class for all internal entity storage.
Definition:
Entity.h:33
SharedFromThis.h
Macros for dealing with shared-pointer classes.
smtkTypeMacroBase
#define smtkTypeMacroBase(...)
Add typedefs to a class for identifcation.
Definition:
SharedFromThis.h:131
Generated by
1.8.17