[orbitcpp-list] deactivating objects (server end)
Status: Beta
Brought to you by:
philipd
|
From: Brian M. <ba...@sn...> - 2001-12-07 06:33:01
|
Hello,
After not using ORBit for a while, I am finally back again, and trying
to get my old program back up and running, using C++ bindings to
ORBit.
However, one question: How do a create a method that will destroy an
object at the server end?
I believe I need to call deactive_object to prevent ORBit from using
it anymore, and then delete the C++ implementation class.
The first step is easy, but the next step is where I am having
problems - freeing the C++ implementation class. In particular, I
cannot seem to convert the reference to the object into the pointer to
the implementation class (yes - this is on the server). Isn't this the
function of reference_to_servant?
I have tried:
void destroy(const A_Aircraft::A_AREF &aref) {
A_Aircraft_var aircraft_var = aref.aircraft;
PortableServer::ObjectId_var objid = poa->reference_to_id(aircraft_var);
Aircraft_impl *aircraft_impl = poa->reference_to_servant(aircraft_var);
poa->deactivate_object(*objid);
delete(aircraft_impl);
}
However, not unexpectedly, the compiler complains on the Aircraft_impl
line:
aircrafts.cc: In method `void Aircrafts_impl::destroy(const Atcsim::A_Aircraft::A_AREF &)':
aircrafts.cc:115: type `Aircraft_impl' is not a base type for type `PortableServer::ServantBase'
Just out of interest I tried casting it to (Aircraft_impl *), but that
doesn't work either:
aircrafts.cc: In method `void Aircrafts_impl::destroy(const Atcsim::A_Aircraft::A_AREF &)':
aircrafts.cc:115: cannot cast up from virtual baseclass `PortableServer::ServantBase'
make[1]: *** [aircrafts.o] Error 1
I have looked up the C++ language mapping standard, but can't find
anything on activating or deactivating objects.
I have tried looking up the sample C++ code referred to in various
places, eg. the FAQ referred to on the website
<URL:http://orbit-resource.sourceforge.net/cpp.html> refers to
<URL:http://www.geocrawler.com/archives/3/835/2000/7/0/4066792/>,
which refers to sample code at
<URL:ftp://orbitcpp.sourceforge.net/pub/orbitcpp> but haven't been
able to access it (connection refused).
Any ideas?
Thanks in advance.
--
Brian May <ba...@sn...>
|