• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

icsm-au / DynAdjust / 13494567994

24 Feb 2025 09:15AM UTC coverage: 81.168% (+2.0%) from 79.161%
13494567994

push

github

web-flow
Merge pull request #234 from icsm-au/1.2.8

Version 1.2.8 (fixes, ehnacements, improved datum management)

6131 of 8137 new or added lines in 90 files covered. (75.35%)

162 existing lines in 33 files now uncovered.

32214 of 39688 relevant lines covered (81.17%)

11775.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.24
/dynadjust/include/memory/dnafile_mapping.cpp
1
//============================================================================
2
// Name         : dnafile_mapping.cpp
3
// Author       : Roger Fraser
4
// Contributors :
5
// Version      : 1.00
6
// Copyright    : Copyright 2017 Geoscience Australia
7
//
8
//                Licensed under the Apache License, Version 2.0 (the "License");
9
//                you may not use this file except in compliance with the License.
10
//                You may obtain a copy of the License at
11
//               
12
//                http ://www.apache.org/licenses/LICENSE-2.0
13
//               
14
//                Unless required by applicable law or agreed to in writing, software
15
//                distributed under the License is distributed on an "AS IS" BASIS,
16
//                WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
//                See the License for the specific language governing permissions and
18
//                limitations under the License.
19
//
20
// Description  : DynAdjust Memory Mapped File Library
21
//============================================================================
22

23
#include <include/memory/dnafile_mapping.hpp>
24

25
namespace dynadjust { 
26
namespace memory {
27

28
//block_map_t::block_map_t()
29
//                : data_size_(0), region_offset_(0) 
30
//{
31
//
32
//}
33
        
34

35
block_map_t::block_map_t(const size_t& size)
178✔
36
                : data_size_(size), region_offset_(0) 
178✔
37
{
38

39
}
178✔
40
        
41

42
block_map_t::block_map_t(const block_map_t &p) 
178✔
43
                : data_size_(p.data_size_)
178✔
44
                , region_offset_(p.region_offset_)
178✔
45
                , region_ptr_(p.region_ptr_) 
178✔
46
{
47

48
}
178✔
49
        
50

51
//block_map_t& block_map_t::operator=(const block_map_t& rhs) 
52
//{
53
//        if (this == &rhs)
54
//                return *this;
55
//        data_size_ = rhs.data_size_;
56
//        region_offset_ = rhs.region_offset_;
57
//        region_ptr_ = rhs.region_ptr_;
58
//        return *this;
59
//}
60
        
61

62
//bool block_map_t::operator==(const block_map_t& rhs) const 
63
//{
64
//        return (
65
//                data_size_ == rhs.data_size_ &&
66
//                region_offset_ == rhs.region_offset_ &&
67
//                region_ptr_ == rhs.region_ptr_
68
//                );
69
//}
70
        
71

72
void block_map_t::MapRegion(FileMapPtr file_map_ptr) {
148✔
73
        region_ptr_.reset(
148✔
74
                new boost::interprocess::mapped_region(
75
                        *file_map_ptr, 
148✔
76
                        boost::interprocess::read_write, 
77
                        region_offset_, 
148✔
78
                        data_size_
79
                        )
148✔
80
                );
81
}
148✔
82

83

84
// class to hold addresses and sizes for all matrices 
85
// in a vector of segmented blocks
86
vmat_file_map::vmat_file_map()
375✔
87
{
88

89
}
375✔
90
        
91

NEW
92
vmat_file_map::vmat_file_map(const std::string& filePath, bool remove_mapped_file) 
×
93
        : filePath_(filePath), remove_mapped_file_(remove_mapped_file) 
×
94
{ 
NEW
95
                file_map_ptr_.reset(new boost::interprocess::file_mapping(filePath_.c_str(), boost::interprocess::read_write));
×
96
}
×
97
        
98

99
vmat_file_map::~vmat_file_map() 
375✔
100
{
101
        if (remove_mapped_file_)
375✔
102
                if (boost::filesystem::exists(filePath_))
98✔
103
                        boost::interprocess::file_mapping::remove(filePath_.c_str());
24✔
104
}
800✔
105
        
106

107
void vmat_file_map::reserveblockMapRegions(const UINT32& size)
92✔
108
{
109
        vblockMapRegions_.reserve(size); 
92✔
110
}
92✔
111
        
112

113
void vmat_file_map::addblockMapRegion(const block_map_t& map) 
178✔
114
{
115
        vblockMapRegions_.push_back(map); 
178✔
116
}
178✔
117

118

119
void vmat_file_map::setnewFilePath(const std::string& filePath, bool remove_mapped_file) 
92✔
120
{
121
        filePath_ = filePath; 
92✔
122
        remove_mapped_file_ = remove_mapped_file;
92✔
123
}
92✔
124
        
125

126
void vmat_file_map::CreateFileMapping() 
77✔
127
{
128
        file_map_ptr_.reset(new boost::interprocess::file_mapping(filePath_.c_str(), boost::interprocess::read_write));
77✔
129
}
76✔
130
        
131

132
void vmat_file_map::MapRegion(const UINT32 block) 
26✔
133
{
134
        vblockMapRegions_.at(block).MapRegion(file_map_ptr_);
26✔
135
}
26✔
136
        
137

138
}        // namespace memory 
139
}        // namespace dynadjust 
140

141

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc