Boost logo

Boost :

From: H. van Niekerk (h.v.niekerk_at_[hidden])
Date: 2005-06-20 13:21:59


Hi,

I'm rather new to shared_ptr and I'm not very experienced in programmer
with C++ but have to do it anyway.
My problem is this: I have 3 .cpp files, e.g. Master.cpp, Client.cpp and
Satellite.cpp.

Originally, Master.cpp is the only .cpp file, and uses auto_ptr to
enable writing and reading from an interface. Like this:

{
    ....
    auto_ptr<FtInterface> fti (ftGetIfFromFactory(device, connection));
    fti->getIfInfo(ii);
    IfOutputs out; // to set interface outputs (ctor clears everything to 0)
    IfInputs inp; // to be read from interface
    fti->writeAndReadAllData(out, inp);
    ...
}

This works well with every action taking place in this file. Now, as
said I have those 3 .cpp files. Master.cpp sends an argument to
Client.cpp and Client.cpp sends it to Satellite.cpp. Satellite.cpp reads
from the interface, and sends it back via Client.cpp to Master.cpp. I
can't use auto_ptr with this and from the Boost-documentation I can't
figure out exactly how to use shared_ptr for this. Can somebody please
help me out?

I hope I explained my problem clear enough.

Thank you for helping out.

H.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk