Make classes final if they're not meant to be derived from
This commit is contained in:
parent
5865ad6ccb
commit
b3391c88ae
@ -20,7 +20,7 @@
|
|||||||
namespace parallelaccessstore {
|
namespace parallelaccessstore {
|
||||||
|
|
||||||
template<class Resource, class ResourceRef, class Key>
|
template<class Resource, class ResourceRef, class Key>
|
||||||
class ParallelAccessStore {
|
class ParallelAccessStore final {
|
||||||
public:
|
public:
|
||||||
explicit ParallelAccessStore(cpputils::unique_ref<ParallelAccessBaseStore<Resource, Key>> baseStore);
|
explicit ParallelAccessStore(cpputils::unique_ref<ParallelAccessBaseStore<Resource, Key>> baseStore);
|
||||||
~ParallelAccessStore() {
|
~ParallelAccessStore() {
|
||||||
@ -56,9 +56,10 @@ public:
|
|||||||
void remove(const Key &key, cpputils::unique_ref<ResourceRef> block);
|
void remove(const Key &key, cpputils::unique_ref<ResourceRef> block);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class OpenResource {
|
class OpenResource final {
|
||||||
public:
|
public:
|
||||||
OpenResource(cpputils::unique_ref<Resource> resource): _resource(std::move(resource)), _refCount(0) {}
|
OpenResource(cpputils::unique_ref<Resource> resource): _resource(std::move(resource)), _refCount(0) {}
|
||||||
|
OpenResource(OpenResource &&rhs) = default;
|
||||||
|
|
||||||
Resource *getReference() {
|
Resource *getReference() {
|
||||||
++_refCount;
|
++_refCount;
|
||||||
@ -79,6 +80,8 @@ private:
|
|||||||
private:
|
private:
|
||||||
cpputils::unique_ref<Resource> _resource;
|
cpputils::unique_ref<Resource> _resource;
|
||||||
uint32_t _refCount;
|
uint32_t _refCount;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(OpenResource);
|
||||||
};
|
};
|
||||||
|
|
||||||
mutable std::mutex _mutex;
|
mutable std::mutex _mutex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user