Files
mxl-multiviewer/MxlInstanceCache.hpp
2026-05-18 00:03:06 +03:00

45 lines
839 B
C++

#pragma once
#include <cstdint>
#include <string>
#include <vector>
#if MXL_MULTIVIEWER_ENABLE_MXL_SDK
#include <mxl/flow.h>
#include <mxl/mxl.h>
#include <mxl/rational.h>
#include <mxl/time.h>
#endif
struct MxlInstanceHandle
{
#if MXL_MULTIVIEWER_ENABLE_MXL_SDK
mxlInstance instance = nullptr;
#endif
std::string domain;
int refCount = 0;
};
class MxlInstanceCache
{
public:
static MxlInstanceCache& instance();
MxlInstanceHandle* acquire(
const std::string& domain,
bool verbose = false);
void release(MxlInstanceHandle* handle);
MxlInstanceCache(const MxlInstanceCache&) = delete;
MxlInstanceCache& operator=(const MxlInstanceCache&) = delete;
private:
MxlInstanceCache() = default;
#if MXL_MULTIVIEWER_ENABLE_MXL_SDK
std::vector<MxlInstanceHandle> m_handles;
#endif
};