Next: 2.2 Compiling
Up: 2.1 Design
Previous: 2.1.2 Data structures
The following steps show how to add a clustering algorithm called foo to the
cluster program.
- Create a pair of files cluster_foo.cc and cluster_foo.hh.
- In cluster_foo.hh, #include "cluster.hh"
and provide a function prototype extern void cluster_foo(int k);,
as is done in the various existing cluster_*.hh files.
- In cluster_foo.cc, #include "cluster_foo.hh",
and then put the clustering algorithm into a function void cluster_foo(int k).
All other functions and data should be marked as static.
- In Makefile, add cluster_foo.o to the end of the ``cluster: ...''
line.
- In Makefile, add cluster_foo.hh to the end of the ``algorithms.o: ...''
line.
- In Makefile, add the line ``cluster_foo.o: cluster.hh''.
- In algorithms.cc, #include "cluster_foo.hh" and
then add to the end of the registerAlgorithms() function
``algorithms.insert("foo", cluster_foo);''.
Kevin Pulo
2000-08-23