strus  0.17
metaDataRestrictionInterface.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
9 #ifndef _STRUS_METADATA_RESTRICTION_INTERFACE_HPP_INCLUDED
10 #define _STRUS_METADATA_RESTRICTION_INTERFACE_HPP_INCLUDED
11 #include "strus/numericVariant.hpp"
12 #include "strus/index.hpp"
13 #include <string>
14 
15 namespace strus {
16 
18 class MetaDataRestrictionInstanceInterface;
19 
22 {
23 public:
26  {}
27 
30  {
37  };
40 
42  static const char* compareOperatorStr( CompareOperator op)
43  {
44  static const char* ar[] = {"<","<=","==","!=",">",">=",0};
45  return ar[ (int)op];
46  }
48  static const char* compareOperatorName( CompareOperator op)
49  {
50  static const char* ar[] = {"lt","le","eq","ne","gt","ge",0};
51  return ar[ (int)op];
52  }
53 
62  virtual void addCondition(
63  const CompareOperator& opr,
64  const std::string& name,
65  const NumericVariant& operand,
66  bool newGroup=true)=0;
67 
71 
74  virtual std::string tostring() const=0;
75 };
76 
77 } //namespace
78 #endif
79 
static const char * compareOperatorName(CompareOperator op)
Get the operator name as string.
Definition: metaDataRestrictionInterface.hpp:48
operator '==' respecting machine epsilon
Definition: metaDataRestrictionInterface.hpp:33
Class for building up a metadata restriction.
Definition: metaDataRestrictionInstanceInterface.hpp:18
Class for building up a metadata restriction.
Definition: metaDataRestrictionInterface.hpp:21
Numeric types used for local and global indices.
operator '>' respecting machine epsilon
Definition: metaDataRestrictionInterface.hpp:35
operator '<=' respecting machine epsilon
Definition: metaDataRestrictionInterface.hpp:32
static const char * compareOperatorStr(CompareOperator op)
Get the operator as string.
Definition: metaDataRestrictionInterface.hpp:42
virtual MetaDataRestrictionInstanceInterface * createInstance() const =0
Create an instance of this metadata restriction.
virtual ~MetaDataRestrictionInterface()
Destructor.
Definition: metaDataRestrictionInterface.hpp:25
CompareOperator
Comparison operator for restrictions.
Definition: metaDataRestrictionInterface.hpp:29
virtual std::string tostring() const =0
Return a readable string representation of the expression.
operator '<' respecting machine epsilon
Definition: metaDataRestrictionInterface.hpp:31
operator '>=' respecting machine epsilon
Definition: metaDataRestrictionInterface.hpp:36
virtual void addCondition(const CompareOperator &opr, const std::string &name, const NumericVariant &operand, bool newGroup=true)=0
Add a condition on the metadata to this metadata restriction.
operator '!=' respecting machine epsilon
Definition: metaDataRestrictionInterface.hpp:34
Definition: metaDataRestrictionInterface.hpp:39