fipa_services
Public Member Functions | Static Public Member Functions | List of all members
fipa::services::ServiceLocator Class Reference

A ServiceLocator is a container for ServiceLocations. More...

#include <ServiceLocator.hpp>

Public Member Functions

 ServiceLocator ()
 
 ServiceLocator (const ServiceLocations &locations)
 
ServiceLocations getLocations () const
 
void addLocation (const ServiceLocation &location)
 
bool hasLocations () const
 
ServiceLocation getFirstLocation () const
 
ServiceLocations search (const std::string &regex, ServiceLocation::Field field=ServiceLocation::SIGNATURE_TYPE)
 
void updateFromString (const std::string &locations)
 
std::string toString () const
 

Static Public Member Functions

static ServiceLocator fromString (const std::string &locations)
 

Detailed Description

A ServiceLocator is a container for ServiceLocations.

This class serves as a container and provides some convenience functions for updating information from string

Constructor & Destructor Documentation

fipa::services::ServiceLocator::ServiceLocator ( )
inline
fipa::services::ServiceLocator::ServiceLocator ( const ServiceLocations locations)

Member Function Documentation

void fipa::services::ServiceLocator::addLocation ( const ServiceLocation location)
inline

Add a service location

Parameters
locationA service location that shall be added to the container, does not check on duplicates
ServiceLocator fipa::services::ServiceLocator::fromString ( const std::string &  locations)
static

Create a ServiceLocator object from an existing string

See also
toString for valid separators in the string
Returns
the ServiceLocator object
ServiceLocation fipa::services::ServiceLocator::getFirstLocation ( ) const
inline

Get the first location, i.e. the one with highest priority

Returns
ServiceLocation of highest priority
ServiceLocations fipa::services::ServiceLocator::getLocations ( ) const
inline
bool fipa::services::ServiceLocator::hasLocations ( ) const
inline

Check if this locator contains any locations

Returns
true if locations exists, false otherwise
ServiceLocations fipa::services::ServiceLocator::search ( const std::string &  regex,
ServiceLocation::Field  field = ServiceLocation::SIGNATURE_TYPE 
)

Search for a service location, e.g. given a certain signature type

Parameters
regexRegex that is matched according to the parameter 'field'
fieldField to which the first parameter ('regex') should be applied
Returns
List of matches
Exceptions
NotFoundif not locations could be found
std::string fipa::services::ServiceLocator::toString ( ) const

Create string representation of service locator <address-0> <signature-type-0> <service-signature-0>;<address-1> <...>

Returns
stringified object
void fipa::services::ServiceLocator::updateFromString ( const std::string &  locations)

Parses a string using ';' as separators and updates the ServiceLocator object

Parameters
locationsList of ';' separated locations

The documentation for this class was generated from the following files: