<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 09/05/2014 03:48 PM, Sylvain Joyeux
      wrote:<br>
    </div>
    <blockquote
      cite="mid:20140905134811.65CC99D968_409BF1BB@sea-mail.dfki.de"
      type="cite">
      <pre wrap="">Could you be more specific as to the type of property.</pre>
    </blockquote>
    I have the following types, in effect four nested std::vector types<br>
    <blockquote><small>namespace ndlcom_device_driver<br>
        {</small><br>
      <small>    struct ConfigureRegisterBit {</small><br>
      <small>        std::string name;</small><br>
      <small>        int bit;</small><br>
      <small>        bool value;t</small><br>
      <small>    };</small><br>
      <br>
      <small>    typedef std::vector&lt; ConfigureRegisterBit &gt;
        ConfigureRegisterBits;</small><br>
      <br>
      <small>    struct ConfigureRegister {</small><br>
      <small>        std::string name;</small><br>
      <small>        representations::RegisterId id;</small><br>
      <small>        double value;</small><br>
      <small>        ConfigureRegisterBits bits;</small><br>
      <small>        std::string valueString;</small><br>
      <small>    };</small><br>
      <br>
      <small>    typedef std::vector&lt; ConfigureRegister &gt;
        ConfigureRegisters;</small><br>
      <br>
      <small>    struct DeviceClassRegister {</small><br>
      <small>        std::string deviceclass;</small><br>
      <small>        ConfigureRegisters registers;</small><br>
      <small>    };</small><br>
      <br>
      <small>    typedef std::vector&lt; DeviceClassRegister &gt;
        DeviceClassRegisters;</small><br>
      <br>
      <small>    struct JointConfig {</small><br>
      <small>        std::string jointName;</small><br>
      <small>        DeviceClassRegisters configureRegisters;</small><br>
      <small>    };</small><br>
      <br>
      <small>    typedef std::vector&lt; JointConfig &gt; JointsConfig;</small><br>
      <small>}</small><br>
    </blockquote>
    The task property is of type JointsConfig. In the ruby script I do<br>
    <blockquote><small>    joints_config = task.joints_config.to_a</small><br>
      <small>    joints_config.each do | joint_config |</small><br>
      <small>       configureRegisters =
        joint_config.configureRegisters.to_a</small><br>
      <small>       configureRegisters.push( Types::NdlcomDeviceDriver</small>::<small>DeviceClassRegister.new
        )</small><br>
      <small>       joint_config.configureRegisters = configureRegisters</small><br>
      <small>    end</small><br>
      <small>    task.joints_config = joints_config  # This is where it
        crashes <br>
      </small></blockquote>
    I also tried something like.<br>
    <br>
    <small>            joints_config.each do | joint |<br>
                      joint.configureRegisters.push(
      Types::NdlcomDeviceDriver::DeviceClassRegister.new )<br>
                      joint.configureRegisters.each do | dc |<br>
                          dc.registers.push(
      Types::NdlcomDeviceDriver::ConfigureRegister.new )<br>
                          dc.registers.each do | reg | <br>
                              reg.bits.push(
      Types::NdlcomDeviceDriver::ConfigureRegisterBit.new ) <br>
                          end<br>
                      end<br>
                  end<br>
      <br>
    </small>The difference is that then the problem is changing from
    crash to following error message.<br>
    <blockquote><small>install/lib/ruby/1.9.1/typelib/compound_type.rb:23:in
        `set': invalidated object for
        /ndlcom_device_driver/DeviceClassRegister.registers for
        /ndlcom_device_driver/JointConfig.configureRegisters (TypeError)<br>
      </small></blockquote>
    <small><big>Let me know if you need more info.</big></small><br>
    <blockquote
      cite="mid:20140905134811.65CC99D968_409BF1BB@sea-mail.dfki.de"
      type="cite">
      <pre wrap="">

Moreover, do you try to change the property while the component is running ?</pre>
    </blockquote>
    No the task is not running.<small><big><br>
        <br>
        Best<br>
        Ajish</big></small>
    <blockquote
      cite="mid:20140905134811.65CC99D968_409BF1BB@sea-mail.dfki.de"
      type="cite">
      <pre wrap="">

Sylvain

On Thu, Sep 4, 2014 at 3:19 PM, Ajish Babu <a class="moz-txt-link-rfc2396E" href="mailto:ajish.babu@dfki.de">&lt;ajish.babu@dfki.de&gt;</a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Hi all,

I have a complex property with std::vector (sub-configs) inside std:vector
(configs). I am trying to modify the property from ruby script.

Changing any already existing value works fine. But once I try to push a new
element to the sub-configs and then write it back like

            configs = task.configs.to_a

            configs.each do | config |
                sub_configs = config.sub_configs.to_a
                sub_configs.push( Types::SubConfig.new )
                config.sub_configs = sub_configs
            end

            task.configs = configs

it crashes. Does anybody know how this can be achieved?

Best
Ajish




_______________________________________________
Rock-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rock-dev@dfki.de">Rock-dev@dfki.de</a>
<a class="moz-txt-link-freetext" href="http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev">http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev</a>

</pre>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>