Poco::OSP

class Service

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

Description

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

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

Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

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

Member Summary

Member Functions: isA, type

Inherited Functions: duplicate, referenceCount, release

Types

ConstPtr

typedef const Ptr ConstPtr;

Ptr

typedef Poco::AutoPtr < Service > Ptr;

Constructors

Service protected

Service();

Creates the Service.

Destructor

~Service protected virtual

~Service();

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);
}