feature_collection_t Derived Type

type, public, extends(serializable_t) :: feature_collection_t

Feature configuration data


Components

Type Visibility Attributes Name Initial
type(feature_config_t), public :: base
type(feature_config_t), public, allocatable :: variants(:)

Type-Bound Procedures

procedure, public :: check => check_collection

  • private subroutine check_collection(self, error)

    Check that the collection has valid OS/compiler logic and can be merged safely Implements standardized feature hierarchy validation: 1. OS_all+id_all (base) → id_compiler+OS_all → id_all+OS_current → id_compiler+OS_current 2. Additive properties (flags) can be concatenated 3. Allocatable properties can only exist in one variant per merge path

    Arguments

    Type IntentOptional Attributes Name
    class(feature_collection_t), intent(in) :: self
    type(error_t), intent(out), allocatable :: error

generic, public :: dump => dump_to_toml, dump_to_file, dump_to_unit

  • private subroutine srcfile_dump_to_toml(self, table, error)

    Dump dependency to toml table

    Arguments

    Type IntentOptional Attributes Name
    class(srcfile_t), intent(inout) :: self

    Instance of the serializable object

    type(toml_table), intent(inout) :: table

    Data structure

    type(error_t), intent(out), allocatable :: error

    Error handling

  • private subroutine dump_to_file(self, file, error, json)

    Write serializable object to file

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self

    Instance of the dependency tree

    character(len=*), intent(in) :: file

    File name

    type(error_t), intent(out), allocatable :: error

    Error handling

    logical, intent(in), optional :: json

    Optional JSON format

  • private subroutine dump_to_unit(self, unit, error, json)

    Write serializable object to a formatted Fortran unit

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self

    Instance of the dependency tree

    integer, intent(in) :: unit

    Formatted unit

    type(error_t), intent(out), allocatable :: error

    Error handling

    logical, intent(in), optional :: json

    Optional JSON format requested?

procedure, public :: dump_to_toml => feature_collection_dump

  • private subroutine feature_collection_dump(self, table, error)

    Serialize: base as a subtable; variants under a “variants” table

    Arguments

    Type IntentOptional Attributes Name
    class(feature_collection_t), intent(inout) :: self
    type(toml_table), intent(inout) :: table
    type(error_t), intent(out), allocatable :: error

procedure, public :: extract_for_target

  • private function extract_for_target(self, target) result(feature)

    Extract a merged feature configuration for the given target platform

    Arguments

    Type IntentOptional Attributes Name
    class(feature_collection_t), intent(in) :: self
    type(platform_config_t), intent(in) :: target

    Return Value type(feature_config_t)

generic, public :: load => load_from_toml, load_from_file, load_from_unit

  • private subroutine srcfile_load_from_toml(self, table, error)

    Read dependency from toml table (no checks made at this stage)

    Arguments

    Type IntentOptional Attributes Name
    class(srcfile_t), intent(inout) :: self

    Instance of the serializable object

    type(toml_table), intent(inout) :: table

    Data structure

    type(error_t), intent(out), allocatable :: error

    Error handling

  • private subroutine load_from_file(self, file, error, json)

    Read dependency tree from file

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self

    Instance of the dependency tree

    character(len=*), intent(in) :: file

    File name

    type(error_t), intent(out), allocatable :: error

    Error handling

    logical, intent(in), optional :: json

    Optional JSON format

  • private subroutine load_from_unit(self, unit, error, json)

    Read dependency tree from file init JSON interpreter Read object from TOML table

    use default TOML parser

    Read object from TOML table

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self

    Instance of the dependency tree

    integer, intent(in) :: unit

    File name

    type(error_t), intent(out), allocatable :: error

    Error handling

    logical, intent(in), optional :: json

    Optional JSON format

procedure, public :: load_from_toml => feature_collection_load

  • private subroutine feature_collection_load(self, table, error)

    Deserialize: read base; then any number of variants under “variants”

    Arguments

    Type IntentOptional Attributes Name
    class(feature_collection_t), intent(inout) :: self
    type(toml_table), intent(inout) :: table
    type(error_t), intent(out), allocatable :: error

generic, public :: operator(==) => serializable_is_same

  • private function srcfile_is_same(this, that)

    Check that two source files are equal All checks passed!

    Arguments

    Type IntentOptional Attributes Name
    class(srcfile_t), intent(in) :: this
    class(serializable_t), intent(in) :: that

    Return Value logical

procedure, public :: push_variant

  • private elemental subroutine push_variant(self, variant)

    Arguments

    Type IntentOptional Attributes Name
    class(feature_collection_t), intent(inout) :: self
    type(feature_config_t), intent(in) :: variant

procedure, public :: serializable_is_same => feature_collection_same

  • private function feature_collection_same(this, that)

    Equality (semantic): base and variants (size + element-wise)

    Arguments

    Type IntentOptional Attributes Name
    class(feature_collection_t), intent(in) :: this
    class(serializable_t), intent(in) :: that

    Return Value logical

procedure, public, non_overridable :: test_serialization

Test load/write roundtrip

  • private subroutine test_serialization(self, message, error)

    Test serialization of a serializable object Dump to scratch file Load from scratch file Check same

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self
    character(len=*), intent(in) :: message
    type(error_t), intent(out), allocatable :: error

Source Code

    type, public, extends(serializable_t) :: feature_collection_t
        
        ! Features shared by all platforms, all compilers
        type(feature_config_t) :: base
        
        ! Features shared by specific platform/compiler configurations
        type(feature_config_t), allocatable :: variants(:)
        
        contains
        
            procedure :: serializable_is_same => feature_collection_same
            procedure :: dump_to_toml        => feature_collection_dump
            procedure :: load_from_toml      => feature_collection_load
                        
            procedure :: push_variant
            procedure :: extract_for_target
            procedure :: check => check_collection

    end type feature_collection_t