<style>blockquote {padding-left: 1ex; margin: 0px 0px 0px 0.8ex; border-left: #cccccc 1px solid;} p {margin: 0px;padding: 0px;} </style>
<p>Dnia 10-08-2012 o godz. 19:06 mazix8@wp.pl mazix8@wp.pl  napisał(a):
<blockquote><!-- blockquote {padding-left: 1ex; margin: 0px 0px 0px 0.8ex; border-left: #cccccc 1px solid;} p {margin: 0px;padding: 0px;}  -->
<p>Hi all!</p>
<p>&nbsp;</p>
<p>I have a class:</p>
<p>&nbsp;</p>
<pre class="lang-c prettyprint"><code><span class="kwd">class</span><span class="pln"> </span><span class="typ">UserImpl</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> </span><span class="kwd">public</span><span class="pln"> POA_User<br /></span><span class="pun">{</span><span class="pln"><br />&nbsp; &nbsp; </span><span class="kwd">private</span><span class="pln"> </span><span class="pun">:</span><span class="pln"><br />&nbsp; &nbsp; &nbsp; &nbsp; typedef <br 
/>vector&lt;GroupImpl*&gt; Groups;<br />        Groups groups;</span><span class="pln"><br />&nbsp; &nbsp; </span><span class="kwd">public</span><span class="pln"> </span><span class="pun">:</span><span class="pln"><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="typ">User</span><span class="pun">::</span><span class="typ">Groups</span><span class="pun">*</span><span class="pln"> getGroups</span><span class="pun">();</span><span class="pln"><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; 
</span><span class="kwd">void</span><span class="pln"> setGroups</span><span class="pun">(</span><span class="kwd">const</span><span class="pln"> </span><span class="pun">::</span><span class="typ">User</span><span class="pun">::</span><span class="typ">Groups</span><span class="pun">&amp;</span><span class="pln"> g</span><span class="pun">);</span><span class="pln"><br /></span><span class="pun">};</span><span class="pln"><br /><br /></span><span 
class="com">#endif</span><span>class="pln"&gt;<br /><br /></span><span class="com">#include</span><span class="pln"> </span><span class="str">"UserImpl.h"</span><span class="pln"><br /><br /></span><span class="typ">User</span><span class="pun">::</span><span class="typ">Groups</span><span class="pun">*</span><span class="pln"> </span><span class="typ">UserImpl</span><span class="pun">::</span><span class="pln">getGroups</span><span class="pun">()</span><span class="pln"><br /></span><span 
class="pun">{</span><span>class="pln"&gt;<br />&nbsp; &nbsp; </span><span class="kwd">const size_t size = this-&gt;groups.size();<br />    User::Groups_var seqOfObjects = new User::Groups(size);<br />    seqOfObjects-&gt;length(size);<br /><br />    size_t i = 0;<br />    vector&lt;GroupImpl*&gt;::const_iterator it = groups.begin();<br />    while (it != groups.end())<br />    {<br />        seqOfObjects[i] = Group::_duplicate((*it)-&gt;_this());<br />        ++it;<br />        ++i;<br />    
}<br /><br />   return <br />seqOfObjects._retn();</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /><br /></span><span class="kwd">void UserImpl::setGroups(const ::User::Groups&amp; g)<br />{<br />    const size_t size = g.length();<br />    this-&gt;groups.resize(size);<br />    this-&gt;groups.clear();<br /><br />    for(size_t i = 0; i&lt;size; i++)<br />    {<br />        GroupImpl *newGroup = new GroupImpl(g[i]-&gt;getID(), g[i]-&gt;getName(),<br />   
    <br />                                     g[i]-&gt;getDescript_ion(),g[i]-&gt;getFounder(),<br />                                            *(g[i]-&gt;getUsers()));<br />        this-&gt;groups.push_back(Groups::value_type(newGroup));<br />    }<br />}<br /><br />And I have some troubles how to write a getter and setter for my class field "groups". I did it, but I have dooubts <br />if it's a good way to do this. It compiles with no error but I'm a beginner in CORBA and would like to<br 
/>someone <br />who knows it good help me. Thanks, mazix</span></code></pre>
<br /></blockquote>
<br /></p><br />