#include <service.h>
Public Member Functions | |
const String & | getServiceName () const |
Service (const String &name) | |
Creates the service assigning it a certain name. | |
virtual | ~Service () |
Destructor needs to be virtual. |
Falcon modules are meant to interact with OS, databases, web servers, and many other resources in behalf of Falcon scripts.
However, some of the resources handled by Falcon binary modules may be extremely useful also for embedding application. Instead of re-linking or re-abstracting the required low level services, this interface allows the modules to publish a set of functionalities that can be used by both the Falcon scripts and the embedding application. This also grants a somehow more direct interface between applications and scripts, that can share objects representing low level resources as files, database connections, shared memory, internet sockets and so on.
Service are required to a module by the Falcon::Module::getService(). a module will publish its services via Falcon::Module::publishService(). Applications willing to create many service instance in a row may find more efficient to use Falcon::Module::getServiceProvider(), which returns a factory for the given service.
As Falcon modules are objects that should usually be loaded via DLL interface, a service will declare all of its methods as virtual (except for const inline methdos), so that access to methods by the user application won't require any linkage with the falcon modules. Of course, this causes a minor inefficience in function calls.
The module where services are defined should declare
#define FALCON_EXPORT_SERVICE
Falcon::Service::Service | ( | const String & | name | ) |
Creates the service assigning it a certain name.
The service requries a name by which it can be published by the module.
virtual Falcon::Service::~Service | ( | ) | [virtual] |
Destructor needs to be virtual.
const String& Falcon::Service::getServiceName | ( | ) | const [inline] |