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: IoT::Devices::IORemoteObject, IoT::Devices::CameraRemoteObject, IoT::Devices::IIO, IoT::Devices::IAccelerometer, IoT::Devices::ISerialDevice, IoT::Devices::RotaryEncoderRemoteObject, IoT::Devices::ISwitch, IoT::Devices::SerialDeviceRemoteObject, IoT::Devices::CounterRemoteObject, IoT::Devices::LEDRemoteObject, IoT::Devices::BarcodeReaderRemoteObject, IoT::Devices::BooleanSensorRemoteObject, IoT::Devices::IBooleanSensor, IoT::Devices::ICounter, IoT::Devices::IMagnetometer, IoT::Devices::TriggerRemoteObject, IoT::Devices::AccelerometerRemoteObject, IoT::Devices::ICamera, IoT::Devices::IDevice, IoT::Devices::ITrigger, IoT::Devices::IRotaryEncoder, IoT::Devices::ISensor, IoT::Devices::DeviceRemoteObject, IoT::Devices::IBarcodeReader, IoT::Devices::IGNSSSensor, IoT::Devices::IGyroscope, IoT::Devices::MagnetometerRemoteObject, IoT::Devices::SensorRemoteObject, IoT::Devices::SwitchRemoteObject, IoT::Devices::GNSSSensorRemoteObject, IoT::Devices::ILED, IoT::Devices::GyroscopeRemoteObject, Poco::OSP::Web::MediaTypeMapper, ExtensionPointService, ServiceFactory, Poco::OSP::Auth::AbstractLDAPAuthAdminService, Poco::OSP::WebEvent::WebEventService, Poco::OSP::Auth::AuthService, Poco::OSP::Web::WebServerService, Poco::OSP::Web::WebSessionStore, Poco::OSP::Auth::AuthAdminService, Poco::OSP::Web::TokenValidator, Poco::OSP::Web::WebServerDispatcher, Poco::OSP::Web::WebSessionService, Poco::OSP::WebEvent::WebEventServiceImpl, BundleInstallerService, PreferencesService, IoT::CANopen::NodeImpl, IoT::MQTT::MQTTClientRemoteObject, IoT::OPC::OPCClientRemoteObject, IoT::DeviceStatus::IDeviceStatusService, IoT::Modbus::ModbusMasterRemoteObject, IoT::BtLE::PeripheralRemoteObject, IoT::CAN::ICANEndpoint, IoT::CANopen::Node, IoT::MQTT::IMQTTClient, IoT::OPC::IOPCClient, IoT::BtLE::IPeripheral, IoT::BtLE::PeripheralBrowserRemoteObject, IoT::BtLE::IPeripheralBrowser, IoT::BtLE::PeripheralFactory, IoT::CAN::CANEndpointRemoteObject, IoT::Modbus::IModbusMaster, IoT::S7PLC::IS7PLCClient, IoT::UDP::UDPEndpointRemoteObject, IoT::XBee::XBeeNodeRemoteObject, IoT::WebEvent::IWebEventNotifier, IoT::MobileConnection::MobileConnectionServiceRemoteObject, IoT::S7PLC::S7PLCClientRemoteObject, IoT::UDP::IUDPEndpoint, IoT::DeviceStatus::DeviceStatusServiceRemoteObject, IoT::NetworkEnvironment::INetworkEnvironmentService, IoT::NetworkEnvironment::NetworkEnvironmentServiceRemoteObject, IoT::XBee::IXBeeNode, IoT::MobileConnection::IMobileConnectionService, IoT::WebEvent::WebEventNotifierRemoteObject

Member Summary

Member Functions: isA, type

Inherited Functions: duplicate, referenceCount, release

Types Aliases

ConstPtr

using ConstPtr = const Ptr;

Ptr

using Ptr = Poco::AutoPtr < Service >;

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);
}
Securely control IoT edge devices from anywhere   Connect a Device