mageec  0.1.0
MAchine Guided Energy Efficient Compilation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | List of all members
mageec::database Class Reference

MAGEEC Machine Learner Database. More...

#include <mageec-db.h>

Public Member Functions

 database (std::string dbname, bool create)
 Creates a new database, loading from the SQlite3 database dbname. More...
 
 ~database ()
 
int initdb ()
 Given a new database, initilize it with the MAGEEC tables. More...
 
std::vector< mageec_pass * > get_pass_list ()
 Loads known passes from the database. More...
 
std::vector< resultget_all_results ()
 Loads all results from the table. More...
 
void add_result (result res)
 Adds a result object to the database. More...
 
void store_pass_blob (std::string passname, char *blob)
 Stores a text string against a pass name. More...
 
const char * get_pass_blob (std::string passname)
 Returns a text string stored against a pass name. More...
 

Detailed Description

MAGEEC Machine Learner Database.

Definition at line 32 of file mageec-db.h.

Constructor & Destructor Documentation

database::database ( std::string  dbname,
bool  create 
)

Creates a new database, loading from the SQlite3 database dbname.

Parameters
dbnamePath to database.
createAttempt to create the database if it does not exist.

Definition at line 31 of file database.cpp.

database::~database ( )

Definition at line 51 of file database.cpp.

Member Function Documentation

void database::add_result ( result  res)

Adds a result object to the database.

Parameters
resTest result to store

Definition at line 133 of file database.cpp.

std::vector< result > database::get_all_results ( )

Loads all results from the table.

Returns
empty vector if empty, else list of results.

Definition at line 186 of file database.cpp.

const char * database::get_pass_blob ( std::string  passname)

Returns a text string stored against a pass name.

It is up to the caller to free this pointer.

Parameters
passnameName of pass.
Returns
Valid pointer to stored data if data has been stored, else NULL.

Definition at line 282 of file database.cpp.

std::vector< mageec_pass * > database::get_pass_list ( )

Loads known passes from the database.

Returns
empty vector if error, else list of passes as mageec_pass.

Definition at line 101 of file database.cpp.

int database::initdb ( )

Given a new database, initilize it with the MAGEEC tables.

Returns
0 if success, sqlite3 error otherwise.

Definition at line 61 of file database.cpp.

void database::store_pass_blob ( std::string  passname,
char *  blob 
)

Stores a text string against a pass name.

If a string already exists in the database for a pass it will be replaced with blob.

Parameters
passnameName of pass.
blobData to store

Definition at line 267 of file database.cpp.


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