Re: help with automatic code generation



JoshforRefugee wrote:
) I heard that we can do automatic code generation using macros, but not
) sure how can I pursue this. Here is my problem.
)
) In my env, I have class A,B and C. All of them has constructors, and
) few common methods, like reset, and execute.
)
) now my env(main) class actually is where I am creating this objects.
) in .h
) A myA;
) B myB;
) C myC;
)
) and later I am calling methods in my .C file
) myA.reset();
) myB.reset();
) myC.reset();
) myA.execute();
) .....
) myC.execute();

Well, the object-oriented approach would be to have all of those objects
implement/inherit a common interface, with the calls reset, execute, etc.

Then you can put all your objects in a group (array, bag, whatever) and
call 'reset' and 'execute' on all of them. Then to add a new one, you only
need to change the bit of code where they're added to the group.

The exact details on how to do this depend on the language, and I'm not too
well-versed in C++ to know how exactly to do it there.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
.



Relevant Pages

  • Re: Cannot paste into remote shell
    ... >> the Debian machine? ... > Can you execute `reset` and see if it fixes this? ... Executing 'reset' did not resolve it, but your second question prompted me (no ... "The rich control all the businesses, ...
    (Debian-User)
  • Re: Verilog - Race Condition - Please Help !!
    ... I am using "reset" variable to control the set of statements that gets ... I am seeing that all the assignment statements are ... code will execute on both clock edges, ...
    (comp.lang.verilog)
  • Re: [patch 2.6.12 (repost w/ corrected subject)] pci: restore BAR values in pci_enable_device_bars
    ... > Do PCI devices ever come out of reset in a PM state, ... > would execute John's new code as a side effect? ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • [Q] LaTeX: hooking on each new page
    ... I'm looking for a way to execute a piece of code at each new page. ... question will not actually output anything; just merely reset or redefine some ... Didier Verna, didier@xxxxxxxxxxxxx, http://www.lrde.epita.fr/~didier ... Prev by Date: ...
    (comp.text.tex)