We help IT Professionals succeed at work.

Macros

qocarlos
qocarlos asked
on
Medium Priority
318 Views
Last Modified: 2013-11-20
Hi,

I've written an application for signal data processing in which I have included a lot of processing commands (Fourier transform, convolution functions, linear prediction, etc)
I would like now to add macro capabilities to this application for repetitive automation of processing instructions.

Can anybody give me any advice about how to implement this?
Comment
Watch Question

CERTIFIED EXPERT

Commented:
what kind of macro support ?

Author

Commented:
For example, if one user applies several commands to an image file:

Command 1
Command 2
Command 3
...

And that he has to apply the same procedure to a many images. What I want to do is to save the commands in a macro so the user will be able to apply this macro to every image file.



CERTIFIED EXPERT
Commented:
Well, for that there can be many ways , for e.g. you can have a structure like

typedef string FunctionID; // can also be int or whatever you like suitable, may even be menu Ids.

struct command
{
  FunctionID func;
  ... // optional data member, depending upon your imp.
 
  command(..) /// ctor.
};

typedef list<command> commands;

for eg. if the user applies FF and then convolution and then print results. you can have

commands cmd1;
cmd1.push_back( command("Fourier") );
cmd1.push_back( command("Convolution") );
cmd1.push_back( command("Print") );

you can then save the lists to disk or any media and replaying the macro would be like traversing the lists and doing the appropriate work like.

for(commands::iterator it = cmd1.begin(); it != cmd1.end(); ++it)
{
   command cmd = (*it).second;
   DoCommand(cmd); that actualy dispatches the work to different functions based upon the ID.
}

If all the interaction of user id thru menus maybe its better to save menu Ids and later just post WM_COMMAND with that particular IDs , so you dont have to do the dispatching either.

But this all depends upon your implementation, maybe you also have to store some extra data with the commands.
You can also get Object oriented by using polymorphism here.

The solutions are many to cosider.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: ambience

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer

Explore More ContentExplore courses, solutions, and other research materials related to this topic.