Auxiliary class for specifying selection of database data.
More...
#include <JSelector.hh>
|
| JSelector () |
| Default constructor. More...
|
|
template<class T > |
| JSelector (const std::string &key, const T value, const Selector::RelOp &operand=Selector::RelOp::Equal) |
| Constructor. More...
|
|
template<class JClass_t , class JType_t > |
| JSelector (JType_t JClass_t::*data_member, const JType_t value, const Selector::RelOp &operand=Selector::RelOp::Equal) |
| Constructor. More...
|
|
template<class JClass_t > |
| JSelector (std::string JClass_t::*data_member, const std::string value, const Selector::RelOp &operand=Selector::RelOp::Equal) |
| Constructor. More...
|
|
JSelector & | add (const JSelector &selection) |
| Add selection. More...
|
|
template<class T > |
JSelector & | add (const std::string &key, const T value, const Selector::RelOp &operand=Selector::RelOp::Equal) |
| Add selection. More...
|
|
template<class JClass_t , class JType_t > |
JSelector & | add (JType_t JClass_t::*data_member, const JType_t value, const Selector::RelOp &operand=Selector::RelOp::Equal) |
| Add selection. More...
|
|
template<class JClass_t > |
JSelector & | add (std::string JClass_t::*data_member, const std::string &value, const Selector::RelOp &operand=Selector::RelOp::Equal) |
| Add selection. More...
|
|
JFirst_t & | mul (const JSecond_t &object) |
| Multiply with object. More...
|
|
Auxiliary class for specifying selection of database data.
Definition at line 68 of file JDB/JSelector.hh.
◆ JSelector() [1/4]
JDATABASE::JSelector::JSelector |
( |
| ) |
|
|
inline |
◆ JSelector() [2/4]
template<class T >
JDATABASE::JSelector::JSelector |
( |
const std::string & |
key, |
|
|
const T |
value, |
|
|
const Selector::RelOp & |
operand = Selector::RelOp::Equal |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
key | key |
value | value |
operand | operand |
Definition at line 94 of file JDB/JSelector.hh.
96 add(key, value, operand);
JSelector & add(const JSelector &selection)
Add selection.
◆ JSelector() [3/4]
template<class JClass_t , class JType_t >
JDATABASE::JSelector::JSelector |
( |
JType_t JClass_t::* |
data_member, |
|
|
const JType_t |
value, |
|
|
const Selector::RelOp & |
operand = Selector::RelOp::Equal |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
data_member | data member |
value | value |
operand | operand |
Definition at line 108 of file JDB/JSelector.hh.
110 add(data_member, value, operand);
◆ JSelector() [4/4]
template<class JClass_t >
JDATABASE::JSelector::JSelector |
( |
std::string JClass_t::* |
data_member, |
|
|
const std::string |
value, |
|
|
const Selector::RelOp & |
operand = Selector::RelOp::Equal |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
data_member | data member |
value | value |
operand | operand |
Definition at line 122 of file JDB/JSelector.hh.
124 add(data_member, value, operand);
◆ add() [1/4]
Add selection.
- Parameters
-
- Returns
- this selection
Definition at line 134 of file JDB/JSelector.hh.
138 copy(selection.begin(), selection.end(), back_inserter(*
this));
void copy(const Head &from, JHead &to)
Copy header from from to to.
◆ add() [2/4]
template<class T >
JSelector& JDATABASE::JSelector::add |
( |
const std::string & |
key, |
|
|
const T |
value, |
|
|
const Selector::RelOp & |
operand = Selector::RelOp::Equal |
|
) |
| |
|
inline |
Add selection.
- Parameters
-
key | key |
value | value |
operand | operand |
- Returns
- this selection
Definition at line 153 of file JDB/JSelector.hh.
161 push_back(Selector(key.c_str(), os.str().c_str(), operand));
◆ add() [3/4]
template<class JClass_t , class JType_t >
JSelector& JDATABASE::JSelector::add |
( |
JType_t JClass_t::* |
data_member, |
|
|
const JType_t |
value, |
|
|
const Selector::RelOp & |
operand = Selector::RelOp::Equal |
|
) |
| |
|
inline |
Add selection.
- Parameters
-
data_member | data member |
value | value |
operand | operand |
- Returns
- this selection
Definition at line 176 of file JDB/JSelector.hh.
const char * getColumn(JType_t JTable_t::*data_member)
Get column name.
◆ add() [4/4]
template<class JClass_t >
JSelector& JDATABASE::JSelector::add |
( |
std::string JClass_t::* |
data_member, |
|
|
const std::string & |
value, |
|
|
const Selector::RelOp & |
operand = Selector::RelOp::Equal |
|
) |
| |
|
inline |
Add selection.
- Parameters
-
data_member | data member |
value | value |
operand | operand |
- Returns
- this selection
Definition at line 191 of file JDB/JSelector.hh.
◆ mul()
template<class JFirst_t , class JSecond_t >
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul |
( |
const JSecond_t & |
object | ) |
|
|
inlineinherited |
Multiply with object.
- Parameters
-
- Returns
- result object
Definition at line 354 of file JMath.hh.
356 return static_cast<JFirst_t&
>(*this) = JFirst_t().mul(
static_cast<const JFirst_t&
>(*
this),
object);
◆ operator>>
std::istream& operator>> |
( |
std::istream & |
in, |
|
|
JSelector & |
selector |
|
) |
| |
|
friend |
Read selector from input stream.
- Parameters
-
in | input stream |
selector | selector |
- Returns
- input stream
Definition at line 204 of file JDB/JSelector.hh.
215 const string::size_type pos = buffer.find(
getOperand(i).Render());
217 if (pos != string::npos && (operand == -1 ||
getOperand(i).Render().length() >
getOperand(operand).Render().length())) {
224 const string::size_type pos = buffer.find(
getOperand(operand).Render());
226 const string key =
JPP::trim(buffer.substr(0, pos));
227 const string value =
JPP::trim(buffer.substr(pos +
getOperand(operand).Render().length()));
229 if (key .find_first_of(
"=!<>") == string::npos &&
230 value.find_first_of(
"=!<>") == string::npos) {
232 selector.push_back(Selector(key.c_str(), value.c_str(),
getOperand(operand)));
236 in.setstate(ios::badbit);
241 in.setstate(ios::badbit);
static const char EOL
End-of-line.
const Selector::RelOp & getOperand(const int index)
Get operand.
static const int NUMBER_OF_OPERANDS
Number of available operands.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
std::string trim(const std::string &buffer)
Trim string.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const JSelector & |
selector |
|
) |
| |
|
friend |
Write selector to output stream.
- Parameters
-
out | output stream |
selector | selector |
- Returns
- output stream
Definition at line 256 of file JDB/JSelector.hh.
258 for (const_iterator i = selector.begin(); i != selector.end(); ++i) {
259 out << i->Name << i->RelationalOperator.Render() << i->Value <<
JSelector::EOL << std::endl;
◆ EOL
const char JDATABASE::JSelector::EOL = ';' |
|
static |
The documentation for this class was generated from the following file: