Advanced configuration property features, Configuration properties applying to arrays – Echelon Neuron C User Manual
Page 104

92
Using Configuration Properties to Configure Device Behavior
Since the same CP family could also be used as a device property, there is a
special context defined for the device. The device’s context is a context operator
(two consecutive colon characters) without a preceding context identifier.
Example, Accessing a Device Property:
network input SCPToemType cp cpOemType[3];
device_properties {
cpOemType = { "Label 1", "Label 2", "Label 3" }
};
void f(void)
{
if (strcmp(::cpOemType[0].ascii, "Demo") == 0) {
... // special demo mode
} else {
... // normal operation
}
}
Even though a configuration network variable can be uniquely accessed through
its variable identifier, it can also be accessed equally well through the context
expression, just like the CP family members.
When more than one syntactically correct method exists for accessing a
particular CP, these methods are equivalent. The compiler translates all
alternatives into the same, equally efficient, code. In such a case, you should
choose the syntax that best documents your application algorithm.
Advanced Configuration Property Features
Configuration properties support a few advanced features that are described in
this section. The first of these features is the use of configuration properties with
network variable arrays. Second is the initialization of configuration properties
at time of instantiation.
Another advanced feature is sharing of configuration properties, where a single
configuration property can apply to two or more network variables, or two or
more functional blocks (see Chapter 5,
Using Functional Blocks to Implement a
, on page 101, for information on functional blocks). However, no
single configuration property (or configuration property family member) can
apply to both network variables
and
functional blocks.
The last advanced feature discussed in this section is configuration properties
with type-inheritance. Some configuration property types (CPTs) indicate that
the type of the configuration property is actually defined by the network variable
to which it applies. Type-inheriting configuration properties are discussed
further at the end of this chapter.
Configuration Properties Applying to Arrays
When configuration properties apply to network variable arrays, the compiler
provides replication of the configuration properties for each member of the array
(unless the property is shared, as discussed in
on page 96). Consider a network variable array with four elements
(each corresponds to some sensor, perhaps):