Skip to content

Commit

Permalink
Changed code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ihedvall committed Oct 2, 2024
1 parent 482bb14 commit e22e279
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions mdflib/src/channelobserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bool ChannelObserver<std::vector<uint8_t>>::GetSampleUnsigned(
const auto* channel_array = channel_.ChannelArray();
const auto array_size = channel_array != nullptr ? channel_array->NofArrayValues() : 1;
const auto sample_index = (sample * array_size) + array_index;
value = 0; // value_list is an byte array
value = 0; // value_list is a byte array
return sample_index < valid_list_.size() && valid_list_[sample_index];
}

Expand All @@ -34,7 +34,7 @@ bool ChannelObserver<std::vector<uint8_t>>::GetSampleSigned(
const auto* channel_array = channel_.ChannelArray();
const auto array_size = channel_array != nullptr ? channel_array->NofArrayValues() : 1;
const auto sample_index = (sample * array_size) + array_index;
value = 0; // value_list is an byte array
value = 0; // value_list is a byte array
return sample_index < valid_list_.size() && valid_list_[sample_index];
}

Expand All @@ -55,7 +55,7 @@ bool ChannelObserver<std::vector<uint8_t>>::GetSampleFloat(
const auto* channel_array = channel_.ChannelArray();
const auto array_size = channel_array != nullptr ? channel_array->NofArrayValues() : 1;
const auto sample_index = (sample * array_size) + array_index;
value = 0.0; // value_list is an byte array
value = 0.0; // value_list is a byte array
return sample_index < valid_list_.size() && valid_list_[sample_index];
}

Expand Down
2 changes: 1 addition & 1 deletion mdflib/src/channelobserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ template <>
bool ChannelObserver<std::vector<uint8_t>>::GetSampleText(
uint64_t sample, std::string& value, uint64_t array_index) const;

// Little bit dirty trick but it's the specialized function below that
// A little bit dirty trick, but it's the specialized function below that
// normally used.
template <class T>
bool ChannelObserver<T>::GetSampleByteArray(uint64_t sample,
Expand Down
1 change: 1 addition & 0 deletions mdflib/src/cn4block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ int64_t Cn4Block::DataLink() const { return Link(kIndexData); }

std::vector<int64_t> Cn4Block::AtLinkList() const {
std::vector<int64_t> link_list;
link_list.reserve(nof_attachments_);
for (uint16_t ii = 0; ii < nof_attachments_; ++ii) {
link_list.push_back(Link(kIndexAt + ii));
}
Expand Down
4 changes: 2 additions & 2 deletions mdflib/src/dgrange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ DgRange::DgRange(const IDataGroup& data_group, size_t min_sample,
const uint64_t record_id = channel_group->RecordId();
bool used = data_group_.IsSubscribingOnRecord(record_id);

// Check if the min_sample > number of samples. Then is no meaning
// to read this CG group. If the group a VSLD group, it doesn't have
// Check if the min_sample > number of samples, then it is no meaning
// to read this CG group. If the group is a VSLD group, it doesn't have
// any samples.
if ( (channel_group->Flags() & CgFlag::VlsdChannel) == 0 &&
min_sample_ > channel_group->NofSamples() ) {
Expand Down
2 changes: 1 addition & 1 deletion mdflib/src/dl4block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ size_t Dl4Block::Read(std::FILE *file) {
size_t Dl4Block::Write(std::FILE *file) {
const bool update = FilePosition() > 0;
if (update) {
// The DL block properties cannot be changed but it
// The DL block properties cannot be changed, but it
// is possible to append DL blocks
WriteBlockList(file, kIndexData);
return block_length_;
Expand Down
7 changes: 3 additions & 4 deletions mdflib/src/hd4block.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ class Hd4Block : public MdfBlock, public IHeader {
const override;
IDataGroup *CreateDataGroup() override;

bool UpdateDtBlocks(std::FILE *file);
bool UpdateCgAndVlsdBlocks(std::FILE *file, bool update_cg, bool update_vlsd);
bool UpdateVlsdBlocks(std::FILE *file);

bool UpdateDtBlocks(std::FILE* file);
bool UpdateCgAndVlsdBlocks(std::FILE* file, bool update_cg, bool update_vlsd);
bool UpdateVlsdBlocks(std::FILE* file);
private:
Mdf4Timestamp timestamp_;

Expand Down
2 changes: 1 addition & 1 deletion mdflib/src/ichannelobserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ std::string IChannelObserver::EngValueToString(uint64_t sample) const {

void IChannelObserver::ReadVlsdData(bool read_vlsd_data) {
read_vlsd_data_ = read_vlsd_data;
// Need to setup the record id subscription list.
// Need to set up the record id subscription list.
record_id_list_.clear();
record_id_list_.insert(channel_.RecordId());
if (channel_.VlsdRecordId() > 0 && read_vlsd_data_) {
Expand Down
2 changes: 1 addition & 1 deletion mdflibrary/src/MdfChannelObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ bool MdfChannelObserver::GetEngValueAsArray(size_t sample,
if (observer_ == nullptr ) {
return false;
}
// Note that engineering value cannot be byte arrays so I assume
// Note that engineering value cannot be byte arrays, so I assume
// that it was the channel value that was requested.
std::vector<uint8_t> temp;
const auto valid = observer_->GetChannelValue(sample, temp);
Expand Down
2 changes: 1 addition & 1 deletion mdflibrary/src/MdfExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ EXPORTFEATUREFUNC(bool, GetEngValueAsString, uint64_t sample, char* value,
EXPORTFEATUREFUNC(bool, GetEngValueAsArray, uint64_t sample, uint8_t value[],
size_t& size) {
// Ref `MdfChannelObserver::GetChannelValueAsArray`
// "Note that engineering value cannot be byte arrays so I assume"
// "Note that engineering value cannot be byte arrays, so I assume"
// "that it was the observer value that was requested."
return MdfChannelObserverGetChannelValueAsArray(observer, sample, value,
size);
Expand Down

0 comments on commit e22e279

Please sign in to comment.