StreamBase C++ API  10.6.6.1
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.,
/// sb://somehost.mycompany.com:10000/;user=me;password=foobar
/// 
Parameters are optional.  The port number is optional; it defaults
to 10000.  

Constructor & Destructor Documentation

sb::StreamBaseURI::StreamBaseURI ( )
inline

Default-constructed object; no operations are allowed.

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

Parse URI from a string.

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

Create explicitly from host/port.

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.

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

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

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

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

Add a parameter.

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

Return a string representation of a list of uris.

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

Return the URI as a string.

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

Create from the environment variable.

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

return a StreamBaseURI without Parameters

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.

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

Return the host component of the URI.

size_t sb::StreamBaseURI::getNumParameters ( )
inline

return the number of parameters

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

Return a parameter, or empty string if undefined.

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

Return a parameter, or empty string if undefined.

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.

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

Return the password component of the URI.

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

Return the port component of the URI.

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

Return the user name component of the URI.

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

Returns true if this object was not default-constructed.

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

Add a parameter.

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

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

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

const StreamBaseURI sb::StreamBaseURI::DEFAULT
static

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

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

The default container name.

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

The default container name.

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

The default StreamBase port (10000).

StreamBaseURI const sb::StreamBaseURI::DEFAULT_URI
static

The default URI.

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

No container specification.

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

URI parameter used for password.

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

The system container name.

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

URI parameter used for username.

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

URI parameter used for username.


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