Streaming C++ API
sb::StreamBaseURI Class Reference

A URI for a StreamBase client connection. More...

#include <StreamBaseURI.hpp>

Public Types

typedef std::map< std::string, std::string > ParamMap
 

Public Member Functions

 StreamBaseURI ()
 Default-constructed object; no operations are allowed. More...
 
 StreamBaseURI (const std::string &uri)
 Parse URI from a string. More...
 
 StreamBaseURI (const std::string &host, unsigned int port, const std::string &user="", const std::string &password="")
 Create explicitly from host/port. More...
 
 StreamBaseURI (const std::string &host, const std::string &container, unsigned int port, const std::string &user="", const std::string &password="")
 Create explicitly from host/port with container. More...
 
 StreamBaseURI (const std::string &host, unsigned int port, const ParamMap &paramMap)
 Create explicitly from host/port, including a map of parameters. More...
 
 StreamBaseURI (const std::string &host, const std::string &container, unsigned int port, const ParamMap &paramMap)
 Create explicitly from host/port with container, including a map of parameters. More...
 
std::string as_string () const
 Return the URI as a string. More...
 
std::string getHost () const
 Return the host component of the URI. More...
 
std::string getContainer () const
 Returns the container name component of the URI. More...
 
unsigned int getPort () const
 Return the port component of the URI. More...
 
std::string getUser () const
 Return the user name component of the URI. More...
 
std::string getPassword () const
 Return the password component of the URI. More...
 
std::string getParameter (const std::string &key) const
 Return a parameter, or empty string if undefined. More...
 
std::string getParam (const std::string &key) const
 Return a parameter, or empty string if undefined. More...
 
bool getParameter (const std::string &key, std::string &value) const
 Return a parameter into value (returning true if one was found). More...
 
void addParameter (const std::string &key, const std::string &value)
 Add a parameter. More...
 
void removeParameter (std::string key)
 Add a parameter. More...
 
size_t getNumParameters ()
 return the number of parameters More...
 
 operator const void * () const
 Returns true if this object was not default-constructed. More...
 
const StreamBaseURI getBaseURI () const
 return a StreamBaseURI without Parameters More...
 

Static Public Member Functions

static std::vector< StreamBaseURIvectorFromString (const std::string &uris)
 Return a StreamBaseURI vector from a string of comma sepearted URIs. More...
 
static std::string as_string (const std::vector< StreamBaseURI > &uris)
 Return a string representation of a list of uris. More...
 
static StreamBaseURI fromEnvironment ()
 Create from the environment variable. More...
 
static std::vector< StreamBaseURIvectorFromEnvironment ()
 Create from the environment variable and return a vector of StreamBaseURIs. More...
 

Static Public Attributes

static const unsigned int DEFAULT_PORT = 10000
 The default StreamBase port (10000). More...
 
static std::string const DEFAULT_HOST
 The default container name. More...
 
static const char *const USER_PARAM
 URI parameter used for username. More...
 
static const char *const USERNAME_PARAM
 URI parameter used for username. More...
 
static const char *const PASSWORD_PARAM
 URI parameter used for password. More...
 
static std::string const DEFAULT_CONTAINER
 The default container name. More...
 
static std::string const SYSTEM_CONTAINER
 The system container name. More...
 
static std::string const NO_CONTAINER
 No container specification. More...
 
static const StreamBaseURI DEFAULT
 The default URI (pointing to localhost, port 10000, default container). More...
 
static StreamBaseURI const DEFAULT_URI
 The default URI. More...
 

Detailed Description

A URI for a StreamBase client connection.

These URIs are of the form

/// sb://hostname:port/;param1=val1;param2=val2
/// 
e.g.,

\verbatim

/// sb://somehost.mycompany.com:10000/;user=me;password=foobar ///

Parameters are optional.  The port number is optional; it defaults
to 10000. 

Constructor & Destructor Documentation

◆ StreamBaseURI() [1/6]

sb::StreamBaseURI::StreamBaseURI ( )
inline

Default-constructed object; no operations are allowed.

◆ StreamBaseURI() [2/6]

sb::StreamBaseURI::StreamBaseURI ( const std::string &  uri)

Parse URI from a string.

◆ StreamBaseURI() [3/6]

sb::StreamBaseURI::StreamBaseURI ( const std::string &  host,
unsigned int  port,
const std::string &  user = "",
const std::string &  password = "" 
)

Create explicitly from host/port.

◆ StreamBaseURI() [4/6]

sb::StreamBaseURI::StreamBaseURI ( const std::string &  host,
const std::string &  container,
unsigned int  port,
const std::string &  user = "",
const std::string &  password = "" 
)

Create explicitly from host/port with container.

◆ StreamBaseURI() [5/6]

sb::StreamBaseURI::StreamBaseURI ( const std::string &  host,
unsigned int  port,
const ParamMap &  paramMap 
)
inline

Create explicitly from host/port, including a map of parameters.

◆ StreamBaseURI() [6/6]

sb::StreamBaseURI::StreamBaseURI ( const std::string &  host,
const std::string &  container,
unsigned int  port,
const ParamMap &  paramMap 
)
inline

Create explicitly from host/port with container, including a map of parameters.

Member Function Documentation

◆ addParameter()

void sb::StreamBaseURI::addParameter ( const std::string &  key,
const std::string &  value 
)
inline

Add a parameter.

◆ as_string() [1/2]

std::string sb::StreamBaseURI::as_string ( ) const

Return the URI as a string.

◆ as_string() [2/2]

static std::string sb::StreamBaseURI::as_string ( const std::vector< StreamBaseURI > &  uris)
static

Return a string representation of a list of uris.

◆ fromEnvironment()

static StreamBaseURI sb::StreamBaseURI::fromEnvironment ( )
static

Create from the environment variable.

◆ getBaseURI()

const StreamBaseURI sb::StreamBaseURI::getBaseURI ( ) const
inline

return a StreamBaseURI without Parameters

◆ getContainer()

std::string sb::StreamBaseURI::getContainer ( ) const
inline

Returns the container name component of the URI.

May return an empty string if no container was specified.

◆ getHost()

std::string sb::StreamBaseURI::getHost ( ) const
inline

Return the host component of the URI.

◆ getNumParameters()

size_t sb::StreamBaseURI::getNumParameters ( )
inline

return the number of parameters

◆ getParam()

std::string sb::StreamBaseURI::getParam ( const std::string &  key) const
inline

Return a parameter, or empty string if undefined.

◆ getParameter() [1/2]

std::string sb::StreamBaseURI::getParameter ( const std::string &  key) const
inline

Return a parameter, or empty string if undefined.

◆ getParameter() [2/2]

bool sb::StreamBaseURI::getParameter ( const std::string &  key,
std::string &  value 
) const

Return a parameter into value (returning true if one was found).

Useful to distinguish an undefined parameter from an empty one.

◆ getPassword()

std::string sb::StreamBaseURI::getPassword ( ) const
inline

Return the password component of the URI.

◆ getPort()

unsigned int sb::StreamBaseURI::getPort ( ) const
inline

Return the port component of the URI.

◆ getUser()

std::string sb::StreamBaseURI::getUser ( ) const
inline

Return the user name component of the URI.

◆ operator const void *()

sb::StreamBaseURI::operator const void * ( ) const
inline

Returns true if this object was not default-constructed.

◆ removeParameter()

void sb::StreamBaseURI::removeParameter ( std::string  key)
inline

Add a parameter.

◆ vectorFromEnvironment()

static std::vector< StreamBaseURI > sb::StreamBaseURI::vectorFromEnvironment ( )
static

Create from the environment variable and return a vector of StreamBaseURIs.

◆ vectorFromString()

static std::vector< StreamBaseURI > sb::StreamBaseURI::vectorFromString ( const std::string &  uris)
static

Return a StreamBaseURI vector from a string of comma sepearted URIs.

The string of URIs supplied must conform to a valid HA URI list, for example they must all reference the same container.

Member Data Documentation

◆ DEFAULT

const StreamBaseURI sb::StreamBaseURI::DEFAULT
static

The default URI (pointing to localhost, port 10000, default container).

◆ DEFAULT_CONTAINER

std::string const sb::StreamBaseURI::DEFAULT_CONTAINER
static

The default container name.

◆ DEFAULT_HOST

std::string const sb::StreamBaseURI::DEFAULT_HOST
static

The default container name.

◆ DEFAULT_PORT

const unsigned int sb::StreamBaseURI::DEFAULT_PORT = 10000
static

The default StreamBase port (10000).

◆ DEFAULT_URI

StreamBaseURI const sb::StreamBaseURI::DEFAULT_URI
static

The default URI.

◆ NO_CONTAINER

std::string const sb::StreamBaseURI::NO_CONTAINER
static

No container specification.

◆ PASSWORD_PARAM

const char* const sb::StreamBaseURI::PASSWORD_PARAM
static

URI parameter used for password.

◆ SYSTEM_CONTAINER

std::string const sb::StreamBaseURI::SYSTEM_CONTAINER
static

The system container name.

◆ USER_PARAM

const char* const sb::StreamBaseURI::USER_PARAM
static

URI parameter used for username.

◆ USERNAME_PARAM

const char* const sb::StreamBaseURI::USERNAME_PARAM
static

URI parameter used for username.


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