Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / CORBA / December 2005

Tip: Looking for answers? Try searching our database.

Extracting a structure in C++ from Java

Thread view: 
nemrac98@gmail.com - 30 Nov 2005 21:01 GMT
Hello, I am attempting to send a structure (which has no null values
within it) that I created in my IDL, from my Java code, to a C++
configure function via CORBA calls. I insert the structure into a CORBA
Any using the helper class created by the IDL before I send it to my
C++ function. The psuedo code is below for Java:
______________________________________

properties[0].id = new String( "SELECT" );

TheStructure selected = new TheStructure();
selected.name = "NAME"; // type string
selected.number = 1234; //type int

Any strAny = mOrb.create_any();

TheStructureHelper.insert( strAny, selected );

properties[0].value = strAny;

try
{
  toCPlusPlus.configure(properties);
}
_________________________________

Once in my C++ code I am not able to extract the structure from the
CORBA Any. The psuedo code is below in my C++ function:

_________________________________

TheStructure * extractInto;

if( incomingProperty >>= extractInto )  //* incomingProperty is my
CORBA Any with the structure in it *//
{

   mName = CORBA::string_dup(extractInto->name);
   mNumber = extractInto->number;
   return true;
}
else
{
   return false;
}

_________________________________

I have done this successfully with other data types such as floats,
ints, etc. but it will not work with a structure. I always get the
function returning false.

Any help or suggestion would be greatly appreciated! Thanks!
Mike - 07 Dec 2005 19:32 GMT
Why are you using the Any?  You should be able to return the Struct
itself, i.e.

TheStructure_var theStruct= corbareference.getTheStruct();


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.