cheshirekow  v0.1.0
PackedIndex.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3  *
4  * This file is part of mpblocks.
5  *
6  * mpblocks is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * mpblocks is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with mpblocks. If not, see <http://www.gnu.org/licenses/>.
18  */
27 #ifndef MPBLOCKS_DUBINS_CURVES_CUDA2_PACKEDINDEX_H_
28 #define MPBLOCKS_DUBINS_CURVES_CUDA2_PACKEDINDEX_H_
29 
30 #include <stdint.h>
31 
32 namespace mpblocks {
33 namespace dubins {
34 namespace curves_cuda {
35 
36 
37 
38 
39 
40 template <unsigned int BYTES>
41 struct PackedStorage{ typedef uint32_t Result; };
42 
43 template <> struct PackedStorage<1>{ typedef uint8_t Result; };
44 template <> struct PackedStorage<2>{ typedef uint16_t Result; };
45 template <> struct PackedStorage<4>{ typedef uint32_t Result; };
46 template <> struct PackedStorage<8>{ typedef uint64_t Result; };
47 
48 
51 template <typename Format_t>
53 {
54  public:
56 
57  private:
59 
60  public:
62  PackedIndex( Format_t bits );
63 
65  PackedIndex( SolutionId id = INVALID, Storage_t idx = 0 );
66 
68  SolutionId getId() const;
69 
71  Storage_t getIdx() const;
72 
74  void setId( SolutionId id );
75 
77  void setIdx( Storage_t idx );
78 
80  Format_t& getPun();
81 
83  void setPun( Format_t bits );
84 
87 
89  void setUnsigned( Storage_t bits );
90 };
91 
92 
93 
94 
95 } // curves
96 } // dubins
97 } // mpblocks
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 #endif // PACKEDINDEX_H_
__device__ __host__ Storage_t getIdx() const
Definition: PackedIndex.hpp:66
__device__ __host__ SolutionId getId() const
Definition: PackedIndex.hpp:53
__device__ __host__ Format_t & getPun()
Definition: PackedIndex.hpp:99
__device__ __host__ void setUnsigned(Storage_t bits)
PackedStorage< sizeof(Format_t) >::Result Storage_t
Definition: PackedIndex.h:55
__device__ __host__ void setIdx(Storage_t idx)
Definition: PackedIndex.hpp:89
__device__ __host__ PackedIndex(Format_t bits)
Definition: PackedIndex.hpp:46
Template meta function which defines internal typedef Result to be an unsigned integer of size BYTES...
Definition: PackedIndex.h:41
__device__ __host__ void setId(SolutionId id)
Definition: PackedIndex.hpp:80
__device__ __host__ Storage_t getUnsigned()
#define __device__
Definition: fakecuda.h:34
#define __host__
Definition: fakecuda.h:37
stores both the index of the entry and the solution id of it's best solver in a bitfield ...
Definition: PackedIndex.h:52
SolutionId
enumerates solution types
Definition: types.h:49
__device__ __host__ void setPun(Format_t bits)