Making sense of C++ core code

Let’s try log the classes and their meaning and usage. The documents and relations may then be converted to doxygen.

General notes

Glossary

Trasnformation, trasnformation node, calculation node, node

calculation unit with arbitrary number of inputs and at least one output

Input, argument, source

calculation node input data

Output, return value, sink

calculation node output data

Connection, connect

procedure of the connection between one TransformationBase::Entry’s output to the other TransformationBase::Entry’s input

GNAObject header

GNAObjectclass
GNASingleObjectclass

Parameters header

The header contains classes representing individual parameters. The base class is changeable.

Data

inconstant_datastruct template
  • elementary data item (usually double) with taint flag propagation

  • may handle a function pointer to calculate the data value

  • may handle a callback function to be called on data change

inconstant_headerstruct
  • carries information to track dependencies:

    • taintflag

    • list of taint signal emitters

    • list of taint signal observers

  • base for inconstant_data

referencesstruct

Variables

Variables represent simple data types (double) with taintflag propagation feature. Variables within same namespace (python side) are distinguished by their name. Creating several variable or parameter instances with the same name will manage the same data.

Variables are mostly used on C++ side. On python side the Parameter, Variable, etc are used as accessors.

callbackclass
  • TBD

changeableclass
dependantclass template
evaluableclass template
  • inherits variable

  • a parameter, which value is evaluated with a function

parameterclass template

references : class

taintflagclass
  • indicates (cast too bool) if the value/transformation should be recalculated

variableclass template

Parametrized header

EvaluableDescriptor : class

VariableDescriptor : class

ParametrizedTypes namespace

Main classes

Baseclass
Entryclass
  • a class to access variable’s value

  • contains pointers to:

EvaluableEntry : class

Indirect access classes

EvaluableHandleclass template
VariableHandleclass template

TransformationBase header

SingleOutputclass
Transformationclass template

TransformationTypes namespace (TransformationBase)

The header is now fully documented via Doxygen.

Functions

Functionstd::function
  • (Args, Rets)

  • an implementation of the particular transformation

TypesFunctionstd::function
  • (Atypes, Rtypes)

  • an transformation input/output types initialization and checking

MemFunctionstd::function
  • template

  • (T* this, Args, Rets)

  • an implementation of the particular transformation

  • requires the object to be passed as the first argument (needs binding)

MemTypesFunctionstd::function
  • template

  • (T*, Atypes, Rtypes)

  • an transformation input/output types initialization and checking

  • requires the object to be passed as the first argument (needs binding)

Main classes

Baseclass
Entrystruct
  • base class for the calculation node representation

  • has methods to:

    • add sources/sinks

    • evaluate/update types/values

    • freeze/unfreeze/touch

  • gives access to:

    • sources/sinks

    • data

    • taintflag

  • accessed via Handle class

  • named

Initializerclass template

Indirect access classes

Accessorclass
Argsstruct
Atypesstruct
Handleclass
InputHandleclass
Retsstruct
Rtypesstruct
Sinkstruct
Sourcestruct
OutputHandleclass
  • limited indirect access to Sink

  • may be:

Errors

TypeErrorclass
  • Base class for type errors

  • Just pass a message to std::runtime_error constructor

CalculationErrorclass
  • Can be throwed if transformation cannot be computed: invalid source and etc..

  • Appears only in operator[](int i) for Args, Rets and in Entry::data(int i)

SinkTypeErrorclass
  • Inherits from TypeError

  • Throwed when type function fails on constructing sink via rets.error(message)

SourceTypeErrorclass
  • Inherits from TypeError

  • Throwed when type function fails on constructing source via args.error(message)

Transformation header

InputDescriptorclass
  • a wrapper to the InputHandle

  • implements various forms of the connect() function

OutputDescriptorclass
TransformationDescriptorclass

UncertainParameter header

The header contains variaous variable and parameter views, defined as transformations and used on python side.

GaussianParameterclass template
  • a nickname for Parameter (Variable)

  • represents normally distributed variable with central value and sigma

  • carries also information about variable’s uncertainty

Parameterclass template
  • derives _Variable

  • carries parameter instance for the variable, i.e. may set it’s value

  • may:

    • set parameter’s value

    • set parameter’s value in terms of sigma relative to it’s central position

    • define limits (used for minimization)

  • the class is used as an input for the minimization

ParameterWrapperclass template
  • a simple wrapper for the parameter class meant to use on python side

  • has set and get methods

  • carries also information about variable’s central value

Variableclass template
  • GNAObject represending a transformation with no inputs and one output

  • output is connected with variable instance (connection is name based)

UniformAngleParameterclass template
  • derives Parameter

  • represents an angle in radiance defined in \([-\pi, \pi)\)

ParametricLazy.hpp header

Defines code for the evaluable creation based on math expressions.

Defines mkdep() function which does the job.

No additional reference for now (it’s magic).