rasdaman complete source
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RasdamanConnector Class Reference

#include <RasdamanConnector.h>

Public Member Functions

 RasdamanConnector (int rasport, int pgport, std::string hostname, std::string RasDbName, std::string PetaDbName, std::string RasUser, std::string PetaUser, std::string RasPasswd, std::string PetaPasswd)
 
 RasdamanConnector (std::string configfile)
 
virtual ~RasdamanConnector ()
 
void connect ()
 
void disconnect ()
 
const r_Database & getDatabase ()
 
r_Database::access_status getStatus ()
 
int getPgPort ()
 
int getRasPort ()
 
std::string getHostName ()
 
std::string getRasDbName ()
 
std::string getPetaDbName ()
 
std::string getRasUser ()
 
std::string getPetaUser ()
 
std::string getPetaPGConnectString (void)
 
const PGconn * getPetaConnection (void)
 
std::string getRasPGConnectString (void)
 
const PGconn * getRasConnection (void)
 

Protected Member Functions

 RasdamanConnector ()
 
int parseConfig (std::string configfile) throw (r_Error)
 
std::string removeWhiteSpaces (std::string str)
 

Protected Attributes

int m_iRasPort
 
int m_iPgPort
 
std::string m_sHostName
 
std::string m_RasDbName
 
std::string m_PetaDbName
 
std::string m_RasUser
 
std::string m_PetaUser
 
std::string m_RasPasswd
 
std::string m_PetaPasswd
 
r_Database m_db
 
PGconn * m_petaconn
 
PGconn * m_rasconn
 

Constructor & Destructor Documentation

RasdamanConnector::RasdamanConnector ( int  rasport,
int  pgport,
std::string  hostname,
std::string  RasDbName,
std::string  PetaDbName,
std::string  RasUser,
std::string  PetaUser,
std::string  RasPasswd,
std::string  PetaPasswd 
)

This constructor accepts individual connection parameters.

Parameters
rasportrasmgr port (e.g. 7001)
pgportpostgres server port (e.g. 5432)
hostnamehostname (e.g. localhost)
RasDbNamerasdaman data base name (e.g. RASBASE)
PetaDbNamepetascope data base name
RasUserrasdaman data base user
PetaUserpetascope data base user
RasPasswdpassword of rasdaman data base user
PetaPasswdpassword of petascope data base user
RasdamanConnector::RasdamanConnector ( std::string  configfile)

This constructor allows parsing a configuration file, which contains the required connection parameters. The configuration file is expected to have the following structure (sample file):

host=localhost rasport=7001 pgport=5432 rasdbname=RASBASE petadbname=PETASCOPE rasuser=rasdaman raspassword=rasdaman petauser=rasdaman petapassword=rasdaman

Parameters
configfilefilename of the configuration file
virtual RasdamanConnector::~RasdamanConnector ( )
virtual
RasdamanConnector::RasdamanConnector ( )
protected

purposely non-available constructor

Member Function Documentation

void RasdamanConnector::connect ( )

Establishes a connection to the rasdaman and petascope data base(s).

void RasdamanConnector::disconnect ( )

Closes the connection to the rasdaman and petascope data base(s).

const r_Database& RasdamanConnector::getDatabase ( )
inline

Yields access to the rasdaman data base object

References m_db.

std::string RasdamanConnector::getHostName ( )
inline

get configured connection details

References m_sHostName.

const PGconn* RasdamanConnector::getPetaConnection ( void  )

get a connection pointer to the petascope data base

std::string RasdamanConnector::getPetaDbName ( )
inline

get configured connection details

References m_PetaDbName.

std::string RasdamanConnector::getPetaPGConnectString ( void  )

get a connection string for the petascope data base which can be used with PQconnectdb()

std::string RasdamanConnector::getPetaUser ( )
inline

get configured connection details

References m_PetaUser.

int RasdamanConnector::getPgPort ( )
inline

Returns the port on which rasdaman tries to connect to the postgres server.

References m_iPgPort.

const PGconn* RasdamanConnector::getRasConnection ( void  )

get a connection pointer to the rasdaman data base

std::string RasdamanConnector::getRasDbName ( )
inline

get configured connection details

References m_RasDbName.

std::string RasdamanConnector::getRasPGConnectString ( void  )

get a connection string for the rasdaman data base which can be used with PQconnectdb()

int RasdamanConnector::getRasPort ( )
inline

Returns the rasmgr port

References m_iRasPort.

std::string RasdamanConnector::getRasUser ( )
inline

get configured connection details

References m_RasUser.

r_Database::access_status RasdamanConnector::getStatus ( )
inline

Returns the current rasdaman data base status.

References m_db.

int RasdamanConnector::parseConfig ( std::string  configfile)
throw (r_Error
)
protected

Parses the configuration file and sets member variables. If anything goes wrong it throws an r_Error::r_Error_NameInvalid error.

std::string RasdamanConnector::removeWhiteSpaces ( std::string  str)
protected

removes whitespaces and tabs from a given string

Member Data Documentation

r_Database RasdamanConnector::m_db
protected

rasdaman data base object

Referenced by getDatabase(), and getStatus().

int RasdamanConnector::m_iPgPort
protected

Postgres port

Referenced by getPgPort().

int RasdamanConnector::m_iRasPort
protected

rasdaman port

Referenced by getRasPort().

PGconn* RasdamanConnector::m_petaconn
protected

pointer to a petascope data base connection

std::string RasdamanConnector::m_PetaDbName
protected

petascope data base name

Referenced by getPetaDbName().

std::string RasdamanConnector::m_PetaPasswd
protected

password of petascope data base user

std::string RasdamanConnector::m_PetaUser
protected

petascope data base user

Referenced by getPetaUser().

PGconn* RasdamanConnector::m_rasconn
protected

pointer to a rasdaman data base connection

std::string RasdamanConnector::m_RasDbName
protected

rasdaman data base name

Referenced by getRasDbName().

std::string RasdamanConnector::m_RasPasswd
protected

password of rasdaman data base user

std::string RasdamanConnector::m_RasUser
protected

rasdaman data base user

Referenced by getRasUser().

std::string RasdamanConnector::m_sHostName
protected

hostname

Referenced by getHostName().


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