]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOSQLiteTreeHandler.h
Added attribute selection functionality.
[creaImageIO.git] / src2 / creaImageIOSQLiteTreeHandler.h
index 611872c5aa7148d6dd6772e86d7b10c7631f85e3..6948675d43d05fe154702695df4fab97a2558e7f 100644 (file)
@@ -55,6 +55,10 @@ namespace creaImageIO
     virtual bool Create(bool writable = false);
     /// Destroys the 'source'
     virtual bool Destroy();
+       /// Begins a transaction
+       virtual void BeginTransaction();
+       ///Commits results and ends transaction
+       virtual void EndTransaction();
     //====================================================================
 
 
@@ -70,6 +74,16 @@ namespace creaImageIO
     virtual unsigned int GetNumberOfChildren(tree::Node* n);
     //====================================================================
 
+       //====================================================================
+    /// Returns the attribute requested. Useful for synchronization.
+       virtual void GetAttribute(std::string levelDescriptor,
+                                                                          std::string searchParam, 
+                                                                          std::string searchVal, 
+                                                                          std::string key, 
+                                                                          std::string& result);
+    //====================================================================
+
+
     //====================================================================
     /// Recursively loads the children of node 'parent' until maxlevel 
     // is reached.
@@ -84,7 +98,13 @@ namespace creaImageIO
     // WITHOUT altering the source, e.g. the database
     virtual void UnLoad(tree::Node* n);
     ///====================================================================
-
+       
+       //====================================================================
+    /// Returns the top level node id for the given search param and search value
+    virtual void GetTopLevelNodeId(const std::string& searchParam, 
+                                                                                       const std::string& searchValue, 
+                                                                                       std::string& parent_id);
+    ///====================================================================
 
     //====================================================================
     // WRITE METHODS : WORK ONLY IN WRITE MODE
@@ -100,6 +120,20 @@ namespace creaImageIO
     virtual bool SetAttribute(tree::Node*, 
                              const std::string& key,
                              const std::string& value);
+       // Sets an attribute
+    virtual void SetAttribute(const std::string& levelDescriptor, 
+                             const std::string& key,
+                             const std::string& value,
+                                 const std::string& searchParam, 
+                                 const std::string& searchVal);
+       //Deletes the tuple that matches the parameters given
+       virtual void DeleteTuple(std::string levelDescriptor, std::string key, std::string value);
+       //Deletes the entries that match the parameters given
+       virtual void RemoveEntries(const std::string i_table, 
+               const std::string i_attribute, 
+               const std::string i_operand, 
+               const std::string i_val);
     //====================================================================
     
 
@@ -154,14 +188,35 @@ namespace creaImageIO
                        const std::string& value);
     //======================================================================
     //======================================================================
-
+       /// Sets an attribute and updates the database
+       void DBSetAttribute(const std::string& levelDescriptor, 
+                             const std::string& key,
+                             const std::string& value,
+                                 const std::string& searchParam, 
+                                 const std::string& searchVal);
+    //======================================================================
+    //======================================================================
+       
     /// Inserts the Node in the database
     void DBInsert(tree::Node* n);
     //======================================================================
 
+       
+       //======================================================================
+
+    /// Deletes the tuple that matches the value specified in the given key and that belongs to the given level
+       void DBDelete(std::string levelDescriptor, std::string key, std::string value);
+    //======================================================================
+
+       //======================================================================
 
        /// Recursively Removes the nodes whose parent is given as a parameter
     void DBRecursiveRemoveNode(tree::Node* node);
+       /// Recursively Removes the nodes found in the given level with the given parent id
+       void DBRecursiveRemoveNode(int level, std::string parentId);
+       //======================================================================
+
     /*
     /// 
     int DBQueryNumberOfChildren(tree::Node* n);
@@ -212,6 +267,7 @@ namespace creaImageIO
     bool mWritable;
     void SetWritable(bool w) { mWritable; }
     bool GetWritable() const { return mWritable; }
+       bool mIsAdding;
 
     /*
     struct TypeId