* Use write lock when removing template
Since template removal modifies the template set map, it should be done
while holding a write lock, instead of a read lock.
* Optimize BasicTemplateSystem
The BasicTemplateSystem that comes with the library uses a 3-level map
to hold template information to avoid templateId and obsDomainId
collision between multiple protocols and hosts. However, the same can be
done by using a single map with a 64-bit key consisting of version,
templateId and obsDomainId.
This greatly simplifies the code and reduces the number of map lookups
from 3 to 1 per call to GetTemplate.
Co-authored-by: Matheus Castanho <matheus.castanho@dcc.ufmg.br>