| Computers Forum Index » Computer - Object (Corba) » Doubt in sequence... |
|
Page 1 of 1 |
|
| Author |
Message |
| mthread... |
Posted: Tue Oct 20, 2009 1:36 pm |
|
|
|
Guest
|
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. |
|
|
| Back to top |
|
|
|
| Martin B.... |
Posted: Tue Oct 20, 2009 5:48 pm |
|
|
|
Guest
|
mthread wrote:
Quote: 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.
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 |
|
|
| Back to top |
|
|
|
| Gary Duzan... |
Posted: Fri Oct 23, 2009 7:44 pm |
|
|
|
Guest
|
In article <35aa33ec-0ace-4c86-9580-5fbbe9f6b03a at (no spam) b3g2000pre.googlegroups.com>,
mthread <rjkumr at (no spam) gmail.com> wrote:
Quote: 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.
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 |
|
|
| Back to top |
|
|
|
|