2021-03-30 18:22:10 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-03-13 17:23:05 -04:00
|
|
|
|
|
|
|
|
#include "Interfaces/MetasoundFrontendInterfaceRegistry.h"
|
2021-03-30 18:22:10 -04:00
|
|
|
#include "MetasoundFrontendDocument.h"
|
|
|
|
|
#include "MetasoundNodeInterface.h"
|
|
|
|
|
|
2023-03-13 17:23:05 -04:00
|
|
|
|
|
|
|
|
namespace Metasound::Frontend
|
2021-03-30 18:22:10 -04:00
|
|
|
{
|
2023-03-13 17:23:05 -04:00
|
|
|
/** Interface for frontend search engine. A frontend search engine provides
|
|
|
|
|
* a simple interface for common frontend queries. It also serves as an
|
|
|
|
|
* opportunity to cache queries to reduce CPU load.
|
|
|
|
|
*/
|
|
|
|
|
class METASOUNDFRONTEND_API ISearchEngine
|
2021-03-30 18:22:10 -04:00
|
|
|
{
|
2023-03-13 17:23:05 -04:00
|
|
|
public:
|
|
|
|
|
/** Return an instance of a search engine. */
|
|
|
|
|
static ISearchEngine& Get();
|
2021-03-30 18:22:10 -04:00
|
|
|
|
2023-03-13 17:23:05 -04:00
|
|
|
virtual ~ISearchEngine() = default;
|
2022-04-25 16:59:41 -04:00
|
|
|
|
2023-03-13 17:23:05 -04:00
|
|
|
/** Updates internal state to speed up queries. */
|
|
|
|
|
virtual void Prime() = 0;
|
2021-12-07 18:37:04 -05:00
|
|
|
|
2023-03-13 17:23:05 -04:00
|
|
|
/** Find the class with the given ClassName & Major Version. Returns false if not found, true if found. */
|
|
|
|
|
virtual bool FindClassWithHighestMinorVersion(const FMetasoundFrontendClassName& InName, int32 InMajorVersion, FMetasoundFrontendClass& OutClass) = 0;
|
2022-04-25 16:59:41 -04:00
|
|
|
|
2024-05-28 18:51:03 -04:00
|
|
|
/** Finds all registered interfaces with the given name. */
|
2023-03-13 17:23:05 -04:00
|
|
|
virtual TArray<FMetasoundFrontendVersion> FindAllRegisteredInterfacesWithName(FName InInterfaceName) = 0;
|
2022-04-25 16:59:41 -04:00
|
|
|
|
2024-05-28 18:51:03 -04:00
|
|
|
/** Finds the registered interface with the highest version of the given name. Returns true if found, false if not. */
|
2023-03-13 17:23:05 -04:00
|
|
|
virtual bool FindInterfaceWithHighestVersion(FName InInterfaceName, FMetasoundFrontendInterface& OutInterface) = 0;
|
2022-04-25 16:59:41 -04:00
|
|
|
|
2023-04-04 19:14:26 -04:00
|
|
|
UE_DEPRECATED(5.3, "Use ISearchEngine::FindUClassDefaultInterfaceVersions using TopLevelAssetPath instead.")
|
2023-03-13 17:23:05 -04:00
|
|
|
virtual TArray<FMetasoundFrontendInterface> FindUClassDefaultInterfaces(FName InUClassName) = 0;
|
2022-04-25 16:59:41 -04:00
|
|
|
|
2023-04-04 19:14:26 -04:00
|
|
|
/** Returns all interfaces that are to be added to a given document when it is initialized on an object with the given class**/
|
|
|
|
|
virtual TArray<FMetasoundFrontendVersion> FindUClassDefaultInterfaceVersions(const FTopLevelAssetPath& InUClassPath) = 0;
|
2023-03-07 17:01:52 -05:00
|
|
|
|
2022-04-25 16:59:41 -04:00
|
|
|
#if WITH_EDITORONLY_DATA
|
2023-03-13 17:23:05 -04:00
|
|
|
/** Find all FMetasoundFrontendClasses.
|
|
|
|
|
* (Optional) Include all versions (i.e. deprecated classes and versions of classes that are not the highest major version).
|
|
|
|
|
*/
|
|
|
|
|
virtual TArray<FMetasoundFrontendClass> FindAllClasses(bool bInIncludeAllVersions) = 0;
|
2021-05-03 17:52:04 -04:00
|
|
|
|
2023-03-13 17:23:05 -04:00
|
|
|
/** Find all classes with the given ClassName.
|
|
|
|
|
* (Optional) Sort matches based on version.
|
|
|
|
|
*/
|
|
|
|
|
virtual TArray<FMetasoundFrontendClass> FindClassesWithName(const FMetasoundFrontendClassName& InName, bool bInSortByVersion) = 0;
|
2021-05-03 17:52:04 -04:00
|
|
|
|
2023-03-13 17:23:05 -04:00
|
|
|
/** Find the highest version of a class with the given ClassName. Returns false if not found, true if found. */
|
|
|
|
|
virtual bool FindClassWithHighestVersion(const FMetasoundFrontendClassName& InName, FMetasoundFrontendClass& OutClass) = 0;
|
2023-04-04 19:14:26 -04:00
|
|
|
|
|
|
|
|
/** Returns array with all registered interfaces. Optionally, include interface versions that are not the highest version. */
|
|
|
|
|
virtual TArray<FMetasoundFrontendInterface> FindAllInterfaces(bool bInIncludeAllVersions = false) = 0;
|
|
|
|
|
#endif // WITH_EDITORONLY_DATA
|
2021-06-23 20:08:21 -04:00
|
|
|
|
2023-03-13 17:23:05 -04:00
|
|
|
protected:
|
|
|
|
|
ISearchEngine() = default;
|
|
|
|
|
};
|
|
|
|
|
} // namespace Metasound::Frontend
|