Helper class for Structure creation in the kernel: Kernel::StructureFactory.
commit62c69c568763b47904f299fa2aecfa017bd71879
authorHenrik Tidefelt <tidefelt@isy.liu.se>
Fri, 14 Nov 2008 15:09:24 +0000 (14 16:09 +0100)
committerHenrik Tidefelt <tidefelt@isy.liu.se>
Mon, 1 Dec 2008 22:32:13 +0000 (1 23:32 +0100)
tree9acb1a42cc0c0f553393ecf9422050d2b327663c
parentdbae43efadee5aafde40a0fa9f3901a34e5d8689
Helper class for Structure creation in the kernel: Kernel::StructureFactory.

This will soon be used by the Schur decomposition function, which will serve as example on how to use the factory.

Basically, the idea is that a global instance of Kernel::StructureFactory is created for each structure signature.  To create an instance of that structure, use the <set> method to modify the fields held in the factory, and when all fields are set, use the <build> method to create an instance.  This is very non-functional, but pretty convenient.  The danger is that one must not forget to set any fields before calling <build>, or values from the last <build> will be used without warning.  Means to prevent this, such as clearing values after every <build>, and checking for unset values upon <build>, seems overly protective and costly.

At least, the factory ensures that only declared fields are assigned, and it takes care of the not-so-obvious details of how to set up a new instance of Lang::Structure.
source/containertypes.cc
source/containertypes.h