Cerata
A library to generate structural hardware designs
output.cc
1 // Copyright 2018-2019 Delft University of Technology
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include <string>
16 #include <memory>
17 
18 #include "cerata/graph.h"
19 #include "cerata/output.h"
20 
21 namespace cerata {
22 
23 OutputGenerator::OutputGenerator(std::string root_dir, std::vector<OutputSpec> outputs)
24  : root_dir_(std::move(root_dir)), outputs_(std::move(outputs)) {}
25 
27  if (output.comp != nullptr) {
28  outputs_.push_back(output);
29  } else {
30  throw std::runtime_error("Component is nullptr.");
31  }
32  return *this;
33 }
34 
35 } // namespace cerata
cerata::OutputSpec
Structure to specify output properties per graph.
Definition: output.h:28
cerata::OutputGenerator::AddOutput
OutputGenerator & AddOutput(const OutputSpec &output)
Add a graph to the list of graphs to generate output for.
Definition: output.cc:26
cerata
Contains every Cerata class, function, etc...
Definition: api.h:41
cerata::OutputGenerator
Abstract class to generate language specific output from Graphs.
Definition: output.h:38
cerata::OutputSpec::comp
Component * comp
The component to output.
Definition: output.h:30
cerata::OutputGenerator::outputs_
std::vector< OutputSpec > outputs_
A list of things to put out.
Definition: output.h:56
cerata::OutputGenerator::OutputGenerator
OutputGenerator(std::string root_dir, std::vector< OutputSpec > outputs={})
Construct an OutputGenerator.
Definition: output.cc:23