qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davide Anastasia" <Davide.Anasta...@qualitycapital.com>
Subject Default copy constructor behaviour for the class messaging::Receiver and messaging::Sender
Date Thu, 01 Mar 2012 10:19:54 GMT
Hi All,

What is the default behaviour for the copy constructor of the classes
messaging::Receiver and messaging::Sender?

I've spent a huge amount of time yesterday to figure out why this class
didn't work:


class Producer



    //! \brief ctor

    Producer(qpid::messaging::Session& session, const std::string&
exchange, const std::string& topic);

    //! \brief dtor



    //! \brief

    void operator()();



    std::string m_address;


    qpid::messaging::Session& m_session;

    qpid::messaging::Sender m_sender;



When an instance of this class is given to
boost::thread_group::create_thread, a new instance is created using the
implicit copy constructor, which just performs a member-to-member blind
copy. Unfortunately, receiver didn't work properly after the copy (which
makes me wonder how the copy constructor for the class messaging::Sender
is implemented) and I had to write an explicit copy constructor that
creates a new messaging::Sender on the same address. That solved the
problem. Is this a bug or a defined behaviour? It seems to me that the
copy constructor just creates a blank Sender. (messaging::Receiver shows
the same problem).


Other question: is there a way to allocate messaging::Sender and
messaging::Receiver on the heap?




Davide Anastasia
Analyst, Research & Development

Quality Capital Management Ltd.
QCM House * Horizon Business Village
No. 1 Brooklands Road
Weybridge * Surrey KT13 0TJ
United Kingdom

Tel: +44 (0) 1932 334 400
Fax: +44 (0) 1932 334 415
Email: Davide.Anastasia@QualityCapital.com

www.qualitycapital.com <http://www.qualitycapital.com/> 


This email and any attachments are confidential and intended solely for
the use of the individual(s) to whom it is addressed. 

Any views or opinions presented are solely those of the author and do
not necessarily represent those of Quality Capital Management Ltd. If
you are not the intended recipient, be advised that you have received
this email in error and that any use, dissemination, printing,
forwarding or copying of this email is strictly prohibited. Please
contact the sender if you have received this email in error. You should
also be aware that emails are susceptible to interference and you should
not assume that the contents of this email originated from the sender
above or that they have been accurately reproduced in their original
form. Quality Capital Management Ltd is authorised and regulated by the
Financial Services Authority in the UK and is a member of the National
Futures Association in the US. 



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message