]> Creatis software - creaImageIO.git/commitdiff
Various fixes on argument passing:
authorguigues <guigues>
Wed, 29 Apr 2009 11:01:23 +0000 (11:01 +0000)
committerguigues <guigues>
Wed, 29 Apr 2009 11:01:23 +0000 (11:01 +0000)
* If a method takes a NON const reference you cannot provide a temporary (e.g. the return value of another method )
* The same passing pointers as references is both useless and problematic for temporaries

src2/creaImageIOGimmick.cpp
src2/creaImageIOGimmick.h
src2/creaImageIOGimmickView.h
src2/creaImageIOTreeDescriptor.cpp
src2/creaImageIOTreeDescriptor.h
src2/creaImageIOTreeHandlerImageAdder.cpp
src2/creaImageIOTreeHandlerImageAdder.h
src2/creaImageIOWxGimmickView.cpp
src2/creaImageIOWxGimmickView.h
src2/icons/synchronize.xpm

index 9b8c9241db490176b75ec487b88d4078f3c64258..e38db81ff628e90f987f3ef3296925a079665bf7 100644 (file)
@@ -80,7 +80,8 @@ namespace creaImageIO
    // @param i_location : DB location                                                              //
    // return : -                                                                                                               //
   ///////////////////////////////////////////////////////////////////////
-       void Gimmick::addDB(std::string &i_name, std::string &i_location)
+       void Gimmick::addDB(const std::string &i_name, 
+                           const std::string &i_location)
        {
                if(mTreeHandlerMap.find(i_name) == mTreeHandlerMap.end())
                {
@@ -97,7 +98,9 @@ namespace creaImageIO
   // @param i_locDB : location of DB                                                                      //
   // return : the SQLiteTreeHandler object on DB                                                  //
        /////////////////////////////////////////////////////////////////////////
-       SQLiteTreeHandler *Gimmick::createDB(std::string &i_name, std::string &i_locDesc, std::string &i_locDB)
+       SQLiteTreeHandler *Gimmick::createDB(const std::string &i_name,
+                                            const std::string &i_locDesc,
+                                            const std::string &i_locDB)
   {
       SQLiteTreeHandler *sqlTreeH = new SQLiteTreeHandler(i_locDB);
     // Create or open local database
@@ -301,7 +304,7 @@ namespace creaImageIO
 
   //========================================================================
   void Gimmick::RemoveFile(const std::string& d, 
-         const tree::Node* & node)
+                          tree::Node* node)
   {
          mImageAdder.SetSynchronizer(mSynchronizer);
          mTimestampDatabase->RemoveNode("PATH",node);
index f93bac1e5d971967e797e9e48426b8cce0138a21..1265ca163f2bb366975e30db22f45a0db4528f42 100644 (file)
@@ -93,7 +93,7 @@ namespace creaImageIO
 
        /// Removes a file from the given TreeHandler
        void RemoveFile(const std::string& d, 
-                       const tree::Node* & filename);
+                       tree::Node* filename);
 
        ///Synchronizes the loaded data with the database. If remove is true the database will be updated, otherwise 
        ///only a warning sign will be issued
@@ -102,11 +102,13 @@ namespace creaImageIO
     /// Prints the tree handled by the handler
     void Print(const std::string& handler);
        
-       ///create a DB from a given descriptor file and for a specific location
-       SQLiteTreeHandler *createDB(std::string &i_name, std::string &i_locDesc, std::string &i_locDB);
+    ///create a DB from a given descriptor file and for a specific location
+    SQLiteTreeHandler *createDB(const std::string &i_name, 
+                               const std::string &i_locDesc, 
+                               const std::string &i_locDB);
 
        // add an existent DB 
-       void addDB(std::string &i_nameDB, std::string &i_locationDB);
+       void addDB(const std::string &i_nameDB, const std::string &i_locationDB);
 
     /// Returns the TreeHandler with a given name
     TreeHandler* GetTreeHandler(const std::string& name) const;
index ec888e3920cefdf289c5068474d39efde83c9def..ef435c17ae9302d85fd1dab27d2c6f4578b0d884 100644 (file)
@@ -80,7 +80,7 @@ namespace creaImageIO
       { GimmickError("INTERNAL ERROR : ClearSelection not implemented"); }
 
          ///Adds a file to ignore
-         virtual void AddIgnoreFile(const tree::Node* & toRemove)
+         virtual void AddIgnoreFile(tree::Node* toRemove)
          { GimmickError("INTERNAL ERROR : AddIgnoreFile not implemented"); }
       
       
index cdbdc15584c30b3bd8a41c460b640dbfcd3c7b04..0d772866bcbecf28076556d780ccf446c6d79300 100644 (file)
@@ -5,7 +5,7 @@
 #include <boost/filesystem.hpp>
 
 
-
+#include <fstream>
 
 
 namespace creaImageIO
@@ -145,7 +145,7 @@ namespace creaImageIO
        // @param : file path                                                                           //
        // return : -                                                                                           //
        //////////////////////////////////////////////////////////////
-       void Descriptor::createDescriptorfromFile(std::string &i_name)
+       void Descriptor::createDescriptorfromFile(const std::string &i_name)
        {
                Clear();
                
index c2fb7ae0d032fa6c3b8e343b2687f49b6e7c1ce9..e6863b14545cdcd6cf36e10274212fe8539fcf10 100644 (file)
@@ -64,7 +64,7 @@ namespace creaImageIO
       void Clear();
 
          //Create Attribute Descriptors from a file
-       void createDescriptorfromFile(std::string &i_file);
+       void createDescriptorfromFile(const std::string &i_file);
 
     private:
       LevelDescriptorListType mLevelDescriptorList;
index 679e156df04b130d4ec728bf67b33eca5969edd4..22c727b87d83ae02b21b47dbff5e85d6646baa66 100644 (file)
@@ -104,7 +104,7 @@ namespace creaImageIO
   }
   //=====================================================================
 
-  void TreeHandlerImageAdder::RemoveFile( const tree::Node*& node)
+  void TreeHandlerImageAdder::RemoveFile( tree::Node* node)
   {
                int n=node->GetNumberOfChildren();
                if(n>0)
index c3024ddea6688426a5f3b0027fb25a4b5acae833..60654911c76c14976cd47a516c5f41b76f581901 100644 (file)
@@ -108,7 +108,7 @@ namespace creaImageIO
     void AddDirectory( const std::string& directory, 
                       bool recurse);
        /// Removes a file from the databases
-       void RemoveFile(const tree::Node*& node);
+       void RemoveFile(tree::Node* node);
        /// Removes files from the databases
        void RemoveFiles(const std::vector<tree::Node*>& nodes);
        /// Synchronizes the DB and disk by repeating the operations the user has done and returns a report
index ce9c01e0e330cd1479cc1a68acb5ffaaf89b6c0a..824386795051727db757a73268c3759da8414d97 100644 (file)
@@ -606,7 +606,7 @@ namespace creaImageIO
 
   
   //=================================================
-  void WxGimmickView::AddIgnoreFile(const tree::Node* & toRemove)
+  void WxGimmickView::AddIgnoreFile(tree::Node* toRemove)
   {
          mGimmick->RemoveFile("Local database",toRemove);
          GetTreeViewMap()["Local database"]->UpdateLevel(1);
@@ -722,14 +722,14 @@ namespace creaImageIO
                for(int i = 0; i< files.size(); i++)
                {
                        //get name of DB (file name)
-                       size_t pos = files[i].find_last_of("\\");
-                       std::string name = crea::wx2std(files[i].substr(pos+1));
-                       pos = name.find_last_of(".");
-                       name = name.substr(0,pos);
-                       //create TreeHandler
-                       mGimmick->addDB(name, crea::wx2std(files[i]));
-                       //create TreeView
-                       CreateSingleTreeView(name);
+                 size_t pos = files[i].find_last_of(_T("\\"));
+                 std::string name = crea::wx2std(files[i].substr(pos+1));
+                 pos = name.find_last_of(".");
+                 name = name.substr(0,pos);
+                 //create TreeHandler
+                 mGimmick->addDB(name, crea::wx2std(files[i]));
+                 //create TreeView
+                 CreateSingleTreeView(name);
                }
        }
   }
index 33870d1327f2ef22627f2c67662a41ccb7e66bcf..fd22e481f08372c4c3879bebae8875d65fd8c2f1 100644 (file)
@@ -59,8 +59,8 @@ namespace creaImageIO
                           bool isSelection, int selection, bool mProcess);
     ///Stops the player
     void StopPlayer(){mViewer->StopPlayer();}
-       ///Adds a file to ignore
-       void AddIgnoreFile(const tree::Node* & toRemove);
+    ///Adds a file to ignore
+    void AddIgnoreFile(tree::Node* toRemove);
     ///Resets the default image
     void ClearSelection();
     
index e5d342f2d59e689ac999f509ea726a19a9c491f8..c112456e06507442738623bd637002b86420a517 100644 (file)
@@ -1,5 +1,5 @@
 /* XPM */
-static char *synchronize_xpm[] = {
+static const char *synchronize_xpm[] = {
 /* columns rows colors chars-per-pixel */
 "48 50 155 2",
 "   c #2FBF25",