wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
ElementInfo.h File Reference

Self-registering element trait template and compile-time constraint validation. More...

Include dependency graph for ElementInfo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ElementConstraints
 Compile-time-validatable subset of ElementMetadata. More...

Functions

ElementMetadata metadataFromConstraints (const ElementConstraints &c)
 Converts ElementConstraints to an ElementMetadata with all constraint-derived fields set.
constexpr bool validate (const ElementConstraints &c)
 Validates element constraints at compile time.

Detailed Description

Self-registering element trait template and compile-time constraint validation.

Definition in file ElementInfo.h.

Function Documentation

◆ metadataFromConstraints()

ElementMetadata metadataFromConstraints ( const ElementConstraints & c)
inline

Converts ElementConstraints to an ElementMetadata with all constraint-derived fields set.

Specializations of ElementInfo<T>::metadata() call this first, then fill in the remaining display fields: pixmapPath, titleText, translatedName, trContext, defaultAppearances, and alternativeAppearances.

Parameters
cSource constraints.
Returns
Partially populated ElementMetadata.

Definition at line 80 of file ElementInfo.h.

References ElementConstraints::canChangeAppearance, ElementMetadata::canChangeAppearance, ElementConstraints::group, ElementMetadata::group, ElementConstraints::hasAudio, ElementMetadata::hasAudio, ElementConstraints::hasAudioBox, ElementMetadata::hasAudioBox, ElementConstraints::hasColors, ElementMetadata::hasColors, ElementConstraints::hasDelay, ElementMetadata::hasDelay, ElementConstraints::hasFrequency, ElementMetadata::hasFrequency, ElementConstraints::hasLabel, ElementMetadata::hasLabel, ElementConstraints::hasTrigger, ElementMetadata::hasTrigger, ElementConstraints::hasTruthTable, ElementMetadata::hasTruthTable, ElementConstraints::hasVolume, ElementMetadata::hasVolume, ElementConstraints::maxInputSize, ElementMetadata::maxInputSize, ElementConstraints::maxOutputSize, ElementMetadata::maxOutputSize, ElementConstraints::minInputSize, ElementMetadata::minInputSize, ElementConstraints::minOutputSize, ElementMetadata::minOutputSize, ElementConstraints::rotatesGraphic, ElementMetadata::rotatesGraphic, ElementConstraints::type, and ElementMetadata::type.

Referenced by ElementInfo< And >::metadata(), ElementInfo< AudioBox >::metadata(), ElementInfo< Buzzer >::metadata(), ElementInfo< Clock >::metadata(), ElementInfo< Demux >::metadata(), ElementInfo< DFlipFlop >::metadata(), ElementInfo< Display14 >::metadata(), ElementInfo< Display16 >::metadata(), ElementInfo< Display7 >::metadata(), ElementInfo< DLatch >::metadata(), ElementInfo< IC >::metadata(), ElementInfo< InputButton >::metadata(), ElementInfo< InputGnd >::metadata(), ElementInfo< InputRotary >::metadata(), ElementInfo< InputSwitch >::metadata(), ElementInfo< InputVcc >::metadata(), ElementInfo< JKFlipFlop >::metadata(), ElementInfo< Led >::metadata(), ElementInfo< Line >::metadata(), ElementInfo< Mux >::metadata(), ElementInfo< Nand >::metadata(), ElementInfo< Node >::metadata(), ElementInfo< Nor >::metadata(), ElementInfo< Not >::metadata(), ElementInfo< Or >::metadata(), ElementInfo< SRFlipFlop >::metadata(), ElementInfo< SRLatch >::metadata(), ElementInfo< Text >::metadata(), ElementInfo< TFlipFlop >::metadata(), ElementInfo< TruthTable >::metadata(), ElementInfo< Xnor >::metadata(), and ElementInfo< Xor >::metadata().

◆ validate()

bool validate ( const ElementConstraints & c)
constexpr

Validates element constraints at compile time.

Parameters
cConstraints to validate.
Returns
true if c is well-formed (known type/group, consistent port sizes).

Definition at line 48 of file ElementInfo.h.

References ElementConstraints::group, ElementConstraints::maxInputSize, ElementConstraints::maxOutputSize, ElementConstraints::minInputSize, ElementConstraints::minOutputSize, and ElementConstraints::type.