Poco::OSP

class ServiceFinder

File Information

Library: OSP
Package: Service
Header: Poco/OSP/ServiceFinder.h

Description

A utility class that simplifies service lookup and instantiation.

Member Summary

Member Functions: find, findByName

Member Functions

find static inline

template < typename Svc > static Poco::AutoPtr < Svc > find(
    Poco::OSP::BundleContext::Ptr pContext
);

Looks up the service with the name given by Svc::SERVICE_NAME, casts it to the class given by the template argument and returns it.

Throws a Poco::NotFoundException if the service cannot be found. Throws a Poco::BadCastException if the cast cannot be performed.

findByName static inline

template < typename Svc > static Poco::AutoPtr < Svc > findByName(
    Poco::OSP::BundleContext::Ptr pContext,
    const std::string & name
);

Looks up the service with the given name, casts it to the class given by the template argument and returns it.

Throws a Poco::NotFoundException if the service cannot be found. Throws a Poco::BadCastException if the cast cannot be performed.

Securely control IoT edge devices from anywhere   Connect a Device