Implement unused Lv2UridCache

This commit is contained in:
Johannes Lorenz
2020-10-18 14:24:16 +02:00
parent 9db671c7ae
commit 0d89d64f49
5 changed files with 117 additions and 2 deletions

View File

@@ -34,6 +34,7 @@
#include <lilv/lilv.h>
#include "Lv2Basics.h"
#include "Lv2UridCache.h"
#include "Lv2UridMap.h"
#include "Plugin.h"
@@ -123,7 +124,7 @@ public:
};
UridMap& uridMap() { return m_uridMap; }
//! Return all
const Lv2UridCache& uridCache() const { return m_uridCache; }
const std::set<const char*, CmpStr>& supportedFeatureURIs() const
{
return m_supportedFeatureURIs;
@@ -140,6 +141,9 @@ private:
// feature data that are common for all Lv2Proc
UridMap m_uridMap;
// URID cache for fast URID access
Lv2UridCache m_uridCache;
// functions
bool isSubclassOf(const LilvPluginClass *clvss, const char *uriStr);
};

52
include/Lv2UridCache.h Normal file
View File

@@ -0,0 +1,52 @@
/*
* Lv2UridCache.h - Lv2UridCache definition
*
* Copyright (c) 2020-2020 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef LV2URIDCACHE_H
#define LV2URIDCACHE_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_LV2
#include <cstdint>
//! Cached URIDs for fast access (for use in real-time code)
class Lv2UridCache
{
public:
enum class Id //!< ID for m_uridCache array
{
midi_MidiEvent, //!< just an example, unused yet
size
};
//! Return URID for a cache ID
uint32_t operator[](Id id) const;
Lv2UridCache(class UridMap& mapper);
private:
uint32_t m_cache[static_cast<int>(Id::size)];
};
#endif // LMMS_HAVE_LV2
#endif // LV2URIDCACHE_H