ROSE  0.9.10.91
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
Rose::BinaryAnalysis::Concolic::Database Class Reference

Description

Database.

A database holds the entire state for a concolic testing system consisting of one or more test suites. A Database object is always connected to exactly one database and limits the scope of its operations to exactly one test suite (except where noted).

A Database object refers to persistent storage through a URL using ROSE's SqlDatabase layer. This supports both PostgreSQL databases and SQLite3 databases the the possibility of adding other RDMSs later.

Objects within a database have an ID number, and these ID numbers are type-specific. When an object is inserted (copied) into a database a new ID number is returned. The Database object memoizes the association between object IDs and objects.

Definition at line 391 of file BinaryConcolic.h.

#include <BinaryConcolic.h>

Inheritance diagram for Rose::BinaryAnalysis::Concolic::Database:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::Concolic::Database:
Collaboration graph
[legend]

Classes

struct  SpecimenId
 ID numbers for specimens. More...
 
struct  TestCaseId
 ID numbers for test cases. More...
 
struct  TestSuiteId
 ID numbers for test suites. More...
 

Public Types

typedef Sawyer::SharedPointer< DatabasePtr
 Reference counting pointer to Database. More...
 
typedef Sawyer::Optional< int > ObjectId
 Base class for object IDs.
 

Public Member Functions

std::vector< TestSuiteIdtestSuites ()
 All test suites. More...
 
std::vector< SpecimenIdspecimens ()
 All specimens. More...
 
std::vector< TestCaseIdtestCases ()
 All test cases. More...
 
TestSuite::Ptr testSuite ()
 Property: the current test suite. More...
 
TestSuiteId testSuite (const TestSuite::Ptr &)
 Property: the current test suite. More...
 
TestSuite::Ptr object (TestSuiteId, Update::Flag update=Update::YES)
 Reconstitute a object from a database ID. More...
 
TestCase::Ptr object (TestCaseId, Update::Flag update=Update::YES)
 Reconstitute a object from a database ID. More...
 
Specimen::Ptr object (SpecimenId, Update::Flag update=Update::YES)
 Reconstitute a object from a database ID. More...
 
TestSuiteId id (const TestSuite::Ptr &, Update::Flag update=Update::YES)
 Returns an ID number for an object, optionally writing to the database. More...
 
TestCaseId id (const TestCase::Ptr &, Update::Flag update=Update::YES)
 Returns an ID number for an object, optionally writing to the database. More...
 
SpecimenId id (const Specimen::Ptr &, Update::Flag update=Update::YES)
 Returns an ID number for an object, optionally writing to the database. More...
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 

Static Public Member Functions

static Ptr instance (const std::string &url)
 Open an existing database. More...
 
static Ptr create (const std::string &url, const std::string &testSuiteName)
 Create a new database and test suite. More...
 

Member Typedef Documentation

Reference counting pointer to Database.

Definition at line 394 of file BinaryConcolic.h.

Member Function Documentation

static Ptr Rose::BinaryAnalysis::Concolic::Database::instance ( const std::string &  url)
static

Open an existing database.

Throws an Exception if the database does not exist.

static Ptr Rose::BinaryAnalysis::Concolic::Database::create ( const std::string &  url,
const std::string &  testSuiteName 
)
static

Create a new database and test suite.

For database management systems that support it, a new database is created, possibly overwriting any previous data if the database already existed. SQLite3 databases can be created this way because they're just files in the local filesystem, but PostgreSQL databases need to be created through the DBMS. Throws an Exception if the new database could not be created.

Once the database is created, a new test suite with the given name is created.

std::vector<TestSuiteId> Rose::BinaryAnalysis::Concolic::Database::testSuites ( )

All test suites.

Returns information about all the test suites that exist in this database. This is essentially the table of contents for the database.

TestSuite::Ptr Rose::BinaryAnalysis::Concolic::Database::testSuite ( )

Property: the current test suite.

If the database has a current test suite, then queries are limited in scope to return results associated with that test suite. Setting the test suite property also updates the database with information about the test suite, creating the test suite if necessary.

TestSuiteId Rose::BinaryAnalysis::Concolic::Database::testSuite ( const TestSuite::Ptr )

Property: the current test suite.

If the database has a current test suite, then queries are limited in scope to return results associated with that test suite. Setting the test suite property also updates the database with information about the test suite, creating the test suite if necessary.

std::vector<SpecimenId> Rose::BinaryAnalysis::Concolic::Database::specimens ( )

All specimens.

If this database object has a current test suite, then the return value is limited to specimens used by that test suite, otherwise all specimens are returned.

std::vector<TestCaseId> Rose::BinaryAnalysis::Concolic::Database::testCases ( )

All test cases.

If this database object has a current test suite, then the return value is limited to test cases used by that test suite, otherwise all test cases are returned.

TestSuite::Ptr Rose::BinaryAnalysis::Concolic::Database::object ( TestSuiteId  ,
Update::Flag  update = Update::YES 
)

Reconstitute a object from a database ID.

The association between object and ID is memoized. If update is yes and a memoized object is being returned, then also updates the object with the current values from the database.

TestCase::Ptr Rose::BinaryAnalysis::Concolic::Database::object ( TestCaseId  ,
Update::Flag  update = Update::YES 
)

Reconstitute a object from a database ID.

The association between object and ID is memoized. If update is yes and a memoized object is being returned, then also updates the object with the current values from the database.

Specimen::Ptr Rose::BinaryAnalysis::Concolic::Database::object ( SpecimenId  ,
Update::Flag  update = Update::YES 
)

Reconstitute a object from a database ID.

The association between object and ID is memoized. If update is yes and a memoized object is being returned, then also updates the object with the current values from the database.

TestSuiteId Rose::BinaryAnalysis::Concolic::Database::id ( const TestSuite::Ptr ,
Update::Flag  update = Update::YES 
)

Returns an ID number for an object, optionally writing to the database.

If the object exists in the database (i.e., returned as the result of some query) then its ID is returned and the database is optionally updated. On the other hand, if the object does not exist in the database then it will be created only if update is yes and its new ID is returned. If the object doesn't exist and isn't created then an invalid ID is returned.

TestCaseId Rose::BinaryAnalysis::Concolic::Database::id ( const TestCase::Ptr ,
Update::Flag  update = Update::YES 
)

Returns an ID number for an object, optionally writing to the database.

If the object exists in the database (i.e., returned as the result of some query) then its ID is returned and the database is optionally updated. On the other hand, if the object does not exist in the database then it will be created only if update is yes and its new ID is returned. If the object doesn't exist and isn't created then an invalid ID is returned.

SpecimenId Rose::BinaryAnalysis::Concolic::Database::id ( const Specimen::Ptr ,
Update::Flag  update = Update::YES 
)

Returns an ID number for an object, optionally writing to the database.

If the object exists in the database (i.e., returned as the result of some query) then its ID is returned and the database is optionally updated. On the other hand, if the object does not exist in the database then it will be created only if update is yes and its new ID is returned. If the object doesn't exist and isn't created then an invalid ID is returned.


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