Add check for smart pointer type in generated code for director connection. This fixes a crash in the generated code caused by the dynamic_cast returning 0 because the specified types are incorrect for smart pointer types.

Add runtime test to the C# test suite's director smartptr test that demonstrates crash in generated code when directors are used with smart pointer types.

Closes #34
Cosmetic tidyup in smartptr feature code and document smartptr fix in previous commit
Octave: fix bugs in output of cleanup code

Closes #35