C++ DSV Filter Library

 www.partow.net  .: Home :.   .: Links :.   .: Search :.   .: Contact :. 


Description

The C++ DSV Filter Library is a simple to use, easy to integrate and extremely efficient and fast CSV/DSV in-memory data store processing library. The DSV filter allows for the efficient evaluation of complex expressions on a per row basis upon the loaded DSV store. The accompanying example demonstrates very simple SQL-like processing capabilities for filtering user specified DSV files.

Capabilities

The C++ DSV Filter Library has the following capabilities:

  • Arbitrarily complex expressions over columns composed of both strings and numbers
  • Selectable output columns
  • Extremely fast in-memory store
  • Memory mapped file option
  • Single header file solution requires no installation or building

C++ DSV Library License

Free use of the C++ DSV Library is permitted under the guidelines and in accordance with the most current version of the "Common Public License."

Compatability

The C++ DSV Library implementation is fully compatible with the following C++ compilers:

  • GNU Compiler Collection (4.1+)
  • Intel® C++ Compiler (9.x+)
  • Clang/LLVM (1.1+)
  • PGI C++ (10.x+)
  • Microsoft Visual Studio C++ Compiler (7.1+)
  • Comeau C++ Compiler (4.3+)
  • IBM XL C/C++ (10.x+)

Download

Dependencies

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 queries that will extract the rows that match various criteria.

The C++ DSV Library Library Table - Copyright Arash Partow

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')
int main()
{
   std::string file_name = "ohlc.txt";
   dsv_filter filter;
   if (!filter.load(file_name))
      return 1;
   std::string expression = "(open > close) and (symbol like '*FT*') and (date >= '20090101')";
   filter.add_filter(expression);
   for (std::size_t row = 1; row < filter.row_count(); ++row)
   {
      if (dsv_filter::e_match == filter[row])
      {
          // do something with row...
      }
   }
   return 0;
}
                       



Copyright Arash Partow