Solved

Passing large object thru an interface...

Posted on 2000-03-30
6
171 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
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!

 

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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
C++ BOOL WINAPI ReadFile fails on windows 10 when reading from USB cable 9 516
has77  challenge 9 98
Window placement 17 95
sumHeights  challenge 17 79
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.

749 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