Solved

Call a function from a group of different argument lists with out switch statement

Posted on 2002-04-10
5
168 Views
Last Modified: 2010-04-02
Here I am having three lists

1)Pointer to Functions (Functions are of variable arguments and different argument types)
2)Argument Type List
3)Arguments received( Received in a buffer, In this we are not receiving any argument type. It is a block of data)

From this I need initialize the arguments and assing the data received in 3 and call the function with these initialized argumnets.
One way is switch case depends on function type.
This will consume lot of memory.

Another way is push the received data onto the stack depends on the srgument type and call the function(This nneds assemly language and not user friendly).
If any other Idea..Please ....

Thanks in advance,
klkreddy
0
Comment
Question by:klkreddy
5 Comments
 
LVL 4

Expert Comment

by:AssafLavie
ID: 6933010
If you're trying to implement RPC I'd suggest first looking into existinggmechanisms. RPC isn't trivial.
0
 

Author Comment

by:klkreddy
ID: 6934338
I want to implement the RPC with out XDR.So I am struggling this much.
0
 
LVL 22

Accepted Solution

by:
ambience earned 200 total points
ID: 6941130
not sure though what exactly the situation is but ..

how about calling the function by pointers indexed by function type.

like say g_func is an array of pointer to functions.

so instead of a switch you index into the array using the function type or id.

(g_func[ function_tpe ])(args...);

this doesnt require assembly to manipulate stack too. Provided you have function ids for all the function callable.

Please post further information incase i havent understood the problem.
0
 
LVL 11

Expert Comment

by:griessh
ID: 7012034
Dear klkreddy

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "ambience"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 

Author Comment

by:klkreddy
ID: 7015530
Hi Ambience,
          Thanks for suggesting me the suitable answer.
Regards,
klkreddy
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question