Skip to content
Snippets Groups Projects
Commit 48e1dcac authored by Jan Trávníček's avatar Jan Trávníček
Browse files

wip programmer documentation

parent 3f0cca47
No related branches found
No related tags found
No related merge requests found
......@@ -306,9 +306,21 @@ Registration functions do not register for normalization.
\subsection{Registration of casts}
Full featured selection of algorithm to call, as implemented in c++ overload resolution algorithm, uses information about casts. Abstraction can keep track of casts available for such a purpose. The cast can also be executed manually when algorithm overload resolution would report multiple call candidates.
 
The cast is in general a conversion for one type to another. Again there are two possible registration approaches either via creation of a global variable or via a function call. The cast can later be referenced by means of the string representing the target type.
\subsection{Registration of casts via constructor}
Registration of cast can be execute via creation of \emph{registraion::CastRegister} class. Template parameters To and From of the class specify the two types participating in the cast. The class can be constructed either using the default constructor or with a constructor accepting a so called cast function as a pointer to function. The cast function must take a single argument of constant reference type identified by From template parameter and return the type specified by To template parameter.
Both constructors actually use the registration via function call internally again and both approaches do register the cast target type for normalization.
The default constructor requires an expression using standard c-like cast From and To the participating types to be valid.
 
\subsection{Registration of casts via function call}
Same information about types participating in the cast must be provided to the registration via function call. There are again overloads allowing either cast by c-like syntax or via a casting function. All overloads need to be templated with the To and From types.
The casting function must produce the To type of the cast. There are however two overloads of registration of cast function. One for parameter being a const reference to From type and second for From type being a value. This gives in total three overloads of registrator functions.
Since the target type is the source of a name used to access the cast operation and the target type name may not be appropriate to use, all three overloads also allow specification of target and source type names.
 
\section{Normalization}
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment