Modularity is one of the central Algorithm Library concepts, hence it is recommended to store application specific MDL parameter types, operators, and MDL functions operating on them and the application specific MDL model classes into separate dynamically loadable shared libraries. Furthermore it is recommended to separate the extensions in extra libraries, one containing Parameter types, associated MDL operators and functions, the other containing Model classes.
The recipe for the construction of such external MDL libraries consists of several steps illustrated in Fig. 2.6
; Declaration of the symbolic library names
(defun LocalModelLibraryName () "modelLibName")
; Declaration of MDL classes
(tuple
'(LocModels
( modelDecl vClass primBase )
( String String String )
...
))
Example 2.4: UNFUG tuple file template for Model extension libraries
; A symbolic Library Name
(defun LocalParamLibraryName () "ParLibName")
; Declaration of parameter types
(tuple
'(LocParameter::instances
(vClass ( header vAlias scan print instantiate newArg ))
(String ( String String Bool Bool Bool C++Const ))
; ... further parameter types
))
; Declaration of operators types
(tuple
'(opTupleName
(resType op1Type op2Type isAlias resAlias
op1Alias op2Alias ( left oper right ))
(String String String Bool String
String String ( Bool String Bool ))
; ... further specifications
))
; ... further operators
Example 2.5: UNFUG tuple file template for Parameter extension libraries
; Declaration of MDL functions
(tuple
'(MDL-FunctionExpressions
( mdlExpr exprDesc cxxExpr parFkt instTuple errorMsg )
( String String String String fktTupleName String )
; ... further functions
))
(tuple
'(fktTupleName
(resType op1Type valFkt resAlias op1Alias ( header ))
(String String String String String ( String ))
; ... further specifications
))
; ... tuples declared in MDL-FunctionExpressions->fktTupleName entries above
Example 2.6: UNFUG tuple file template for function extension libraries
;;- Symbolic VMAKE directory name
(Module-Directory ParLibName-Directory)
(Name ParLibName-Tuple :file "ParLibName.tup")
;;-------------------------
;;- Objects for the MDL-Parameter-extension-library |
;;-------------------------
(Unfug-Target ParLibName-Param-Source
:template Vienna-Model-Library-ParamExtensionDefinition-Tpl
:tuple Vienna-Template-Instantiation-Tup
Vienna-Model-Library-Main-Tup
Vienna-Model-Library-ModelExtensionTuple
ParLibName-Tuple
:target "ParLibName.acc"
)
(Unfug-Target ParLibName-Param-Header
:template Vienna-Model-Library-ModelExtensionDeclaration-Tpl
:tuple Vienna-Template-Instantiation-Tup
Vienna-Model-Library-ModelExtensionTuple
ParLibName-Tuple
:target "ParLibName.ahh"
)
(C++-Target ParLibName-Auto-Objs
:source ParLibName-Param-Source
:defines (LOCAL_PARAM_LIBRARY_DEFINITION 1)
)
(C++-Target ParLibName-User-Objs
:source :wildcard "*.cc"
)
;;----------------------
;; The local MDL-Parameter-extension-library |
;;----------------------
(Library-Target ParLibName-Library
:libname "ParLibName"
:objects ParLibName-User-Objs
ParLibName-Auto-Objs
:shared
:depends Vienna-Model-Library
)
(Include-Target :include :wildcard "*.hh"
ParLibName-Param-Header
)
Example 2.7: VMAKE makefile template for Parameter extension libraries
;;- Symbolic VMAKE directory name
(Module-Directory FuncLibName-Directory)
(Name FuncLibName-Tuple :file "FuncLibName.tup")
;;-------------------------
;;- Objects for the MDL-Function-Extension-Library |
;;-------------------------
(Unfug-Target FuncLibName-Functions-Source
:template Vienna-Model-Library-MDLFunctionsDefinition-Tpl
:tuple Vienna-Template-Instantiation-Tup
Vienna-Model-Library-Main-Tup
Vienna-Model-Library-ModelExtensionTuple
FuncLibName-Tuple
:target "FuncLibName.acc"
)
(Unfug-Target FuncLibName-Functions-Header
:template Vienna-Model-Library-MDLFunctionsDeclaration-Tpl
:tuple Vienna-Template-Instantiation-Tup
Vienna-Model-Library-ModelExtensionTuple
FuncLibName-Tuple
:target "FuncLibName.ahh"
)
(C++-Target FuncLibName-Auto-Objs
:source FuncLibName-Functions-Source
:defines (LOCAL_FUNCS_LIBRARY_DEFINITION 1)
)
(C++-Target FuncLibName-User-Objs
:source :wildcard "*.cc"
)
;;----------------------
;; The local MDL-Function-Extension-Library |
;;----------------------
(Library-Target FuncLibName-Library
:libname "FuncLibName"
:objects FuncLibName-User-Objs
FuncLibName-Auto-Objs
:shared
:depends Vienna-Model-Library
)
(Include-Target :include FuncLibName-Functions-Header)
Example 2.8: VMAKE makefile template for MDL function extension libraries
;;- Symbolic VMAKE directory name
(Module-Directory MDLLibName-Directory)
(Name MDLLibName-Tuple :file "MDLLibName.tup")
;;------------------------
;;- Objects for the MDL-Model-extension-library |
;;------------------------
(Unfug-Target MDLLibName-Model-Source
:template Vienna-Model-Library-ModelExtensionDefinition-Tpl
:tuple Vienna-Template-Instantiation-Tup
Vienna-Model-Library-ModelExtensionTuple
MDLLibName-Tuple
:target "MDLLibName.acc"
)
(Unfug-Target MDLLibName-Parameter-Header
:template Vienna-Model-Library-ModelExtensionDeclaration-Tpl
:tuple Vienna-Template-Instantiation-Tup
Vienna-Model-Library-ModelExtensionTuple
MDLLibName-Tuple
:target "MDLLibName.ahh"
)
(C++-Target MDLLibName-Auto-Objects
:source MDLLibName-Model-Source
)
(C++-Target MDLLibName-User-Objects
:source :wildcard "*.cc"
)
;;-----------------------------
;;- Include File: MDL-Model-extension-library declarations |
;;-----------------------------
(Include-Target :include MDLLibName-Parameter-Header )
(Library-Target MDLLibName-Library
:libname "MDLLibName"
:objects MDLLibName-User-Objects
MDLLibName-Auto-Objects
:shared
:depends Vienna-Model-Library
ParLibName-Library
)
(Include-Target :include :wildcard "*.hh"
)
Example 2.9: VMAKE makefile template for Model extension libraries
Consecutive executions of VMAKE extract the informations contained in the ``make'' and ``tuple'' files and generate automatically the required C++ code containing the necessary Algorithm Library bindings of the demanded MDL features. The generated files are compiled together with the above mentioned user defined C++ classes and functions implementing the required MDL functionality and linked into according shared libraries.
The thereby generated libraries contain the system dependent representations of MDL extension libraries. Depending on their planned application there are several possibilities for their usage:
The Algorithm Library is bundled with the extension library AdditionalLibcFuncs (Appendix B) containing MDL functions which provide according functions of the standard C library useful for general scripting of applications. Application specific MDL extension libraries, e.g. the libraries containing MDL Models, functions, and Parameters supporting the diffusion modeling with PROMIS-NT (Section 4), are distributed in conjunction with the according application.