move template class code to header file

Signed-off-by: Fuang.Cao <cavan.cfa@gmail.com>