Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > HELP C++ and Corba?

Reply
Thread Tools

HELP C++ and Corba?

 
 
Bob Smith
Guest
Posts: n/a
 
      08-27-2003
Hello all,
I am having a very difficult time getting something to work. This
involves CORBA, hopefully someone here will be able to answer it, and if not
maybe someone can point me in the right direction to where I can get it
answered. Using ACE/TAO.... Redhat 7.3 using Kdevelop.
OK really I just want to copy a CORBA octet sequence to and array where I
can get a pointer to point to it. The first 0-3 octets in the sequence are
stored in the first int and so forth... so the array of ints would be one
quarter of the size of the octet sequence.

This is what I have and doesn't work:

//corba object already declared.

CORBA::Octet* ptempBuffer;
ptempBuffer =payLoad_var->getBuffer();
char* working_data =(char*)ptempBuffer;

byte_index =0;
for(analog_index = 0; analog_index <16; analog_index++)
{

working_data[byteIndex]=char(analog_data[analog_index]>>;
working_data[byteIndex+1]=char(analog_data[analog_index]& 0xFF);
working_data[byteIndex+2]=char(0x00);
working_data[byteIndex+3]=char(0x00);
byte_index +=4;
}

This is what i have and it seems to crash!
Can someone be kind and help a poor soul?
thanks




 
Reply With Quote
 
 
 
 
Shane Beasley
Guest
Posts: n/a
 
      08-27-2003
"Bob Smith" <> wrote in message news:<q5T2b.11004$>. ..

> I am having a very difficult time getting something to work. This
> involves CORBA, hopefully someone here will be able to answer it, and if not
> maybe someone can point me in the right direction to where I can get it
> answered. Using ACE/TAO.... Redhat 7.3 using Kdevelop.


This is an ISO C++ newsgroup, which means (a) this is (mostly)
off-topic, and (b) it's a crapshoot whether anyone here speaks CORBA.
In the future, you should probably post to comp.object.corba, or else
comp.soft-sys.ace (yes, they talk TAO) or one of the mailing lists for
which it acts as a gateway:

http://www.cs.wustl.edu/~schmidt/TAO-mail.html

> This is what i have and it seems to crash!


Looking at this code, I can only guess that the crash is due to
accessing memory that isn't yours to access. analog_data ought to have
at least 16 elements, and working_data ought to have 64 (4 bytes for
each of analog_data's 16 elements). That's about all I can tell you
from looking at this code. Except...

<off-topic>
CORBA sequences like payLoad_var (that's what it is, no?) seem to act
a lot like C++ std::vector objects. As such, you have to resize them
before you start using them. Also, they have an overloaded operator[],
so you don't need to mess with pointers.

(For future reference, even when using a pointer, you should be able
to use CORBA::Octet without casting. That is, working_data should have
been a pointer to CORBA::Octet and not a pointer to char, since that's
what getBuffer() returns. And if you must cast, prefer C++-style casts
[like static_cast] to C-style ones whenever possible [which it almost
always is].)

Putting everything together, something like this ought to do it:

// allocate 64 octets (must be done before getBuffer!)
payLoad_var->length(64);

byte_index = 0;

for(analog_index = 0; analog_index <16; analog_index++)
{
typedef CORBA::Octet octet;
payLoad_var[byteIndex]=octet(analog_data[analog_index]>>;
payLoad_var[byteIndex+1]=octet(analog_data[analog_index]& 0xFF);
payLoad_var[byteIndex+2]=octet(0x00);
payLoad_var[byteIndex+3]=octet(0x00);
byte_index +=4;
}
</off-topic>

If that doesn't do the trick, a CORBA or ACE/TAO forum would be much
better equipped to help you. Try there next.

- Shane
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
HELP - HELP - HELP =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?= ASP .Net 4 03-09-2006 12:46 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 1 07-16-2004 01:12 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 0 07-16-2004 10:00 AM
HELP! HELP! HELP! Opening Web Application Project Error =?Utf-8?B?dHJlbGxvdzQyMg==?= ASP .Net 0 02-20-2004 05:16 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57