Uniot Core
0.8.1
Loading...
Searching...
No Matches
ObjectRegisterRecord.h
Go to the documentation of this file.
1/*
2 * This is a part of the Uniot project.
3 * Copyright (C) 2016-2024 Uniot <contact@uniot.io>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <ClearQueue.h>
22#include <Logger.h>
23#include <TypeId.h>
24
25namespace uniot {
26
41 public:
46
50 void operator=(const ObjectRegisterRecord &) = delete;
51
59 auto success = sRegisteredLinks.pushUnique(this);
60 UNIOT_LOG_DEBUG("record.push [%lu][%d]", this, success);
61 }
62
70 auto success = sRegisteredLinks.removeOne(this);
71 UNIOT_LOG_DEBUG("record.remove [%lu][%d]", this, success);
72 }
73
84 static bool exists(ObjectRegisterRecord *record) {
85 return sRegisteredLinks.contains(record);
86 }
87
88 private:
95 static ClearQueue<ObjectRegisterRecord *> sRegisteredLinks;
96};
97
98} // namespace uniot
Definition ClearQueue.h:38
Interface for objects that expose their runtime type information.
Definition TypeId.h:52
static bool exists(ObjectRegisterRecord *record)
Checks if a record still exists in the registry.
Definition ObjectRegisterRecord.h:84
virtual ~ObjectRegisterRecord()
Destructor that automatically unregisters this instance.
Definition ObjectRegisterRecord.h:69
ObjectRegisterRecord(const ObjectRegisterRecord &)=delete
Deleted copy constructor to prevent copying.
void operator=(const ObjectRegisterRecord &)=delete
Deleted assignment operator to prevent copying.
ObjectRegisterRecord()
Constructor that automatically registers this instance.
Definition ObjectRegisterRecord.h:58
#define UNIOT_LOG_DEBUG(...)
Log an DEBUG level message Used for general information about system operation. Only compiled if UNIO...
Definition Logger.h:293
Contains all classes and functions related to the Uniot Core.