RE: [Flightgear-devel] Class name clash and namespaces

2003-01-22 Thread Jon Berndt
I copied over Bernie's changes for namespaces, but have not been able to
get the code to compile with FlightGear. The files JSBSim.cxx|hxx need to
be aware of the new namespace scoping of JSBSim, and I can't seem to get
it to work. Suggestions?

Jon



smime.p7s
Description: application/pkcs7-signature


RE: [Flightgear-devel] Class name clash and namespaces

2003-01-22 Thread David Luff
On 1/22/03 at 7:12 AM Jon Berndt wrote:

I copied over Bernie's changes for namespaces, but have not been able to
get the code to compile with FlightGear. The files JSBSim.cxx|hxx need to
be aware of the new namespace scoping of JSBSim, and I can't seem to get
it to work. Suggestions?

Wouldn't something like this work?

Either:

using namespace jsbsim

or 

using jsbsim::FGFDMExec
etc...

at the top of the files

or 

fdmex = new jsbsim::FGFDMExec
etc...

everytime its needed.

Cheers - Dave


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



RE: [Flightgear-devel] Class name clash and namespaces

2003-01-22 Thread Jon Berndt
 Wouldn't something like this work?

 Either:

 using namespace jsbsim

 or

 using jsbsim::FGFDMExec
 etc...

 at the top of the files

 or

 fdmex = new jsbsim::FGFDMExec
 etc...

 everytime its needed.

 Cheers - Dave


You would expect it to, wouldn't you. I added using namespace JSBSim at
the top of JSBSim.hxx as follows:

/*
%%
FORWARD DECLARATIONS
%%
*/

#include simgear/misc/props.hxx

#include FDM/JSBSim/FGFDMExec.h

using namespace JSBSim;

class FGState;
class FGAtmosphere;
class FGFCS;
class FGPropulsion;
class FGMassBalance;
class FGAerodynamics;
class FGInertial;
class FGAircraft;
class FGTranslation;
class FGRotation;
class FGPosition;
class FGAuxiliary;
class FGOutput;
class FGInitialCondition;

But, I get this when I try and compile:

g++ -DHAVE_CONFIG_H -I. -I. -I../../../src/Include -I../../.. -I../../../s
rc   -DFGFS  -c -o JSBSim.o `test -f 'JSBSim.cxx' || echo './'`JSBSim.cxx
In file included from JSBSim.cxx:63:
JSBSim.hxx:218: syntax error before `*'
JSBSim.hxx:221: syntax error before `*'
JSBSim.hxx:222: syntax error before `*'
JSBSim.hxx:223: syntax error before `*'
JSBSim.hxx:224: syntax error before `*'
JSBSim.hxx:225: syntax error before `*'
JSBSim.hxx:226: syntax error before `*'
JSBSim.hxx:227: syntax error before `*'
JSBSim.hxx:228: syntax error before `*'
JSBSim.hxx:229: syntax error before `*'
JSBSim.hxx:230: syntax error before `*'
JSBSim.hxx:231: syntax error before `*'
JSBSim.cxx: In method `FGJSBsim::FGJSBsim(double)':
JSBSim.cxx:81: parse error before `='
JSBSim.cxx:82: `Atmosphere' undeclared (first use this function)
JSBSim.cxx:82: (Each undeclared identifier is reported only once
JSBSim.cxx:82: for each function it appears in.)
JSBSim.cxx:83: `FCS' undeclared (first use this function)
JSBSim.cxx:84: `MassBalance' undeclared (first use this function)
...
...

The pertinent lines in JSBSim.cxx are:

== Line 63, JSBSim.cxx:

#include JSBSim.hxx

== Line 218, JSBSim.hxx:

private:
FGFDMExec *fdmex;
FGInitialCondition *fgic; // -- line 218
bool needTrim;

FGState*State;
FGAtmosphere*   Atmosphere;
FGFCS*  FCS;

== Line 81, JSBSim.cxx:

FGJSBsim::FGJSBsim( double dt )
  : FGInterface(dt)
{
bool result;

fdmex = new FGFDMExec( (FGPropertyManager*)globals-get_props() );

State   = fdmex-GetState(); // -- Line 81
Atmosphere  = fdmex-GetAtmosphere();
FCS = fdmex-GetFCS();
MassBalance = fdmex-GetMassBalance();

So, any suggestions? I'm stuck.

Jon




smime.p7s
Description: application/pkcs7-signature


Re: [Flightgear-devel] Class name clash and namespaces

2003-01-22 Thread Bernie Bright
On Wed, 22 Jan 2003 07:50:55 -0600
Jon Berndt [EMAIL PROTECTED] wrote:

  Wouldn't something like this work?
 
  Either:
 
  using namespace jsbsim
 
  or
 
  using jsbsim::FGFDMExec
  etc...
 
  at the top of the files
 
  or
 
  fdmex = new jsbsim::FGFDMExec
  etc...
 
  everytime its needed.
 
  Cheers - Dave
 
 
 You would expect it to, wouldn't you. I added using namespace JSBSim at
 the top of JSBSim.hxx as follows:
 
 /*
 %%
 FORWARD DECLARATIONS
 %%
 */
 
 #include simgear/misc/props.hxx
 
 #include FDM/JSBSim/FGFDMExec.h
 
 using namespace JSBSim;
 
 class FGState;
 class FGAtmosphere;
 class FGFCS;
 class FGPropulsion;
 class FGMassBalance;
 class FGAerodynamics;
 class FGInertial;
 class FGAircraft;
 class FGTranslation;
 class FGRotation;
 class FGPosition;
 class FGAuxiliary;
 class FGOutput;
 class FGInitialCondition;
 
 But, I get this when I try and compile:
 
 g++ -DHAVE_CONFIG_H -I. -I. -I../../../src/Include -I../../.. -I../../../s
 rc   -DFGFS  -c -o JSBSim.o `test -f 'JSBSim.cxx' || echo './'`JSBSim.cxx
 In file included from JSBSim.cxx:63:
 JSBSim.hxx:218: syntax error before `*'
 JSBSim.hxx:221: syntax error before `*'
 JSBSim.hxx:222: syntax error before `*'
 JSBSim.hxx:223: syntax error before `*'
 JSBSim.hxx:224: syntax error before `*'
 JSBSim.hxx:225: syntax error before `*'
 JSBSim.hxx:226: syntax error before `*'
 JSBSim.hxx:227: syntax error before `*'
 JSBSim.hxx:228: syntax error before `*'
 JSBSim.hxx:229: syntax error before `*'
 JSBSim.hxx:230: syntax error before `*'
 JSBSim.hxx:231: syntax error before `*'
 JSBSim.cxx: In method `FGJSBsim::FGJSBsim(double)':
 JSBSim.cxx:81: parse error before `='
 JSBSim.cxx:82: `Atmosphere' undeclared (first use this function)
 JSBSim.cxx:82: (Each undeclared identifier is reported only once
 JSBSim.cxx:82: for each function it appears in.)
 JSBSim.cxx:83: `FCS' undeclared (first use this function)
 JSBSim.cxx:84: `MassBalance' undeclared (first use this function)
 ...
 ...

Forward declarations must be in a namespace:

namespace JSBSim {
class FGState;
class FGAtmosphere;
class FGFCS;
class FGPropulsion;
class FGMassBalance;
class FGAerodynamics;
class FGInertial;
class FGAircraft;
class FGTranslation;
class FGRotation;
class FGPosition;
class FGAuxiliary;
class FGOutput;
class FGInitialCondition;
}

using namespace JSBSim;
...

Just updated my FlightGear JSBSim sources with namespace versions and am happy
to announce a clean compile.

Cheers,
Bernie

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Class name clash and namespaces

2003-01-22 Thread Jon S Berndt
On Thu, 23 Jan 2003 07:53:59 +1100
 Bernie Bright [EMAIL PROTECTED] wrote:


Forward declarations must be in a namespace:

namespace JSBSim {
class FGState;
class FGAtmosphere;
class FGFCS;
class FGPropulsion;
class FGMassBalance;
class FGAerodynamics;
class FGInertial;
class FGAircraft;
class FGTranslation;
class FGRotation;
class FGPosition;
class FGAuxiliary;
class FGOutput;
class FGInitialCondition;
}

using namespace JSBSim;
...

Just updated my FlightGear JSBSim sources with namespace 
versions and am happy
to announce a clean compile.

Cheers,
Bernie

Good morning, and thanks. I'll update JSBSim later tonight 
(Texas time) and then recommend that JSBSim CVS be copied 
to current FlightGear devel CVS (if testing goes well). 
Tony, David: concur?

Jon

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel


RE: [Flightgear-devel] Class name clash and namespaces

2003-01-21 Thread Jon Berndt
 Just added namespace jsbsim { ... } to latest CVS JSBSim and got a
clean
 compile and link.  I'm not in a position to test at the moment.  BTW
 FGConditon was missing from filtersjb/Makefile.am.

Ah, yes. I need to go in and change that. Thanks. I'll probably recommend
that this current version of JSBSim (0.9.4) gets moved into FlightGear CVS
very soon.

Question: Did you add namespace usage to ALL JSBSim files? I tried it with
just FGCondition (to minimize typing) and was successful. If you did this
with all files, could you tar it up and email it to me for reference?

Jon



smime.p7s
Description: application/pkcs7-signature


RE: [Flightgear-devel] Class name clash and namespaces

2003-01-21 Thread David Megginson
Jon Berndt writes:

  Ah, yes. I need to go in and change that. Thanks. I'll probably recommend
  that this current version of JSBSim (0.9.4) gets moved into FlightGear CVS
  very soon.
  
  Question: Did you add namespace usage to ALL JSBSim files? I tried it with
  just FGCondition (to minimize typing) and was successful. If you did this
  with all files, could you tar it up and email it to me for reference?

That sounds like a very good idea, especially since JSBSim tends to
use the FG* prefix in its classes, just like FlightGear does.  Why
don't we update JSBSim in FlightGear as soon as the whole thing is
moved into the jsbsim Namespace and tested.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



RE: [Flightgear-devel] Class name clash and namespaces

2003-01-21 Thread Jon Berndt
 That sounds like a very good idea, especially since JSBSim tends to
 use the FG* prefix in its classes, just like FlightGear does.  Why
 don't we update JSBSim in FlightGear as soon as the whole thing is
 moved into the jsbsim Namespace and tested.

I got Bernie's code (Thanks Bernie). What is currently in CVS works - I
have tested it with FlightGear using the C172, and in standalone mode
using some test scripts. The JSBSim code currently in JSBSim CVS has only
FGCondition scoped in the JSBSim namespace. You can use this and play with
it if you like in FlightGear (need to modify Makefile.am in filtersjb/ to
add FGCondition.cpp|h). I intend to look closely at Bernies mods with an
eye towards namespacing all of JSBSim.

The takeoff report is nice, as it lists the takeoff run distance and the
distance to clear a 50' object. This ought to be helpful in validating our
models.

Jon

JON S. BERNDT
Coordinator, JSBSim Project
www.JSBSim.org
[EMAIL PROTECTED]




smime.p7s
Description: application/pkcs7-signature


Re: [Flightgear-devel] Class name clash and namespaces

2003-01-20 Thread Jon S Berndt
On Tue, 21 Jan 2003 09:07:57 +1100
 Bernie Bright [EMAIL PROTECTED] wrote:

On Mon, 20 Jan 2003 07:37:54 -0600
Jon Berndt [EMAIL PROTECTED] wrote:

I remember having this conversation before.  If you have 
the FlightGear source
then check the YASim fdm code.  Its all in namespace 
yasim.  Basically you 
must wrap every header and source file with namespace 
jsbsim { ... }.

Cheers,
Bernie

Now that you mention it ... I guess I do remember that, 
now. I think I also remember that I tried it and broke our 
code. Maybe I'll try again, now. Thanks,

Jon

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel