I have this library (one class with 700 methods) I want to wrap all the calls, so I can log the calls and do other stuff. Using emacs macros and stuff, I >>can create a proxy class which has the same signature, but each method calls a C macro which calls the original class method, and does other stuff.
A class or a namespace?
A document class. Yes it's huge.
I'm thinking there must be a better way. I'm thinking BOOST_PP library could abstract the above macros into something concise. However, the library is intimidating. There are lots of features, and I'm not clear on how I should get started.
For ad hoc code generation, I usually end up with awk and sed. I just did this wrapping thing with a java class definition ( no actual source code) and could pretty much use lynx to render the javadoc html, extract method signatures, and use awk to generate methods with sed and finally vi to touch stuff up. The generated class contained an instance of the original class that was simply called in each generated method after my custion code,if any, executed. I wasn't just interested in wrapping as I also made a fake version for unsupported operations.
That does seem to be a good approach. Thanks for the idea. __________________________________________________________________ Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at http://ca.toolbar.yahoo.com.