Solved

Passing large object thru an interface...

Posted on 2000-03-30
6
175 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
[X]
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
  • 2
  • 2
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
vachooho earned 50 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
Independent Software Vendors: 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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
How do you programatically show and hide the Windows 10 On-Screen-Keyboard? 3 1,024
Replacement selected text 2 69
has77  challenge 9 105
Problem to open Excel file 15 266
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.

739 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