OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
EntryKeyField Class Reference

#include <EntryKeyField.hh>

Collaboration diagram for EntryKeyField:
Collaboration graph

Public Member Functions

 EntryKeyField (EntryKeyData *fieldData, const EntryKeyFieldProperty *type)
 
virtual ~EntryKeyField ()
 
 EntryKeyField (const EntryKeyField &old)
 
EntryKeyFieldoperator= (const EntryKeyField &old)
 
bool isEqual (const EntryKeyField &field) const
 
bool isGreater (const EntryKeyField &field) const
 
bool isSmaller (const EntryKeyField &field) const
 
double coefficient (const EntryKeyField &field1, const EntryKeyField &field2) const
 
std::string toString () const
 
const EntryKeyFieldPropertytype () const
 

Private Attributes

EntryKeyDatadata_
 Value of the field. More...
 
const EntryKeyFieldPropertyproperties_
 Type of the field. More...
 

Detailed Description

Represents a field containing a value and a type.

Definition at line 45 of file EntryKeyField.hh.

Constructor & Destructor Documentation

◆ EntryKeyField() [1/2]

EntryKeyField::EntryKeyField ( EntryKeyData fieldData,
const EntryKeyFieldProperty type 
)

Constructor.

Parameters
fieldDataValue of the field.
typeType of the field.

Definition at line 44 of file EntryKeyField.cc.

46  :
47  data_(fieldData), properties_(type) {
48 }

◆ ~EntryKeyField()

EntryKeyField::~EntryKeyField ( )
virtual

Destructor.

Deallocates memory reserved for the value of the field.

Definition at line 64 of file EntryKeyField.cc.

64  {
65  assert(data_ != NULL);
66  delete data_;
67  data_ = NULL;
68 }

References assert, and data_.

◆ EntryKeyField() [2/2]

EntryKeyField::EntryKeyField ( const EntryKeyField old)

Copy constructor.

Parameters
oldA field.

Definition at line 55 of file EntryKeyField.cc.

55  :
56  data_(old.data_->copy()), properties_(old.properties_) {
57 }

Member Function Documentation

◆ coefficient()

double EntryKeyField::coefficient ( const EntryKeyField field1,
const EntryKeyField field2 
) const

Returns the relative position between two fields.

Returns the field's relative position to the first field compared to the second. For example, if this field has value 14, the first field has 10 and the second 20, relative position would be 0.4.

Parameters
field1First field.
field2Second field.
Returns
The relative position between two fields.

Definition at line 130 of file EntryKeyField.cc.

132  {
133 
134  return data_->coefficient(field1.data_, field2.data_);
135 }

References EntryKeyData::coefficient(), and data_.

Referenced by CostDBEntry::CostDBEntry().

Here is the call graph for this function:

◆ isEqual()

bool EntryKeyField::isEqual ( const EntryKeyField field) const

Checks if two fields are equal.

Parameters
fieldA field.
Returns
True if two integers are equal, otherwise false.

Definition at line 92 of file EntryKeyField.cc.

92  {
93  return data_->isEqual(field.data_);
94 }

References data_, and EntryKeyData::isEqual().

Referenced by Interpolation::filter(), and Matcher::onlyThisFieldDiffers().

Here is the call graph for this function:

◆ isGreater()

bool EntryKeyField::isGreater ( const EntryKeyField field) const

Checks if this field is greater than another field.

Parameters
fieldA field.
Returns
True if this field is greater than another field, otherwise false.

Definition at line 103 of file EntryKeyField.cc.

103  {
104  return data_->isGreater(field.data_);
105 }

References data_, and EntryKeyData::isGreater().

Referenced by Interpolation::filter().

Here is the call graph for this function:

◆ isSmaller()

bool EntryKeyField::isSmaller ( const EntryKeyField field) const

Checks if this field is smaller than another field.

Parameters
fieldA field.
Returns
True if this field is smaller than another field, otherwise false.

Definition at line 114 of file EntryKeyField.cc.

114  {
115  return data_->isSmaller(field.data_);
116 }

References data_, and EntryKeyData::isSmaller().

Referenced by Interpolation::filter().

Here is the call graph for this function:

◆ operator=()

EntryKeyField & EntryKeyField::operator= ( const EntryKeyField old)

Assignment operator.

Parameters
oldA field.
Returns
A copy of the field.

Definition at line 77 of file EntryKeyField.cc.

77  {
78  if (this != &old) {
79  data_ = old.data_->copy();
81  }
82  return *this;
83 }

References EntryKeyData::copy(), data_, and properties_.

Here is the call graph for this function:

◆ toString()

std::string EntryKeyField::toString ( ) const

Returns value of the field as a string.

Returns
Value of the field as a string.

Definition at line 143 of file EntryKeyField.cc.

143  {
144  return data_->toString();
145 }

References data_, and EntryKeyData::toString().

Here is the call graph for this function:

◆ type()

const EntryKeyFieldProperty* EntryKeyField::type ( ) const

Member Data Documentation

◆ data_

EntryKeyData* EntryKeyField::data_
private

Value of the field.

Definition at line 62 of file EntryKeyField.hh.

Referenced by coefficient(), isEqual(), isGreater(), isSmaller(), operator=(), toString(), and ~EntryKeyField().

◆ properties_

const EntryKeyFieldProperty* EntryKeyField::properties_
private

Type of the field.

Definition at line 64 of file EntryKeyField.hh.

Referenced by operator=().


The documentation for this class was generated from the following files:
assert
#define assert(condition)
Definition: Application.hh:86
EntryKeyData::coefficient
virtual double coefficient(const EntryKeyData *, const EntryKeyData *) const =0
Returns the relative position between two data.
EntryKeyField::type
const EntryKeyFieldProperty * type() const
EntryKeyData::isEqual
virtual bool isEqual(const EntryKeyData *) const =0
Checks if two data are equal.
EntryKeyData::copy
virtual EntryKeyData * copy() const =0
Copies data.
EntryKeyData::isGreater
virtual bool isGreater(const EntryKeyData *) const =0
Checks if this data is greater than another data.
EntryKeyField::properties_
const EntryKeyFieldProperty * properties_
Type of the field.
Definition: EntryKeyField.hh:64
EntryKeyData::isSmaller
virtual bool isSmaller(const EntryKeyData *) const =0
Checks if this data is smaller than another data.
EntryKeyField::data_
EntryKeyData * data_
Value of the field.
Definition: EntryKeyField.hh:62
EntryKeyData::toString
virtual std::string toString() const =0
Converts the data into a string.