1.00.0
C++ Simulated Travel Demand Generation Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Friends
Pages
DBParams.hpp
Go to the documentation of this file.
1
#ifndef __TRADEMGEN_DBPARAMS_HPP
2
#define __TRADEMGEN_DBPARAMS_HPP
3
4
// //////////////////////////////////////////////////////////////////////
5
// Import section
6
// //////////////////////////////////////////////////////////////////////
7
// STL
8
#include <iosfwd>
9
#include <string>
10
// Trademgen
11
#include <
trademgen/TRADEMGEN_Types.hpp
>
12
#include <
trademgen/TRADEMGEN_Abstract.hpp
>
13
14
namespace
TRADEMGEN {
15
17
typedef
std::list<std::string>
DBParamsNameList_T
;
18
19
21
struct
DBParams
:
public
TRADEMGEN_Abstract
{
22
public
:
23
// ///////// Getters ////////
25
std::string
getUser
()
const
{
26
return
_user;
27
}
28
30
std::string
getPassword
()
const
{
31
return
_passwd;
32
}
33
35
std::string
getHost
()
const
{
36
return
_host;
37
}
38
40
std::string
getPort
()
const
{
41
return
_port;
42
}
43
45
std::string
getDBName
()
const
{
46
return
_dbname;
47
}
48
49
50
// ///////// Setters //////////
52
void
setUser
(
const
std::string& iUser) {
53
_user = iUser;
54
}
55
57
void
setPassword
(
const
std::string& iPasswd) {
58
_passwd = iPasswd;
59
}
60
62
void
setHost
(
const
std::string& iHost) {
63
_host = iHost;
64
}
65
67
void
setPort
(
const
std::string& iPort) {
68
_port = iPort;
69
}
70
72
void
setDBName
(
const
std::string& iDBName) {
73
_dbname = iDBName;
74
}
75
76
77
public
:
78
// ///////// Busines methods ////////
80
bool
check
()
const
{
81
if
(_user.empty() ==
true
|| _passwd.empty() ==
true
82
|| _host.empty() ==
true
|| _port.empty()
83
|| _dbname.empty() ==
true
) {
84
return
false
;
85
}
86
return
true
;
87
}
88
89
public
:
90
// ///////// Display methods ////////
93
void
toStream
(std::ostream& ioOut)
const
{
94
ioOut <<
toString
();
95
}
96
99
void
fromStream
(std::istream&) {
100
}
101
103
std::string
toShortString
()
const
{
104
std::ostringstream oStr;
105
oStr << _dbname <<
"."
<< _user <<
"@"
<< _host <<
":"
<< _port;
106
return
oStr.str();
107
}
108
110
std::string
toString
()
const
{
111
std::ostringstream oStr;
112
oStr << _dbname <<
"."
<< _user <<
"@"
<< _host <<
":"
<< _port;
113
return
oStr.str();
114
}
115
116
117
public
:
119
DBParams
(
const
std::string& iDBUser,
const
std::string& iDBPasswd,
120
const
std::string& iDBHost,
const
std::string& iDBPort,
121
const
std::string& iDBName)
122
: _user (iDBUser), _passwd (iDBPasswd), _host (iDBHost), _port (iDBPort),
123
_dbname (iDBName) {
124
}
125
127
// DBParams ();
129
// DBParams (const DBParams&);
130
132
virtual
~DBParams
() {}
133
134
135
private
:
136
// /////// Attributes /////////
138
std::string _user;
140
std::string _passwd;
142
std::string _host;
144
std::string _port;
146
std::string _dbname;
147
};
148
149
}
150
#endif // __TRADEMGEN_DBPARAMS_HPP
Generated on Sun Dec 23 2012 17:58:29 for TraDemGen by
1.8.1.1