Poco::OSP

class ServiceRef

File Information

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

Description

ServiceRef objects are used by the ServiceRegistry class to manage service registrations.

Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Member Summary

Member Functions: castedInstance, demangle, instance, name, properties

Inherited Functions: duplicate, referenceCount, release

Types Aliases

ConstPtr

using ConstPtr = const Ptr;

Ptr

using Ptr = Poco::AutoPtr < ServiceRef >;

Constructors

ServiceRef

ServiceRef(
    const std::string & name,
    const Properties & props,
    Service::Ptr pService
);

Creates the ServiceRef, using the given arguments.

Destructor

~ServiceRef protected virtual

~ServiceRef();

Destroys the ServiceRef.

Member Functions

castedInstance inline

template < class Svc > Poco::AutoPtr < Svc > castedInstance() const;

Returns an instance of the Service.

If a ServiceFactory has been registered for the service, creates and returns a new instance of the Service class. Otherwise, returns the registered Service object.

Throws a Poco::BadCastException if the service object cannot be casted to the desired type.

demangle static

static std::string demangle(
    const char * typeName
);

Demangles the given mangled type name, if demangling support is available in the compiler.

Note: On Windows/MSVC, the result of typeid().name already is a demangled type name so this method does nothing.

instance

Service::Ptr instance() const;

Returns an instance of the Service.

If a ServiceFactory has been registered for the service, creates and returns a new instance of the Service class. Otherwise, returns the registered Service object.

name inline

const std::string & name() const;

Returns the name under which the service has been registered.

properties inline

const Properties & properties() const;

Returns the service properties.

properties

Properties & properties();

Returns the service properties.