Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Lookup Table ?

Posted on 2012-03-21
1
459 Views
Last Modified: 2016-09-29
i have a class that holds some methods...

Server sends Client a function name and Client uses a statement (case/of) to execute it from a hardcoded indexed TStringList.

how can i avoid this ?

someone told me something like this...:

you could use an enumerated type shared across both projects. on the startup of the server, it would index the functions (as procedure objects) in a list, based on the enumerated type

when calling your server's function, just cast the enumerated type as an ordinal, which would change it to integer so it can be transported over socke

that is how to pass a procedure as a pointer
[20/03/2012 23:47:02] Jeff Lefebvre: store a list of procedure pointers, indexed by an enumerated type

1) the link i sent you talks about procedure pointers
2) add procedure pointers into a TList or array, in the same order as the list enumerated type elemented
3) you could do it in a TList, or array of pointers
4) yes, or a TList
0
Comment
Question by:rotem156
1 Comment
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 37753773
@rotem156

>>can i see a sample code

This is new code?  Your question stated that you already have a class with public functions/methods.

There are some code snippets in the comments to a similar question
http://stackoverflow.com/questions/4186458/delphi-call-a-function-whose-name-is-stored-in-a-string
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 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