Project Description
The C++ CSV Filter Library is a simple to use, easy to integrate and extremely efficient and fast CSV in-memory data store processing library. The CSV filter allows for the efficient evaluation of complex expressions on a per row basis upon the loaded CSV store.

Download
http://www.partow.net/programming/dsvfilter/index.html

Capabilities
The C++ CSV Filter Library has the following capabilities:
  • Arbitary expressions over columns composed of strings and numbers
  • Selectable output columns
  • Extrememly fast in-memory store
  • Single header file solution requires no installation or building


Example
In the following example, we have a table of OHLC values for a group of equities (GOOG and MSFT). Furthermore we may wish to perform a series of SQL like queries that will extract the rows that match various criteria.

dsv_filter_table.png

The following are a few example queries:
  • volume >= 1000000 and symbol == 'GOOG'
  • abs(open - close) > abs(high - low)
  • avg(open,close,high,low)* volume > 10^7 and inrange('20090702',date,'20090730')
  • (open > close) and (symbol like '*FT*') and (date >= '20090101')
  • (volume > 0) and (close > 0) and (open > 0)

int main()
{
   std::string file_name = "ohlc.txt";
   dsv_filter filter;
   filter.load(file_name);

   std::string expression =
      "(open > close) and (symbol like '*FT*') and (date >= '20090101')";

   filter.add_filter(filter_expression);
   for (std::size_t row = 1; row < filter.row_count(); ++row)
   {
      if (dsv_filter::e_match == filter[row])
      {
          // do something...
      }
   }
}


Information
http://www.partow.net/programming/dsvfilter/index.html

Last edited May 5, 2012 at 4:39 AM by ArashPartow, version 4