ICacheable.h
Go to the documentation of this file.
/*
* Copyright (C) 2016-2023 Grok Image Compression Inc.
*
* This source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
namespace grk
{
enum GrkCacheState
{
GRK_CACHE_STATE_CLOSED,
GRK_CACHE_STATE_OPEN,
GRK_CACHE_STATE_ERROR
};
class ICacheable
{
public:
ICacheable() : state_(GRK_CACHE_STATE_CLOSED) {}
virtual ~ICacheable() = default;
bool isOpen(void)
{
return state_ == GRK_CACHE_STATE_OPEN;
}
bool isClosed(void)
{
return state_ == GRK_CACHE_STATE_CLOSED;
}
bool isError(void)
{
return state_ == GRK_CACHE_STATE_ERROR;
}
void setCacheState(GrkCacheState state)
{
state_ = state;
}
private:
GrkCacheState state_;
};
} // namespace grk
grk::ICacheable
Definition ICacheable.h:29
grk::ICacheable::isOpen
bool isOpen(void)
Definition ICacheable.h:33
grk::ICacheable::state_
GrkCacheState state_
Definition ICacheable.h:51
grk::ICacheable::setCacheState
void setCacheState(GrkCacheState state)
Definition ICacheable.h:45
grk::ICacheable::isError
bool isError(void)
Definition ICacheable.h:41
grk::ICacheable::~ICacheable
virtual ~ICacheable()=default
grk::ICacheable::ICacheable
ICacheable()
Definition ICacheable.h:31
grk::ICacheable::isClosed
bool isClosed(void)
Definition ICacheable.h:37
grk
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk::GrkCacheState
GrkCacheState
Definition ICacheable.h:22
grk::GRK_CACHE_STATE_CLOSED
@ GRK_CACHE_STATE_CLOSED
Definition ICacheable.h:23
grk::GRK_CACHE_STATE_ERROR
@ GRK_CACHE_STATE_ERROR
Definition ICacheable.h:25
grk::GRK_CACHE_STATE_OPEN
@ GRK_CACHE_STATE_OPEN
Definition ICacheable.h:24