Sen API
Sen Libraries
Loading...
Searching...
No Matches
cpp.h
Go to the documentation of this file.
1// === cpp.h ===========================================================================================================
2// Sen Infrastructure
3// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4// See the LICENSE.txt file for more information.
5// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6// =====================================================================================================================
7
8#ifndef SEN_LIBS_GEN_INCLUDE_SEN_GEN_CPP_H
9#define SEN_LIBS_GEN_INCLUDE_SEN_GEN_CPP_H
10
13
14#include <filesystem>
15#include <map>
16#include <memory>
17#include <string>
18#include <vector>
19
20namespace sen::gen
21{
22
25{
28 bool recursive = false;
29
32 bool publicSymbols = false;
33
36 std::string basePath;
37};
38
41{
43 std::string packageName;
44
46 std::vector<std::string> stlFiles;
47
50 std::vector<std::string> packageDependencies;
51
54 std::vector<std::string> userImplementedClasses;
55};
56
60{
61 SEN_NOCOPY_NOMOVE(CppGenerator)
62
63public:
66
70 using FileContents = std::map<std::filesystem::path, std::string>;
71
77 [[nodiscard]] FileContents generate(const sen::lang::TypeSet& typeSet, const CppOptions& opts = {});
78
80 [[nodiscard]] std::string generateExports(const CppExportsOptions& opts);
81
82private:
83 class Impl;
84 std::unique_ptr<Impl> pimpl_;
85};
86
87} // namespace sen::gen
88
89#endif // SEN_LIBS_GEN_INCLUDE_SEN_GEN_CPP_H
FileContents generate(const sen::lang::TypeSet &typeSet, const CppOptions &opts={})
Renders the types header + impl source for the supplied type set. When opts.recursive is true,...
std::string generateExports(const CppExportsOptions &opts)
Renders the package exports source file (sen_exported_types.cpp).
std::map< std::filesystem::path, std::string > FileContents
Map of relative output path -> rendered file contents. Keys are produced from the type set's parentDi...
Definition cpp.h:70
std::string packageName
The Sen package name. Becomes the hashed package id embedded into the file.
Definition cpp.h:43
bool publicSymbols
When true, generated classes use public C++ symbols (rather than the default translation-unit-private...
Definition cpp.h:32
std::vector< std::string > userImplementedClasses
Qualified names of types the user implements in this package. Each is materialised as a registration ...
Definition cpp.h:54
std::vector< std::string > packageDependencies
Names of every package this one depends on. Each becomes a hashed package id in the rendered file's d...
Definition cpp.h:50
bool recursive
When true, the generator also renders sources for every transitively imported type set found in TypeS...
Definition cpp.h:28
std::vector< std::string > stlFiles
Names of every STL file participating in the package.
Definition cpp.h:46
std::string basePath
Optional base path embedded into the rendered #include lines so generated headers resolve correctly u...
Definition cpp.h:36
Options for CppGenerator::generateExports.
Definition cpp.h:41
Options controlling how CppGenerator::generate renders one type set.
Definition cpp.h:25
A set of types coming from a STL file.
Definition stl_resolver.h:33
Definition cpp.h:21