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

#include <EntryKeyData.hh>

Inheritance diagram for EntryKeyDataBool:
Inheritance graph
Collaboration diagram for EntryKeyDataBool:
Collaboration graph

Public Member Functions

 EntryKeyDataBool ()
 
 EntryKeyDataBool (bool fieldData)
 
virtual ~EntryKeyDataBool ()
 
EntryKeyDatacopy () const
 
bool isEqual (const EntryKeyData *fieldData) const
 
bool isGreater (const EntryKeyData *fieldData) const
 
bool isSmaller (const EntryKeyData *fieldData) const
 
double coefficient (const EntryKeyData *data1, const EntryKeyData *data2) const
 
std::string toString () const
 
- Public Member Functions inherited from EntryKeyData
 EntryKeyData ()
 
virtual ~EntryKeyData ()
 

Private Member Functions

 EntryKeyDataBool (const EntryKeyDataBool &)
 Copying not allowed. More...
 
EntryKeyDataBooloperator= (const EntryKeyDataBool &)
 Assignment not allowed. More...
 

Private Attributes

bool data_
 Boolean data. More...
 

Detailed Description

Implementation for boolean type of data.

Definition at line 166 of file EntryKeyData.hh.

Constructor & Destructor Documentation

◆ EntryKeyDataBool() [1/3]

EntryKeyDataBool::EntryKeyDataBool ( )

Default constructor.

Definition at line 481 of file EntryKeyData.cc.

481  : data_() {
482 }

Referenced by copy().

◆ EntryKeyDataBool() [2/3]

EntryKeyDataBool::EntryKeyDataBool ( bool  fieldData)

Constructor.

Parameters
fieldDataA boolean.

Definition at line 489 of file EntryKeyData.cc.

489  : data_(fieldData) {
490 }

◆ ~EntryKeyDataBool()

EntryKeyDataBool::~EntryKeyDataBool ( )
virtual

Destructor.

Definition at line 495 of file EntryKeyData.cc.

495  {
496 }

◆ EntryKeyDataBool() [3/3]

EntryKeyDataBool::EntryKeyDataBool ( const EntryKeyDataBool )
private

Copying not allowed.

Member Function Documentation

◆ coefficient()

double EntryKeyDataBool::coefficient ( const EntryKeyData data1,
const EntryKeyData data2 
) const
virtual

Cannot be called for EntryKeyDataBool.

Booleans cannot be compared with greater of smaller and no coefficient can be counted.

Parameters
data1Nothing.
data2Nothing.
Returns
Nothing
Exceptions
WrongSubclassGiven data type was illegal.

Implements EntryKeyData.

Definition at line 573 of file EntryKeyData.cc.

573  {
574  throw WrongSubclass(__FILE__, __LINE__,
575  "EntryKeyDataBool::coefficient");
576  return 0.0; // stupid return statement to keep compiler quiet
577 }

◆ copy()

EntryKeyData * EntryKeyDataBool::copy ( ) const
virtual

Copies the boolean.

Client is responsible of deallocating the memory reserved for the returned object.

Returns
A copy of the boolean.

Implements EntryKeyData.

Definition at line 507 of file EntryKeyData.cc.

507  {
508  return new EntryKeyDataBool(data_);
509 }

References data_, and EntryKeyDataBool().

Here is the call graph for this function:

◆ isEqual()

bool EntryKeyDataBool::isEqual ( const EntryKeyData fieldData) const
virtual

Checks if two booleans are equal.

Cannot compare to other data types.

Parameters
fieldDataBoolean.
Returns
True if two booleans are equal.
Exceptions
WrongSubclassGiven data type was illegal.

Implements EntryKeyData.

Definition at line 521 of file EntryKeyData.cc.

521  {
522  EntryKeyDataBool* data = dynamic_cast<EntryKeyDataBool*>(
523  const_cast<EntryKeyData*>(fieldData));
524  if (data == NULL) {
525  throw WrongSubclass(__FILE__, __LINE__,
526  "EntryKeyDataBool::isEqual");
527  }
528  return data_ == data->data_;
529 }

References data_.

◆ isGreater()

bool EntryKeyDataBool::isGreater ( const EntryKeyData fieldData) const
virtual

Checks if another operation set is greater.

Cannot compare to other data types. You cannot say which is greater in case of booleans and false is returned always.

Parameters
fieldDataBoolen.
Returns
Always false.
Exceptions
WrongSubclassGiven data type was illegal.

Implements EntryKeyData.

Definition at line 542 of file EntryKeyData.cc.

542  {
543  return false;
544 }

◆ isSmaller()

bool EntryKeyDataBool::isSmaller ( const EntryKeyData fieldData) const
virtual

Checks if this operation set is smaller than another set.

Cannot compare to other data types. You cannot say which is greater in case of booleans and true is returned always.

Parameters
fieldDataBoolean.
Returns
Always true.
Exceptions
WrongSubclassGiven data type was illegal.

Implements EntryKeyData.

Definition at line 557 of file EntryKeyData.cc.

557  {
558  return true;
559 }

◆ operator=()

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

Assignment not allowed.

◆ toString()

std::string EntryKeyDataBool::toString ( ) const
virtual

Converts the boolean into a string.

Returns
Boolean as a string.

Implements EntryKeyData.

Definition at line 585 of file EntryKeyData.cc.

585  {
586 
587  if (data_) {
588  return "true";
589  } else {
590  return "false";
591  }
592 }

References data_.

Member Data Documentation

◆ data_

bool EntryKeyDataBool::data_
private

Boolean data.

Definition at line 182 of file EntryKeyData.hh.

Referenced by copy(), isEqual(), and toString().


The documentation for this class was generated from the following files:
EntryKeyDataBool::data_
bool data_
Boolean data.
Definition: EntryKeyData.hh:182
EntryKeyData
Definition: EntryKeyData.hh:53
WrongSubclass
Definition: Exception.hh:336
EntryKeyDataBool::EntryKeyDataBool
EntryKeyDataBool()
Definition: EntryKeyData.cc:481
EntryKeyDataBool
Definition: EntryKeyData.hh:166