Re: Patch for : src/Lib/vpf/database path

Alex Romosan <[email protected]> Sat, 22 Jan 2005 12:51:47 -0800
Newsgroups gmane.games.flightgear.terragear.devel
Message-ID <[email protected]>
"Curtis L. Olson" <[email protected]> writes:

> Frederic Bouvier wrote:
>
>> Paul Surgeon a écrit :
>>
>>> GCC 3.4 doesn't like a copy constructor as a private member of a class.
>>> It only accepts it as a public member.
>>>
>>> I'm not sure if that is what is wanted but at least it compiles on
>>> my system now.
>>>
>>>
>> Private copy constructor ( and private assignment operator ) are
>> there to prevent objects of that class to be copied. Any attempt
>> result in a compiler error. If the class designer don't want the
>> objects be copied ( because the object must be a singleton or there
>> are resource or performance issues ), it is better to see why the
>> compiler needs to copy objects.
>
>
> Hmmm, I have already applied this patch.  Let me know if I should back
> it out.

i think the correct fix is this (the relevant part is at the bottom,
the top part changes static functions to anonymous namespace):

Index: vpf-summary.cxx
===================================================================
RCS file: /var/cvs/TerraGear-0.0/TerraGear/src/Lib/vpf/vpf-summary.cxx,v
retrieving revision 1.1
diff -u -r1.1 vpf-summary.cxx
--- vpf-summary.cxx	18 Sep 2001 21:17:49 -0000	1.1
+++ vpf-summary.cxx	22 Jan 2005 20:48:24 -0000
@@ -34,10 +34,11 @@
 
 #include "vpf.hxx"
 
+namespace {
 /**
  * Get a printable name for a value type.
  */
-static const char *
+const char *
 get_value_type_name (VpfValue::Type type)
 {
   switch (type) {
@@ -64,7 +65,7 @@
 /**
  * Get a printable name for a topology type.
  */
-static const char *
+const char *
 get_topology_name (VpfFeature::TopologyType type)
 {
   switch (type) {
@@ -87,7 +88,7 @@
 /**
  * Print an indentation.
  */
-static string
+string
 indent (int level)
 {
   string result;
@@ -100,7 +101,7 @@
 /**
  * Print a summary of a property declaration.
  */
-static void
+void
 dump_property_decl (const VpfPropertyDecl &decl, int level)
 {
   cout << indent(level) << "Name: " << decl.getName() << endl;
@@ -125,7 +126,7 @@
 /**
  * Print a summary of a feature.
  */
-static void
+void
 dump_feature (const VpfFeature &feature, int level)
 {
   cout << indent(level) << "Name: " << feature.getName() << endl;
@@ -155,7 +156,7 @@
 /**
  * Print a summary of a coverage.
  */
-static void
+void
 dump_coverage (const VpfCoverage &cov, int level)
 {
   cout << indent(level) << "Coverage name: " << cov.getName() << endl;
@@ -175,7 +176,7 @@
 /**
  * Print a summary of a library.
  */
-static void
+void
 dump_library (const VpfLibrary &lib, int level)
 {
   cout << indent(level) << "Library name: " << lib.getName() << endl;
@@ -200,7 +201,7 @@
 /**
  * Print a summary of a database.
  */
-static void
+void
 dump_database (const VpfDataBase &db, int level)
 {
   cout << indent(level) << "Database name: " << db.getName() << endl;
@@ -214,33 +215,34 @@
     dump_library(db.getLibrary(i), level+2);
   }
 }
+}
 
 int
 main (int ac, char ** av)
 {
+  VpfDataBase db(av[1]);
   try {
     switch (ac) {
     case 2:
       cout << "*** Database: " << av[1] << " ***" << endl << endl;
-      dump_database(VpfDataBase(av[1]), 0);
+      dump_database(db, 0);
       return 0;
     case 3:
       cout << "*** Library: " << av[2] << " ***" << endl << endl;
-      dump_library(VpfDataBase(av[1]).getLibrary(av[2]), 0);
+      dump_library(db.getLibrary(av[2]), 0);
       return 0;
     case 4:
       cout << "*** Coverage: " << av[3] << " ***" << endl << endl;
-      dump_coverage(VpfDataBase(av[1])
-		    .getLibrary(av[2]).getCoverage(av[3]), 0);
+      dump_coverage(db.getLibrary(av[2]).getCoverage(av[3]), 0);
       return 0;
     case 5:
       cout << "*** Feature: " << av[4] << " ***" << endl << endl;;
-      dump_feature(VpfDataBase(av[1]).getLibrary(av[2]).getCoverage(av[3])
+      dump_feature(db.getLibrary(av[2]).getCoverage(av[3])
 		   .getFeature(av[4]), 0);
       return 0;
     case 6:
       cout << "*** Feature Property: " << av[5] << " ***" << endl << endl;
-      dump_property_decl(VpfDataBase(av[1]).getLibrary(av[2])
+      dump_property_decl(db.getLibrary(av[2])
 			 .getCoverage(av[3]).getFeature(av[4])
 			 .getPropertyDecl(av[5]), 0);
       return 0;

i am cc'ing curt as well (sorry for the cc curt) but i posted this fix
previously and it seems it was ignored. maybe this time...

--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. |

_______________________________________________
Terragear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/terragear-devel
2f585eeea02e2c79d7b1d8c4963bae2d