Auxiliary class for specifying selection of database data.  
 More...
#include <JSelector.hh>
 | 
|   | JSelector () | 
|   | Default constructor.  
  | 
|   | 
| template<class T >  | 
|   | JSelector (const std::string &key, const T value, const Selector::RelOp &operand=Selector::RelOp::Equal) | 
|   | Constructor.  
  | 
|   | 
| 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.  
  | 
|   | 
| template<class JClass_t >  | 
|   | JSelector (std::string JClass_t::*data_member, const std::string value, const Selector::RelOp &operand=Selector::RelOp::Equal) | 
|   | Constructor.  
  | 
|   | 
| JSelector &  | add (const JSelector &selection) | 
|   | Add selection.  
  | 
|   | 
| template<class T >  | 
| JSelector &  | add (const std::string &key, const T value, const Selector::RelOp &operand=Selector::RelOp::Equal) | 
|   | Add selection.  
  | 
|   | 
| 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.  
  | 
|   | 
| 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.  
  | 
|   | 
| JFirst_t &  | mul (const JSecond_t &object) | 
|   | Multiply with object.  
  | 
|   | 
 | 
| static const char  | EOL = ';' | 
|   | End-of-line.  
  | 
|   | 
 | 
| std::istream &  | operator>> (std::istream &in, JSelector &selector) | 
|   | Read selector from input stream.  
  | 
|   | 
| std::ostream &  | operator<< (std::ostream &out, const JSelector &selector) | 
|   | Write selector to output stream.  
  | 
|   | 
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.
   95    {
   96      add(key, value, operand);
 
   97    }
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.
  109    {
  110      add(data_member, value, operand);
 
  111    }
 
 
 
◆ 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.
  123    {
  124      add(data_member, value, operand);
 
  125    }
 
 
 
◆ add() [1/4]
Add selection. 
- Parameters
 - 
  
  
 
- Returns
 - this selection 
 
Definition at line 134 of file JDB/JSelector.hh.
  135    {
  137 
  138      copy(selection.begin(), selection.end(), back_inserter(*
this));
 
  139 
  140      return *this;
  141    }
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.
  154    {
  156 
  157      ostringstream os;
  158 
  159      os << value;
  160 
  161      push_back(Selector(
key.c_str(), os.str().c_str(), operand));
 
  162 
  163      return *this;
  164    }
 
 
 
◆ 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.
  177    {
  179    }
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.
  355    {
  356      return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
  357    }
 
 
 
◆ 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.
  205    {
  208 
  210 
  211        int operand = -1;
  212 
  214 
  215          const string::size_type pos = buffer.find(
getOperand(i).Render());
 
  216 
  217          if (pos != string::npos && (operand == -1 || 
getOperand(i).Render().length() > 
getOperand(operand).Render().length())) {
 
  218            operand = i;
  219          }
  220        }
  221 
  222        if (operand != -1) {
  223 
  224          const string::size_type pos = buffer.find(
getOperand(operand).Render());
 
  225 
  227          const string value = 
JPP::trim(buffer.substr(pos + 
getOperand(operand).Render().length()));
 
  228 
  229          if (key  .find_first_of("=!<>") == string::npos &&
  230              value.find_first_of("=!<>") == string::npos) {
  231 
  232            selector.push_back(Selector(
key.c_str(), value.c_str(), 
getOperand(operand)));
 
  233 
  234          } else {
  235 
  236            in.setstate(ios::badbit);
  237          }
  238 
  239        } else {
  240 
  241          in.setstate(ios::badbit);
  242        }
  243      }
  244 
  245      return in;
  246    }
static const char EOL
End-of-line.
 
static const int NUMBER_OF_OPERANDS
Number of available operands.
 
const Selector::RelOp & getOperand(const int index)
Get operand.
 
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.
  257    {
  258      for (const_iterator i = selector.begin(); i != selector.end(); ++i) {
  259        out << i->Name << i->RelationalOperator.Render()  << i->Value << 
JSelector::EOL << std::endl;
 
  260      }
  261 
  262      return out;
  263    }
 
 
 
◆ EOL
  
  
      
        
          | const char JDATABASE::JSelector::EOL = ';' | 
         
       
   | 
  
static   | 
  
 
 
The documentation for this class was generated from the following file: