[cig-commits] r11579 - cs/benchmark/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Mar 26 08:02:37 PDT 2008


Author: luis
Date: 2008-03-26 08:02:37 -0700 (Wed, 26 Mar 2008)
New Revision: 11579

Modified:
   cs/benchmark/cigma/trunk/src/Reader.cpp
Log:
Use PathUtils functions in NewReader() factory method


Modified: cs/benchmark/cigma/trunk/src/Reader.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/Reader.cpp	2008-03-26 15:02:35 UTC (rev 11578)
+++ cs/benchmark/cigma/trunk/src/Reader.cpp	2008-03-26 15:02:37 UTC (rev 11579)
@@ -8,26 +8,34 @@
 #include "TextReader.h"
 #include "VtkReader.h"
 
+#include "PathUtils.h"
+
+
 using namespace cigma;
 
 
 // ---------------------------------------------------------------------------
 
-cigma::Reader* NewReader(const char *fileext)
+Reader* NewReader(const char *fileext)
 {
-    std::string ext = fileext;
+    // 
+    // XXX: Need to pass filename to this function, not just the extension.
+    // This way, we could use the IsHdfFile() and IsVtkFile() functions
+    // which can read the corresponding file headers to verify.
+    // Another thing to verify here is whether the file exists or not.
+    //
 
-    if (ext == ".h5")
+    if (HdfExtension(fileext))
     {
         return new HdfReader();
     }
 
-    if (ext == ".txt")
+    if (TextExtension(fileext))
     {
         return new TextReader();
     }
 
-    if ((ext == ".vtk") || (ext == ".vts") || (ext == ".vtu"))
+    if (VtkExtension(fileext))
     {
         return new VtkReader();
     }
@@ -37,11 +45,11 @@
 
 // ---------------------------------------------------------------------------
 
-cigma::Reader::Reader()
+Reader::Reader()
 {
 }
 
-cigma::Reader::~Reader()
+Reader::~Reader()
 {
 }
 



More information about the cig-commits mailing list