Move file-scope variables into classes to avoid issues in unity builds.

UBT redefines the concept of a translation unit by concatenating
multiple source files into one during unity builds, so relying on
file-scope to keep identically named variables distinct is a bad idea.
This fixes #4.