Project

General

Profile

1
In general, the TempMap code can be pretty frightening. What needs to be done
2
is to define an interface to TempMap that can be easily and consistently
3
used by map factories. There should be two general classes of functions
4
in this interface: those for constructing the TempMap and those for working
5
with it.
6

    
7
Example of functions in the first category are functions to
8
add a TempRootClassMap, TempClassMap, or TempTableMap to the TempMap --
9
basically a way to add or retrieve anything that is stored in a variable
10
in TempMap. One difficulty here is that map factories have a common need
11
to retrieve submaps that don't yet exist -- for example, when creating a
12
TempRelatedClassMap, the map factory needs access to the TempClassMap, even
13
though it might not yet have been constructed. Thus, the variable access
14
functions need to come in two flavors: one to say, "I am mapping this now
15
and an error must occur if I have already mapped it," and the other to say
16
"I need this object and if it hasn't been created yet, please create it so
17
I can have a reference to it." This is what is currently done with the
18
add/map* and get* functions, although the names could certainly be better.
19

    
20
Examples of functions in the second category are those to construct the
21
table maps from class maps, those to construct a real Map from a TempMap, and
22
those to construct class maps from table maps (note that the latter doesn't
23
yet exist).
24

    
25
Thus, the strategy followed by most map factories is either to construct the
26
class maps (TempClassMap, TempPropertyMap, etc.) and then call a function to
27
construct the table maps (TempTableMap, TempColumnMap, etc.) or vice versa.
28
Both types of map factories then call a function to convert the temp maps
29
into real maps.
30

    
31
One final note is that similar interfaces should be defined for all the Temp*
32
classes. For example, there should be a well-defined interface for adding
33
columns to tables, property maps to class maps, and so on.
(4-4/9)