class Service

File Information

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


This is the base class for all services registered with the ServiceRegistry.

All subclasses of Service must override the type() and isA() member functions.


Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Known Derived Classes: Poco::OSP::Auth::PooledAuthAdminService, Poco::OSP::Mail::MailDeliveryService, BundleInstallerService, Poco::OSP::Web::MediaTypeMapper, Poco::OSP::Web::TokenValidator, PreferencesService, Poco::OSP::Auth::AuthAdminService, Poco::OSP::Mail::MailDeliveryServiceImpl, Poco::OSP::WebEvent::WebEventService, Poco::OSP::Web::WebServerDispatcher, Poco::OSP::Auth::AbstractLDAPAuthAdminService, Poco::OSP::WebEvent::WebEventServiceImpl, Poco::OSP::Web::WebSessionService, ExtensionPointService, Poco::OSP::Web::WebServerService, Poco::OSP::Auth::AuthService, ServiceFactory, Poco::OSP::Web::WebSessionStore

Member Summary

Member Functions: isA, type

Inherited Functions: duplicate, referenceCount, release

Types Aliases


using ConstPtr = const Ptr;


using Ptr = Poco::AutoPtr < Service >;


Service protected


Creates the Service.


~Service protected virtual


Destroys the Service.

Member Functions

isA virtual

virtual bool isA(
    const std::type_info & otherType
) const;

Returns true if the class is a subclass of the class given by type. Comparison must always be done by type name, not by simply comparing std::type_info object references.

Subclasses must override this member function.

The implementation of isA() is always as follows:

bool MyService::isA(const std::type_info& otherType) const
    std::string name(typeid(MyService).name());
    return name == otherType.name() || MyBaseClass::isA(otherType);

type virtual

virtual const std::type_info & type() const;

Returns the type information for the object's class.

Subclasses must override this member function.

The implementation of isA() is usually as follows:

const std::type_info& MyService::type() const
    return typeid(MyService);

If a service class implements a service interface, the type information for the interface class should be returned instead:

const std::type_info& MyServiceImpl::type() const
    return typeid(MyService);