OpenASIP  2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
EntryKeyProperty Class Reference

#include <EntryKeyProperty.hh>

Collaboration diagram for EntryKeyProperty:
Collaboration graph

Public Member Functions

 ~EntryKeyProperty ()
 
std::string name () const
 
EntryKeyFieldPropertycreateFieldProperty (std::string field)
 
EntryKeyFieldPropertyfieldProperty (std::string field) const
 

Static Public Member Functions

static EntryKeyPropertycreate (std::string type)
 
static EntryKeyPropertyfind (std::string type)
 
static void destroy ()
 

Protected Member Functions

 EntryKeyProperty (std::string propertyName)
 

Private Types

typedef std::vector< EntryKeyFieldProperty * > FieldPropertyTable
 Table of field types. More...
 
typedef std::vector< EntryKeyProperty * > EntryPropertyTable
 Table of entry types. More...
 

Private Member Functions

 EntryKeyProperty (const EntryKeyProperty &)
 Copying not allowed. More...
 
EntryKeyPropertyoperator= (const EntryKeyProperty &)
 Assignment not allowed. More...
 

Private Attributes

std::string name_
 Entry type. More...
 
FieldPropertyTable entryFields_
 Field types of the entry type. More...
 

Static Private Attributes

static EntryPropertyTable entryTypes_
 All known entry types. More...
 

Detailed Description

Represents a type of an CostDBEntryKey which contains types of its fields, that is, EntryKeyFields.

Using the EntryKeyProperty usually includes finding of the specific EntryKeyProperty with Find(). Then the types of EntryKeyProperty's fields can be accessed using FieldProperty(). Creation of the types is done similarly using first Create() and then CreateFieldProperty().

For each CostDBEntryKey an EntryKeyProperty should be assigned.

Definition at line 57 of file EntryKeyProperty.hh.

Member Typedef Documentation

◆ EntryPropertyTable

Table of entry types.

Definition at line 76 of file EntryKeyProperty.hh.

◆ FieldPropertyTable

Table of field types.

Definition at line 74 of file EntryKeyProperty.hh.

Constructor & Destructor Documentation

◆ ~EntryKeyProperty()

EntryKeyProperty::~EntryKeyProperty ( )

Destructor.

Deallocates memory reserved for field types.

Definition at line 59 of file EntryKeyProperty.cc.

59  {
60 
61  for (FieldPropertyTable::iterator i = entryFields_.begin();
62  i != entryFields_.end(); i++) {
63 
64  assert(*i != NULL);
65  delete *i;
66  *i = NULL;
67  }
68 }

References assert, and entryFields_.

◆ EntryKeyProperty() [1/2]

EntryKeyProperty::EntryKeyProperty ( std::string  propertyName)
protected

Constructor.

Parameters
propertyNameType of entry.

Definition at line 51 of file EntryKeyProperty.cc.

51  : name_(propertyName) {
52 }

Referenced by create().

◆ EntryKeyProperty() [2/2]

EntryKeyProperty::EntryKeyProperty ( const EntryKeyProperty )
private

Copying not allowed.

Member Function Documentation

◆ create()

EntryKeyProperty * EntryKeyProperty::create ( std::string  type)
static

Creates entry type.

If exists, returns the old one.

Parameters
typeEntry type.
Returns
Entry type.

Definition at line 125 of file EntryKeyProperty.cc.

125  {
126 
127  for (EntryPropertyTable::const_iterator i = entryTypes_.begin();
128  i != entryTypes_.end(); i++) {
129 
130  if ((*i)->name() == type) {
131  return (*i);
132  }
133  }
134 
135  EntryKeyProperty* newType = new EntryKeyProperty(type);
136  entryTypes_.push_back(newType);
137  return newType;
138 }

References EntryKeyProperty(), and entryTypes_.

Referenced by CostDatabase::CostDatabase().

Here is the call graph for this function:

◆ createFieldProperty()

EntryKeyFieldProperty * EntryKeyProperty::createFieldProperty ( std::string  field)

Creates field type.

If exists, returns the old one.

Parameters
fieldType of field.
Returns
Field type.

Definition at line 79 of file EntryKeyProperty.cc.

79  {
80 
81  for (FieldPropertyTable::const_iterator i = entryFields_.begin();
82  i != entryFields_.end(); i++) {
83 
84  if ((*i)->name() == field) {
85  return (*i);
86  }
87  }
88 
89  EntryKeyFieldProperty* newField = new EntryKeyFieldProperty(field, this);
90  entryFields_.push_back(newField);
91  return newField;
92 }

References entryFields_.

Referenced by CostDatabase::CostDatabase().

◆ destroy()

void EntryKeyProperty::destroy ( )
static

Deallocates memory reserved for entry types.

Definition at line 166 of file EntryKeyProperty.cc.

166  {
167 
168  for (EntryPropertyTable::iterator i = entryTypes_.begin();
169  i != entryTypes_.end(); i++) {
170 
171  assert(*i != NULL);
172  delete *i;
173  *i = NULL;
174  }
175  entryTypes_.resize(0);
176 }

References assert, and entryTypes_.

◆ fieldProperty()

EntryKeyFieldProperty * EntryKeyProperty::fieldProperty ( std::string  field) const

Finds field type.

If not found, exits.

Parameters
fieldField type.
Returns
Field type.
Exceptions
KeyNotFoundRequested field was not found.

Definition at line 104 of file EntryKeyProperty.cc.

104  {
105  for (FieldPropertyTable::const_iterator i = entryFields_.begin();
106  i != entryFields_.end(); i++) {
107 
108  if ((*i)->name() == field) {
109  return (*i);
110  }
111  }
112  throw KeyNotFound(__FILE__, __LINE__, "EntryKeyProperty::fieldProperty");
113  return NULL; // stupid return statement to make compiler quiet
114 }

References entryFields_.

Referenced by CostDatabase::buildBuses(), CostDatabase::buildFunctionUnits(), CostDatabase::buildRegisterFiles(), CostDatabase::buildSockets(), InterpolatingRFEstimator::createSearch(), InterpolatingFUEstimator::createSearch(), InterpolatingFUEstimator::createSearchTypes(), InterpolatingRFEstimator::createSearchTypes(), and CostDBEntryKey::keyFieldOfType().

◆ find()

EntryKeyProperty * EntryKeyProperty::find ( std::string  type)
static

Finds entry type.

If not found, exits.

Parameters
typeEntry type.
Returns
Entry type.
Exceptions
KeyNotFoundRequested field was not found.

Definition at line 150 of file EntryKeyProperty.cc.

150  {
151  for (EntryPropertyTable::const_iterator i = entryTypes_.begin();
152  i != entryTypes_.end(); i++) {
153 
154  if ((*i)->name() == type) {
155  return (*i);
156  }
157  }
158  throw KeyNotFound(__FILE__, __LINE__, "EntryKeyProperty::find");
159  return NULL; // stupid return statement to make compiler quiet
160 }

References entryTypes_.

Referenced by CostDatabase::buildBuses(), CostDatabase::buildFunctionUnits(), CostDatabase::buildRegisterFiles(), CostDatabase::buildSockets(), InterpolatingFUEstimator::initializeEstimator(), and InterpolatingRFEstimator::initializeEstimator().

◆ name()

std::string EntryKeyProperty::name ( ) const

◆ operator=()

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

Assignment not allowed.

Member Data Documentation

◆ entryFields_

FieldPropertyTable EntryKeyProperty::entryFields_
private

Field types of the entry type.

Definition at line 81 of file EntryKeyProperty.hh.

Referenced by createFieldProperty(), fieldProperty(), and ~EntryKeyProperty().

◆ entryTypes_

EntryKeyProperty::EntryPropertyTable EntryKeyProperty::entryTypes_
staticprivate

All known entry types.

Definition at line 84 of file EntryKeyProperty.hh.

Referenced by create(), destroy(), and find().

◆ name_

std::string EntryKeyProperty::name_
private

Entry type.

Definition at line 79 of file EntryKeyProperty.hh.


The documentation for this class was generated from the following files:
EntryKeyFieldProperty
Definition: EntryKeyFieldProperty.hh:47
EntryKeyProperty::EntryKeyProperty
EntryKeyProperty(std::string propertyName)
Definition: EntryKeyProperty.cc:51
assert
#define assert(condition)
Definition: Application.hh:86
EntryKeyProperty
Definition: EntryKeyProperty.hh:57
EntryKeyProperty::name_
std::string name_
Entry type.
Definition: EntryKeyProperty.hh:79
KeyNotFound
Definition: Exception.hh:285
EntryKeyProperty::entryTypes_
static EntryPropertyTable entryTypes_
All known entry types.
Definition: EntryKeyProperty.hh:84
EntryKeyProperty::entryFields_
FieldPropertyTable entryFields_
Field types of the entry type.
Definition: EntryKeyProperty.hh:81