mapgd  0.4
A program for the Maximum-likelihood analysis of population genomic data.
 All Data Structures Functions Variables Friends Groups Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Private Attributes | Friends
Data Class Referenceabstract

A class which can be written as flat text file or into an SQL database. More...

#include <data.h>

Inheritance diagram for Data:
Inheritance graph
[legend]

Public Member Functions

virtual std::string header (void) const =0
 
void read_binary (std::istream &str)
 
void write_binary (std::ostream &str) const
 
 Data (std::vector< std::string > &)
 
virtual const std::string get_file_name () const
 
virtual const std::string get_table_name () const
 
virtual const bool indexed () const
 
virtual const bool get_binary () const
 
virtual const std::string sql_header (void) const
 Return the names of the columns, along with variable type.
 
virtual const std::string sql_column_names (void) const
 Return the names of the columns.
 
virtual const std::string sql_values (void) const
 Return the values to be placed in columns.
 
virtual void sql_read (std::istream &)
 Reads the values...
 
virtual size_t size (void) const
 The size of the class in bytes.
 

Static Public Member Functions

static Datanew_from_str (const std::string &, const std::vector< std::string > &)
 Constructs an instance of the class Registered w/ string.
 

Static Public Attributes

static const std::string file_name =".txt"
 The read function must be defined in the child class. More...
 
static const std::string table_name ="NONE"
 The read function must be defined in the child class. More...
 

Protected Member Functions

virtual void read (std::istream &str)=0
 The read function must be defined in the child class.
 
virtual void write (std::ostream &str) const =0
 The write function must be defined in the child class.
 

Static Private Attributes

static const bool binary =false
 A flag to indicate that binary reading/writing is not supported by default. More...
 

Friends

std::ostream & operator<< (std::ostream &, const Data &)
 Use the << operator to write Data in text mode.
 
std::istream & operator>> (std::istream &, Data &)
 Use the >> operator to read Data in text mode.
 

Detailed Description

A class which can be written as flat text file or into an SQL database.

Data can be written in a plain text representation (the overloaded >> and <<), in a binary representation which requires accurate information from the size() function, or be given to an SQL database (the sql_ functions). Additionally, all Data must have a static Registration, which uses the static table_name to write the derived class into new_data_. The static member new_data_ is a map between strings and constructors for the derived classes, so that derived Data classes can be created from strings. Ultimately my goal is to require Data classes to define a transformations between each other, so that mapgd can convert between exteranal data schemes and internal schemes as easily as possible, and maybe even aid in determining when data in the SQL data base needs to be updated. Notes to self: I can implement his be defining a bijection between the sets {X, Y, ... } and {Z}, meaning that I can construct {X, Y, ... } whenever I know {Z} and visa versa. In order to know how to define a bijection we need to define injective and surjective function between Data. If {X, Y} are surjective on {Z} but not injective, then we can define a bijection by removing elements from {X} or {Y}. TODO: Find a way to establish which elements of {X} or {Y} are extraneous. Also, is this injective/surjective language actually helpful?

Field Documentation

const bool Data::binary =false
staticprivate

A flag to indicate that binary reading/writing is not supported by default.

A flag to indicate whether reading/writing in binary mode is supported for the data_type.

const std::string Data::file_name =".txt"
static

The read function must be defined in the child class.

The destination table in the Db.

const std::string Data::table_name ="NONE"
static

The read function must be defined in the child class.

The destination table in the Db.


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