Refactor monitor.

Move function body to *.cc file
Modify GetTopicCount
Merge pull request #25 from Shanicky/monitor

Refactor monitor.