Xmipp  v3.23.11-Nereus
Public Member Functions | Public Attributes | List of all members
MDValueRelational Class Reference

#include <metadata_query.h>

Inheritance diagram for MDValueRelational:
Inheritance graph
[legend]
Collaboration diagram for MDValueRelational:
Collaboration graph
[legend]

Public Member Functions

template<class T >
 MDValueRelational (MDLabel label, const T &value, RelationalOp op, int limit=-1, int offset=0, MDLabel orderLabel=MDL_OBJID)
 
 MDValueRelational (const MDObject &value, RelationalOp op, int limit=-1, int offset=0, MDLabel orderLabel=MDL_OBJID)
 
 ~MDValueRelational ()
 
String opString () const
 
virtual String queryStringFunc () const
 
template<class T >
void setValue (T &value)
 
- Public Member Functions inherited from MDQuery
 MDQuery (int limit=-1, int offset=0, MDLabel orderLabel=MDL_OBJID, bool asc=true)
 
virtual ~MDQuery ()
 
String orderByString () const
 
String limitString () const
 
String whereString () const
 

Public Attributes

MDObjectvalue
 
RelationalOp op
 
- Public Attributes inherited from MDQuery
int limit
 If distint of -1 the results will be limited to this value. More...
 
int offset
 If distint of 0, offset elements will be discarded. More...
 
MDLabel orderLabel
 Label to which apply sort of the results. More...
 
bool asc
 

Detailed Description

Subclass of MDQuery and base for all relational queries. This kind of query can be used to compare some LABEL values in a column of the MetaData with an specified VALUE.

See also
RelationalOp for possible relational operations.

Definition at line 103 of file metadata_query.h.

Constructor & Destructor Documentation

◆ MDValueRelational() [1/2]

template<class T >
MDValueRelational::MDValueRelational ( MDLabel  label,
const T &  value,
RelationalOp  op,
int  limit = -1,
int  offset = 0,
MDLabel  orderLabel = MDL_OBJID 
)
inline

Definition at line 110 of file metadata_query.h.

111  {
112  this->op = op;
113  this->value = new MDObject(label, value);
114  }
int limit
If distint of -1 the results will be limited to this value.
MDLabel orderLabel
Label to which apply sort of the results.
int offset
If distint of 0, offset elements will be discarded.
MDQuery(int limit=-1, int offset=0, MDLabel orderLabel=MDL_OBJID, bool asc=true)

◆ MDValueRelational() [2/2]

MDValueRelational::MDValueRelational ( const MDObject value,
RelationalOp  op,
int  limit = -1,
int  offset = 0,
MDLabel  orderLabel = MDL_OBJID 
)
inline

Definition at line 116 of file metadata_query.h.

117  {
118  this->op = op;
119  this->value = new MDObject(value);
120  }
int limit
If distint of -1 the results will be limited to this value.
MDLabel orderLabel
Label to which apply sort of the results.
int offset
If distint of 0, offset elements will be discarded.
MDQuery(int limit=-1, int offset=0, MDLabel orderLabel=MDL_OBJID, bool asc=true)

◆ ~MDValueRelational()

MDValueRelational::~MDValueRelational ( )
inline

Definition at line 122 of file metadata_query.h.

123  {
124  delete this->value;
125  }

Member Function Documentation

◆ opString()

String MDValueRelational::opString ( ) const
inline

Definition at line 127 of file metadata_query.h.

128  {
129  switch (op)
130  {
131  case EQ:
132  return "=";
133  case NE:
134  return "!=";
135  case GT:
136  return ">";
137  case LT:
138  return "<";
139  case GE:
140  return ">=";
141  case LE:
142  return "<=";
143  default:
144  REPORT_ERROR(ERR_ARG_INCORRECT,"Unknown binary operator");
145  }
146  }
Not equal.
Less than.
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
Equal.
Incorrect argument received.
Definition: xmipp_error.h:113
Greater equal.
Greater than.
Less equal.

◆ queryStringFunc()

virtual String MDValueRelational::queryStringFunc ( ) const
inlinevirtual

Return the query string, should be overrided in subclasses

Reimplemented from MDQuery.

Definition at line 148 of file metadata_query.h.

149  {
150  return (value == NULL) ? " " : MDL::label2Str(value->label) + opString() + value->toString(false, true);
151  }
String opString() const
MDLabel label
String toString(bool withFormat=false, bool isSql=false) const
static String label2Str(const MDLabel &label)

◆ setValue()

template<class T >
void MDValueRelational::setValue ( T &  value)
inline

Definition at line 154 of file metadata_query.h.

155  {
156  this->value->setValue(value);
157  }
void setValue(const int &iv)

Member Data Documentation

◆ op

RelationalOp MDValueRelational::op

Definition at line 107 of file metadata_query.h.

◆ value

MDObject* MDValueRelational::value

Definition at line 106 of file metadata_query.h.


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