Faster  0.0.4Alpha
Superfastdistributtedcomputing
fddStorage.h
1 #ifndef LIBFASTER_FDDSTORAGE_H
2 #define LIBFASTER_FDDSTORAGE_H
3 
4 
5 #include <cstdlib>
6 #include "fddStorageBase.h"
7 
8 namespace faster{
9 
10  template <class T> class fddStorage;
11 
12  template <class T>
13  class fddStorageCore : public fddStorageBase {
14  protected:
15  T * localData;
16  public:
18  fddStorageCore(size_t s);
19 
20  ~fddStorageCore();
21 
22  T * getData();
23  void setSize(size_t s UNUSED) {};
24 
25  T & operator[](size_t ref);
26 
27 
28  };
29 
30  // FDD storage place
31  // Stores worker's FDD data locally
32  template <class T>
33  class fddStorage : public fddStorageCore<T> {
34  public:
35  fddStorage();
36  fddStorage(size_t s):fddStorageCore<T>(s){}
37  fddStorage(T * data, size_t s);
38  void setData( T * data, size_t s);
39  void setDataRaw( void * data, size_t s);
40 
41  void setSize(size_t s) override;
42 
43  void insert(T & item);
44 
45  void grow(size_t toSize);
46  void shrink();
47  };
48 
49  template <class T>
50  class fddStorage <T *> : public fddStorageCore<T *> {
51  private:
52  size_t * lineSizes;
53 
54  public:
55  fddStorage();
56  fddStorage(size_t s);
57  fddStorage(T ** data, size_t * lineSizes, size_t s);
58 
59  ~fddStorage();
60 
61  void setData( T ** data, size_t * lineSizes, size_t s);
62  void setDataRaw( void * data, size_t * lineSizes, size_t s);
63  void setSize(size_t s) override;
64 
65  void insert(T *& item, size_t s);
66 
67  size_t * getLineSizes();
68 
69  void grow(size_t toSize);
70  void shrink();
71  };
72 
73 }
74 
75 #endif
Definition: fddStorage.h:13
Definition: _workerFdd.h:14
Definition: _workerFdd.h:11
Definition: fddStorageBase.h:10