OpenASIP  2.0
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Matcher Class Referenceabstract

#include <Matcher.hh>

Inheritance diagram for Matcher:
Inheritance graph
Collaboration diagram for Matcher:
Collaboration graph

Public Member Functions

 Matcher (const EntryKeyFieldProperty *type)
 
virtual ~Matcher ()
 
virtual void quickFilter (const CostDBEntryKey &searchKey, CostDBTypes::EntryTable &components)=0
 
virtual void filter (const CostDBEntryKey &, CostDBTypes::EntryTable &)=0
 

Protected Member Functions

const EntryKeyFieldPropertyfieldType () const
 
bool onlyThisFieldDiffers (const EntryKeyFieldProperty *type, const CostDBEntry &entry1, const CostDBEntry &entry2) const
 

Private Member Functions

 Matcher (const Matcher &)
 Copying not allowed. More...
 
Matcheroperator= (const Matcher &)
 Assignment not allowed. More...
 

Private Attributes

const EntryKeyFieldPropertyfieldType_
 Type of the field on which filtering is applied to. More...
 

Detailed Description

Interface for searching database entries.

Search is based only on the information of one specific field of the entries. Using the interface for queries requires at first a QuickFilter() call and then a Filter() call.

Definition at line 50 of file Matcher.hh.

Constructor & Destructor Documentation

◆ Matcher() [1/2]

Matcher::Matcher ( const EntryKeyFieldProperty type)

Constructor.

Marks the field type to which a search is aplied.

Parameters
typeType of the field.

Definition at line 44 of file Matcher.cc.

44  :
45  fieldType_(type) {
46 }

◆ ~Matcher()

Matcher::~Matcher ( )
virtual

Destructor.

Definition at line 51 of file Matcher.cc.

51  {
52 }

◆ Matcher() [2/2]

Matcher::Matcher ( const Matcher )
private

Copying not allowed.

Member Function Documentation

◆ fieldType()

const EntryKeyFieldProperty* Matcher::fieldType ( ) const
protected

◆ filter()

virtual void Matcher::filter ( const CostDBEntryKey ,
CostDBTypes::EntryTable  
)
pure virtual

◆ onlyThisFieldDiffers()

bool Matcher::onlyThisFieldDiffers ( const EntryKeyFieldProperty type,
const CostDBEntry entry1,
const CostDBEntry entry2 
) const
protected

Checks if only a specific field of two entries is different and all other fields have equal values.

Parameters
typeType of the field.
entry1An entry.
entry2An entry.
Returns
True if only one field of two entries is different, otherwise false.

Definition at line 64 of file Matcher.cc.

67  {
68 
69  for (int i = 0; i < entry1.fieldCount(); i++) {
70  const EntryKeyField& j = entry1.field(i);
71 
72  if (!j.isEqual(entry2.keyFieldOfType(*j.type())) &&
73  !(j.type() == type)) {
74 
75  return false;
76  }
77  }
78  return true;
79 }

References CostDBEntry::field(), CostDBEntry::fieldCount(), EntryKeyField::isEqual(), CostDBEntry::keyFieldOfType(), and EntryKeyField::type().

Referenced by Interpolation::filter().

Here is the call graph for this function:

◆ operator=()

Matcher& Matcher::operator= ( const Matcher )
private

Assignment not allowed.

◆ quickFilter()

virtual void Matcher::quickFilter ( const CostDBEntryKey searchKey,
CostDBTypes::EntryTable components 
)
pure virtual

Filters out unnecessary entries in linear time.

Parameters
searchKeySearch key.
componentsEntries from which to find. Updated to contain entries that matched the search request.

Implemented in SelectSet< select, unSelect >, SelectSet<&EntryKeyField::isGreater, &EntryKeyField::isSmaller >, SelectSet<&EntryKeyField::isSmaller, &EntryKeyField::isGreater >, ExactMatch, and Interpolation.

Member Data Documentation

◆ fieldType_

const EntryKeyFieldProperty* Matcher::fieldType_
private

Type of the field on which filtering is applied to.

Definition at line 85 of file Matcher.hh.


The documentation for this class was generated from the following files:
CostDBEntry::fieldCount
int fieldCount() const
Definition: CostDBEntry.cc:169
EntryKeyField
Definition: EntryKeyField.hh:45
Matcher::fieldType_
const EntryKeyFieldProperty * fieldType_
Type of the field on which filtering is applied to.
Definition: Matcher.hh:85
EntryKeyField::type
const EntryKeyFieldProperty * type() const
CostDBEntry::keyFieldOfType
EntryKeyField keyFieldOfType(const EntryKeyFieldProperty &type) const
Definition: CostDBEntry.cc:148
CostDBEntry::field
const EntryKeyField & field(int index) const
Definition: CostDBEntry.cc:182
EntryKeyField::isEqual
bool isEqual(const EntryKeyField &field) const
Definition: EntryKeyField.cc:92