CompileDES  3.12
Executable-Code Generation from Synchronised libFAUDES Automata
cgp_codegenerator.h File Reference

Code-generator common base class. More...

#include "libfaudes.h"
#include "cgp_eventconfig.h"

Go to the source code of this file.

Classes

class  CodeGenerator
 Code-generation common base. More...
 
struct  CodeGenerator::LineAddress
 Compiled record per input line. More...
 
struct  CodeGenerator::FlagExpression
 Compiled record per input flag-expression. More...
 
struct  CodeGenerator::TimerConfiguration
 Compiled record per timer acting. More...
 
struct  CodeGenerator::ActionAddress
 Compiled record per action-address. More...
 
class  CodeGenerator::TimerAction
 Compiled record per event on how it affects timers. More...
 
class  CodeGenerator::Registration< T >
 Registration class. More...
 

Macros

#define FCG_VERB0(msg)   { if(mVerbLevel>=0) *pErrStream << msg << std::endl; }
 
#define FCG_VERB1(msg)   { if(mVerbLevel>=1) *pErrStream << msg << std::endl; }
 
#define FCG_VERB2(msg)   { if(mVerbLevel>=2) *pErrStream << msg << std::endl; }
 
#define FCG_ERR(msg)   { *pErrStream << msg << std::endl; throw Exception("CodeGenerator()","internal error", 500); }
 
#define COMPILEDES_VERSION   "3.0x"
 

Code-Generator Registry

Derived classes register via a static registration mechanism to provide an application-invokable constructor. The static registry records the constructor with a std::string typename as identifier. The purpose of this mechanism is to instantiate derived classes by their identifier at runtime.E.g.

instantiates a CodeGenerator object of the type registered by "iec". See the command-line tool compiledes.cpp for a relevant use case.

Registration can be conveniently triggered by instantiation of a CodeGenerator::Registration object via the provided macro. E.g. in the source that defines the class IecCodeGenerator

FAUDES_REGISTERCODEGENERATOR("iec",IecCodeGenerator);

is used to register the respective class with the identifier "iec".

#define FAUDES_REGISTERCODEGENERATOR(ftype, ctype)   static CodeGenerator::Registration<ctype> gRegister(ftype)
 Class registration macro.
 

Class Documentation

◆ CodeGenerator::LineAddress

struct CodeGenerator::LineAddress

Definition at line 472 of file cgp_codegenerator.h.

Class Members
string mAddress
int mBitAddress target expression to represent line value
EventSet mPosEvents bit-address of buffer for edge detection (consecutive)
EventSet mNegEvents events to trigger on positive edge
EventSet mPosStatics events to trigger on negative edge
EventSet mNegStatics events to trigger on high power on
bool mStatic events to trigger on low power on

◆ CodeGenerator::FlagExpression

struct CodeGenerator::FlagExpression

Definition at line 489 of file cgp_codegenerator.h.

Class Members
string mAddress target expression to represent the line value
EventSet mEvents events to trigger on positive evaluation

◆ CodeGenerator::TimerConfiguration

struct CodeGenerator::TimerConfiguration

Definition at line 504 of file cgp_codegenerator.h.

Class Members
string mAddress target address prefix to maintain timer state
string mElapseEvent event to trigger on timer elapse
string mInitialValue target representation of initial value
EventSet mStartEvents start events as in AttributeCodeGeneratorEvent
EventSet mStopEvents stop events as in AttributeCodeGeneratorEvent
EventSet mResetEvents reset events as in AttributeCodeGeneratorEvent

◆ CodeGenerator::ActionAddress

struct CodeGenerator::ActionAddress

Definition at line 538 of file cgp_codegenerator.h.

Class Members
string mAddress target address as specified in configuration
bool mSetClr is a set/clr type of address
bool mExe is an executable type of address