AW: [omniORB] How avoid copying "in" parameters?

evgeni.rojkov at durr.com evgeni.rojkov at durr.com
Thu Feb 7 14:48:21 GMT 2008


>>  //..................
>>  // I would like to store the msg in a message queue
>>  // without copying it because it can generate performance
>>  // issues.
>>  CORBA::Boolean addWork( const Message& msg )
>>  {
>>       m_queue.store( msg ); // Store a copy of msg...
>>  }

I assume you could not skip copying data the input parameter references if the
m_queue should be processed after addWork() returns. In other case you risk
invalid references. It is not CORBA - related, just C++.
Regards, Evgeni

-----Ursprüngliche Nachricht-----
Von: omniorb-list-bounces at omniorb-support.com
[mailto:omniorb-list-bounces at omniorb-support.com] Im Auftrag von DA SILVA
Antonio
Gesendet: Donnerstag, 7. Februar 2008 13:39
An: omniorb-list at omniorb-support.com
Betreff: [omniORB] How avoid copying "in" parameters?



Hi all,

When I declare a parameter as "in" inside an IDL,
it is then implemented as a reference in C++.
How can I store the parameter/data I receive in this
reference without copying it?

For example :

struct Message
{
    attribute string to_do;
};

interface Worker
{
    boolean addWork( in Message msg );
};

==> implemented as :

class WorkerImpl : public Worker
{
    //..................
    // I would like to store the msg in a message queue
    // without copying it because it can generate performance
    // issues.
    CORBA::Boolean addWork( const Message& msg )
  {
       m_queue.store( msg ); // Store a copy of msg...
  }
};

Any ideas?

Antonio.


_______________________________________________
omniORB-list mailing list
omniORB-list at omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list



More information about the omniORB-list mailing list