homogeneize coding style.

  - TypeWkPtr -> TypeWkPtr_t.
Add a macro to static cast with dynamic cast checking in debug mode.