Now able to produce template fwd decl for the new rootmap file format

Rootcling is now able to produce the template forward declaration for the new rootmap format.
When looping on the selected classes, it is checked if they are templates.
If this is the case, the definition is found together with its containing namespaces.
Fix Coverity issue 53235 53234

The result of ctime was used directly w/o checking if the
returned pointer was null.
All the calls were replaced.
It is maybe relevant to observe that the defect was found only
now even if the code was there since a couple of months.