creaImageIO::SQLiteTreeHandler Class Reference
[Model]

Concrete TreeHandler which manages a Tree stored in a sqlite database. More...

#include <creaImageIOSQLiteTreeHandler.h>

Inheritance diagram for creaImageIO::SQLiteTreeHandler:

Inheritance graph
[legend]
Collaboration diagram for creaImageIO::SQLiteTreeHandler:

Collaboration graph
[legend]

List of all members.

Public Types

typedef
tree::Node::AttributeMapType 
AttributeMapType
 ====================================================================

Public Member Functions

 SQLiteTreeHandler (const std::string &filename)
 Ctor with database file name.
virtual ~SQLiteTreeHandler ()
 Dtor.
const std::string & GetFileName () const
 Returns the sqlite db file name.
virtual bool IsReadable ()
 Is the 'source' readable ?
virtual bool IsWritable ()
 Is the 'source' writable ?
virtual bool Open (bool writable=false)
 Opens an existing 'source'.
virtual bool Close ()
 Closes the 'source'.
virtual bool Create (bool writable=false)
 Creates a new 'source'.
virtual bool Destroy ()
 Destroys the 'source'.
virtual void BeginTransaction ()
 Begins a transaction.
virtual void EndTransaction ()
 Commits results and ends transaction.
virtual unsigned int GetNumberOfChildren (tree::Node *n)
 Returns the number of children of the Node *WITHOUT LOADING THEM*.
virtual void GetAttribute (std::string levelDescriptor, std::string searchParam, std::string searchVal, std::string key, std::string &result)
 Returns the attribute requested. Useful for synchronization.
virtual int LoadChildren (tree::Node *parent, int maxlevel)
 Recursively loads the children of node 'parent' until maxlevel.
virtual void UnLoad (tree::Node *n)
 Unloads the Node and its descendants.
virtual void GetTopLevelNodeId (const std::string &searchParam, const std::string &searchValue, std::string &parent_id)
 ====================================================================
virtual int AddBranch (const AttributeMapType &attr)
 ====================================================================
virtual bool Remove (tree::Node *)
 Removes the node and its descendants.
virtual bool SetAttribute (tree::Node *, const std::string &key, const std::string &value)
 Sets an attribute of a Node.
virtual void SetAttribute (const std::string &levelDescriptor, const std::string &key, const std::string &value, const std::string &searchParam, const std::string &searchVal)
virtual void DeleteTuple (std::string levelDescriptor, std::string key, std::string value)
virtual void RemoveEntries (const std::string i_table, const std::string i_attribute, const std::string i_operand, const std::string i_val)
tree::TreeGetTree ()
 Returns the Tree handled.
const tree::TreeGetTree () const
 Returns the Tree handled (const).
virtual int AddBranch (const AttributeMapType &)
 Adds a branch in the tree with the attributes provided.

Protected Member Functions

bool DBOpen ()
 Open the database.
bool DBImportTreeDescription ()
 Import the Tree::Description from database (verifies the structure).
bool DBCreate ()
 Creates a new database on disk and the tables.
void SQLAppendAttributesDefinition (int level, std::string &s)
 Appends to string s the SQL command to create the attributes of a given level.
tree::NodeDBGetParent (const AttributeMapType &attr)
 Returns the parent to which the branch defined by the attributes.
int DBLoadChildren (tree::Node *parent, int numberoflevels=1)
 Loads the children of Node parent.
void SQLAppendAttributesValues (tree::Node *n, std::string &s)
 Appends to string s the SQL command to set the attributes values.
void DBGraftToParent (tree::Node *parent, const AttributeMapType &attr)
 Graft the branch defined by the attributes to the parent.
bool DBSetAttribute (tree::Node *, const std::string &key, const std::string &value)
 Sets an attribute of a Node 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)
 Sets an attribute and updates the database.
void DBInsert (tree::Node *n)
 Inserts the Node in the database.
void DBDelete (std::string levelDescriptor, std::string key, std::string value)
 Deletes the tuple that matches the value specified in the given key and that belongs to the given level.
void DBRecursiveRemoveNode (tree::Node *node)
 Recursively Removes the nodes whose parent is given as a parameter.
void DBRecursiveRemoveNode (int level, std::string parentId)
 Recursively Removes the nodes found in the given level with the given parent id.

Private Member Functions

void SetWritable (bool w)
bool GetWritable () const

Private Attributes

CppSQLite3DBmDB
 The DB.
std::string mFileName
 The physical location associated to the DicomDatabase (directory, db file...).
bool mWritable
 Is the DB writable ?
bool mIsAdding


Detailed Description

Concrete TreeHandler which manages a Tree stored in a sqlite database.

Definition at line 17 of file creaImageIOSQLiteTreeHandler.h.


Member Typedef Documentation

typedef tree::Node::AttributeMapType creaImageIO::TreeHandler::AttributeMapType [inherited]

====================================================================

Definition at line 123 of file creaImageIOTreeHandler.h.


Constructor & Destructor Documentation

creaImageIO::SQLiteTreeHandler::SQLiteTreeHandler ( const std::string &  filename  ) 

Ctor with database file name.

virtual creaImageIO::SQLiteTreeHandler::~SQLiteTreeHandler (  )  [virtual]

Dtor.


Member Function Documentation

const std::string& creaImageIO::SQLiteTreeHandler::GetFileName (  )  const [inline]

Returns the sqlite db file name.

Definition at line 29 of file creaImageIOSQLiteTreeHandler.h.

References mFileName.

00029 { return mFileName; }

virtual bool creaImageIO::SQLiteTreeHandler::IsReadable (  )  [inline, virtual]

Is the 'source' readable ?

Reimplemented from creaImageIO::TreeHandler.

Definition at line 35 of file creaImageIOSQLiteTreeHandler.h.

00035 { return true; }

virtual bool creaImageIO::SQLiteTreeHandler::IsWritable (  )  [inline, virtual]

Is the 'source' writable ?

Reimplemented from creaImageIO::TreeHandler.

Definition at line 37 of file creaImageIOSQLiteTreeHandler.h.

00037 { return true; }

virtual bool creaImageIO::SQLiteTreeHandler::Open ( bool  writable = false  )  [virtual]

Opens an existing 'source'.

Reimplemented from creaImageIO::TreeHandler.

virtual bool creaImageIO::SQLiteTreeHandler::Close (  )  [virtual]

Closes the 'source'.

Reimplemented from creaImageIO::TreeHandler.

virtual bool creaImageIO::SQLiteTreeHandler::Create ( bool  writable = false  )  [virtual]

Creates a new 'source'.

Reimplemented from creaImageIO::TreeHandler.

virtual bool creaImageIO::SQLiteTreeHandler::Destroy (  )  [virtual]

Destroys the 'source'.

Reimplemented from creaImageIO::TreeHandler.

virtual void creaImageIO::SQLiteTreeHandler::BeginTransaction (  )  [virtual]

Begins a transaction.

Reimplemented from creaImageIO::TreeHandler.

virtual void creaImageIO::SQLiteTreeHandler::EndTransaction (  )  [virtual]

Commits results and ends transaction.

Reimplemented from creaImageIO::TreeHandler.

virtual unsigned int creaImageIO::SQLiteTreeHandler::GetNumberOfChildren ( tree::Node n  )  [virtual]

Returns the number of children of the Node *WITHOUT LOADING THEM*.

Reimplemented from creaImageIO::TreeHandler.

virtual void creaImageIO::SQLiteTreeHandler::GetAttribute ( std::string  levelDescriptor,
std::string  searchParam,
std::string  searchVal,
std::string  key,
std::string &  result 
) [virtual]

Returns the attribute requested. Useful for synchronization.

Reimplemented from creaImageIO::TreeHandler.

virtual int creaImageIO::SQLiteTreeHandler::LoadChildren ( tree::Node parent,
int  maxlevel 
) [virtual]

Recursively loads the children of node 'parent' until maxlevel.

Reimplemented from creaImageIO::TreeHandler.

virtual void creaImageIO::SQLiteTreeHandler::UnLoad ( tree::Node n  )  [virtual]

Unloads the Node and its descendants.

Reimplemented from creaImageIO::TreeHandler.

virtual void creaImageIO::SQLiteTreeHandler::GetTopLevelNodeId ( const std::string &  searchParam,
const std::string &  searchValue,
std::string &  parent_id 
) [virtual]

====================================================================

Returns the top level node id for the given search param and search value

Reimplemented from creaImageIO::TreeHandler.

virtual int creaImageIO::SQLiteTreeHandler::AddBranch ( const AttributeMapType attr  )  [virtual]

====================================================================

Adds a branch in the tree with the attributes provided

virtual bool creaImageIO::SQLiteTreeHandler::Remove ( tree::Node  )  [virtual]

Removes the node and its descendants.

Reimplemented from creaImageIO::TreeHandler.

virtual bool creaImageIO::SQLiteTreeHandler::SetAttribute ( tree::Node ,
const std::string &  key,
const std::string &  value 
) [virtual]

Sets an attribute of a Node.

Reimplemented from creaImageIO::TreeHandler.

virtual void creaImageIO::SQLiteTreeHandler::SetAttribute ( const std::string &  levelDescriptor,
const std::string &  key,
const std::string &  value,
const std::string &  searchParam,
const std::string &  searchVal 
) [virtual]

Reimplemented from creaImageIO::TreeHandler.

virtual void creaImageIO::SQLiteTreeHandler::DeleteTuple ( std::string  levelDescriptor,
std::string  key,
std::string  value 
) [virtual]

Reimplemented from creaImageIO::TreeHandler.

virtual void creaImageIO::SQLiteTreeHandler::RemoveEntries ( const std::string  i_table,
const std::string  i_attribute,
const std::string  i_operand,
const std::string  i_val 
) [virtual]

Reimplemented from creaImageIO::TreeHandler.

bool creaImageIO::SQLiteTreeHandler::DBOpen (  )  [protected]

Open the database.

bool creaImageIO::SQLiteTreeHandler::DBImportTreeDescription (  )  [protected]

Import the Tree::Description from database (verifies the structure).

bool creaImageIO::SQLiteTreeHandler::DBCreate (  )  [protected]

Creates a new database on disk and the tables.

void creaImageIO::SQLiteTreeHandler::SQLAppendAttributesDefinition ( int  level,
std::string &  s 
) [protected]

Appends to string s the SQL command to create the attributes of a given level.

tree::Node* creaImageIO::SQLiteTreeHandler::DBGetParent ( const AttributeMapType attr  )  [protected]

Returns the parent to which the branch defined by the attributes.

int creaImageIO::SQLiteTreeHandler::DBLoadChildren ( tree::Node parent,
int  numberoflevels = 1 
) [protected]

Loads the children of Node parent.

void creaImageIO::SQLiteTreeHandler::SQLAppendAttributesValues ( tree::Node n,
std::string &  s 
) [protected]

Appends to string s the SQL command to set the attributes values.

void creaImageIO::SQLiteTreeHandler::DBGraftToParent ( tree::Node parent,
const AttributeMapType attr 
) [protected]

Graft the branch defined by the attributes to the parent.

bool creaImageIO::SQLiteTreeHandler::DBSetAttribute ( tree::Node ,
const std::string &  key,
const std::string &  value 
) [protected]

Sets an attribute of a Node and updates the database.

void creaImageIO::SQLiteTreeHandler::DBSetAttribute ( const std::string &  levelDescriptor,
const std::string &  key,
const std::string &  value,
const std::string &  searchParam,
const std::string &  searchVal 
) [protected]

Sets an attribute and updates the database.

void creaImageIO::SQLiteTreeHandler::DBInsert ( tree::Node n  )  [protected]

Inserts the Node in the database.

void creaImageIO::SQLiteTreeHandler::DBDelete ( std::string  levelDescriptor,
std::string  key,
std::string  value 
) [protected]

Deletes the tuple that matches the value specified in the given key and that belongs to the given level.

void creaImageIO::SQLiteTreeHandler::DBRecursiveRemoveNode ( tree::Node node  )  [protected]

Recursively Removes the nodes whose parent is given as a parameter.

void creaImageIO::SQLiteTreeHandler::DBRecursiveRemoveNode ( int  level,
std::string  parentId 
) [protected]

Recursively Removes the nodes found in the given level with the given parent id.

void creaImageIO::SQLiteTreeHandler::SetWritable ( bool  w  )  [inline, private]

Definition at line 268 of file creaImageIOSQLiteTreeHandler.h.

References mWritable.

00268 { mWritable; }

bool creaImageIO::SQLiteTreeHandler::GetWritable (  )  const [inline, private]

Definition at line 269 of file creaImageIOSQLiteTreeHandler.h.

References mWritable.

00269 { return mWritable; }

tree::Tree& creaImageIO::TreeHandler::GetTree (  )  [inline, inherited]

Returns the Tree handled.

Definition at line 36 of file creaImageIOTreeHandler.h.

References creaImageIO::TreeHandler::mTree.

00036 { return mTree; }

const tree::Tree& creaImageIO::TreeHandler::GetTree (  )  const [inline, inherited]

Returns the Tree handled (const).

Definition at line 38 of file creaImageIOTreeHandler.h.

References creaImageIO::TreeHandler::mTree.

00038 { return mTree; }

virtual int creaImageIO::TreeHandler::AddBranch ( const AttributeMapType  )  [inline, virtual, inherited]

Adds a branch in the tree with the attributes provided.

Definition at line 128 of file creaImageIOTreeHandler.h.

00128 { return -1; }


Member Data Documentation

CppSQLite3DB* creaImageIO::SQLiteTreeHandler::mDB [private]

The DB.

Definition at line 263 of file creaImageIOSQLiteTreeHandler.h.

std::string creaImageIO::SQLiteTreeHandler::mFileName [private]

The physical location associated to the DicomDatabase (directory, db file...).

Definition at line 265 of file creaImageIOSQLiteTreeHandler.h.

Referenced by GetFileName().

bool creaImageIO::SQLiteTreeHandler::mWritable [private]

Is the DB writable ?

Definition at line 267 of file creaImageIOSQLiteTreeHandler.h.

Referenced by GetWritable(), and SetWritable().

bool creaImageIO::SQLiteTreeHandler::mIsAdding [private]

Definition at line 270 of file creaImageIOSQLiteTreeHandler.h.


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 10:50:00 2009 for CreaImageIO by  doxygen 1.5.3