Skip to content

feat: add async overloads of GetManagedObjects() #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jwinarske
Copy link
Contributor

Adds the following to Standardinterfaces.h

template <typename _Function>
PendingAsyncCall GetManagedObjectsAync(_Function&& callback)
{
    std::map<sdbus::ObjectPath, std::map<sdbus::InterfaceName, std::map<PropertyName, sdbus::Variant>>> objectsInterfacesAndProperties;
    return m_proxy.callMethodAsync("GetManagedObjects").onInterface(INTERFACE_NAME).uponReplyInvoke(std::forward<_Function>(callback));
}

std::future<std::map<sdbus::ObjectPath, std::map<sdbus::InterfaceName, std::map<PropertyName, sdbus::Variant>>>> GetManagedObjectsAync(with_future_t) const {
    return m_proxy.callMethodAsync("GetManagedObjects").onInterface(INTERFACE_NAME).getResultAsFuture<std::map<sdbus::ObjectPath, std::map<sdbus::InterfaceName, std::map<PropertyName, sdbus::Variant>>>>();
}

@sangelovic
Copy link
Collaborator

@jwinarske Welcome and thanks for the PR. Would be great to also add test cases for the new functionality. Something like SdbusTestObject.GetsZeroManagedObjectsIfHasNoSubPathObjects and SdbusTestObject. GetsManagedObjectsSuccessfully, just that the tests would use the async version. Would you volunteer to write those or shall I help you here?

@sangelovic sangelovic force-pushed the jw/add_GetManagedObjectsAsync_variants branch from 67bdc3d to b01c90b Compare May 5, 2025 10:37
@sangelovic sangelovic force-pushed the jw/add_GetManagedObjectsAsync_variants branch from 91d5d4e to fb0b9a5 Compare May 5, 2025 11:24
@sangelovic sangelovic changed the title Add GetManagedObjectsAync variants to Standardinterfaces.h feat: add async overloads of GetManagedObjects() May 5, 2025
@sangelovic sangelovic merged commit 7fbfcec into Kistler-Group:master May 5, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants