Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » BITSTRING getting created reverse
BITSTRING getting created reverse [message #1726064] Wed, 09 March 2016 10:56 Go to next message
murli sharma is currently offline murli sharmaFriend
Messages: 85
Registered: November 2015
Member
Hi,

I'm creating a BITSTRING object in C++ and logging it in TTCN script.
I found it to be printed in reverse.

I'm using the following constructor to create the BITSTRING object in C++:
BITSTRING::BITSTRING(int n_bits, const unsigned char *bits_ptr)


Am I doing something wrong?

Please find the sample code attached.

Thanks
Re: BITSTRING getting created reverse [message #1726068 is a reply to message #1726064] Wed, 09 March 2016 11:21 Go to previous messageGo to next message
Botond Baranyi is currently offline Botond BaranyiFriend
Messages: 53
Registered: February 2016
Member
Hi,

the BITSTRING class stores the bits of each byte in reverse order.
You can read up on TITAN's C++ classes and functions in our API guide:
http:/ /ttcn.ericsson.se/download/doc/apiguide.pdf (without the space)
The BITSTRING class can be found in section 5.3.5.
Re: BITSTRING getting created reverse [message #1726069 is a reply to message #1726064] Wed, 09 March 2016 11:23 Go to previous messageGo to next message
Gábor Szalai is currently offline Gábor SzalaiFriend
Messages: 133
Registered: December 2015
Senior Member
Hi,

The first bit of the bitstring is stored in the 0th bit of 0th byte of the unsigned char array used for storage.

The 0th bit of the unsigned char is the lowest one, not the highest.

That is why the order seems to be reversed.
Re: BITSTRING getting created reverse [message #1726297 is a reply to message #1726069] Fri, 11 March 2016 07:53 Go to previous messageGo to next message
murli sharma is currently offline murli sharmaFriend
Messages: 85
Registered: November 2015
Member
Hi,

Can I myself change the constructor
BITSTRING::BITSTRING(int n_bits, const unsigned char *bits_ptr)
in titan code to create the BITSTRING object in reverse order.
Would it have any side-effects?

Thanks
Re: BITSTRING getting created reverse [message #1726312 is a reply to message #1726297] Fri, 11 March 2016 09:55 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Murli,

we don't recommend this, for several reasons.
Of course you can change in your own copy, but then you will have to do it every time the source code in github changes.
And yes, there probably will be side effects.

So I'd recommend you either change your external C code, or adapt your TTCN code to account for the bitstring order.

Best regards

Elemer





Previous Topic:Dynamic test case error: Performing a valueof or send operation on a non-specific template
Next Topic:Embeddig OPC UA Client within TTCN-3
Goto Forum:
  


Current Time: Thu Apr 25 16:20:01 GMT 2024

Powered by FUDForum. Page generated in 0.02637 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top