Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Types | Protected Attributes
soar_module::sqlite_statement_pool Class Reference

#include <soar_db.h>

Public Member Functions

void release (pooled_sqlite_statement *stmt)
pooled_sqlite_statementrequest (timer *query_timer=NULL)
 sqlite_statement_pool (agent *my_agent, sqlite_database *new_db, const char *new_sql)
 ~sqlite_statement_pool ()

Protected Types

typedef std::list
< pooled_sqlite_statement
*, soar_memory_pool_allocator
< pooled_sqlite_statement * > > 
sqlite_statement_pool_pool

Protected Attributes

sqlite_databasemy_db
const char * my_sql
sqlite_statement_pool_poolstatements

Detailed Description

Definition at line 547 of file soar_db.h.

Member Typedef Documentation

Definition at line 551 of file soar_db.h.

Constructor & Destructor Documentation

soar_module::sqlite_statement_pool::sqlite_statement_pool ( agent my_agent,
sqlite_database new_db,
const char *  new_sql 
)
inline

Definition at line 562 of file soar_db.h.

References statements.

: my_db( new_db ), my_sql( new_sql )
{
#ifdef USE_MEM_POOL_ALLOCATORS
#else
my_agent;
#endif
}
soar_module::sqlite_statement_pool::~sqlite_statement_pool ( )
inline

Definition at line 572 of file soar_db.h.

References statements.

{
for ( sqlite_statement_pool_pool::iterator it=statements->begin(); it!=statements->end(); it++ )
{
delete (*it);
}
delete statements;
}

Member Function Documentation

void soar_module::sqlite_statement_pool::release ( pooled_sqlite_statement stmt)
inline

Definition at line 582 of file soar_db.h.

References soar_module::statement::reinitialize(), and statements.

Referenced by epmem_process_query(), and epmem_register_pedges().

{
stmt->reinitialize();
statements->push_front( stmt );
}
pooled_sqlite_statement* soar_module::sqlite_statement_pool::request ( timer query_timer = NULL)
inline

Definition at line 588 of file soar_db.h.

References my_db, my_sql, soar_module::statement::prepare(), soar_module::statement::set_timer(), and statements.

Referenced by epmem_process_query(), and epmem_register_pedges().

{
pooled_sqlite_statement* return_val = NULL;
if ( statements->empty() )
{
// make new (assigns timer)
return_val = new pooled_sqlite_statement( this, my_db, my_sql, query_timer );
// ready to use
return_val->prepare();
}
else
{
return_val = statements->front();
statements->pop_front();
// assign timer
return_val->set_timer( query_timer );
}
return return_val;
}

Field Documentation

sqlite_database* soar_module::sqlite_statement_pool::my_db
protected

Definition at line 558 of file soar_db.h.

Referenced by request().

const char* soar_module::sqlite_statement_pool::my_sql
protected

Definition at line 559 of file soar_db.h.

Referenced by request().

sqlite_statement_pool_pool* soar_module::sqlite_statement_pool::statements
protected

Definition at line 556 of file soar_db.h.

Referenced by release(), request(), sqlite_statement_pool(), and ~sqlite_statement_pool().


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