|
Peano
|
Load Balancing Service. More...
#include <LoadBalancingService.h>

Public Member Functions | |
| virtual | ~LoadBalancingService () |
| void | setLoadBalancing (AbstractLoadBalancing *loadBalancing) |
| Install a new load balancing strategy. | |
| AbstractLoadBalancing * | getLoadBalancing () const |
| bool | hasLoadBalancing () const |
| void | shutdown () |
| Delete the installed load balancing strategy (if any) and reset the service, i.e. | |
Static Public Member Functions | |
| static LoadBalancingService & | getInstance () |
Private Member Functions | |
| LoadBalancingService () | |
| Singletons don't do anything in their constructor - see tarch::services::Service for a discussion. | |
| LoadBalancingService (const LoadBalancingService &other)=delete | |
| You may not copy a singleton. | |
Private Attributes | |
| AbstractLoadBalancing * | _loadBalancing |
| Owned by this service. | |
Static Private Attributes | |
| static tarch::logging::Log | _log |
| static LoadBalancingService | _singleton |
Load Balancing Service.
Singleton which administers exactly one AbstractLoadBalancing instance - the load balancing strategy that is currently active. User/extension code (the main routine, typically) hands over an AbstractLoadBalancing subclass via setLoadBalancing(), and everybody else who needs to trigger or query the load balancing goes through this service instead of holding (or passing around) a pointer to the strategy object itself.
The service owns the AbstractLoadBalancing object that it administers: it deletes the previous strategy whenever you install a new one via setLoadBalancing(), and it deletes the last installed strategy in shutdown()/the destructor.
Definition at line 37 of file LoadBalancingService.h.
|
private |
Singletons don't do anything in their constructor - see tarch::services::Service for a discussion.
|
privatedelete |
You may not copy a singleton.
|
virtual |
|
static |
| AbstractLoadBalancing * toolbox::loadbalancing::LoadBalancingService::getLoadBalancing | ( | ) | const |
| bool toolbox::loadbalancing::LoadBalancingService::hasLoadBalancing | ( | ) | const |
| void toolbox::loadbalancing::LoadBalancingService::setLoadBalancing | ( | AbstractLoadBalancing * | loadBalancing | ) |
Install a new load balancing strategy.
Ownership of loadBalancing is handed over to the service, i.e. the service will delete the object eventually (either because you replace it with another call to setLoadBalancing(), or because shutdown()/the destructor is invoked). If a load balancing strategy had already been installed, it is deleted before the new one is stored, unless you pass in the very same pointer again.
| loadBalancing | New strategy. Might be nullptr to simply discard the previously installed strategy without installing a new one. |
| void toolbox::loadbalancing::LoadBalancingService::shutdown | ( | ) |
Delete the installed load balancing strategy (if any) and reset the service, i.e.
getLoadBalancing() returns nullptr afterwards.
|
private |
Owned by this service.
May be nullptr if no load balancing has been installed (yet).
Definition at line 47 of file LoadBalancingService.h.
|
staticprivate |
Definition at line 39 of file LoadBalancingService.h.
|
staticprivate |
Definition at line 41 of file LoadBalancingService.h.