Signature | Description | Parameters |
---|---|---|
template<typename T, typename V> V & visit(const char *name, V &visitor, bool in_reverse = false); |
It passes the values of each index and the named column to the functor visitor sequentially from beginning to end NOTE: There is also a const version of this method. |
T: Type of the named column V: Type of the visitor functor name: Name of the data column visitor: An instance of the visitor in_reverse: If true, it will iterate over the column in reverse order |
template<typename T, typename V> std::future<V &> visit_async(const char *name, V &visitor, bool in_reverse = false); |
These are identical to above visit() but could execute asynchronously. NOTE: It should be safe to run multiple visits on different columns at the same time (as long as the index column is not being modified). NOTE: It should be safe to run multiple read-only visits on the same column or different columns at the same time NOTE: There is also a const version of this method. |
|
template<typename T1, typename T2, typename V> V & visit(const char *name1, const char *name2, V &visitor, bool in_reverse = false); |
It passes the values of each index and the two named columns to the functor visitor sequentially from beginning to end NOTE: There is also a const version of this method. |
T1: Type of the first named column T2: Type of the second named column V: Type of the visitor functor name1: Name of the first data column name2: Name of the second data column visitor: An instance of the visitor in_reverse: If true, it will iterate over the columns in reverse order |
template<typename T1, typename T2, typename V> std::future<V &> visit_async(const char *name1, const char *name2, V &visitor, bool in_reverse = false); |
These are identical to above visit() but could execute asynchronously. NOTE: It should be safe to run multiple visits on different columns at the same time (as long as the index column is not being modified). NOTE: It should be safe to run multiple read-only visits on the same column or different columns at the same time NOTE: There is also a const version of this method. |
|
template<typename T1, typename T2, typename T3, typename V> V & visit(const char *name1, const char *name2, const char *name3, V &visitor, bool in_reverse = false); |
It passes the values of each index and the three named columns to the functor visitor sequentially from beginning to end NOTE: There is also a const version of this method. |
T1: Type of the first named column T2: Type of the second named column T3: Type of the third named column V: Type of the visitor functor name1: Name of the first data column name2: Name of the second data column name3: Name of the third data column visitor: An instance of the visitor in_reverse: If true, it will iterate over the columns in reverse order |
template<typename T1, typename T2, typename T3, typename V> std::future<V &> visit_async(const char *name1, const char *name2, const char *name3, V &visitor, bool in_reverse = false); |
These are identical to above visit() but could execute asynchronously. NOTE: It should be safe to run multiple visits on different columns at the same time (as long as the index column is not being modified). NOTE: It should be safe to run multiple read-only visits on the same column or different columns at the same time NOTE: There is also a const version of this method. |
|
template<typename T1, typename T2, typename T3, typename T4, typename V> V & visit(const char *name1, const char *name2, const char *name3, const char *name4, V &visitor, bool in_reverse = false); |
It passes the values of each index and the four named columns to the functor visitor sequentially from beginning to end NOTE: There is also a const version of this method. |
T1: Type of the first named column T2: Type of the second named column T3: Type of the third named column T4: Type of the fourth named column V: Type of the visitor functor name1: Name of the first data column name2: Name of the second data column name3: Name of the third data column name4: Name of the fourth data column visitor: An instance of the visitor in_reverse: If true, it will iterate over the columns in reverse order |
template<typename T1, typename T2, typename T3, typename T4, typename V> std::future<V &> visit_async(const char *name1, const char *name2, const char *name3, const char *name4, V &visitor, bool in_reverse = false); |
These are identical to above visit() but could execute asynchronously. NOTE: It should be safe to run multiple visits on different columns at the same time (as long as the index column is not being modified). NOTE: It should be safe to run multiple read-only visits on the same column or different columns at the same time NOTE: There is also a const version of this method. |
|
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename V> V & visit(const char *name1, const char *name2, const char *name3, const char *name4, const char *name5, V &visitor, bool in_reverse = false); |
It passes the values of each index and the five named columns to the functor visitor sequentially from beginning to end NOTE: There is also a const version of this method. |
T1: Type of the first named column T2: Type of the second named column T3: Type of the third named column T4: Type of the fourth named column T5: Type of the fifth named column V: Type of the visitor functor name1: Name of the first data column name2: Name of the second data column name3: Name of the third data column name4: Name of the fourth data column name5: Name of the fifth data column visitor: An instance of the visitor in_reverse: If true, it will iterate over the columns in reverse order |
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename V> std::future<V &> visit_async(const char *name1, const char *name2, const char *name3, const char *name4, const char *name5, V &visitor, bool in_reverse = false); |
These are identical to above visit() but could execute asynchronously. NOTE: It should be safe to run multiple visits on different columns at the same time (as long as the index column is not being modified). NOTE: It should be safe to run multiple read-only visits on the same column or different columns at the same time NOTE: There is also a const version of this method. |
static void test_VWBAS() { std::cout << "\nTesting VWBASVisitor{ } ..." << std::endl; RandGenParams<double> bprice_p; bprice_p.mean = 1.0; bprice_p.std = 0.005; bprice_p.seed = 10; bprice_p.min_value = 100.0; bprice_p.max_value = 102.0; RandGenParams<double> aprice_p = bprice_p; aprice_p.seed = 200; aprice_p.min_value = 102.0; aprice_p.max_value = 104.0; RandGenParams<double> asize_p = bprice_p; asize_p.std = 1; asize_p.seed = 500; asize_p.min_value = 50.0; asize_p.max_value = 2000.0; RandGenParams<double> bsize_p = asize_p; asize_p.std = 1; asize_p.seed = 123456; asize_p.min_value = 50.0; asize_p.max_value = 2000.0; MyDataFrame df; df.load_data( MyDataFrame::gen_sequence_index(100, 1124, 1), std::make_pair("bid_price", gen_uniform_real_dist<double>(1024, bprice_p)), std::make_pair("ask_price", gen_uniform_real_dist<double>(1024, aprice_p)), std::make_pair("bid_size", gen_uniform_real_dist<double>(1024, bsize_p)), std::make_pair("ask_size", gen_uniform_real_dist<double>(1024, asize_p))); VWBASVisitor<double> v1(100); const MyDataFrame const_df = df; auto fut = const_df.visit_async<double, double, double, double>("bid_price", "ask_price", "bid_size", "ask_size", v1); auto result = fut.get().get_result(); assert(result.size() == 11); assert(result[0].event_count == 100); assert(result[0].index_value == 100); assert(result[1].event_count == 100); assert(result[1].cumulative_event_count == 200); assert(result[1].index_value == 200); assert(result[10].event_count == 24); assert(result[10].index_value == 1100); assert(fabs(result[0].spread - 2.11835) < 0.00001); assert(fabs(result[0].percent_spread - 2.0998) < 0.0001); assert(fabs(result[0].vwbas - 2.15156) < 0.00001); assert(fabs(result[0].percent_vwbas - 2.13298) < 0.00001); assert(fabs(result[0].high_bid_price - 101.966) < 0.001); assert(fabs(result[0].low_ask_price - 102.012) < 0.001); assert(fabs(result[0].cumulative_vwbas - 2.15156) < 0.00001); assert(fabs(result[5].spread - 1.92471) < 0.00001); assert(fabs(result[5].percent_spread - 1.90509) < 0.0001); assert(fabs(result[5].vwbas - 1.9199) < 0.0001); assert(fabs(result[5].percent_vwbas - 1.90052) < 0.00001); assert(fabs(result[5].high_bid_price - 101.987) < 0.001); assert(fabs(result[5].low_ask_price - 102.04) < 0.01); assert(fabs(result[5].cumulative_vwbas - 2.07029) < 0.00001); assert(fabs(result[10].spread - 1.98223) < 0.00001); assert(fabs(result[10].percent_spread - 1.96279) < 0.0001); assert(fabs(result[10].vwbas - 2.05129) < 0.0001); assert(fabs(result[10].percent_vwbas - 2.03336) < 0.00001); assert(fabs(result[10].high_bid_price - 101.997) < 0.001); assert(fabs(result[10].low_ask_price - 102.12) < 0.01); assert(fabs(result[10].cumulative_vwbas - 2.02198) < 0.00001); }