LILAC
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
engineimp Class Reference

#include <engineimp.h>

Public Member Functions

void write_dat ()
 Writes formatted data to disk and clears from ram.
void add_writer (const std::shared_ptr< writer > &wval)
 Adds a new writer to the engine.
void needs_updating (std::string name)
void needs_updating (std::shared_ptr< item > p)
void remove_item (std::string name)
 Returns the current count for updating, aka removing items.
void run ()
 Runs the engine.
bool item_exists (std::shared_ptr< item > val) const
 Queries whether an item exists or not.
bool item_exists (const std::string &val) const
 engineimp (const std::string &fname, const std::string &outname, const std::string &index)
 Constructor, reads from an input file.
 ~engineimp ()
 Deletes data.

Public Attributes

size_t index

Private Member Functions

void read (std::istream &fstr)
void _read (std::istream &fstr)
void sort_pp ()
void execute_command (std::string inval)
void update ()

Private Attributes

std::thread write_thread
std::mutex data_lock
std::mutex condition_lock
std::condition_variable write_cond
volatile std::atomic_size_t datas_queued
volatile std::atomic_char is_over
std::string curdir
FILE * ofile
std::map< size_t, std::list
< std::shared_ptr< writer > > > 
writers
std::list< std::map< size_t,
std::list< std::shared_ptr
< writer > > > > 
async_write_queue
std::map< std::string,
item_wrapper
values
std::map< std::string, inputinputs
std::set< std::shared_ptr< item > > update_vars

Friends

class engine
class item
class variable
item_wrapper eval_lisp (std::string in_cmd, std::string base_name, std::map< std::string, input > &inv, engineimp *en)

Detailed Description

This class is the actual engime implementation. It is kept separate from the engine class to allow editing without having to recompile large portions of the program. It also makes interfacing safer as one has limited access to the internals of the engine.

In the future, there may be different types of engine (MPI-based engines, pure learning engines, etc) and this will make it much easier to implement and work on those w/o exposing the logic to the rest of the program. I do need to move some of the engineimp functions to the engine class, however. But for now, I need to get the c-elegans code running and some proper tutorials written

Definition at line 47 of file engineimp.h.

Constructor & Destructor Documentation

engineimp::engineimp ( const std::string fname,
const std::string outname,
const std::string index 
)

Constructor, reads from an input file.

Definition at line 30 of file engine.cpp.

Here is the call graph for this function:

engineimp::~engineimp ( )

Deletes data.

Definition at line 58 of file engine.cpp.

Here is the call graph for this function:

Member Function Documentation

void engineimp::_read ( std::istream &  fstr)
private

Definition at line 27 of file engine_read.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void engineimp::add_writer ( const std::shared_ptr< writer > &  wval)

Adds a new writer to the engine.

Definition at line 22 of file engine_write.cpp.

Here is the caller graph for this function:

void engineimp::execute_command ( std::string  inval)
private

Definition at line 78 of file engine_read.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool engineimp::item_exists ( std::shared_ptr< item val) const

Queries whether an item exists or not.

Definition at line 68 of file engine.cpp.

Here is the caller graph for this function:

bool engineimp::item_exists ( const std::string val) const

Definition at line 79 of file engine.cpp.

void engineimp::needs_updating ( std::string  name)

Adds an item to the list of items that require updating

Parameters
nameName of the item that requires updating

Definition at line 96 of file engine.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void engineimp::needs_updating ( std::shared_ptr< item inval)

Adds an item to the list of items that require updating Goes by pointer so that items that are not part of the engine can be updated. Useful for wrapper classes such as the integrators

Parameters
invalPointer to the item that requires updating

Definition at line 113 of file engine.cpp.

Here is the call graph for this function:

void engineimp::read ( std::istream &  fstr)
private

Definition at line 23 of file engine_read.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void engineimp::remove_item ( std::string  name)

Returns the current count for updating, aka removing items.

void engineimp::run ( )

Runs the engine.

Definition at line 21 of file engine_run.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void engineimp::sort_pp ( )
private

Sorts the items in order of dependencies and performs all of the postprocessing

Definition at line 66 of file engine_read.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void engineimp::update ( )
private

Updates items which reference variables that require changing, and resets the list of items which require updating

Definition at line 86 of file engine.cpp.

Here is the caller graph for this function:

void engineimp::write_dat ( )

Writes formatted data to disk and clears from ram.

Definition at line 26 of file engine_write.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class engine
friend

Definition at line 83 of file engineimp.h.

item_wrapper eval_lisp ( std::string  in_cmd,
std::string  base_name,
std::map< std::string, input > &  inv,
engineimp en 
)
friend

Definition at line 75 of file eval_lisp.cpp.

friend class item
friend

Definition at line 84 of file engineimp.h.

friend class variable
friend

Definition at line 85 of file engineimp.h.

Member Data Documentation

std::list<std::map<size_t, std::list<std::shared_ptr<writer> > > > engineimp::async_write_queue
private

Definition at line 62 of file engineimp.h.

std::mutex engineimp::condition_lock
private

Definition at line 50 of file engineimp.h.

std::string engineimp::curdir
private

Definition at line 59 of file engineimp.h.

std::mutex engineimp::data_lock
private

Definition at line 49 of file engineimp.h.

volatile std::atomic_size_t engineimp::datas_queued
private

Definition at line 52 of file engineimp.h.

size_t engineimp::index

Definition at line 71 of file engineimp.h.

std::map<std::string, input> engineimp::inputs
private

Definition at line 64 of file engineimp.h.

volatile std::atomic_char engineimp::is_over
private

Definition at line 53 of file engineimp.h.

FILE* engineimp::ofile
private

Definition at line 60 of file engineimp.h.

std::set<std::shared_ptr<item> > engineimp::update_vars
private

Definition at line 65 of file engineimp.h.

std::map<std::string, item_wrapper > engineimp::values
private

Definition at line 63 of file engineimp.h.

std::condition_variable engineimp::write_cond
private

Definition at line 51 of file engineimp.h.

std::thread engineimp::write_thread
private

Definition at line 48 of file engineimp.h.

std::map<size_t, std::list<std::shared_ptr<writer> > > engineimp::writers
private

Definition at line 61 of file engineimp.h.


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