Cpp templates for event handling

Change-Id: I1f3fb07121f0b83aa211f8cedc60302424308835