Uniot Core
0.8.1
Loading...
Searching...
No Matches
RegisterManagerProxy.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 "RegisterManager.h"
22
23namespace uniot {
24
36 public:
41
45 void operator=(const RegisterManagerProxy &) = delete;
46
53 RegisterManagerProxy(const String &name, RegisterManager *reg)
54 : mName(name), mpRegister(reg) {
55 }
56
65 bool getGpio(size_t index, uint8_t &outValue) const {
66 return mpRegister->getGpio(mName, index, outValue);
67 }
68
76 template <typename T>
77 T *getObject(size_t index) {
78 return mpRegister->getObject<T>(mName, index);
79 }
80
81 private:
82 String mName;
83 RegisterManager *mpRegister;
84};
85
86} // namespace uniot
Definition RegisterManager.h:37
void operator=(const RegisterManagerProxy &)=delete
Assignment operator is deleted to prevent unexpected behavior.
RegisterManagerProxy(const String &name, RegisterManager *reg)
Creates a new proxy for accessing a specific named register.
Definition RegisterManagerProxy.h:53
RegisterManagerProxy(const RegisterManagerProxy &)=delete
Copy constructor is deleted to prevent unexpected behavior.
bool getGpio(size_t index, uint8_t &outValue) const
Gets a GPIO value from the specified index in the bound register.
Definition RegisterManagerProxy.h:65
T * getObject(size_t index)
Gets an object of the specified type from the bound register.
Definition RegisterManagerProxy.h:77
Contains all classes and functions related to the Uniot Core.