There's a TF tutorial on creating a op, which covers anything written from scratch, but when you've got existing C++ classes (or anything callable from C++, really) which do the heavy lifting and are stateful, or at least require intialization/instatiation, the tutorial recommends, as a side note that ops need to be reentrant, that a ResourceMgr be used, linking to the corresponding header and no example.
That's sort of a cliff-hanger given how nice the rest of the tutorial. Two related SO questions