chunkedseq
container library for large in-memory data sets
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
test_chunkedbag.cpp
Go to the documentation of this file.
1 
13  #define DEBUG_MIDDLE_SEQUENCE 1
14 
15 #include "cmdline.hpp"
16 #include "chunkedbag.hpp"
17 #include "test_seq.hpp"
18 
19 using namespace pasl::data;
20 
21 
22 /***********************************************************************/
23 // Specification of integer items
24 
25 class IntItem {
26  int value;
27 
28 public:
29  IntItem() : value(0) {}
30 
31  static IntItem from_int(int n) {
32  IntItem x;
33  x.value = n;
34  return x;
35  }
36 
37  static int to_int(IntItem& x) {
38  return x.value;
39  }
40 
41  static void print(IntItem& x) {
42  printf("%d", IntItem::to_int(x));
43  }
44 
45  static void free(IntItem& x) {
46  }
47 
48 };
49 
50 /***********************************************************************/
51 // Specialization of the sequence to integer items
52 
53 template<int Chunk_capacity>
55 
56 
57 /***********************************************************************/
58 
59 int main(int argc, char** argv) {
60  pasl::util::cmdline::set(argc, argv);
61 
62  size_t chunk_capacity = (size_t) pasl::util::cmdline::parse_or_default_int("chunk_capacity", 2);
63  if (chunk_capacity == 2)
64  TestSeq<IntBagOf<2>,IntItem>::execute_test();
65  else if (chunk_capacity == 4)
66  TestSeq<IntBagOf<4>,IntItem>::execute_test();
67  else
68  pasl::util::cmdline::die("unsupported capacity");
69 
70  return 0;
71 }
72 
73 
74 /***********************************************************************/
Chunked-bag functor.
Unit tests for sequences.
int main(int argc, char **argv)
const int chunk_capacity
[weighted_split_example]