Hi Pascal,
first of all, by PI I mean PortableInterceptor, i.e. specification which
also specifies API for CodecFactory and Codec which you seems to use in
the code below, but you didn't use in your original email where you used
MICO specific codec API. So everything is OK from this point of view.
Now, to your issue. As I understand the situation is that you have
perfectly working code and when you add #include QApplication to it
which comes from Qt library, then your code is not working at all. The
first thing which comes to mind is that your added include silently
redefine or undefine something which is needed and defined by the former
includes (CORBA). Hence I recommended to see if reordering of the
includes solves your issue. BTW: What compiler and on which platform do
you use exactly? i.e. version numbers might be interesting here.
Also what's very dangerous is to use any namespace in globaly included
header files. I would recommend you to use absolute scope names in all
your header files, hence fixing anyserial.h to:
#ifndef __ANYSERIAL__
#define __ANYSERIAL__
#include CORBA.h
#include mico/throw.h
#include coss/CosNaming.h
void operator ( CORBA::Any anyobject, const CORBA::OctetSeq dataseq);
void operator ( const CORBA::Any anyobject, CORBA::OctetSeq dataseq);
#endif
And finally third attempt I would do is to carefully examine
preprocessed source of your application to see any issue with silent
symbol undefine or redefine...
Cheers,
Karel
PS: also please sign to mico-devel@mico.org mailing list here:
http://www.mico.org/mailman/listinfo/mico-devel from your address you
are using now, otherwise you still will not be able to sent any email
into the list.
ld1bp...@unibw.de wrote:
Hi Karel,
many thanks again for your suggestions. I tried to change the #include
order in the file but the problem still comes up. To give you the best
answer regarding the anyserial.h file I just write you down the header and
the cpp files so that you can see how they are structured.
--- anyserial.h ---
#ifndef __ANYSERIAL__
#define __ANYSERIAL__
#include CORBA.h
#include mico/throw.h
#include coss/CosNaming.h
using namespace CORBA;
void operator ( Any anyobject, const OctetSeq dataseq);
void operator ( const Any anyobject, OctetSeq dataseq);
#endif
--- anyserial.cpp ---
// anyserial implementation
#include anyserial.h
void operator ( Any anyobject, const OctetSeq dataseq)
{
// Codec
ORB_var orb;
Object_var obj;
IOP::CodecFactory_var cf;
IOP::Encoding enc2;
IOP::Codec_ptr codec_ptr;
// Generate codec based on CodecFactory
int argc = 1;
char* argv[1];
argv[0] = anyserial;
orb = ORB_init( argc, argv, mico-local-orb );
obj = orb-resolve_initial_references(CodecFactory);
cf = IOP::CodecFactory::_narrow(obj);
enc2.format = IOP::ENCODING_CDR_ENCAPS;
enc2.major_version = 1;
enc2.minor_version = 2;
codec_ptr = cf-create_codec(enc2);
// Decode dataseq and copy new generated object of type any into
anyobject
anyobject = *(codec_ptr-decode(dataseq));
}
void operator ( const Any anyobject, OctetSeq dataseq)
{
// Codec
ORB_var orb;
Object_var obj;
IOP::CodecFactory_var cf;
IOP::Encoding enc2;
IOP::Codec_ptr codec_ptr;
// Generate codec based on CodecFactory
int argc = 1;
char* argv[1];
argv[0] = anyserial;
orb = ORB_init( argc, argv, mico-local-orb );
obj = orb-resolve_initial_references(CodecFactory);
cf = IOP::CodecFactory::_narrow(obj);
enc2.format = IOP::ENCODING_CDR_ENCAPS;
enc2.major_version = 1;
enc2.minor_version = 2;
codec_ptr = cf-create_codec(enc2);
// Encode anyobject and generate a new octet sequence
OctetSeq_var newdataseq_ptr = codec_ptr-encode(anyobject);
int length = newdataseq_ptr-length();
// Copy generated octet sequence into dataseq
dataseq.length(length);
for (int i=0; ilength; i++)
dataseq[i] = (*newdataseq_ptr)[i];
}
I think I used what is really necessary of MICO/CORBA, am I right? As you
can see I also specified using namespace MICO;. What is PI?
Pasquale
Hi Pascal,
this is strange, please try to reorder your header files to
#include anyserial.h
#include ifDKAircraftInterface.h
#include QApplication
or to:
#include ifDKAircraftInterface.h
#include anyserial.h
#include QApplication
BTW, does your anyserial includes anything from MICO/CORBA? Do you use
inside it `using namespace CORBA'?
Also please try to use PI's codec API as your college Andreas does.
Cheers,
Karel
--
Karel Gardas kgar...@objectsecurity.com
ObjectSecurity Ltd. http://www.objectsecurity.com
ld1bp...@unibw.de wrote:
Hallo Karel,
thank you very much for your support. The anyobject Any variable
contains