diff options
Diffstat (limited to 'plugins/warp/api')
| -rw-r--r-- | plugins/warp/api/python/_warpcore.py | 23 | ||||
| -rw-r--r-- | plugins/warp/api/python/warp.py | 7 | ||||
| -rw-r--r-- | plugins/warp/api/warp.cpp | 10 | ||||
| -rw-r--r-- | plugins/warp/api/warp.h | 2 | ||||
| -rw-r--r-- | plugins/warp/api/warpcore.h | 2 |
5 files changed, 44 insertions, 0 deletions
diff --git a/plugins/warp/api/python/_warpcore.py b/plugins/warp/api/python/_warpcore.py index 740072ab..da262f18 100644 --- a/plugins/warp/api/python/_warpcore.py +++ b/plugins/warp/api/python/_warpcore.py @@ -205,6 +205,29 @@ def BNWARPContainerCommitSource( # ------------------------------------------------------- +# _BNWARPContainerFetchFunctions + +_BNWARPContainerFetchFunctions = core.BNWARPContainerFetchFunctions +_BNWARPContainerFetchFunctions.restype = None +_BNWARPContainerFetchFunctions.argtypes = [ + ctypes.POINTER(BNWARPContainer), + ctypes.POINTER(BNWARPTarget), + ctypes.POINTER(BNWARPTypeGUID), + ctypes.c_ulonglong, + ] + + +# noinspection PyPep8Naming +def BNWARPContainerFetchFunctions( + container: ctypes.POINTER(BNWARPContainer), + target: ctypes.POINTER(BNWARPTarget), + guids: ctypes.POINTER(BNWARPTypeGUID), + count: int + ) -> None: + return _BNWARPContainerFetchFunctions(container, target, guids, count) + + +# ------------------------------------------------------- # _BNWARPContainerGetFunctionsWithGUID _BNWARPContainerGetFunctionsWithGUID = core.BNWARPContainerGetFunctionsWithGUID diff --git a/plugins/warp/api/python/warp.py b/plugins/warp/api/python/warp.py index c761c323..c7486b8c 100644 --- a/plugins/warp/api/python/warp.py +++ b/plugins/warp/api/python/warp.py @@ -305,6 +305,13 @@ class WarpContainer(metaclass=_WarpContainerMetaclass): core_guids[i] = guids[i].uuid return warpcore.BNWARPContainerRemoveTypes(self.handle, source.uuid, core_guids, count) + def fetch_functions(self, target: WarpTarget, guids: List[FunctionGUID]): + count = len(guids) + core_guids = (warpcore.BNWARPFunctionGUID * count)() + for i in range(count): + core_guids[i] = guids[i].uuid + warpcore.BNWARPContainerFetchFunctions(self.handle, target.handle, core_guids, count) + def get_sources_with_function_guid(self, target: WarpTarget, guid: FunctionGUID) -> List[Source]: count = ctypes.c_size_t() sources = warpcore.BNWARPContainerGetSourcesWithFunctionGUID(self.handle, target.handle, guid.uuid, count) diff --git a/plugins/warp/api/warp.cpp b/plugins/warp/api/warp.cpp index 147add8e..52c7ea9d 100644 --- a/plugins/warp/api/warp.cpp +++ b/plugins/warp/api/warp.cpp @@ -249,6 +249,16 @@ bool Container::RemoveTypes(const Source &source, const std::vector<TypeGUID> &g return result; } +void Container::FetchFunctions(const Target &target, const std::vector<FunctionGUID> &guids) const +{ + size_t count = guids.size(); + BNWARPFunctionGUID *apiGuids = new BNWARPFunctionGUID[count]; + for (size_t i = 0; i < count; i++) + apiGuids[i] = *guids[i].Raw(); + BNWARPContainerFetchFunctions(m_object, target.m_object, apiGuids, count); + delete[] apiGuids; +} + std::vector<Source> Container::GetSourcesWithFunctionGUID(const Target& target, const FunctionGUID &guid) const { size_t count; diff --git a/plugins/warp/api/warp.h b/plugins/warp/api/warp.h index b57a0c7b..807ba998 100644 --- a/plugins/warp/api/warp.h +++ b/plugins/warp/api/warp.h @@ -354,6 +354,8 @@ namespace Warp { bool RemoveTypes(const Source &source, const std::vector<TypeGUID> &guids) const; + void FetchFunctions(const Target& target, const std::vector<FunctionGUID> &guids) const; + std::vector<Source> GetSourcesWithFunctionGUID(const Target& target, const FunctionGUID &guid) const; std::vector<Source> GetSourcesWithTypeGUID(const TypeGUID &guid) const; diff --git a/plugins/warp/api/warpcore.h b/plugins/warp/api/warpcore.h index 09190126..20a59b7b 100644 --- a/plugins/warp/api/warpcore.h +++ b/plugins/warp/api/warpcore.h @@ -108,6 +108,8 @@ extern "C" WARP_FFI_API bool BNWARPContainerRemoveFunctions(BNWARPContainer* container, const BNWARPTarget* target, const BNWARPSource* source, BNWARPFunction** functions, size_t count); WARP_FFI_API bool BNWARPContainerRemoveTypes(BNWARPContainer* container, const BNWARPSource* source, BNWARPTypeGUID* types, size_t count); + WARP_FFI_API void BNWARPContainerFetchFunctions(BNWARPContainer* container, BNWARPTarget* target, const BNWARPTypeGUID* guids, size_t count); + WARP_FFI_API BNWARPSource* BNWARPContainerGetSourcesWithFunctionGUID(BNWARPContainer* container, const BNWARPTarget* target, const BNWARPFunctionGUID* guid, size_t* count); WARP_FFI_API BNWARPSource* BNWARPContainerGetSourcesWithTypeGUID(BNWARPContainer* container, const BNWARPTypeGUID* guid, size_t* count); WARP_FFI_API BNWARPFunction** BNWARPContainerGetFunctionsWithGUID(BNWARPContainer* container, const BNWARPTarget* target, const BNWARPSource* source, const BNWARPFunctionGUID* guid, size_t* count); |
