Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing large object thru an interface...

Posted on 2000-03-30
6
Medium Priority
?
183 Views
Last Modified: 2013-11-20

How do i pass a large object from one ATL COM EXE to another( both developed in VC++ 5.0 ) on an interface.
The object is an instance of a huge class which has a lot of data in it and also pointers to many other classes.

Thanx in advance.
Rashmin
 
 
0
Comment
Question by:Rashmin
  • 2
  • 2
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
vachooho earned 150 total points
ID: 2670428
one of solutions (guess not the best)

split your large amount of data into small structured pieces

Pointer to other classes replace with interface pointers. (i.e. you need to develop some COM wrappers for each of your classes involved into COM traffic)

add get/put methods for each piece of data element so other object in other process could reach it without troubles.

sample
say you have
Class B
{
  int a,b,c;
}
Class A
{
   int a,b,c;
   B * b;
}

could be
interface B
{
 HRESULT get_a([out, retval]int * a);
 HRESULT get_b([out, retval]int * b);
 HRESULT get_c([out, retval]int * c);
 HRESULT put_a([in]int a);
 HRESULT put_b([in]int b);
 HRESULT put_c([in]int c);
}
interface A
{
 HRESULT get_a([out, retval]int * a);
 HRESULT get_b([out, retval]int * b);
 HRESULT get_c([out, retval]int * c);
 HRESULT put_a([in]int a);
 HRESULT put_b([in]int b);
 HRESULT put_c([in]int c);
 HRESULT get_functionB([out, retval]B** b);
 HRESULT put_functionB([in]B* b);
}
0
 
LVL 8

Expert Comment

by:gelbert
ID: 2670829
I would suggest not to pass your object around which involves problem of changing all pointers to interfaces.
  You should keep object where it is but pass it interface which client can query to get info, request action or get another interface. I think this is COM way of doing things
0
 

Author Comment

by:Rashmin
ID: 2671652
Hi vachooho
If this is the only way through, then it is bit difficult, since the object i am talking of is bit too large and contains pointers to a lot many classes and hence would not be possible to write a wrapper in COM for that.
Is there no other way of doing it?

Thanx

Rashmin
0
Industry Leaders: 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!

 

Author Comment

by:Rashmin
ID: 2671657
Hi gelbert

Is this the only way thru?
0
 
LVL 5

Expert Comment

by:vachooho
ID: 2673127
you can write your own marshaling code for that object but I think it will be much more difficult than splitting object into elementar pieces.
0
 
LVL 8

Expert Comment

by:gelbert
ID: 2673290
 Try to make several smaller objects out of your object(based on functionality, provided services). As result you should end up with container object whch aggregates number of other objects.
  I know it is kind of painful but it would easy your maintanence or allow more simple design changes (you know when project is almost done, then management would come up with "great" idea which has nothing to do with project design :) ).
  And it always easy to reuse smaller classes/COM objects and use components which you can plag/unplag without redoing a lot of code
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses
Course of the Month11 days, 6 hours left to enroll

886 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