![]() |
lingua-franca 0.10.1
Lingua Franca code generator
|
A class for keeping the current target configuration. More...
Inherited by org.lflang.federated.generator.FederateTargetConfig.
Public Member Functions | |
| TargetDecl | extractTargetDecl () |
| Construct a TargetDecl by extracting the fields of the given TargetConfig. | |
| Optional< TargetProperty<?, ?> > | forName (String name) |
| Return the target property in this target config that matches the given string. | |
| List< TargetProperty<?, ?> > | getAssignedProperties () |
| Return the target properties that have been assigned a value. | |
| Resource | getMainResource () |
| Get the main resource that is under compilation. | |
| List< TargetProperty<?, ?> > | getRegisteredProperties () |
| Return the target properties that are currently registered. | |
| boolean | isFederated () |
| Return whether this configuration is used in the context of a federated program. | |
| boolean | isSet (TargetProperty<?, ?> property) |
| Return true if this target property has been set (past initialization), false otherwise. | |
| boolean | isSupported (TargetProperty p) |
| Return true if the given target property is supported, false otherwise. | |
| String | listOfRegisteredProperties () |
| Return the target properties that are currently registered. | |
| void | load (GeneratorArguments args, MessageReporter err) |
| Load overrides passed in as CLI arguments. | |
| List< TargetProperty<?, ?> > | loaded () |
| Return all the target properties that have been set. | |
| void | mergeImportedConfig (Resource importedResource, Resource mainResource, Predicate< TargetProperty > loadOrNot, MessageReporter messageReporter) |
| If the federate that the target configuration applies to is imported, merge target properties declared in the file that it was imported from. | |
| void | register (TargetProperty<?, ?>... properties) |
| Register target properties and assign them their initial value. | |
| void | reportUnsupportedTargetProperty (String name, MessageReporter.Stage2 stage2) |
| Report that a target property is not supported by the current target. | |
| void | reset (TargetProperty<?, ?> property) |
| Reset this target property to its initial value (and mark it as unset). | |
| String | settings () |
| Return a description of the current settings. | |
| TargetConfig (Resource resource, GeneratorArguments args, MessageReporter reporter) | |
| Create a new target configuration based on the given target declaration AST node and the arguments passed to the code generator. | |
| void | update (TargetConfig config, List< KeyValuePair > pairs, Path relativePath, Predicate< TargetProperty > loadOrNot, MessageReporter err) |
| Update the given configuration using the given target properties. | |
| void | validate (MessageReporter reporter) |
| Validate all set properties and report issues via the given reporter. | |
Static Public Member Functions | |
| static List< KeyValuePair > | extractProperties (TargetConfig config) |
| Extract all properties as a list of key-value pairs from a TargetConfig. | |
| static TargetConfig | getMockInstance (Target target) |
| Return mock instance to use for testing, which is not tied to a generator context or a resource. | |
Public Attributes | |
| final List< String > | compileAdditionalSources = new ArrayList<>() |
| Additional sources to add to the compile command if appropriate. | |
| final Target | target |
| The target of this configuration (e.g., C, TypeScript, Python). | |
Static Public Attributes | |
| static final String | NOT_IN_LF_SYNTAX_MESSAGE |
| Error message to use when a target property does not exist in LF syntax. | |
Protected Member Functions | |
| void | load (JsonObject jsonObject, MessageReporter messageReporter) |
| Update this configuration based on the given JSON object. | |
| void | load (Resource resource, MessageReporter reporter) |
| Load configuration from the given resource. | |
| TargetConfig (Target target) | |
| Create a new target configuration based on the given target declaration AST node only. | |
Protected Attributes | |
| final Map< TargetProperty<?, ?>, KeyValuePair > | keyValuePairs = new HashMap<>() |
| Map from. | |
| Resource | mainResource |
| The main resource that is under compilation. | |
| final Map< TargetProperty<?, ?>, Object > | properties = new HashMap<>() |
| Map of target properties. | |
Package Functions | |
| public< T, S extends TargetPropertyType > T | get (TargetProperty< T, S > property) throws IllegalArgumentException |
| Return the value currently assigned to the given target property. | |
| public< T, S extends TargetPropertyType > T | getOrDefault (TargetProperty< T, S > property) |
| Return the value currently assigned to the given target property, or its default value if none been set. | |
| public< T, S extends TargetPropertyType > KeyValuePair | lookup (TargetProperty< T, S > targetProperty) |
| Return the AST node that was used to assign a value for the given target property. | |
| public< T, S extends TargetPropertyType > void | set (TargetProperty< T, S > property, T value) |
| Assign the given value to the given target property. | |
A class for keeping the current target configuration.
Class members of type String are initialized as empty strings, unless otherwise stated.
|
protected |
Create a new target configuration based on the given target declaration AST node only.
| target | AST node of a target declaration. |
| org.lflang.target.TargetConfig.TargetConfig | ( | Resource | resource, |
| GeneratorArguments | args, | ||
| MessageReporter | reporter ) |
Create a new target configuration based on the given target declaration AST node and the arguments passed to the code generator.
| resource | The main resource. |
| args | The arguments passed to the code generator. |
| reporter | An error reporter. |
|
static |
Extract all properties as a list of key-value pairs from a TargetConfig.
The returned list only includes properties that were explicitly set.
| config | The TargetConfig to extract from. |
| TargetDecl org.lflang.target.TargetConfig.extractTargetDecl | ( | ) |
Construct a TargetDecl by extracting the fields of the given TargetConfig.
| Optional< TargetProperty<?, ?> > org.lflang.target.TargetConfig.forName | ( | String | name | ) |
Return the target property in this target config that matches the given string.
| name | The string to match against. |
|
package |
Return the value currently assigned to the given target property.
| List< TargetProperty<?, ?> > org.lflang.target.TargetConfig.getAssignedProperties | ( | ) |
Return the target properties that have been assigned a value.
| Resource org.lflang.target.TargetConfig.getMainResource | ( | ) |
Get the main resource that is under compilation.
|
static |
Return mock instance to use for testing, which is not tied to a generator context or a resource.
|
package |
Return the value currently assigned to the given target property, or its default value if none been set.
| property | The property to get the value of |
| <T> | The Java type of the returned value. |
| <S> | The LF type of the returned value. |
| List< TargetProperty<?, ?> > org.lflang.target.TargetConfig.getRegisteredProperties | ( | ) |
Return the target properties that are currently registered.
| boolean org.lflang.target.TargetConfig.isFederated | ( | ) |
Return whether this configuration is used in the context of a federated program.
| boolean org.lflang.target.TargetConfig.isSet | ( | TargetProperty<?, ?> | property | ) |
Return true if this target property has been set (past initialization), false otherwise.
| boolean org.lflang.target.TargetConfig.isSupported | ( | TargetProperty | p | ) |
Return true if the given target property is supported, false otherwise.
| String org.lflang.target.TargetConfig.listOfRegisteredProperties | ( | ) |
Return the target properties that are currently registered.
| void org.lflang.target.TargetConfig.load | ( | GeneratorArguments | args, |
| MessageReporter | err ) |
Load overrides passed in as CLI arguments.
| args | List of overrides that may or may not be set |
| err | Message reporter to report attempts to set unsupported target properties. |
|
protected |
Update this configuration based on the given JSON object.
| jsonObject | The JSON object to read updates from. |
| messageReporter | A message reporter to report issues. |
|
protected |
Load configuration from the given resource.
| resource | A resource to load from. |
| reporter | A message reporter for reporting errors and warnings. |
| List< TargetProperty<?, ?> > org.lflang.target.TargetConfig.loaded | ( | ) |
Return all the target properties that have been set.
|
package |
Return the AST node that was used to assign a value for the given target property.
| targetProperty | The target property to find a matching AST node for. |
| <T> | The Java type of values assigned to the given target property. |
| <S> | The LF type of values assigned to the given target property. |
| void org.lflang.target.TargetConfig.mergeImportedConfig | ( | Resource | importedResource, |
| Resource | mainResource, | ||
| Predicate< TargetProperty > | loadOrNot, | ||
| MessageReporter | messageReporter ) |
If the federate that the target configuration applies to is imported, merge target properties declared in the file that it was imported from.
| importedResource | The resource in which the target configuration is to be loaded from. |
| mainResource | The resource in which the main reactor is specified. |
| loadOrNot | Predicate to determine for each target property whether it should be loaded. |
| messageReporter | An error reporter to use when problems are encountered. |
| void org.lflang.target.TargetConfig.register | ( | TargetProperty<?, ?>... | properties | ) |
Register target properties and assign them their initial value.
| properties | The target properties to register. |
| void org.lflang.target.TargetConfig.reportUnsupportedTargetProperty | ( | String | name, |
| MessageReporter.Stage2 | stage2 ) |
Report that a target property is not supported by the current target.
| name | The name of the unsupported target property. |
| stage2 | The second stage an the error reporter through which to report the warning. |
| void org.lflang.target.TargetConfig.reset | ( | TargetProperty<?, ?> | property | ) |
Reset this target property to its initial value (and mark it as unset).
|
package |
Assign the given value to the given target property.
| property | The target property to assign the value to. |
| value | The value to assign to the target property. |
| <T> | The Java type of the value. |
| <S> | The LF type of the value. |
| String org.lflang.target.TargetConfig.settings | ( | ) |
Return a description of the current settings.
| void org.lflang.target.TargetConfig.update | ( | TargetConfig | config, |
| List< KeyValuePair > | pairs, | ||
| Path | relativePath, | ||
| Predicate< TargetProperty > | loadOrNot, | ||
| MessageReporter | err ) |
Update the given configuration using the given target properties.
| config | The configuration object to update. |
| pairs | AST node that holds all the target properties. |
| relativePath | The path from the main resource to the resource from which the new properties originate. |
| loadOrNot | Predicate to determine whether a property should be loaded. |
| err | Message reporter for errors. |
| void org.lflang.target.TargetConfig.validate | ( | MessageReporter | reporter | ) |
Validate all set properties and report issues via the given reporter.
| reporter | A reporter to report errors and warnings through. |
| final List<String> org.lflang.target.TargetConfig.compileAdditionalSources = new ArrayList<>() |
Additional sources to add to the compile command if appropriate.
|
protected |
Map from.
|
protected |
The main resource that is under compilation.
|
static |
Error message to use when a target property does not exist in LF syntax.
|
protected |
Map of target properties.
| final Target org.lflang.target.TargetConfig.target |
The target of this configuration (e.g., C, TypeScript, Python).