#!/bin/sh
if [ $# -lt 2 ]
then
	echo -n "usage: new_stk_templates [-no-containers] -t <object type> -d <directory> "
	echo "[-I \"full path of object include file\"]*"
	echo "ex   : new_stk_templates -t \"Vertex*\" -d graph -I \"LINK/graph/Vertex.h\""
	echo "ex   : new_stk_templates -t \"int\" -d basic"
	exit
fi

object_type=""
extra_include=""
directory=""
no_containers="no"
new_extra_include=""

while [ $# -gt 0 ]
do
	case "$1" in
	-no-containers)	no_containers="yes";;
	-t)	shift; object_type="$1 ";;
	-d) 	shift; directory=$1;;
	-I)	shift; extra_include="-I $1 $extra_include";;
	esac
	shift
done

$LINK_BASE/bin/instantiate -c Wrapper -s -t $object_type -II "LINK/stkWrapper/Wrapper.h" -d $directory $extra_include
$LINK_BASE/bin/instantiate -c Register -s -t $object_type -II "LINK/stkWrapper/Register.h" -d $directory $extra_include

if [ $no_containers = "yes" ]
then
	exit
fi

$LINK_BASE/bin/instantiate -s -t "Container<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/Container.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "Container<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/Container.h" $extra_include


$LINK_BASE/bin/instantiate -s -t "Collection<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/Collection.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "Collection<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/Collection.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "$object_type" -c CollectionWrapper -II "LINK/stkWrapper/CollectionWrapper.h" -d $directory -I "LINK/basic/Collection.h" $extra_include

$LINK_BASE/bin/instantiate -s -t "MSet<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/MSet.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "MSet<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/MSet.h" $extra_include


$LINK_BASE/bin/instantiate -s -t "Set<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/Set.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "Set<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/Set.h" $extra_include

$LINK_BASE/bin/instantiate -s -t "Sequence<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/Sequence.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "Sequence<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/Sequence.h" $extra_include

###$LINK_BASE/bin/instantiate -s -t "SubSet<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/SubSet.h" $extra_include
###$LINK_BASE/bin/instantiate -s -t "SubSet<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/SubSet.h" $extra_include

###$LINK_BASE/bin/instantiate -s -t "SetFuncs<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/SetFuncs.h" $extra_include
###$LINK_BASE/bin/instantiate -s -t "SetFuncs<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/SetFuncs.h" $extra_include
###$LINK_BASE/bin/instantiate -s -t "$object_type" -c SetFuncsWrapper -II "LINK/stkWrapper/SetFuncsWrapper.h" -d $directory -I "LINK/basic/SetFuncs.h" $extra_include

$LINK_BASE/bin/instantiate -s -t "List<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/List.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "List<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/List.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "$object_type" -c ListWrapper -II "LINK/stkWrapper/ListWrapper.h" -d $directory -I "LINK/basic/List.h" $extra_include

$LINK_BASE/bin/instantiate -s -t "Array<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/Array.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "Array<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/Array.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "$object_type" -c ArrayWrapper -II "LINK/stkWrapper/ArrayWrapper.h" -d $directory -I "LINK/basic/Array.h" $extra_include

$LINK_BASE/bin/instantiate -s -t "SortedArray<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/SortedArray.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "SortedArray<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/SortedArray.h" $extra_include

$LINK_BASE/bin/instantiate -s -t "SortedList<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/SortedList.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "SortedList<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/SortedList.h" $extra_include

$LINK_BASE/bin/instantiate -s -t "DList<$object_type>" -c Wrapper -II "LINK/stkWrapper/Wrapper.h" -d $directory -I "LINK/basic/DList.h" $extra_include
$LINK_BASE/bin/instantiate -s -t "DList<$object_type>" -c Register -II "LINK/stkWrapper/Register.h" -d $directory -I "LINK/basic/DList.h" $extra_include
