|
Open Model Railroad Network (OpenMRN)
|
Go to the source code of this file.
Classes | |
| class | openlcb::GroupBaseEntry |
| Constexpr base class for all group like structures. More... | |
| class | openlcb::EntryMarker< N > |
| Helper class for partial template specialization. More... | |
| class | openlcb::NoopGroupEntry |
| Empty group entry that can be used for structuring the CDI configs. More... | |
| class | openlcb::GroupBase |
| Base class for all CDI Group structures (including segment, and the whole CDI entry). More... | |
| class | openlcb::RepeatedGroup< Group, N > |
| Defines a repeated group of a given type and a given number of repeats. More... | |
| class | openlcb::EmptyGroup< N > |
| Defines an empty group with no members, but blocking a certain amount of space in the rendered configuration. More... | |
| class | openlcb::ToplevelEntryBase |
| Base class for all entries that can appear in the MainCdi group. More... | |
| class | openlcb::Identification |
| Add this entry to the beginning of the CDI group to render an "<identification>" tag at the beginning of the output cdi.xml. More... | |
| class | openlcb::Acdi |
| Renders an "<acdi>" tag in the CDI group. More... | |
Namespaces | |
| namespace | openlcb |
Macros | |
| #define | CDI_GROUP_HELPER(START_LINE, GroupName, ARGS...) |
| Helper macro for rendering code for CDI groups. | |
| #define | CDI_GROUP_ENTRY_HELPER(LINE, NAME, TYPE, ...) |
| #define | CDI_GROUP_END_HELPER(LINE) |
| Helper macro to generate the code needed at the end of a group. | |
| #define | CDI_GROUP(GroupName, ARGS...) CDI_GROUP_HELPER(__LINE__, GroupName, ##ARGS) |
| Starts a CDI group. | |
| #define | CDI_GROUP_ENTRY(NAME, TYPE, ARGS...) CDI_GROUP_ENTRY_HELPER(__LINE__, NAME, TYPE, ##ARGS) |
| Adds an entry to a CDI group. | |
| #define | CDI_GROUP_END() CDI_GROUP_END_HELPER(__LINE__) |
| Closes a CDI group structure definition. | |
| #define | CDI_FACTORY_RESET(PATH) PATH().write(fd, PATH##_options().defaultvalue()) |
| Performs factory reset on a CDI variable. | |
| #define | CDI_READ_TRIMMED(PATH, fd) |
| Requests a readout of a numeric variable with trimming. | |
| #define | CDI_READ_TRIM_DEFAULT(PATH, fd) |
| Requests a readout of a numeric variable with verifying range. | |
| #define | RENDER_CDI(NS, TYPE, NAME, N) |
| Use this macro if additional CDI entries need to be rendered, in addition to the openlcb::ConfigDef. | |
Functions | |
| openlcb::CDI_GROUP (UserInfoSegment, Segment(MemoryConfigDefs::SPACE_ACDI_USR), Offset(1)) | |
| Configuration description for a segment containing the ACDI user-modifiable data. | |
| openlcb::CDI_GROUP_ENTRY (name, StringConfigEntry< 63 >, Name("User Name"), Description("This name will appear in network browsers for this device.")) | |
| User name entry. | |
| openlcb::CDI_GROUP_ENTRY (description, StringConfigEntry< 64 >, Name("User Description"), Description("This description will appear in network browsers for " "this device.")) | |
| User description entry. | |
| openlcb::CDI_GROUP_END () | |
| Signals termination of the group. | |
| openlcb::CDI_GROUP (InternalConfigData, Name("Internal data"), Description("Do not change these settings.")) | |
| Configuration description for internal configuration variables. | |
| openlcb::CDI_GROUP_ENTRY (version, Uint16ConfigEntry, Name("Version")) | |
| Used to detect firmwares that have their config layout set in incompatible ways. | |
| openlcb::CDI_GROUP_ENTRY (next_event, Uint16ConfigEntry, Name("Next event ID")) | |
| Last two bytes ofthe next available event ID that can be assigned in a factory reset to the producers/consumers. | |
| template<typename CdiType > | |
| void | render_cdi_helper (const CdiType &t, string ns, string name) |
| Helper function defined in CompileCdiMain.cxx. | |
| template<int N> | |
| void | render_all_cdi () |
| Forward declaration of the recursive helper template for adding multiple CDIs to a single binary image. | |
| template<> | |
| void | render_all_cdi< 0 > () |
| End-of-recursion template instantiation for CDI rendering. | |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Static representation of a config file.
Definition in file ConfigRepresentation.hxx.
| #define CDI_FACTORY_RESET | ( | PATH | ) | PATH().write(fd, PATH##_options().defaultvalue()) |
Performs factory reset on a CDI variable.
The variable must have a default value defined. Usage: CDI_FACTORY_RESET(opts_.short_retry_delay); assuming that there is something like CDI_GROUP_ENTRY(short_retry_delay, Uint8ConfigEntry, Default(13)); in the CDI group whose type opts_ is, and there is a local variable fd for writing to the configuration file. Will generate compile error if the variable does not have a default value in the configuration group entry.
Definition at line 301 of file ConfigRepresentation.hxx.
| #define CDI_GROUP | ( | GroupName, | |
| ARGS... | |||
| ) | CDI_GROUP_HELPER(__LINE__, GroupName, ##ARGS) |
Starts a CDI group.
| GroupName | is the c++ name of the struct that is being defined. |
| ARGS | are additional arguments for group options, like Name(...), Description(...), Segment(...), Offset(...) or MainCdi(). |
Definition at line 275 of file ConfigRepresentation.hxx.
| #define CDI_GROUP_END | ( | ) | CDI_GROUP_END_HELPER(__LINE__) |
Closes a CDI group structure definition.
Definition at line 290 of file ConfigRepresentation.hxx.
| #define CDI_GROUP_END_HELPER | ( | LINE | ) |
Helper macro to generate the code needed at the end of a group.
| LINE | line number in the config.hxx where this group should end. Used to start the recursion looking for group entries. |
Definition at line 242 of file ConfigRepresentation.hxx.
| #define CDI_GROUP_ENTRY | ( | NAME, | |
| TYPE, | |||
| ARGS... | |||
| ) | CDI_GROUP_ENTRY_HELPER(__LINE__, NAME, TYPE, ##ARGS) |
Adds an entry to a CDI group.
| NAME | is the c++ name of the entry |
| TYPE | is the c++ class / struct of the entry being added |
| ARGS | are additional arguments for the entry options, like Name(...), Description(...). If a subgroup is added, then group options are also allowed and they will override the respective values from the group definition. |
Definition at line 286 of file ConfigRepresentation.hxx.
| #define CDI_GROUP_ENTRY_HELPER | ( | LINE, | |
| NAME, | |||
| TYPE, | |||
| ... | |||
| ) |
Definition at line 195 of file ConfigRepresentation.hxx.
| #define CDI_GROUP_HELPER | ( | START_LINE, | |
| GroupName, | |||
| ARGS... | |||
| ) |
Helper macro for rendering code for CDI groups.
| START_LINE | the line number (in the config.hxx) file where the group starts. This line number will be used to terminate the recursion looking for config entries. |
| GroupName | C++ identifier for the name of this group. |
| ARGS | Proxied additional arguments, forwarded to the Options class. |
Definition at line 134 of file ConfigRepresentation.hxx.
| #define CDI_READ_TRIM_DEFAULT | ( | PATH, | |
| fd | |||
| ) |
Requests a readout of a numeric variable with verifying range.
If the value currently present in the config file is outside the defined minimum/maximum, then sets the value to the default value in the config file (overwriting). Returns the current value after trimming.
Usage: uint16_t my_value = CDI_READ_TRIM_DEFAULT(cfg.seg().foo_bar, fd);
Definition at line 322 of file ConfigRepresentation.hxx.
| #define CDI_READ_TRIMMED | ( | PATH, | |
| fd | |||
| ) |
Requests a readout of a numeric variable with trimming.
If the value currently present in the config file is less than the defined minimum, then sets the value to the minimum in the config file (overwriting), same for max. Returns the current value after trimming.
Usage: uint16_t my_value = CDI_READ_TRIMMED(cfg.seg().foo_bar, fd);
Definition at line 311 of file ConfigRepresentation.hxx.
| #define RENDER_CDI | ( | NS, | |
| TYPE, | |||
| NAME, | |||
| N | |||
| ) |
Use this macro if additional CDI entries need to be rendered, in addition to the openlcb::ConfigDef.
Example usage:
} // namespace XXX – RENDER_CDI will work only if at toplevel!
RENDER_CDI(openlcb, ConfigDef, "CDI", 3); this will create CDI_DATA and CDI_SIZE symbols.
| NS | is the namespace without quotes |
| TYPE | is the typename of the CDI root group (with MainCdi()) |
| NAME | is the basenamefor the output symbols. Generated will be _DATA and _SIZE |
| N | is a unique integer between 2 and 10 for the invocation. |
Definition at line 515 of file ConfigRepresentation.hxx.
| void render_all_cdi | ( | ) |
Forward declaration of the recursive helper template for adding multiple CDIs to a single binary image.
Definition at line 17 of file CompileCdiMain.cxx.
|
inline |
End-of-recursion template instantiation for CDI rendering.
Definition at line 497 of file ConfigRepresentation.hxx.
| void render_cdi_helper | ( | const CdiType & | t, |
| string | ns, | ||
| string | name | ||
| ) |
Helper function defined in CompileCdiMain.cxx.
Definition at line 24 of file CompileCdiMain.cxx.