Solved

Passing large object thru an interface...

Posted on 2000-03-30
6
170 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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
Windows Drag & Drop Location 2 108
centeredAverage challenge 8 179
haveThree challenge 22 121
"Black Box" Testing of Control System Software 2 70
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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