OpenASIP 2.2
Loading...
Searching...
No Matches
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) {}
std::string name_
std::string name() const

◆ ~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}
std::vector< Info > operations_
std::vector< std::string > dagOperations_

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 ProGeTools::checkForGeneratableFU(), and Automagic::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}
std::vector< std::string > options_
ObjectState * childByName(const std::string &name) const
bool hasChild(const std::string &name) const
ObjectState * child(int index) const
int intValue() const
std::string stringAttribute(const std::string &name) const
std::string stringValue() const
std::string name() const
int childCount() const
const std::string TAG_OPTION
const std::string TAG_OPERATION
const std::string TAG_OPERATION_LATENCY
const std::string ATTRIB_NAME
const std::string TAG_HDBFILE
const std::string TAG_OPERATION_ID

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]

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

Definition at line 113 of file FUGenerated.cc.

113 {
114 return operations_;
115}

References operations_.

Referenced by FUGen::createImplementationFiles(), and FUGen::parseOperations().

◆ operations() [2/2]

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

Definition at line 118 of file FUGenerated.cc.

118 {
119 return operations_;
120}

References operations_.

◆ 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_) {
80 opState->setAttribute(ATTRIB_NAME, operation.operationName);
81 ObjectState* hdbState = new ObjectState(TAG_HDBFILE);
82 hdbState->setValue(operation.hdb);
84 idState->setValue(operation.id);
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}
void setAttribute(const std::string &name, const std::string &value)
void setValue(const std::string &value)
void addChild(ObjectState *child)
const std::string TAG_FUGENERATE

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(), name(), and saveState().

◆ operations_

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

Definition at line 73 of file FUGenerated.hh.

Referenced by addOperation(), addOperation(), loadState(), operations(), 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: