Can I try factory on 3.20.xx ? [message #625014] |
Wed, 22 September 2010 03:01  |
Eclipse User |
|
|
|
Hi,
xdctools version 3.20.xx has already been available.
Question : Can I try a new proxy called "factory" by referring to ..
http://rtsc.eclipse.org/docs-tip/RTSC_Interface_Primer/Lesso n_15
This article says that ...
NOTE: This lesson leverages some new proxy capabilities slated for XDCtools 3.20.
NOTE: For now, just treat the programming examples as "read-only".
If "factory" is not still available, could you please let me know when it is scheduled.
Best Regards,
Kawada
|
|
|
|
|
Re: Can I try factory on 3.20.xx ? [message #792271 is a reply to message #629623] |
Mon, 06 February 2012 15:32  |
Eclipse User |
|
|
|
Kawada,
I know this thread is very old and probably not relevant any more to you, but I'll answer in case you come upon a similar issue later.
So, if I understand your scenario correctly, instance factories would work for you, but there could be a different solution that can be implemented without instance factories.
At runtime, you can always call
IProcProvider_create, but you have to pass something to that call that will specify one of the modules inheriting IProcProvider. What you will need to pass is basically a pointer to the virtual function table for the specific module. For example, if you have modules ProviderA and ProviderB, you can create instances of each using these two calls, and appropriate variables:
IProcProvider_Handle pA, pB;
ProviderA_Params AParams;
ProviderB_Params BParams;
pA = IProcProvider_create(ProviderA_Module_upCast(), (struct IProcProvider_Params*)&AParams, NULL);
pB = IProcProvider_create(ProviderB_Module_upCast(), (struct IProcProvider_Params*)&BParams, NULL);
Because IProcProvider_create returns IProcProvider_Handle, you can pass these handles directly to ProcUnit_create calls:
ProcUnit_Handle pu1, pu2;
pu1 = ProcUnit_create(pA);
pu2 = ProcUnit_create(pB);
A disadvantage of this approach is that you have to know at runtime which modules implement IProcProvider interface. But, it seemed to me from your description that you prefer to create them at runtime, and in that case modules' names have to show up in the runtime code. Even factories wouldn't help you there because they also require you to specify a module when creating instances.
|
|
|
Powered by
FUDForum. Page generated in 0.04786 seconds