[ox/mc] Rename FieldPresenceMask to FieldPresenceIndicator

This commit is contained in:
Gary Talent 2019-03-07 23:00:59 -06:00
parent f218ec44af
commit e45122184e
5 changed files with 17 additions and 17 deletions

View File

@ -1,6 +1,6 @@
add_library( add_library(
OxMetalClaw OxMetalClaw
presencemask.cpp presenceindicator.cpp
read.cpp read.cpp
write.cpp write.cpp
) )
@ -22,7 +22,7 @@ install(
FILES FILES
err.hpp err.hpp
mc.hpp mc.hpp
presencemask.hpp presenceindicator.hpp
read.hpp read.hpp
types.hpp types.hpp
write.hpp write.hpp

View File

@ -8,16 +8,16 @@
#include <ox/std/byteswap.hpp> #include <ox/std/byteswap.hpp>
#include "err.hpp" #include "err.hpp"
#include "presencemask.hpp" #include "presenceindicator.hpp"
namespace ox { namespace ox {
FieldPresenseMask::FieldPresenseMask(uint8_t *mask, std::size_t maxLen) { FieldPresenceIndicator::FieldPresenceIndicator(uint8_t *mask, std::size_t maxLen) {
m_mask = mask; m_mask = mask;
m_maskLen = maxLen; m_maskLen = maxLen;
} }
bool FieldPresenseMask::get(int i) const { bool FieldPresenceIndicator::get(int i) const {
if (i / 8 < m_maskLen) { if (i / 8 < m_maskLen) {
return (m_mask[i / 8] >> (i % 8)) & 1; return (m_mask[i / 8] >> (i % 8)) & 1;
} else { } else {
@ -25,7 +25,7 @@ bool FieldPresenseMask::get(int i) const {
} }
} }
Error FieldPresenseMask::set(int i, bool on) { Error FieldPresenceIndicator::set(int i, bool on) {
if (i / 8 < m_maskLen) { if (i / 8 < m_maskLen) {
if (on) { if (on) {
m_mask[i / 8] |= 1 << (i % 8); m_mask[i / 8] |= 1 << (i % 8);

View File

@ -13,14 +13,14 @@
namespace ox { namespace ox {
class FieldPresenseMask { class FieldPresenceIndicator {
private: private:
uint8_t *m_mask = nullptr; uint8_t *m_mask = nullptr;
int m_maskLen = 0; int m_maskLen = 0;
int m_fields = 0; int m_fields = 0;
public: public:
FieldPresenseMask(uint8_t *mask, std::size_t maxLen); FieldPresenceIndicator(uint8_t *mask, std::size_t maxLen);
bool get(int i) const; bool get(int i) const;
@ -36,19 +36,19 @@ class FieldPresenseMask {
}; };
constexpr void FieldPresenseMask::setFields(int fields) noexcept { constexpr void FieldPresenceIndicator::setFields(int fields) noexcept {
m_fields = fields; m_fields = fields;
} }
constexpr int FieldPresenseMask::getFields() const noexcept { constexpr int FieldPresenceIndicator::getFields() const noexcept {
return m_fields; return m_fields;
} }
constexpr void FieldPresenseMask::setMaxLen(int maxLen) noexcept { constexpr void FieldPresenceIndicator::setMaxLen(int maxLen) noexcept {
m_maskLen = maxLen; m_maskLen = maxLen;
} }
constexpr int FieldPresenseMask::getMaxLen() const noexcept { constexpr int FieldPresenceIndicator::getMaxLen() const noexcept {
return m_maskLen; return m_maskLen;
} }

View File

@ -15,7 +15,7 @@
#include <ox/std/vector.hpp> #include <ox/std/vector.hpp>
#include "err.hpp" #include "err.hpp"
#include "presencemask.hpp" #include "presenceindicator.hpp"
#include "types.hpp" #include "types.hpp"
namespace ox { namespace ox {
@ -23,7 +23,7 @@ namespace ox {
class MetalClawReader { class MetalClawReader {
private: private:
FieldPresenseMask m_fieldPresence; FieldPresenceIndicator m_fieldPresence;
int m_fields = 0; int m_fields = 0;
int m_field = 0; int m_field = 0;
std::size_t m_buffIt = 0; std::size_t m_buffIt = 0;

View File

@ -12,11 +12,11 @@
#include <ox/ser/types.hpp> #include <ox/ser/types.hpp>
#include <ox/std/byteswap.hpp> #include <ox/std/byteswap.hpp>
#include <ox/std/string.hpp> #include <ox/std/string.hpp>
#include <ox/std/vector.hpp>
#include <ox/std/types.hpp> #include <ox/std/types.hpp>
#include <ox/std/vector.hpp>
#include "err.hpp" #include "err.hpp"
#include "presencemask.hpp" #include "presenceindicator.hpp"
#include "types.hpp" #include "types.hpp"
namespace ox { namespace ox {
@ -24,7 +24,7 @@ namespace ox {
class MetalClawWriter { class MetalClawWriter {
private: private:
FieldPresenseMask m_fieldPresence; FieldPresenceIndicator m_fieldPresence;
int m_fields = 0; int m_fields = 0;
int m_field = 0; int m_field = 0;
std::size_t m_buffIt = 0; std::size_t m_buffIt = 0;