Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Doubt in sequence

0 views
Skip to first unread message

mthread

unread,
Oct 20, 2009, 9:36:16 AM10/20/09
to
Hi,
I am learning corba(Book : Advance CORBA programming with C++) and
have a doubt on the code given below.

CCS::Controller::ThermometerSeq_var listv = new
CCS::Controller::ThermometerSeq(m_asset .size());
listv->length(m_assets.size());

In the above code ThermometerSeq is a typedef of
sequence<Thermometer>. I Would like to know the purpose of the call
listv->length.

Martin B.

unread,
Oct 20, 2009, 9:48:09 AM10/20/09
to

The ctor of ThermometerSeq reserves the space for m_asset.size() items
and the call to the length(size) method then sets the accessible size of
the container.

br,
Martin

Gary Duzan

unread,
Oct 23, 2009, 3:44:57 PM10/23/09
to
In article <35aa33ec-0ace-4c86...@b3g2000pre.googlegroups.com>,

The constructor argument defines how much space is pre-allocated
to hold the sequence, but the length() method indicates how many
entries are actually used. If you try to access any sequence entries
for reading or writing beyond the length()-1'th entry, your ORB
may throw an exception, possibly CORBA::BAD_PARAM, or have other
undefined behavior.

Hope this helped.

Gary Duzan
Motorola H&NM


0 new messages