OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
aObject.h
Go to the documentation of this file.
1/*
2 * File: aObject.h
3 * Package: akCore
4 *
5 * Created on: July 26, 2020
6 * Author: Alexander Kuester
7 * Copyright (c) 2022 Alexander Kuester
8 * This file is part of the uiCore component.
9 * This file is subject to the terms and conditions defined in
10 * file 'LICENSE', which is part of this source code package.
11 */
12
13#pragma once
14
15// AK header
17#include <akCore/akCore.h>
18
19// Qt header
20#include <qstring.h> // QString
21
22// C++ header
23#include <map>
24
26#define A_OBJECT_DESTROYING_WITHOWNER if (m_owner != nullptr) { ak::aObject * obj = m_owner->parentObject(); if (obj != nullptr) { obj->removeChildObject(m_owner); } }
27#define A_OBJECT_DESTROYING_WITHPARENT if (m_parentObject != nullptr) { m_parentObject->removeChildObject(this); m_parentObject = nullptr; }
28#define A_OBJECT_DESTROYING A_OBJECT_DESTROYING_WITHOWNER else A_OBJECT_DESTROYING_WITHPARENT
29
30namespace ak {
31
35 public:
36
40 aObject(
41 objectType _type = otNone,
42 UID _UID = ak::invalidUID
43 //int _references = 1
44 );
45
48 aObject(
49 const aObject & _other
50 );
51
54 aObject & operator = (
55 const aObject & _other
56 );
57
59 virtual ~aObject();
60
61 // ################################################################################
62
66 virtual void removeChildObject(
67 aObject * _child
68 );
69
72 virtual void addChildObject(
73 aObject * _child
74 );
75
79 const QString & _name
80 ) { m_uniqueName = _name; }
81
83 virtual void setParentObject(
84 aObject * _parentObject
85 );
86
87 // ################################################################################
88
90 QString uniqueName(void) const { return m_uniqueName; }
91
93 aObject * parentObject(void) const;
94
96 int childObjectCount(void) const;
97
100 aObject * childObject(
101 UID _childUID
102 );
103
106 void setOwner(
107 aObject * _object
108 );
109
111 aObject * owner(void) const;
112
113 // ################################################################################
114
116 void setUid(
117 UID _UID
118 );
119
121 UID uid(void) const;
122
124 objectType type(void) const;
125
127 virtual bool isWidgetType(void) const;
128
129 protected:
136 std::map<UID, aObject *> m_childObjects;
137 };
138}
#define UICORE_API_EXPORT
Definition globalDataTypes.h:20
This class is used to store the main information of any object used Information contained is the UID ...
Definition aObject.h:34
std::map< UID, aObject * > m_childObjects
Definition aObject.h:136
void setUniqueName(const QString &_name)
Will set this objects unique name.
Definition aObject.h:78
objectType m_objectType
The objects references.
Definition aObject.h:132
QString uniqueName(void) const
Will return the unique name of this object.
Definition aObject.h:90
aObject * m_parentObject
Definition aObject.h:134
UID m_uid
Definition aObject.h:130
int m_references
The objects UID.
Definition aObject.h:131
aObject * m_owner
Definition aObject.h:135
QString m_uniqueName
The object type of this object.
Definition aObject.h:133
Definition uiAPI.h:45
const UID invalidUID
Represents the invalid UID for an object.
Definition globalDataTypes.h:71
unsigned long long UID
The UID datatype used for objects.
Definition globalDataTypes.h:65
objectType
Describes the type of an object.
Definition akCore.h:167
@ otNone
Definition akCore.h:168