eepgwde::detail::DataFrame Class Reference
[Containers for CSV data]

A transient data structure to use the data from a CSV file loaded into a multi_array. More...

#include <eleve/src0/csv1.hpp>

List of all members.

Public Types

enum  part_t { ROW, COLUMN }
typedef boost::bimap< int,
std::string > 
attr_pos_t
typedef
attr_pos_t::left_map::const_iterator 
l_itr
 ! A left iterator for the header bimap.
typedef
attr_pos_t::right_map::const_iterator 
r_itr
 ! A right iterator for the header bimap.
typedef
boost::multi_array_types::index_range 
range
typedef boost::multi_array
< boost::any, 2 > 
ma_any_t
typedef ma_any_t::array_view
< 2 >::type 
payload_t
 View on the data.
typedef ma_any_t::array_view
< 1 >::type 
column_t
 View: one column.
typedef payload_t::iterator iterator0
 By row and then column iterator.
typedef column_t::iterator iterator1
 By column iterator.

Public Member Functions

column_t column (const std::string name0) throw (std::domain_error)
 Get a column by name.
column_t column (int position0) throw (std::out_of_range)
 Get a column by position.
Typing::types0_t::value_type column_t0 (int position0) throw (std::out_of_range)
 Get a column's expected type.
Typing::types0_t::value_type column_t0 (const std::string name0) throw (std::domain_error)
 Get a column's expected type.
Typing::types0_ttypes0 ()
 Get all the types defined.
template<typename T>
void render (column_t &view0, const boost::any null_=(eepgwde::detail::null0< boost::any >())()) throw (std::domain_error)
template<typename T>
void render (const std::string colname0) throw (std::domain_error)
void render (const std::string colname0) throw (std::domain_error)
 Change the type of a column.
void render () throw (std::domain_error)
 Change the types of all columns.
 DataFrame (ma_any_t &frame_, std::string overrides0=std::string("")) throw (std::domain_error)
 Build a frame manager using the named overrides set.
const std::string & overrides () const
 DataFrame (const DataFrame &df) throw (std::domain_error)
 DataFrame (DataFrame &df) throw (std::domain_error)
DataFrameoperator= (const DataFrame &t)
ma_any_tadd (ma_any_t *)
 Add a row.
ma_any_tadd (DataFrame::ma_any_t *, const std::string &name0)
 Add a column (at the end) to the frame with the name given.
ma_any_tadd (DataFrame::ma_any_t *, const std::set< std::string > &names)
 Add a set of column names (at the end).
virtual ~DataFrame () throw ()
ma_any_tadd (DataFrame::ma_any_t *, const std::vector< Record * > &xtra_attrs, std::set< std::string > names=std::set< std::string >())

Public Attributes

attr_pos_t header
 ! The bimap containing the headers.
ma_any_tframe
 Reference to the frame passed to the constuctor.
boost::shared_ptr
< eepgwde::detail::DataFrame::payload_t
payload

Protected Attributes

std::auto_ptr
< eepgwde::detail::DataFrame::Impl
impl

Friends

class Impl

Classes

struct  columnar
 Classes for components. More...
struct  columnar1
struct  Comparor
struct  headar
struct  Impl
struct  payloader
struct  Record
struct  rowar


Detailed Description

A transient data structure to use the data from a CSV file loaded into a multi_array.

It creates a header and a payload. You use those to re-type the data in the payload.

Definition at line 40 of file csv1.hpp.


Member Typedef Documentation

typedef boost::bimap<int, std::string> eepgwde::detail::DataFrame::attr_pos_t

! A map to look up by column name or by column index

Note:
Indices start at 1.

Definition at line 49 of file csv1.hpp.

typedef attr_pos_t::left_map::const_iterator eepgwde::detail::DataFrame::l_itr

! A left iterator for the header bimap.

Definition at line 52 of file csv1.hpp.

typedef attr_pos_t::right_map::const_iterator eepgwde::detail::DataFrame::r_itr

! A right iterator for the header bimap.

Definition at line 55 of file csv1.hpp.

typedef boost::multi_array_types::index_range eepgwde::detail::DataFrame::range

Definition at line 57 of file csv1.hpp.

typedef boost::multi_array<boost::any, 2> eepgwde::detail::DataFrame::ma_any_t

Definition at line 58 of file csv1.hpp.

typedef ma_any_t::array_view<2>::type eepgwde::detail::DataFrame::payload_t

View on the data.

Definition at line 61 of file csv1.hpp.

typedef ma_any_t::array_view<1>::type eepgwde::detail::DataFrame::column_t

View: one column.

Definition at line 64 of file csv1.hpp.

typedef payload_t::iterator eepgwde::detail::DataFrame::iterator0

By row and then column iterator.

Definition at line 67 of file csv1.hpp.

typedef column_t::iterator eepgwde::detail::DataFrame::iterator1

By column iterator.

Definition at line 69 of file csv1.hpp.


Member Enumeration Documentation

Enumerator:
ROW 
COLUMN 

Definition at line 43 of file csv1.hpp.


Constructor & Destructor Documentation

eepgwde::detail::DataFrame::DataFrame ( ma_any_t frame_,
std::string  overrides0 = std::string("") 
) throw (std::domain_error) [explicit]

Build a frame manager using the named overrides set.

Add some useful attributes to a frame.

Create a payload view - no header row. The header goes into a numbered bimap.

Definition at line 193 of file csv1.cpp.

References eepgwde::detail::frame, and frame_.

eepgwde::detail::DataFrame::DataFrame ( const DataFrame df  )  throw (std::domain_error)

Definition at line 231 of file csv1.cpp.

eepgwde::detail::DataFrame::DataFrame ( DataFrame df  )  throw (std::domain_error)

Definition at line 237 of file csv1.cpp.

eepgwde::detail::DataFrame::~DataFrame (  )  throw () [virtual]

Definition at line 145 of file csv1.cpp.


Member Function Documentation

DataFrame::column_t eepgwde::detail::DataFrame::column ( const std::string  name0  )  throw (std::domain_error)

DataFrame::column_t eepgwde::detail::DataFrame::column ( int  position0  )  throw (std::out_of_range)

Get a column by position.

Definition at line 248 of file csv1.cpp.

Typing::types0_t::value_type eepgwde::detail::DataFrame::column_t0 ( int  position0  )  throw (std::out_of_range)

Get a column's expected type.

Definition at line 152 of file csv1.cpp.

Referenced by Test::colt_t::colt::d1().

Typing::types0_t::value_type eepgwde::detail::DataFrame::column_t0 ( const std::string  name0  )  throw (std::domain_error)

Get a column's expected type.

Definition at line 163 of file csv1.cpp.

Typing::types0_t & eepgwde::detail::DataFrame::types0 (  ) 

Get all the types defined.

Definition at line 147 of file csv1.cpp.

References impl.

Referenced by Test::colt_t::colt::d0().

template<typename T>
void eepgwde::detail::DataFrame::render ( column_t view0,
const boost::any  null_ = (eepgwde::detail::null0<boost::any>())() 
) throw (std::domain_error) [inline]

template<typename T>
void eepgwde::detail::DataFrame::render ( const std::string  colname0  )  throw (std::domain_error) [inline]

Change the type of a column.

Template Parameters:
T data type to coerce the boost::any
See also:
renderer

Definition at line 113 of file csv1.hpp.

References column().

void eepgwde::detail::DataFrame::render ( const std::string  colname0  )  throw (std::domain_error)

Change the type of a column.

fn1_ref_t render_bps & eepgwde::detail::DataFrame::render (  )  throw (std::domain_error)

Change the types of all columns.

Render all the columns.

Catch any failures and throw at the end.

Definition at line 304 of file csv1.cpp.

References e1(), and header.

const std::string & eepgwde::detail::DataFrame::overrides (  )  const

Definition at line 243 of file csv1.cpp.

References impl.

DataFrame & eepgwde::detail::DataFrame::operator= ( const DataFrame t  ) 

Definition at line 216 of file csv1.cpp.

References frame, header, impl, Impl, and payload.

DataFrame::ma_any_t * eepgwde::detail::DataFrame::add ( ma_any_t result  ) 

Add a row.

Add a row (at the end) to the frame.

Copy the frame to a new frame (passed by reference)

This is a bit weighty. You can only copy from one frame to another.

Definition at line 327 of file csv1.cpp.

References frame.

Referenced by Test::attrs_t::attrs::q0().

DataFrame::ma_any_t * eepgwde::detail::DataFrame::add ( DataFrame::ma_any_t result,
const std::string &  name0 
)

Add a column (at the end) to the frame with the name given.

Add a column.

This is a bit weighty. You can only copy from one frame to another.

Definition at line 353 of file csv1.cpp.

References frame.

DataFrame::ma_any_t * eepgwde::detail::DataFrame::add ( DataFrame::ma_any_t result,
const std::set< std::string > &  name0 
)

Add a set of column names (at the end).

Add a column.

This is a bit weighty. You can only copy from one frame to another.

Definition at line 381 of file csv1.cpp.

References frame.

ma_any_t* eepgwde::detail::DataFrame::add ( DataFrame::ma_any_t ,
const std::vector< Record * > &  xtra_attrs,
std::set< std::string >  names = std::set< std::string >() 
)

Add a set of column names (at the end) and use data from the attrs_ of a DataFrame


Friends And Related Function Documentation

friend class Impl [friend]

Definition at line 393 of file csv1.hpp.

Referenced by operator=().


Member Data Documentation

Definition at line 397 of file csv1.hpp.

Referenced by operator=(), overrides(), and types0().


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

Generated on Thu Feb 18 21:30:12 2010 for eleve by  doxygen 1.5.6