ifgen.environment package#
Submodules#
ifgen.environment.field module#
A module implementing interfaces for processing individual struct fields.
- ifgen.environment.field.process_field(struct_name: str, padding: PaddingManager, types: TypeSystem, field: dict[str, Any], namespace: list[str]) Iterator[dict[str, Any]] [source]#
Process a single struct field.
ifgen.environment.padding module#
A module implementing a struct-padding manager.
Module contents#
A module implementing a generation-environment interface.
- class ifgen.environment.Directories(config_parts: list[str], source: Path, output: Path, test_dir: Path)[source]#
Bases:
NamedTuple
A collection of directories relevant to code generation outputs.
- config_parts: list[str]#
Alias for field number 0
- output: Path#
Alias for field number 2
- source: Path#
Alias for field number 1
- test_dir: Path#
Alias for field number 3
- class ifgen.environment.Generator(*values)[source]#
Bases:
StrEnum
An enumeration declaring all valid kinds of generators.
- ENUMS = 'enums'#
- IFGEN = 'ifgen'#
- STRUCTS = 'structs'#
- class ifgen.environment.IfgenEnvironment(root: Path, config: Config)[source]#
Bases:
LoggerMixin
A class for managing stateful information while generating outputs.
- get_dirs(langauge: Language) Directories | None [source]#
Get source, output and test directories.
- get_enum(name: str, exact: bool = False) RuntimeEnum [source]#
Get a runtime enum instance for a given enumeration.
- get_protocol(name: str, exact: bool = False) Protocol [source]#
Get the protocol instance for a given struct.
- is_enum(name: str, exact: bool = False) bool [source]#
Determine if a field is an enumeration or not.
- make_path(name: str, generator: Generator, language: Language, from_output: bool = False, track: bool = True) Path [source]#
Make part of a task’s path.
- make_test_path(name: str, generator: Generator, language: Language) Path [source]#
Make a path to an interface’s unit-test suite.
- class ifgen.environment.Language(*values)[source]#
Bases:
StrEnum
An enumeration declaring output generation variants.
- CPP = 'CPP'#
- PYTHON = 'Python'#
- property cfg_dir_name: str#
Get the configuration key for this language’s output configuration.
- property header_suffix: str#
Get a header-file suffix for this language.
- property slug: str#
Get a slug string.
- property source_suffix: str#
Get a source-file suffix for this language.