Cerata
A library to generate structural hardware designs
output.h
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 #pragma once
16 
17 #include <unordered_map>
18 #include <vector>
19 #include <utility>
20 #include <string>
21 #include <memory>
22 
23 #include "cerata/graph.h"
24 
25 namespace cerata {
26 
28 struct OutputSpec {
32  std::unordered_map<std::string, std::string> meta = {};
33 };
34 
39  public:
41  explicit OutputGenerator(std::string root_dir, std::vector<OutputSpec> outputs = {});
42 
44  OutputGenerator &AddOutput(const OutputSpec &output);
45 
47  virtual void Generate() = 0;
48 
50  virtual std::string subdir() = 0;
51 
52  protected:
54  std::string root_dir_;
56  std::vector<OutputSpec> outputs_;
57 };
58 
59 } // namespace cerata
cerata::Component
A Component graph.
Definition: graph.h:158
cerata::OutputGenerator::root_dir_
std::string root_dir_
The root directory to generate the output in.
Definition: output.h:54
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::Generate
virtual void Generate()=0
Start the output generation.
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::subdir
virtual std::string subdir()=0
Return the subdirectory this OutputGenerator will generate into.
cerata::OutputSpec::meta
std::unordered_map< std::string, std::string > meta
Metadata for back-ends.
Definition: output.h:32
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