1
0
forked from blue/pica
pica/database/resource.h

32 lines
627 B
C
Raw Permalink Normal View History

2023-12-30 22:42:11 +00:00
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
//SPDX-License-Identifier: GPL-3.0-or-later
2023-12-29 17:40:00 +00:00
#pragma once
#include <memory>
#include "interface.h"
namespace DB {
class Pool;
class Resource {
friend class Pool;
Resource(std::unique_ptr<Interface> interface, std::weak_ptr<Pool> parent);
public:
Resource(const Resource&) = delete;
Resource(Resource&& other);
~Resource();
Resource& operator = (const Resource&) = delete;
Resource& operator = (Resource&& other);
Interface* operator -> ();
private:
std::weak_ptr<Pool> parent;
std::unique_ptr<Interface> interface;
};
}