[Flightgear-devel] Re: KLN89 GPS added: cleanups [patch]

2005-11-30 Thread Alex Romosan
David Luff [EMAIL PROTECTED] writes:

 I've added a KLN89 GPS unit hardcoded in C++ (OK'd by Curt).
 Briefly, since it's late, it's only included on the c172p 2D panel
 (--aircraft=c172p-2dpanel). It looks best at --geometry=1024x768
 since the fonts are at 1:1 pixellation at that resolution.

the attached patch replaces passing strings by value with passing them
by reference (string - const string) to avoid copying them
needlessly. also makes GetId() in GPSPage a pure virtual function.

cvs diff: Diffing src/Instrumentation
Index: src/Instrumentation/dclgps.cxx
===
RCS file: /var/cvs/FlightGear-0.9/source/src/Instrumentation/dclgps.cxx,v
retrieving revision 1.1
diff -u -r1.1 dclgps.cxx
--- src/Instrumentation/dclgps.cxx	30 Nov 2005 00:47:41 -	1.1
+++ src/Instrumentation/dclgps.cxx	30 Nov 2005 23:12:19 -
@@ -194,8 +194,7 @@
 
 void GPSPage::CleanUp() {}
 void GPSPage::LooseFocus() {}
-void GPSPage::SetId(string s) {}
-string GPSPage::GetId() { return(); }
+void GPSPage::SetId(const string s) {}
 
 // - //
 
@@ -888,7 +887,7 @@
 	return((xtd / _currentCdiScale) * 5.0 * 2.5 * -1.0);
 }
 
-void DCLGPS::DtoInitiate(string s) {
+void DCLGPS::DtoInitiate(const string s) {
 	cout  DtoInitiate, s =   s  '\n';
 	bool multi;
 	const GPSWaypoint* wp = FindFirstById(s, multi, true);
@@ -1013,7 +1012,7 @@
 // returns -1 if groundspeed is less than 30kts.
 // If the waypoint is an unreached part of the active flight plan the time will be via each leg.
 // otherwise it will be a direct-to time.
-double DCLGPS::GetTimeToWaypoint(string id) {
+double DCLGPS::GetTimeToWaypoint(const string id) {
 	if(_groundSpeed_kts  30.0) {
 		return(-1.0);
 	}
@@ -1089,7 +1088,7 @@
 	return(-1);
 }
 
-int DCLGPS::GetWaypointIndex(string id) {
+int DCLGPS::GetWaypointIndex(const string id) {
 	for(unsigned int i=0; i_flightPlans[0]-waypoints.size(); ++i) {
 		if(_flightPlans[0]-waypoints[i]-id == id) return((int)i);
 	}
@@ -1240,7 +1239,7 @@
 
 /***/
 
-const GPSWaypoint* DCLGPS::ActualFindFirstById(string id, bool exact) {
+const GPSWaypoint* DCLGPS::ActualFindFirstById(const string id, bool exact) {
 gps_waypoint_map_const_iterator itr;
 if(exact) {
 itr = _waypoints.find(id);
@@ -1255,7 +1254,7 @@
 }
 }
 
-const GPSWaypoint* DCLGPS::FindFirstById(string id, bool multi, bool exact) {
+const GPSWaypoint* DCLGPS::FindFirstById(const string id, bool multi, bool exact) {
 	multi = false;
 	if(exact) return(ActualFindFirstById(id, exact));
 	
@@ -1317,7 +1316,7 @@
 
 // Host specific lookup functions
 // TODO - add the ASCII / alphabetical stuff from the Atlas version
-FGNavRecord* DCLGPS::FindFirstVorById(string id, bool multi, bool exact) {
+FGNavRecord* DCLGPS::FindFirstVorById(const string id, bool multi, bool exact) {
 	// NOTE - at the moment multi is never set.
 	multi = false;
 	//if(exact) return(_overlays-FindFirstVorById(id, exact));
@@ -1336,7 +1335,7 @@
 	return(NULL);	// Shouldn't get here!
 }
 #if 0
-Overlays::NAV* DCLGPS::FindFirstVorById(string id, bool multi, bool exact) {
+Overlays::NAV* DCLGPS::FindFirstVorById(const string id, bool multi, bool exact) {
 	// NOTE - at the moment multi is never set.
 	multi = false;
 	if(exact) return(_overlays-FindFirstVorById(id, exact));
@@ -1386,7 +1385,7 @@
 #endif //0
 
 // TODO - add the ASCII / alphabetical stuff from the Atlas version
-FGNavRecord* DCLGPS::FindFirstNDBById(string id, bool multi, bool exact) {
+FGNavRecord* DCLGPS::FindFirstNDBById(const string id, bool multi, bool exact) {
 	// NOTE - at the moment multi is never set.
 	multi = false;
 	//if(exact) return(_overlays-FindFirstVorById(id, exact));
@@ -1405,7 +1404,7 @@
 	return(NULL);	// Shouldn't get here!
 }
 #if 0
-Overlays::NAV* DCLGPS::FindFirstNDBById(string id, bool multi, bool exact) {
+Overlays::NAV* DCLGPS::FindFirstNDBById(const string id, bool multi, bool exact) {
 	// NOTE - at the moment multi is never set.
 	multi = false;
 	if(exact) return(_overlays-FindFirstNDBById(id, exact));
@@ -1455,7 +1454,7 @@
 #endif //0
 
 // TODO - add the ASCII / alphabetical stuff from the Atlas version
-const FGFix* DCLGPS::FindFirstIntById(string id, bool multi, bool exact) {
+const FGFix* DCLGPS::FindFirstIntById(const string id, bool multi, bool exact) {
 	// NOTE - at the moment multi is never set, and indeed can't be
 	// since FG can only map one Fix per ID at the moment.
 	multi = false;
@@ -1516,7 +1515,7 @@
 	return NULL;	// Don't think we can ever get here.
 }
 
-const FGAirport* DCLGPS::FindFirstAptById(string id, bool multi, bool exact) {
+const FGAirport* DCLGPS::FindFirstAptById(const string id, bool multi, bool exact) {
 	// NOTE - at the moment multi is never set.
 	//cout  FindFirstAptById, id =   id  '\n';
 	multi = false;
Index: src/Instrumentation/dclgps.hxx

Re: [Flightgear-devel] Re: KLN89 GPS added: cleanups [patch]

2005-11-30 Thread David Luff
Alex Romosan writes:

 David Luff [EMAIL PROTECTED] writes:

Urgghh - email addy in header!

 
  I've added a KLN89 GPS unit hardcoded in C++ (OK'd by Curt).
  Briefly, since it's late, it's only included on the c172p 2D panel
  (--aircraft=c172p-2dpanel). It looks best at --geometry=1024x768
  since the fonts are at 1:1 pixellation at that resolution.
 
 the attached patch replaces passing strings by value with passing them
 by reference (string - const string) to avoid copying them
 needlessly. also makes GetId() in GPSPage a pure virtual function.
 
 

Thanks, I'll read through that and apply it, probably tomorrow.

Cheers - Dave

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


Re: [Flightgear-devel] Re: KLN89 GPS added: cleanups [patch]

2005-11-30 Thread Andy Ross
David Luff [EMAIL PROTECTED] wrote:
 Alex Romosan writes:
  David Luff [EMAIL PROTECTED] writes:

 Urgghh - email addy in header!

And from an unexpected source, too:

  User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Someone needs to plonk the emacs folks, methinks. :)

Andy



___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


[Flightgear-devel] Re: KLN89 GPS added: cleanups [patch]

2005-11-30 Thread Alex Romosan
David Luff  writes:

 Alex Romosan writes:

 David Luff [EMAIL PROTECTED] writes:

 Urgghh - email addy in header!

sorry. if anybody knows how to change the citation line in gnus
automatically please let me know. thanks.

--alex--

-- 
| I believe the moment is at hand when, by a paranoiac and active |
|  advance of the mind, it will be possible (simultaneously with  |
|  automatism and other passive states) to systematize confusion  |
|  and thus to help to discredit completely the world of reality. |

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d