MCPcopy Create free account
hub / github.com/PX4/eigen / CompressedStorage

Class CompressedStorage

Eigen/src/SparseCore/CompressedStorage.h:22–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 */
21template<typename _Scalar,typename _StorageIndex>
22class CompressedStorage
23{
24 public:
25
26 typedef _Scalar Scalar;
27 typedef _StorageIndex StorageIndex;
28
29 protected:
30
31 typedef typename NumTraits<Scalar>::Real RealScalar;
32
33 public:
34
35 CompressedStorage()
36 : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
37 {}
38
39 explicit CompressedStorage(Index size)
40 : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
41 {
42 resize(size);
43 }
44
45 CompressedStorage(const CompressedStorage& other)
46 : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
47 {
48 *this = other;
49 }
50
51 CompressedStorage& operator=(const CompressedStorage& other)
52 {
53 resize(other.size());
54 if(other.size()>0)
55 {
56 internal::smart_copy(other.m_values, other.m_values + m_size, m_values);
57 internal::smart_copy(other.m_indices, other.m_indices + m_size, m_indices);
58 }
59 return *this;
60 }
61
62 void swap(CompressedStorage& other)
63 {
64 std::swap(m_values, other.m_values);
65 std::swap(m_indices, other.m_indices);
66 std::swap(m_size, other.m_size);
67 std::swap(m_allocatedSize, other.m_allocatedSize);
68 }
69
70 ~CompressedStorage()
71 {
72 delete[] m_values;
73 delete[] m_indices;
74 }
75
76 void reserve(Index size)
77 {
78 Index newAllocatedSize = m_size + size;
79 if (newAllocatedSize > m_allocatedSize)

Callers

nothing calls this directly

Calls 6

smart_copyFunction · 0.85
smart_memmoveFunction · 0.85
ptrMethod · 0.80
resizeFunction · 0.70
swapFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected