libfaster API Documentation  Development Version
Super fast distributted computing
indexedFddStorage.h
1 #ifndef LIBFASTER_INDEXEDFDDSTORAGE_H
2 #define LIBFASTER_INDEXEDFDDSTORAGE_H
3 
4 
5 #include <cstdlib>
6 
7 #include "definitions.h"
8 #include "fddStorageBase.h"
9 
10 namespace faster {
11 
12  template <class K, class T> class indexedFddStorage;
13 
14  template <class K, class T>
16  protected:
17  T * localData;
18  K * localKeys;
19  public:
21  indexedFddStorageCore(size_t s);
22 
24 
25  T * getData();
26  K * getKeys();
27  void setSize(size_t s UNUSED) {};
28 
29  T & operator[](size_t ref);
30 
31  void sortByKey();
32  };
33 
34  // FDD storage place
35  // Stores worker's FDD data locally
36  template <class K, class T>
37  class indexedFddStorage : public indexedFddStorageCore<K, T> {
38  public:
40  indexedFddStorage(size_t s);
41  indexedFddStorage(K * keys, T * data, size_t s);
42  void setData( K * keys, T * data, size_t s);
43  void setDataRaw( void * keys, void * data, size_t s);
44 
45  void setSize(size_t s) override;
46 
47  void insert(K key, T & item);
48  void insertRaw(void * d, size_t s);
49 
50  void grow(size_t toSize);
51  void shrink();
52  };
53 
54  template <class K, class T>
56  private:
57  size_t * lineSizes;
58 
59  public:
61  indexedFddStorage(size_t s);
62  indexedFddStorage(K * keys, T ** data, size_t * lineSizes, size_t s);
63 
65 
66  void setData( K * keys, T ** data, size_t * lineSizes, size_t s);
67  void setDataRaw( void * keys, void * data, size_t * lineSizes, size_t s);
68  void setSize(size_t s) override;
69 
70  void insert(K key, T *& item, size_t s);
71  void insertRaw(void * d, size_t s);
72 
73  size_t * getLineSizes();
74 
75  void grow(size_t toSize);
76  void shrink();
77  };
78 
79 
80 }
81 
82 #endif
libfaster main namespace
Definition: _workerFdd.h:11