OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
Pack_stat.hpp
1 /*
2  * Pack_stat.hpp
3  *
4  * Created on: Jul 17, 2015
5  * Author: i-bird
6  */
7 
8 #ifndef SRC_PACK_STAT_HPP_
9 #define SRC_PACK_STAT_HPP_
10 
16 {
17  size_t cnt;
18 
19 public:
20 
21  inline Unpack_stat()
22  :cnt(0)
23  {}
24 
30  inline void addOffset(size_t off)
31  {
32  cnt += off;
33  }
34 
39  inline size_t getOffset()
40  {
41  return cnt;
42  }
43 };
44 
49 class Pack_stat
50 {
51  size_t p_mark;
52  size_t un_ele;
53 
54 public:
55 
56  inline Pack_stat()
57  :p_mark(0),un_ele(0)
58  {}
59 
64  inline void incReq()
65  {
66  un_ele++;
67  }
68 
74  inline size_t reqPack()
75  {
76  return un_ele;
77  }
78 
84  inline void mark()
85  {
86  p_mark = un_ele;
87  }
88 
94  inline size_t getMark()
95  {
96  return p_mark;
97  }
98 
106  template<typename T> inline void * getMarkPointer(T & mem)
107  {
108  return mem.getPointer(p_mark);
109  }
110 
116  template<typename T> size_t getMarkSize(T & mem)
117  {
118  return (char *)mem.getPointer(un_ele) - (char *)mem.getPointer(p_mark);
119  }
120 
121 };
122 
123 #endif /* SRC_PACK_STAT_HPP_ */
size_t getOffset()
Return the actual counter.
Definition: Pack_stat.hpp:39
void mark()
Mark.
Definition: Pack_stat.hpp:84
size_t getMarkSize(T &mem)
Get the memory size from the mark point.
Definition: Pack_stat.hpp:116
void incReq()
Increment the request pointer.
Definition: Pack_stat.hpp:64
void addOffset(size_t off)
Increment the request pointer.
Definition: Pack_stat.hpp:30
Unpacking status object.
Definition: Pack_stat.hpp:15
size_t reqPack()
return the actual request for packing
Definition: Pack_stat.hpp:74
void * getMarkPointer(T &mem)
Return the memory pointer at the mark place.
Definition: Pack_stat.hpp:106
Packing status object.
Definition: Pack_stat.hpp:49
size_t getMark()
Return the mark.
Definition: Pack_stat.hpp:94