SubcloneSeeker  1.0.0
Subclone deconvolution software framework
 All Classes Files Functions Variables Macros Pages
SubcloneSeeker::Archivable Interface Referenceabstract

Abstract class that defines the interface to handle archiving objects into sqlite3 database. More...

#include <Archivable.h>

Inheritance diagram for SubcloneSeeker::Archivable:
SubcloneSeeker::EventCluster SubcloneSeeker::SomaticEvent SubcloneSeeker::Subclone SubcloneSeeker::SegmentalMutation SubcloneSeeker::SNP SubcloneSeeker::CNV SubcloneSeeker::LOH

Public Member Functions

 Archivable ()
 
sqlite3_int64 getId ()
 
void setId (sqlite3_int64 nid)
 
bool createTableInDB (sqlite3 *database)
 
sqlite3_int64 archiveObjectToDB (sqlite3 *database)
 
bool unarchiveObjectFromDB (sqlite3 *database, sqlite3_int64 id)
 
DBObjectID_vec vecAllObjectsID (sqlite3 *database)
 

Protected Member Functions

virtual std::string getTableName ()=0
 
virtual std::string createTableStatementStr ()=0
 
virtual std::string createObjectStatementStr ()=0
 
virtual std::string updateObjectStatementStr ()=0
 
virtual std::string selectObjectColumnListStr ()=0
 
virtual int bindObjectToStatement (sqlite3_stmt *statement)=0
 
virtual void updateObjectFromStatement (sqlite3_stmt *statement)=0
 

Protected Attributes

sqlite3_int64 id
 

Detailed Description

Abstract class that defines the interface to handle archiving objects into sqlite3 database.

This abstract class defines the required behaviors when handling object archiving to and from a sqlite3 database, which will be used by the project to store computation results. As of now four methods are required for any class that wishes to support archiving:

  1. return a string describing the name of the table
  2. create the table in a given database
  3. store an object into the table
  4. retrieve an object from the table with an identifier

The unarchiving procedure uses an integer id to determine which database record is to be used for unarchiving. This would require that an SERIAL column exists in the table.

Constructor & Destructor Documentation

SubcloneSeeker::Archivable::Archivable ( )
inline

Minimal constructor to reset all member variables

Member Function Documentation

sqlite3_int64 Archivable::archiveObjectToDB ( sqlite3 *  database)

Archive the object into the database

Parameters
databaseAn open sqlite3 database connection handle
Returns
The id of the newly inserted object, if successful; or -1 if error occurred
virtual int SubcloneSeeker::Archivable::bindObjectToStatement ( sqlite3_stmt *  statement)
protectedpure virtual

Bind archivable properties to a prepared, unbound sqlite3 statement

Parameters
statementA prepared, unbound sqlite3 statement instance
Returns
How many parameters are bound to the statement + 1

Implemented in SubcloneSeeker::Subclone, SubcloneSeeker::EventCluster, SubcloneSeeker::SegmentalMutation, and SubcloneSeeker::SNP.

virtual std::string SubcloneSeeker::Archivable::createObjectStatementStr ( )
protectedpure virtual

return the unbound statement for record creation

Returns
unbound statement for record creation

Implemented in SubcloneSeeker::Subclone, SubcloneSeeker::EventCluster, SubcloneSeeker::SegmentalMutation, and SubcloneSeeker::SNP.

bool Archivable::createTableInDB ( sqlite3 *  database)

Create the storage table in the database

Parameters
databaseAn open sqlite3 database connection handle
Returns
Whether the operation is successful or not
virtual std::string SubcloneSeeker::Archivable::createTableStatementStr ( )
protectedpure virtual

return the table definition when creating the table in a sqlite3 database

Imagine a generic SQL create statement: CREATE TABLE <tableName> (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT <other-columns>); Notice that the returned string must be prefixed with a comma ",", to separate any custom columns from the id column

Returns
The extra column definitions, prefixed with ","

Implemented in SubcloneSeeker::Subclone, SubcloneSeeker::EventCluster, and SubcloneSeeker::SomaticEvent.

sqlite3_int64 SubcloneSeeker::Archivable::getId ( )
inline

get access function of id

Returns
the database identifier of the object
virtual std::string SubcloneSeeker::Archivable::getTableName ( )
protectedpure virtual

returns the name of the table in which all object of a specific class are stored

Returns
Table name

Implemented in SubcloneSeeker::LOH, SubcloneSeeker::CNV, SubcloneSeeker::Subclone, SubcloneSeeker::EventCluster, and SubcloneSeeker::SNP.

virtual std::string SubcloneSeeker::Archivable::selectObjectColumnListStr ( )
protectedpure virtual

return the list of columns to be used in select statement for getting data from the database

Imagine the generic SQL select statement: SELECT <col1>, <col2>, ... FROM <tableName> WHERE id=?; The method should return the <col1>,<col2>,... part

Returns
the list of columns as string

Implemented in SubcloneSeeker::Subclone, SubcloneSeeker::EventCluster, SubcloneSeeker::SegmentalMutation, and SubcloneSeeker::SNP.

void SubcloneSeeker::Archivable::setId ( sqlite3_int64  nid)
inline

Set the database id

Parameters
nidthe new database id
bool Archivable::unarchiveObjectFromDB ( sqlite3 *  database,
sqlite3_int64  id 
)

Unarchive an object from the database

Parameters
databaseAn open sqlite3 database connection handle
idThe identifier with which the correct record is to be found
Returns
Whether the operation is successful or not
virtual void SubcloneSeeker::Archivable::updateObjectFromStatement ( sqlite3_stmt *  statement)
protectedpure virtual

Populate archivable properties from a prepared statement during unarchiving

Parameters
statementA prepared statement contains the retrieved row

Implemented in SubcloneSeeker::Subclone, SubcloneSeeker::EventCluster, SubcloneSeeker::SegmentalMutation, and SubcloneSeeker::SNP.

virtual std::string SubcloneSeeker::Archivable::updateObjectStatementStr ( )
protectedpure virtual

return the unbound statement for record update

Returns
unbound statement for record update

Implemented in SubcloneSeeker::Subclone, SubcloneSeeker::EventCluster, SubcloneSeeker::SegmentalMutation, and SubcloneSeeker::SNP.

std::vector< sqlite3_int64 > Archivable::vecAllObjectsID ( sqlite3 *  database)

Return a std::vector of all ids of records of the current object's class

Returns
A vector of sqlite3_int64, describing all records with the same class

Member Data Documentation

sqlite3_int64 SubcloneSeeker::Archivable::id
protected

the database identifier for a specific record


The documentation for this interface was generated from the following files: