metaprogramming - Meta-Programming in Delphi - Adding a function call to every method of a class -


I want to add some instrumentation to an application, basically adding the function call as the first line for each Wish I Method / Event In many statistics, code appears broadly.

  Process TSomeClass.SomeProcedure; Start the execution quarter (classname, 'some process'); // This is what I want to insert. // Finishing the rest process;  

I can do it manually in thousands of ways (maybe it may take a few hours), but I was thinking that there was some programmatic way to do this.

I can extract the code quite easily with a regular expression, but one way to add it ( start after process or Can not define the function and enter the code with the appropriate parameters.)

This will be a big case for AOP in Delphi, but it is not very well supported.

For some backgrounds, I am working with a large heritage application server (Dataset / DCOM) and I want to determine which functions the client is still calling. The Execution Control Function gives class as a class district in the class district, it enhances the class name, method name, exceritation count, and logs the total running time (in a different thread course) for that method.

is a form of aspects of DSHR (). All methods should be virtual so that there is a very real limit but it can be something that you can use.

Here is a link to their AOP example:

For example, you will do something like this:

  TMyAspect = Class (TAspect) DoBefore Public Classing Process (Example: TObject; Method: TRttiMethod; const Args: TArray & lt; TValue;; DoInvoke Out; Boolean; Outcome: TValue; Override; End;  

The implementation might look like this:

  class process TMyAspect.DoBefore (example: TObject; method: TRttiMethod; const ergos: TArray & lt; TValue>; DoInvoke Out: Boolean; Outcome: TVLue); inherited from; Execution Quarter (example classname, method name); End;  

And you'll hook it to the method like this:

  Insertive AdSak (TSomeClass, TMyAspect, 'SomeProcedure');  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -