OpenASIP  2.0
Classes | Public Member Functions | Private Attributes | List of all members
IDF::FUGenerated Class Reference

#include <FUGenerated.hh>

Inheritance diagram for IDF::FUGenerated:
Inheritance graph
Collaboration diagram for IDF::FUGenerated:
Collaboration graph

Classes

struct  DAGOperation
 
struct  Info
 

Public Member Functions

 FUGenerated ()=default
 
 FUGenerated (const std::string &name)
 
virtual ~FUGenerated ()=default
 
void loadState (const ObjectState *state) override
 
ObjectStatesaveState () const override
 
std::string name () const
 
void name (const std::string &newName)
 
std::vector< Info > & operations ()
 
const std::vector< std::string > & dagOperations () const
 
const std::vector< Info > & operations () const
 
void addOperation (const Info &op)
 
void addOperation (const DAGOperation &op)
 
const std::vector< std::string > & options () const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Private Attributes

std::string name_
 
std::vector< Infooperations_
 
std::vector< std::string > dagOperations_
 
std::vector< std::string > options_
 

Detailed Description

Definition at line 41 of file FUGenerated.hh.

Constructor & Destructor Documentation

◆ FUGenerated() [1/2]

IDF::FUGenerated::FUGenerated ( )
default

◆ FUGenerated() [2/2]

IDF::FUGenerated::FUGenerated ( const std::string &  name)

Definition at line 45 of file FUGenerated.cc.

45 : name_(name) {}

◆ ~FUGenerated()

virtual IDF::FUGenerated::~FUGenerated ( )
virtualdefault

Member Function Documentation

◆ addOperation() [1/2]

void IDF::FUGenerated::addOperation ( const DAGOperation op)

Definition at line 133 of file FUGenerated.cc.

133  {
134  dagOperations_.emplace_back(op.operationName);
135  for (auto&& subop : op.suboperations) {
136  operations_.emplace_back(subop);
137  }
138 }

References dagOperations_, IDF::FUGenerated::DAGOperation::operationName, operations_, and IDF::FUGenerated::DAGOperation::suboperations.

◆ addOperation() [2/2]

void IDF::FUGenerated::addOperation ( const Info op)

Definition at line 128 of file FUGenerated.cc.

128  {
129  operations_.emplace_back(op);
130 }

References operations_.

Referenced by Automagic::checkForGeneratableFU(), and ProGeTools::checkForGeneratableFU().

◆ dagOperations()

const std::vector< std::string > & IDF::FUGenerated::dagOperations ( ) const

Definition at line 123 of file FUGenerated.cc.

123  {
124  return dagOperations_;
125 }

References dagOperations_.

◆ loadState()

void IDF::FUGenerated::loadState ( const ObjectState state)
overridevirtual

Loads the state of the object from the given ObjectState object.

Parameters
stateObjectState object from which (and the children of which) the state is loaded.

Implements Serializable.

Definition at line 48 of file FUGenerated.cc.

48  {
50 
51  for (int i = state->childCount() - 1; i >= 0; --i) {
52  ObjectState* child = state->child(i);
53 
54  if (child->name() == TAG_OPERATION) {
55  std::string opName = child->stringAttribute(ATTRIB_NAME);
56  std::string hdbFile =
58  int id = child->childByName(TAG_OPERATION_ID)->intValue();
59  int latency = 0;
60  if (child->hasChild(TAG_OPERATION_LATENCY)) {
61  latency =
63  }
64  Info info = {opName, hdbFile, id, latency};
65  operations_.emplace_back(info);
66  } else if (child->name() == TAG_OPTION) {
67  options_.emplace_back(child->stringValue());
68  }
69  }
70 }

References IDF::ATTRIB_NAME, ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), ObjectState::hasChild(), ObjectState::intValue(), ObjectState::name(), name_, operations_, options_, ObjectState::stringAttribute(), ObjectState::stringValue(), IDF::TAG_HDBFILE, IDF::TAG_OPERATION, IDF::TAG_OPERATION_ID, IDF::TAG_OPERATION_LATENCY, and IDF::TAG_OPTION.

Referenced by IDF::MachineImplementation::loadState().

Here is the call graph for this function:

◆ name() [1/2]

std::string IDF::FUGenerated::name ( ) const

◆ name() [2/2]

void IDF::FUGenerated::name ( const std::string &  newName)

Definition at line 108 of file FUGenerated.cc.

108  {
109  name_ = newName;
110 }

References name_.

◆ operations() [1/2]

const std::vector< FUGenerated::Info > & IDF::FUGenerated::operations ( )

Definition at line 113 of file FUGenerated.cc.

113  {
114  return operations_;
115 }

References operations_.

◆ operations() [2/2]

const std::vector<Info>& IDF::FUGenerated::operations ( ) const

◆ options()

const std::vector< std::string > & IDF::FUGenerated::options ( ) const

Definition at line 141 of file FUGenerated.cc.

141  {
142  return options_;
143 }

References options_.

◆ saveState()

ObjectState * IDF::FUGenerated::saveState ( ) const
overridevirtual

Saves the objects state into an ObjectState object and maybe its child objects.

Returns
The root of the ObjectState tree created.

Implements Serializable.

Definition at line 73 of file FUGenerated.cc.

73  {
75 
77 
78  for (const auto operation : operations_) {
79  ObjectState* opState = new ObjectState(TAG_OPERATION);
80  opState->setAttribute(ATTRIB_NAME, operation.operationName);
81  ObjectState* hdbState = new ObjectState(TAG_HDBFILE);
82  hdbState->setValue(operation.hdb);
84  idState->setValue(operation.id);
85  ObjectState* latencyState = new ObjectState(TAG_OPERATION_LATENCY);
86  latencyState->setValue(operation.latency);
87  opState->addChild(hdbState);
88  opState->addChild(idState);
89  opState->addChild(latencyState);
90  state->addChild(opState);
91  }
92 
93  for (const auto option : options_) {
94  ObjectState* opState = new ObjectState(TAG_OPTION);
95  opState->setValue(option);
96  state->addChild(opState);
97  }
98 
99  return state;
100 }

References ObjectState::addChild(), IDF::ATTRIB_NAME, name_, operations_, options_, ObjectState::setAttribute(), ObjectState::setValue(), IDF::TAG_FUGENERATE, IDF::TAG_HDBFILE, IDF::TAG_OPERATION, IDF::TAG_OPERATION_ID, IDF::TAG_OPERATION_LATENCY, and IDF::TAG_OPTION.

Here is the call graph for this function:

Member Data Documentation

◆ dagOperations_

std::vector<std::string> IDF::FUGenerated::dagOperations_
private

Definition at line 74 of file FUGenerated.hh.

Referenced by addOperation(), and dagOperations().

◆ name_

std::string IDF::FUGenerated::name_
private

Definition at line 72 of file FUGenerated.hh.

Referenced by loadState(), name(), and saveState().

◆ operations_

std::vector<Info> IDF::FUGenerated::operations_
private

Definition at line 73 of file FUGenerated.hh.

Referenced by addOperation(), loadState(), operations(), and saveState().

◆ options_

std::vector<std::string> IDF::FUGenerated::options_
private

Definition at line 75 of file FUGenerated.hh.

Referenced by loadState(), options(), and saveState().


The documentation for this class was generated from the following files:
IDF::TAG_OPERATION_LATENCY
const std::string TAG_OPERATION_LATENCY
Definition: FUGenerated.cc:40
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
IDF::TAG_OPTION
const std::string TAG_OPTION
Definition: FUGenerated.cc:41
IDF::FUGenerated::name_
std::string name_
Definition: FUGenerated.hh:72
ObjectState::intValue
int intValue() const
IDF::TAG_HDBFILE
const std::string TAG_HDBFILE
Definition: FUGenerated.cc:43
ObjectState
Definition: ObjectState.hh:59
ObjectState::childByName
ObjectState * childByName(const std::string &name) const
Definition: ObjectState.cc:443
IDF::TAG_OPERATION_ID
const std::string TAG_OPERATION_ID
Definition: FUGenerated.cc:39
IDF::FUGenerated::operations_
std::vector< Info > operations_
Definition: FUGenerated.hh:73
IDF::FUGenerated::options_
std::vector< std::string > options_
Definition: FUGenerated.hh:75
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
ObjectState::childCount
int childCount() const
ObjectState::hasChild
bool hasChild(const std::string &name) const
Definition: ObjectState.cc:358
ObjectState::name
std::string name() const
IDF::FUGenerated::dagOperations_
std::vector< std::string > dagOperations_
Definition: FUGenerated.hh:74
IDF::TAG_FUGENERATE
const std::string TAG_FUGENERATE
Definition: FUGenerated.cc:42
IDF::ATTRIB_NAME
const std::string ATTRIB_NAME
Definition: FUGenerated.cc:37
ObjectState::stringValue
std::string stringValue() const
IDF::FUGenerated::name
std::string name() const
Definition: FUGenerated.cc:103
ObjectState::setValue
void setValue(const std::string &value)
IDF::TAG_OPERATION
const std::string TAG_OPERATION
Definition: FUGenerated.cc:38
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100