Solved

Passing large object thru an interface...

Posted on 2000-03-30
6
161 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 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VB.NET how to use the Vertical ScrollBar 5 87
Process filename extension 3 157
notReplace  challenge 53 102
fizzArray2 challenge 1 61
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now