Assignment operator does not work for StructTypeInfo<OwnTypes>

Hi,
I'm working with the types_test unit test and found a bug when assigning
objects of own data types.

To reproduce that bug please expand the
rtt/tests/types_test.cpp:BOOST_AUTO_TEST_CASE( testTypes):

- Types()->addType( new StructTypeInfo<AType,false>("astruct"));
- somewhere in string test:
"var astruct aVar\n" +
"var astruct bVar\n" +
"aVar.a = 42\n" +
"do test.assertMsg(aVar.a == 42, \"aVar.a != 42 assignement failed -
testTypes\")\n" +
"bVar = aVar\n" +
"do test.assertMsg(bVar.a == aVar.a, \"bVar.a != aVar.a assignement
failed - testTypes\")\n" +

The assignment of a complete AType will remain untouched. The second assertion will fail.
Any solutions? I'm using the orocos-toolchain 2.6

Thanks
Sandra

Assignment operator does not work for StructTypeInfo<OwnTypes>

Hi Sandra,

On Thu, Feb 6, 2014 at 1:36 PM, Sandra Beyer <sandra [dot] beyer [..] ...> wrote:
> Hi,
>
> I'm working with the types_test unit test and found a bug when assigning
>
> objects of own data types.
>
>
>
> To reproduce that bug please expand the
>
> rtt/tests/types_test.cpp:BOOST_AUTO_TEST_CASE( testTypes):
>
>
>
>
>
> - Types()->addType( new StructTypeInfo<AType,false>("astruct"));
>
> - somewhere in string test:
>
> "var astruct aVar\n" +
>
> "var astruct bVar\n" +
>
> "aVar.a = 42\n" +
>
> "do test.assertMsg(aVar.a == 42, \"aVar.a != 42 assignement failed -
>
> testTypes\")\n" +
>
> "bVar = aVar\n" +
>
> "do test.assertMsg(bVar.a == aVar.a, \"bVar.a != aVar.a assignement
>
> failed - testTypes\")\n" +
>
>
>
>
>
> The assignment of a complete AType will remain untouched. The second
> assertion will fail.
>
> Any solutions? I’m using the orocos-toolchain 2.6

I could reproduce your case in toolchain 2.7 as well.

Is this only happening in state machines or also in program scripts ?

Peter

Assignment operator does not work for StructTypeInfo<OwnTypes>

Hi Sandra,

I've fixed the issue, could you verify that it works for you ? The bug
was not in the copying, but in the reading of the member variable
'.a'. I've pushed a fix to the master and toolchain-2.7 branches, but
also attached it such that you can apply it to toolchain-2.6 yourself.
I've also pushed this fix to toolchain-2.6 on gitorious.

Thanks for supplying the unit test, it greatly enlarges the chances of
us fixing it quickly.

Peter

On Wed, Feb 12, 2014 at 10:07 AM, Sandra Beyer
<sandra [dot] beyer [..] ...> wrote:
> Hi Peter,
> the problem seems to exist only in state machines. When I add the same lines in the unit test case rtt/tests/types_test.cpp:BOOST_AUTO_TEST_CASE(testDotsAndIndexes) everything is working fine.
>
> Sandra
> ________________________________________
> Von: Peter Soetens [peter [..] ...]
> Gesendet: Mittwoch, 12. Februar 2014 00:08
> An: Sandra Beyer
> Cc: orocos-dev [..] ...; orocos-users [..] ...
> Betreff: Re: [Orocos-users] Assignment operator does not work for StructTypeInfo<OwnTypes>
>
> Hi Sandra,
>
> On Thu, Feb 6, 2014 at 1:36 PM, Sandra Beyer <sandra [dot] beyer [..] ...> wrote:
>> Hi,
>>
>> I'm working with the types_test unit test and found a bug when assigning
>>
>> objects of own data types.
>>
>>
>>
>> To reproduce that bug please expand the
>>
>> rtt/tests/types_test.cpp:BOOST_AUTO_TEST_CASE( testTypes):
>>
>>
>>
>>
>>
>> - Types()->addType( new StructTypeInfo<AType,false>("astruct"));
>>
>> - somewhere in string test:
>>
>> "var astruct aVar\n" +
>>
>> "var astruct bVar\n" +
>>
>> "aVar.a = 42\n" +
>>
>> "do test.assertMsg(aVar.a == 42, \"aVar.a != 42 assignement failed -
>>
>> testTypes\")\n" +
>>
>> "bVar = aVar\n" +
>>
>> "do test.assertMsg(bVar.a == aVar.a, \"bVar.a != aVar.a assignement
>>
>> failed - testTypes\")\n" +
>>
>>
>>
>>
>>
>> The assignment of a complete AType will remain untouched. The second
>> assertion will fail.
>>
>> Any solutions? I’m using the orocos-toolchain 2.6
>
> I could reproduce your case in toolchain 2.7 as well.
>
> Is this only happening in state machines or also in program scripts ?
>
> Peter

Assignment operator does not work for StructTypeInfo<OwnTypes>

Hi Sandra,

On Thu, Feb 6, 2014 at 1:36 PM, Sandra Beyer <sandra [dot] beyer [..] ...> wrote:
> Hi,
>
> I'm working with the types_test unit test and found a bug when assigning
>
> objects of own data types.
>
>
>
> To reproduce that bug please expand the
>
> rtt/tests/types_test.cpp:BOOST_AUTO_TEST_CASE( testTypes):
>
>
>
>
>
> - Types()->addType( new StructTypeInfo<AType,false>("astruct"));
>
> - somewhere in string test:
>
> "var astruct aVar\n" +
>
> "var astruct bVar\n" +
>
> "aVar.a = 42\n" +
>
> "do test.assertMsg(aVar.a == 42, \"aVar.a != 42 assignement failed -
>
> testTypes\")\n" +
>
> "bVar = aVar\n" +
>
> "do test.assertMsg(bVar.a == aVar.a, \"bVar.a != aVar.a assignement
>
> failed - testTypes\")\n" +
>
>
>
>
>
> The assignment of a complete AType will remain untouched. The second
> assertion will fail.
>
> Any solutions? I’m using the orocos-toolchain 2.6

I could reproduce your case in toolchain 2.7 as well.

Is this only happening in state machines or also in program scripts ?

Peter