Modify templates to accept compatible data types

Modify the templates to check if the receive data has a compatible
type with the target variable. Until this patch, only the same type was
accepted. Now, the code is able to make changes between data types.

Change-Id: I18d24cd9813601d10aa44982c3777e01649ee152
cmake: Fix error in CMakeLists.txt

Change-Id: I06c1392606200eca7bf165d19a5c1473baa9deb8