The Road to Clang-Format part 3
Whitespace! Part Deux
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I2033813f12ab073bb57f4771e007126b0f8c7e26
diff --git a/src/chip_data/hei_chip_data_stream.hpp b/src/chip_data/hei_chip_data_stream.hpp
index 8b59fe9..e675420 100755
--- a/src/chip_data/hei_chip_data_stream.hpp
+++ b/src/chip_data/hei_chip_data_stream.hpp
@@ -38,7 +38,7 @@
/** iv_buffer points to the first address of the Chip Data File
buffer. **/
- const void * const iv_buffer;
+ const void* const iv_buffer;
/** iv_bufferSize is the size of the data buffer. It is
initialized when the ChipDataStream class is instantiated. **/
const size_t iv_bufferSize;
@@ -55,13 +55,13 @@
data buffer containing all the data and its size is passed
into the class.
**/
- ChipDataStream(void * i_buffer, size_t i_bufferSize) :
+ ChipDataStream(void* i_buffer, size_t i_bufferSize) :
iv_asyncOffset(0), iv_buffer(i_buffer), iv_bufferSize(i_bufferSize)
{}
/** Eliminate copy and assignment operator constructors **/
- ChipDataStream(const ChipDataStream &) = delete;
- ChipDataStream & operator=(const ChipDataStream &) = delete;
+ ChipDataStream(const ChipDataStream&) = delete;
+ ChipDataStream& operator=(const ChipDataStream&) = delete;
/** Destructor **/
@@ -76,7 +76,7 @@
*@return *this: A pointer to "this" object
**/
template <class D>
- ChipDataStream & operator>>(D & o_right)
+ ChipDataStream& operator>>(D& o_right)
{
read(&o_right, sizeof(D));
return *this;
@@ -90,12 +90,12 @@
*@param i_size the size (in bytes) to copy
*@return None\n\n
**/
- void read(void * o_buf, size_t i_size)
+ void read(void* o_buf, size_t i_size)
{
/* Ensure memory is not accessed outside i_buffer */
HEI_ASSERT((iv_asyncOffset + i_size) <= iv_bufferSize);
/* Copy appropriate bytes from i_buffer to o_buff */
- memcpy(o_buf, (char *)iv_buffer + iv_asyncOffset, i_size);
+ memcpy(o_buf, (char*)iv_buffer + iv_asyncOffset, i_size);
/* Increment asynchronous offset to next piece of data */
iv_asyncOffset = iv_asyncOffset + i_size;
}
@@ -112,7 +112,7 @@
* @return *this: A pointer to "this" object
**/
template <> inline
-ChipDataStream & ChipDataStream::operator>>(uint16_t & o_right)
+ChipDataStream& ChipDataStream::operator>>(uint16_t& o_right)
{
read(&o_right, sizeof(o_right));
be16toh(o_right);
@@ -124,7 +124,7 @@
* @return *this: A pointer to "this" object
**/
template <> inline
-ChipDataStream & ChipDataStream::operator>>(int16_t & o_right)
+ChipDataStream& ChipDataStream::operator>>(int16_t& o_right)
{
read(&o_right, sizeof(o_right));
be16toh(o_right);
@@ -136,7 +136,7 @@
* @return *this: A pointer to "this" object
**/
template <> inline
-ChipDataStream & ChipDataStream::operator>>(uint32_t & o_right)
+ChipDataStream& ChipDataStream::operator>>(uint32_t& o_right)
{
read(&o_right, sizeof(o_right));
be32toh(o_right);
@@ -148,7 +148,7 @@
* @return *this: A pointer to "this" object
**/
template <> inline
-ChipDataStream & ChipDataStream::operator>>(int32_t & o_right)
+ChipDataStream& ChipDataStream::operator>>(int32_t& o_right)
{
read(&o_right, sizeof(o_right));
be32toh(o_right);
@@ -160,7 +160,7 @@
* @return *this: A pointer to "this" object
**/
template <> inline
-ChipDataStream & ChipDataStream::operator>>(uint64_t & o_right)
+ChipDataStream& ChipDataStream::operator>>(uint64_t& o_right)
{
read(&o_right, sizeof(o_right));
be64toh(o_right);
@@ -172,7 +172,7 @@
* @return *this: A pointer to "this" object
**/
template <> inline
-ChipDataStream & ChipDataStream::operator>>(int64_t & o_right)
+ChipDataStream& ChipDataStream::operator>>(int64_t& o_right)
{
read(&o_right, sizeof(o_right));
be64toh(o_right);
diff --git a/src/hei_chip.hpp b/src/hei_chip.hpp
index 216a4cc..83ef663 100644
--- a/src/hei_chip.hpp
+++ b/src/hei_chip.hpp
@@ -17,34 +17,34 @@
~Chip() = default;
- Chip(const Chip &) = default;
+ Chip(const Chip&) = default;
- Chip & operator=(const Chip &) = default;
+ Chip& operator=(const Chip&) = default;
/**
* @brief Constructor.
* @param i_chip See description for iv_chip.
* @param i_type See description for iv_type.
*/
- Chip(void * i_chip, ChipType_t i_type) :
+ Chip(void* i_chip, ChipType_t i_type) :
iv_chip(i_chip), iv_type(i_type)
{}
public: // Accessors
- void * getChip() const { return iv_chip; }
+ void* getChip() const { return iv_chip; }
ChipType_t getType() const { return iv_type; }
public: // Operators
- bool operator==(const Chip & r) const
+ bool operator==(const Chip& r) const
{
return (iv_chip == r.iv_chip) &&
(iv_type == r.iv_type);
}
- bool operator<(const Chip & r) const
+ bool operator<(const Chip& r) const
{
return (iv_chip < r.iv_chip) ||
((iv_chip == r.iv_chip) && (iv_type < r.iv_type));
@@ -59,7 +59,7 @@
* purpose is to eventually get passed back to the user application with
* information associated with each chip.
*/
- void * iv_chip = nullptr;
+ void* iv_chip = nullptr;
/**
* When doing analysis on a chip, the isolator will need to know the chip
diff --git a/src/hei_isolation_data.hpp b/src/hei_isolation_data.hpp
index f0c89c8..317329f 100644
--- a/src/hei_isolation_data.hpp
+++ b/src/hei_isolation_data.hpp
@@ -23,10 +23,10 @@
~IsolationData() = default;
/** @brief Copy constructor. */
- IsolationData(const IsolationData &) = default;
+ IsolationData(const IsolationData&) = default;
/** @brief Assignment operator. */
- IsolationData & operator=(const IsolationData &) = default;
+ IsolationData& operator=(const IsolationData&) = default;
private: // Instance variables
@@ -41,13 +41,13 @@
* @brief Adds a signature to the signature list.
* @param i_signature The target signature.
*/
- void addSignature(const Signature & i_signature)
+ void addSignature(const Signature& i_signature)
{
iv_sigLists.push_back(i_signature);
}
/** @brief Allows access to the signature list. */
- const std::vector<Signature> & getSignatureList()
+ const std::vector<Signature>& getSignatureList()
{
return iv_sigLists;
}
diff --git a/src/hei_main.hpp b/src/hei_main.hpp
index 5cc10bd..e812bef 100644
--- a/src/hei_main.hpp
+++ b/src/hei_main.hpp
@@ -63,7 +63,7 @@
*
* @return RC_SUCCESS or RC_CHIP_DATA_INVALID or RC_CHIP_DATA_INITIALIZED
*/
-inline ReturnCode initialize(void * i_buffer, size_t i_bufferSize,
+inline ReturnCode initialize(void* i_buffer, size_t i_bufferSize,
bool i_forceInit = false)
{
return Isolator::getSingleton().initialize(i_buffer, i_bufferSize,
@@ -97,8 +97,8 @@
*
* @return RC_SUCCESS or RC_CHIP_DATA_MISSING
*/
-inline ReturnCode isolate(const std::vector<Chip> & i_chipList,
- IsolationData & o_isoData)
+inline ReturnCode isolate(const std::vector<Chip>& i_chipList,
+ IsolationData& o_isoData)
{
return Isolator::getSingleton().isolate(i_chipList, o_isoData);
}
diff --git a/src/hei_return_code.hpp b/src/hei_return_code.hpp
index c9ebc8a..0475bc7 100644
--- a/src/hei_return_code.hpp
+++ b/src/hei_return_code.hpp
@@ -18,10 +18,10 @@
{}
/** @brief Default copy constructor. */
- ReturnCode(const ReturnCode &) = default;
+ ReturnCode(const ReturnCode&) = default;
/** @brief Default assignment operator. */
- ReturnCode& operator=(const ReturnCode &) = default;
+ ReturnCode& operator=(const ReturnCode&) = default;
/** @brief Default destructor. */
~ReturnCode() = default;
@@ -33,13 +33,13 @@
operator uint64_t() const { return iv_rc; }
/** @brief Equals operator. */
- bool operator==(const ReturnCode & rhs) const
+ bool operator==(const ReturnCode& rhs) const
{
return rhs.iv_rc == iv_rc;
}
/** @brief Not equals operator. */
- bool operator!=(const ReturnCode & rhs) const
+ bool operator!=(const ReturnCode& rhs) const
{
return rhs.iv_rc != iv_rc;
}
diff --git a/src/hei_user_interface.hpp b/src/hei_user_interface.hpp
index 81b1473..6fb887c 100644
--- a/src/hei_user_interface.hpp
+++ b/src/hei_user_interface.hpp
@@ -44,7 +44,7 @@
* failure the user application is responsible for reporting why the
* register access failed.
*/
-ReturnCode registerRead(void * i_chip, void * o_buffer, size_t & io_bufSize,
+ReturnCode registerRead(void* i_chip, void* o_buffer, size_t& io_bufSize,
uint64_t i_regType, uint64_t i_address);
#ifndef __HEI_READ_ONLY
@@ -80,7 +80,7 @@
* failure the user application is responsible for reporting why the
* register access failed.
*/
-ReturnCode registerWrite(void * i_chip, void * i_buffer, size_t & io_bufSize,
+ReturnCode registerWrite(void* i_chip, void* i_buffer, size_t& io_bufSize,
uint64_t i_regType, uint64_t i_address);
#endif
diff --git a/src/isolator/hei_isolation_node.cpp b/src/isolator/hei_isolation_node.cpp
index b30a678..398960f 100644
--- a/src/isolator/hei_isolation_node.cpp
+++ b/src/isolator/hei_isolation_node.cpp
@@ -5,8 +5,8 @@
//------------------------------------------------------------------------------
-bool IsolationNode::analyze(const Chip & i_chip, AttentionType_t i_attnType,
- IsolationData & io_isoData) const
+bool IsolationNode::analyze(const Chip& i_chip, AttentionType_t i_attnType,
+ IsolationData& io_isoData) const
{
bool o_activeAttn = false; // Initially, assume no active attentions.
@@ -18,7 +18,7 @@
HEI_ASSERT(iv_rules.end() != rule_itr);
// Get the returned BitString for this rule.
- const BitString * bs = rule_itr->second->getBitString(i_chip);
+ const BitString* bs = rule_itr->second->getBitString(i_chip);
// Ensure this BitString is not longer than the maximum bit field.
HEI_ASSERT(bs->getBitLen() <= sizeof(RegisterBit_t) * 8);
@@ -76,7 +76,7 @@
//------------------------------------------------------------------------------
-void IsolationNode::addRule(AttentionType_t i_attnType, const Register * i_rule)
+void IsolationNode::addRule(AttentionType_t i_attnType, const Register* i_rule)
{
// A rule for this attention type should not already exist.
HEI_ASSERT(iv_rules.end() == iv_rules.find(i_attnType));
@@ -90,7 +90,7 @@
//------------------------------------------------------------------------------
-void IsolationNode::addChild(uint8_t i_bit, const IsolationNode * i_child)
+void IsolationNode::addChild(uint8_t i_bit, const IsolationNode* i_child)
{
// An entry for this bit should not already exist.
HEI_ASSERT(iv_children.end() == iv_children.find(i_bit));
@@ -104,7 +104,7 @@
//------------------------------------------------------------------------------
-std::vector<const IsolationNode *> IsolationNode::cv_isolationStack {};
+std::vector<const IsolationNode*> IsolationNode::cv_isolationStack {};
//------------------------------------------------------------------------------
diff --git a/src/isolator/hei_isolation_node.hpp b/src/isolator/hei_isolation_node.hpp
index e2ab485..68e2389 100644
--- a/src/isolator/hei_isolation_node.hpp
+++ b/src/isolator/hei_isolation_node.hpp
@@ -42,7 +42,7 @@
* @param i_hwReg A reference to the HardwareRegister targeted for
* isolation.
*/
- explicit IsolationNode(const HardwareRegister & i_hwReg) :
+ explicit IsolationNode(const HardwareRegister& i_hwReg) :
iv_hwReg(i_hwReg)
{}
@@ -60,7 +60,7 @@
*
* Needed by Flyweight class, but should not be allowed in general.
*/
- IsolationNode(const IsolationNode &) = default;
+ IsolationNode(const IsolationNode&) = default;
/**
* @brief Explicitly disables assignment operator.
@@ -69,7 +69,7 @@
* of the constant instance variables, but helps communicate it is not
* allowed.
*/
- IsolationNode & operator=(const IsolationNode &) = delete;
+ IsolationNode& operator=(const IsolationNode&) = delete;
private: // Instance variables
@@ -78,7 +78,7 @@
* this instance of the class. The reference is required to maintain
* polymorphism.
*/
- const HardwareRegister & iv_hwReg;
+ const HardwareRegister& iv_hwReg;
/**
* This register could report multiple types of attentions. We can use a
@@ -87,13 +87,13 @@
* HardwareRegister objects and virtual operator registers (all children
* of the Register class).
*/
- std::map<AttentionType_t, const Register *> iv_rules;
+ std::map<AttentionType_t, const Register*> iv_rules;
/**
* Each bit (key) in this map indicates that an attention was driven from
* another register (value).
*/
- std::map<RegisterBit_t, const IsolationNode *> iv_children;
+ std::map<RegisterBit_t, const IsolationNode*> iv_children;
public: // Member functions
@@ -111,8 +111,8 @@
* @return True, if any active attentions found on this register.
* False, otherwise.
*/
- bool analyze(const Chip & i_chip, AttentionType_t i_attnType,
- IsolationData & io_isoData) const;
+ bool analyze(const Chip& i_chip, AttentionType_t i_attnType,
+ IsolationData& io_isoData) const;
// TODO: The next two functions are only intended to be used during
// initialization of the isolator. Consider, making them private and
@@ -129,7 +129,7 @@
* @param The target attention type.
* @param The rule for this attention type.
*/
- void addRule(AttentionType_t i_attnType, const Register * i_rule);
+ void addRule(AttentionType_t i_attnType, const Register* i_rule);
/**
* @brief Adds a child register to analyze for the given bit in this
@@ -141,19 +141,19 @@
* @param The target bit on this register.
* @param The child register to analyze for the given bit.
*/
- void addChild(RegisterBit_t i_bit, const IsolationNode * i_child);
+ void addChild(RegisterBit_t i_bit, const IsolationNode* i_child);
public: // Operators
/** @brief Equals operator. */
- bool operator==(const IsolationNode & i_r) const
+ bool operator==(const IsolationNode& i_r) const
{
// iv_hwReg should be unique per IsolationNode.
return (iv_hwReg == i_r.iv_hwReg);
}
/** @brief Less than operator. */
- bool operator<(const IsolationNode & i_r) const
+ bool operator<(const IsolationNode& i_r) const
{
// iv_hwReg should be unique per IsolationNode.
return (iv_hwReg < i_r.iv_hwReg);
@@ -173,7 +173,7 @@
* this node can be popped off the top of the stack. Once all the recursive
* calls have returned back to the root node the stack should be empty.
*/
- static std::vector<const IsolationNode *> cv_isolationStack;
+ static std::vector<const IsolationNode*> cv_isolationStack;
/**
* @brief Pushes this node to the top of the stack. Will assert that this
diff --git a/src/isolator/hei_isolator.cpp b/src/isolator/hei_isolator.cpp
index 75dfb96..d3cb5f2 100644
--- a/src/isolator/hei_isolator.cpp
+++ b/src/isolator/hei_isolator.cpp
@@ -11,7 +11,7 @@
namespace libhei
{
-ReturnCode Isolator::initialize(void * i_buffer, size_t i_bufferSize,
+ReturnCode Isolator::initialize(void* i_buffer, size_t i_bufferSize,
bool i_forceInit)
{
ReturnCode rc;
@@ -20,8 +20,8 @@
HEI_INF("Isolator::initialize(%p,%lu,%d)", i_buffer, i_bufferSize,
i_forceInit);
- Flyweight<ScomRegister> & sfw = Flyweight<ScomRegister>::getSingleton();
- Flyweight<IdScomRegister> & ifw = Flyweight<IdScomRegister>::getSingleton();
+ Flyweight<ScomRegister>& sfw = Flyweight<ScomRegister>::getSingleton();
+ Flyweight<IdScomRegister>& ifw = Flyweight<IdScomRegister>::getSingleton();
sfw.get(ScomRegister { CHIP_TYPE_INVALID, REG_ID_INVALID,
REG_INST_DEFAULT, REG_ACCESS_RW, 0x01234567 });
@@ -54,8 +54,8 @@
Flyweight<IdScomRegister>::getSingleton().clear();
}
-ReturnCode Isolator::isolate(const std::vector<Chip> & i_chipList,
- IsolationData & o_isoData) const
+ReturnCode Isolator::isolate(const std::vector<Chip>& i_chipList,
+ IsolationData& o_isoData) const
{
ReturnCode rc;
@@ -66,7 +66,7 @@
HardwareRegister::flushAll();
// Analyze active error on each chip.
- for (auto const & chip : i_chipList)
+ for (const auto& chip : i_chipList)
{
// BEGIN temporary code
HEI_INF("Isolator::isolate(%p,%u)", chip.getChip(), chip.getType());
diff --git a/src/isolator/hei_isolator.hpp b/src/isolator/hei_isolator.hpp
index 3c4a589..e832514 100644
--- a/src/isolator/hei_isolator.hpp
+++ b/src/isolator/hei_isolator.hpp
@@ -41,22 +41,22 @@
}
/** @brief Copy constructor. */
- Isolator(const Isolator &) = delete;
+ Isolator(const Isolator&) = delete;
/** @brief Assignment operator. */
- Isolator & operator=(const Isolator &) = delete;
+ Isolator& operator=(const Isolator&) = delete;
public:
/** @brief Provides access to a singleton instance of this object. */
- static Isolator & getSingleton()
+ static Isolator& getSingleton()
{
static Isolator theIsolator;
return theIsolator;
}
/** @brief See API wrapper description in hei_main.hpp. */
- ReturnCode initialize(void * i_buffer, size_t i_bufferSize,
+ ReturnCode initialize(void* i_buffer, size_t i_bufferSize,
bool i_forceInit = false);
/**
@@ -68,8 +68,8 @@
void uninitialize();
/** @brief See API wrapper description in hei_main.hpp. */
- ReturnCode isolate(const std::vector<Chip> & i_chipList,
- IsolationData & o_isoData) const;
+ ReturnCode isolate(const std::vector<Chip>& i_chipList,
+ IsolationData& o_isoData) const;
private:
diff --git a/src/isolator/hei_signature.hpp b/src/isolator/hei_signature.hpp
index 4be04b3..79d4ed3 100644
--- a/src/isolator/hei_signature.hpp
+++ b/src/isolator/hei_signature.hpp
@@ -25,7 +25,7 @@
* @param i_bit The target bit within this register.
* @param i_attnType The attention type reported by this bit.
*/
- Signature(const Chip & i_chip, RegisterId_t i_id,
+ Signature(const Chip& i_chip, RegisterId_t i_id,
RegisterInstance_t i_instance, RegisterBit_t i_bit,
AttentionType_t i_attnType) :
iv_chip(i_chip), iv_id(i_id), iv_instance(i_instance),
@@ -36,10 +36,10 @@
~Signature() = default;
/** @brief Copy constructor. */
- Signature(const Signature &) = default;
+ Signature(const Signature&) = default;
/** @brief Assignment operator. */
- Signature & operator=(const Signature &) = default;
+ Signature& operator=(const Signature&) = default;
private: // Instance variables.
@@ -52,7 +52,7 @@
public: // Member functions
/** @return The chip containing this register. */
- const Chip & getChip() const { return iv_chip; }
+ const Chip& getChip() const { return iv_chip; }
/** @return The register ID. */
RegisterId_t getId() const { return iv_id; }
diff --git a/src/register/hei_hardware_register.cpp b/src/register/hei_hardware_register.cpp
index 52dc28c..2337e4e 100755
--- a/src/register/hei_hardware_register.cpp
+++ b/src/register/hei_hardware_register.cpp
@@ -15,14 +15,14 @@
#if 0
void HardwareRegister::setBitString(const BitString *bs)
{
- BitString & l_string = accessBitString();
+ BitString& l_string = accessBitString();
l_string.setString(*bs);
}
#endif
//------------------------------------------------------------------------------
-const BitString * HardwareRegister::getBitString(const Chip & i_chip) const
+const BitString* HardwareRegister::getBitString(const Chip& i_chip) const
{
// Verify this register belongs on i_chip.
verifyAccessorChip(i_chip);
@@ -44,7 +44,7 @@
//------------------------------------------------------------------------------
-BitString & HardwareRegister::accessBitString(const Chip & i_chip)
+BitString& HardwareRegister::accessBitString(const Chip& i_chip)
{
// Verify this register belongs on i_chip.
verifyAccessorChip(i_chip);
@@ -66,7 +66,7 @@
//------------------------------------------------------------------------------
-ReturnCode HardwareRegister::read(const Chip & i_chip, bool i_force) const
+ReturnCode HardwareRegister::read(const Chip& i_chip, bool i_force) const
{
ReturnCode rc;
@@ -82,7 +82,7 @@
(REG_ACCESS_WO != getAccessLevel()));
// Get the buffer from the register cache.
- BitString & bs = accessCache(i_chip);
+ BitString& bs = accessCache(i_chip);
// Get the byte size of the buffer.
size_t sz_buffer = BitString::getMinBytes(bs.getBitLen());
@@ -111,7 +111,7 @@
#ifndef __HEI_READ_ONLY
-ReturnCode HardwareRegister::write(const Chip & i_chip) const
+ReturnCode HardwareRegister::write(const Chip& i_chip) const
{
ReturnCode rc;
@@ -126,7 +126,7 @@
HEI_ASSERT(queryCache(i_chip));
// Get the buffer from the register cache.
- BitString & bs = accessCache(i_chip);
+ BitString& bs = accessCache(i_chip);
// Get the byte size of the buffer.
size_t sz_buffer = BitString::getMinBytes(bs.getBitLen());
@@ -153,14 +153,14 @@
//------------------------------------------------------------------------------
-bool HardwareRegister::Cache::query(const Chip & i_chip,
- const HardwareRegister * i_hwReg) const
+bool HardwareRegister::Cache::query(const Chip& i_chip,
+ const HardwareRegister* i_hwReg) const
{
// Does i_chip exist in the cache?
auto chipPairItr = iv_cache.find(i_chip);
if (iv_cache.end() != chipPairItr)
{
- auto & hwRegMap = chipPairItr->second; // for ease of use
+ auto& hwRegMap = chipPairItr->second; // for ease of use
// Does i_hwReg exist in the cache?
auto hwRegPairItr = hwRegMap.find(i_hwReg);
@@ -175,13 +175,13 @@
//------------------------------------------------------------------------------
-BitString & HardwareRegister::Cache::access(const Chip & i_chip,
+BitString& HardwareRegister::Cache::access(const Chip& i_chip,
const HardwareRegister * i_hwReg)
{
// If the entry does not exist, create a new entry.
if (!query(i_chip, i_hwReg))
{
- BitString * bs = new BitStringBuffer { i_hwReg->getSize() * 8 };
+ BitString* bs = new BitStringBuffer { i_hwReg->getSize() * 8 };
iv_cache[i_chip][i_hwReg] = bs;
}
@@ -194,9 +194,9 @@
void HardwareRegister::Cache::flush()
{
// Delete all of the BitStrings.
- for (auto & chipPair : iv_cache)
+ for (auto& chipPair : iv_cache)
{
- for (auto & hwRegPair : chipPair.second)
+ for (auto& hwRegPair : chipPair.second)
{
delete hwRegPair.second;
}
@@ -211,14 +211,14 @@
//------------------------------------------------------------------------------
-void HardwareRegister::Cache::flush(const Chip & i_chip,
- const HardwareRegister * i_hwReg)
+void HardwareRegister::Cache::flush(const Chip& i_chip,
+ const HardwareRegister* i_hwReg)
{
// Does i_chip exist in the cache?
auto chipPairItr = iv_cache.find(i_chip);
if (iv_cache.end() != chipPairItr)
{
- auto & hwRegMap = chipPairItr->second; // for ease of use
+ auto& hwRegMap = chipPairItr->second; // for ease of use
// Does i_hwReg exist in the cache?
auto hwRegPairItr = hwRegMap.find(i_hwReg);
diff --git a/src/register/hei_hardware_register.hpp b/src/register/hei_hardware_register.hpp
index ab1c66e..059a9cf 100755
--- a/src/register/hei_hardware_register.hpp
+++ b/src/register/hei_hardware_register.hpp
@@ -102,7 +102,7 @@
public: // Operators
/** @brief Equals operator. */
- bool operator==(const HardwareRegister & i_r) const
+ bool operator==(const HardwareRegister& i_r) const
{
// Comparing register type, chip type, and address should be sufficient.
return (getRegisterType() == i_r.getRegisterType()) &&
@@ -111,7 +111,7 @@
}
/** @brief Less than operator. */
- bool operator<(const HardwareRegister & i_r) const
+ bool operator<(const HardwareRegister& i_r) const
{
// Comparing register type, chip type, and address should be sufficient.
if (getRegisterType() < i_r.getRegisterType())
@@ -136,7 +136,7 @@
public:
/** Function overloaded from parent Register class. */
- const BitString * getBitString(const Chip & i_chip) const;
+ const BitString* getBitString(const Chip& i_chip) const;
#if 0
/**
@@ -157,7 +157,7 @@
* read from hardware and update the cache.
* @return See the return code from the registerRead() user interface API.
*/
- ReturnCode read(const Chip & i_chip, bool i_force = false) const;
+ ReturnCode read(const Chip& i_chip, bool i_force = false) const;
#ifndef __HEI_READ_ONLY
@@ -167,7 +167,7 @@
* @param i_chip The target chip in which this register belongs.
* @return See the return code from the registerWrite() user interface API.
*/
- ReturnCode write(const Chip & i_chip) const;
+ ReturnCode write(const Chip& i_chip) const;
#endif // __HEI_READ_ONLY
@@ -182,12 +182,12 @@
* @param i_chip The target chip in which this register belongs.
* @return A reference to the BitString.
*/
- BitString & accessBitString(const Chip & i_chip);
+ BitString& accessBitString(const Chip& i_chip);
private: // Hardware accessor management functions.
/** @brief Asserts this register belongs on the target accessor chip. */
- void verifyAccessorChip(const Chip & i_chip) const
+ void verifyAccessorChip(const Chip& i_chip) const
{
HEI_ASSERT(getChipType() == i_chip.getType());
}
@@ -212,10 +212,10 @@
~Cache() = default;
/** @brief Copy constructor. */
- Cache(const Cache &) = delete;
+ Cache(const Cache&) = delete;
/** @brief Assignment operator. */
- Cache & operator=(const Cache &) = delete;
+ Cache& operator=(const Cache&) = delete;
/**
* @brief Queries if a specific entry exists in the cache.
@@ -223,8 +223,8 @@
* @param i_hwReg The target register.
* @return True if the entry exists, false otherwise.
*/
- bool query(const Chip & i_chip,
- const HardwareRegister * i_hwReg) const;
+ bool query(const Chip& i_chip,
+ const HardwareRegister* i_hwReg) const;
/**
* @brief Returns the data buffer for the given chip and register.
@@ -234,8 +234,8 @@
* @note If an entry does not exist in the cache, an entry will be
* created and the BitString will be initialized to 0.
*/
- BitString & access(const Chip & i_chip,
- const HardwareRegister * i_hwReg);
+ BitString& access(const Chip& i_chip,
+ const HardwareRegister* i_hwReg);
/** @brief Flushes entire contents from cache. */
void flush();
@@ -245,7 +245,7 @@
* @param i_chip The target chip.
* @param i_hwReg The target register.
*/
- void flush(const Chip & i_chip, const HardwareRegister * i_hwReg);
+ void flush(const Chip& i_chip, const HardwareRegister* i_hwReg);
private:
@@ -279,7 +279,7 @@
* @brief Flushes this register from the cache.
* @param i_chip The target chip in which this register belongs.
*/
- void flush(const Chip & i_chip) const
+ void flush(const Chip& i_chip) const
{
cv_cache.flush(i_chip, this);
}
@@ -290,7 +290,7 @@
* @param i_chip The target chip in which this register belongs.
* @return True if an entry for this register exist in this cache.
*/
- bool queryCache(const Chip & i_chip) const
+ bool queryCache(const Chip& i_chip) const
{
return cv_cache.query(i_chip, this);
}
@@ -299,7 +299,7 @@
* @param i_chip The target chip in which this register belongs.
* @return A reference to this register's BitString in cache.
*/
- BitString & accessCache(const Chip & i_chip) const
+ BitString& accessCache(const Chip& i_chip) const
{
return cv_cache.access(i_chip, this);
}
diff --git a/src/register/hei_register.hpp b/src/register/hei_register.hpp
index 4514c28..4b5c5fe 100755
--- a/src/register/hei_register.hpp
+++ b/src/register/hei_register.hpp
@@ -37,7 +37,7 @@
* @param i_chip Indicates which chip to access for this register.
* @return A BitString containing the value of this register.
*/
- virtual const BitString * getBitString(const Chip & i_chip) const = 0;
+ virtual const BitString* getBitString(const Chip& i_chip) const = 0;
};
// Pure virtual destructor must be defined.
diff --git a/src/register/hei_scom_register.hpp b/src/register/hei_scom_register.hpp
index c90d5be..d056475 100644
--- a/src/register/hei_scom_register.hpp
+++ b/src/register/hei_scom_register.hpp
@@ -46,7 +46,7 @@
*
* Needed by Flyweight class, but should not be allowed in general.
*/
- ScomRegister(const ScomRegister &) = default;
+ ScomRegister(const ScomRegister&) = default;
/**
* @brief Explicitly disables assignment operator.
@@ -55,7 +55,7 @@
* of the constant instance variables, but helps communicate it is not
* allowed.
*/
- ScomRegister & operator=(const ScomRegister &) = delete;
+ ScomRegister& operator=(const ScomRegister&) = delete;
public: // Accessor functions
@@ -125,7 +125,7 @@
*
* Needed by Flyweight class, but should not be allowed in general.
*/
- IdScomRegister(const IdScomRegister &) = default;
+ IdScomRegister(const IdScomRegister&) = default;
/**
* @brief Explicitly disables assignment operator.
@@ -134,7 +134,7 @@
* of the constant instance variables, but helps communicate it is not
* allowed.
*/
- IdScomRegister & operator=(const IdScomRegister &) = delete;
+ IdScomRegister& operator=(const IdScomRegister&) = delete;
public: // Accessor functions
diff --git a/src/util/hei_bit_string.cpp b/src/util/hei_bit_string.cpp
index 24de34e..b863829 100755
--- a/src/util/hei_bit_string.cpp
+++ b/src/util/hei_bit_string.cpp
@@ -31,7 +31,7 @@
// Get the relative address of this byte and the relative starting position
// within the byte.
uint64_t relPos = 0;
- uint8_t * relAddr = getRelativePosition(relPos, i_pos);
+ uint8_t* relAddr = getRelativePosition(relPos, i_pos);
// Get the length of the target bit field within this byte and the length of
// the bit field for any remaining bits.
@@ -75,7 +75,7 @@
// Get the relative address of this byte and the relative starting position
// within the byte.
uint64_t relPos = 0;
- uint8_t * relAddr = getRelativePosition(relPos, i_pos);
+ uint8_t* relAddr = getRelativePosition(relPos, i_pos);
// Get the length of the target bit field within this byte and the length of
// the bit field for any remaining bits.
@@ -132,7 +132,7 @@
// could be used in the constructor of BitStringBuffer, which could causes
// an infinite loop.
uint8_t a[sizeof(i_pattern)] = {};
- BitString bs { sizeof(i_pattern)*8, a };
+ BitString bs { sizeof(i_pattern) * 8, a };
bs.setFieldRight(0, i_pLen, i_pattern);
// Iterate the range in chunks the size of i_pLen.
@@ -152,7 +152,7 @@
//------------------------------------------------------------------------------
-void BitString::setString(const BitString & i_sStr, uint64_t i_sPos,
+void BitString::setString(const BitString& i_sStr, uint64_t i_sPos,
uint64_t i_sLen, uint64_t i_dPos)
{
// Ensure the source parameters are valid.
@@ -171,8 +171,8 @@
// The bit strings may be in overlapping memory spaces. So we need to copy
// the data in the correct direction to prevent overlapping.
uint64_t sRelOffset = 0, dRelOffset = 0;
- uint8_t * sRelAddr = i_sStr.getRelativePosition(sRelOffset, i_sPos);
- uint8_t * dRelAddr = getRelativePosition(dRelOffset, i_dPos);
+ uint8_t* sRelAddr = i_sStr.getRelativePosition(sRelOffset, i_sPos);
+ uint8_t* dRelAddr = getRelativePosition(dRelOffset, i_dPos);
// Copy the data.
if ((dRelAddr == sRelAddr) && (dRelOffset == sRelOffset))
@@ -208,7 +208,7 @@
//------------------------------------------------------------------------------
-void BitString::maskString(const BitString & i_mask)
+void BitString::maskString(const BitString& i_mask)
{
// Get the length of the smallest string.
uint64_t actLen = std::min(getBitLen(), i_mask.getBitLen());
@@ -226,7 +226,7 @@
//------------------------------------------------------------------------------
-bool BitString::isEqual(const BitString & i_str) const
+bool BitString::isEqual(const BitString& i_str) const
{
if (getBitLen() != i_str.getBitLen())
return false; // size not equal
@@ -295,7 +295,7 @@
//------------------------------------------------------------------------------
-BitStringBuffer BitString::operator&(const BitString & i_bs) const
+BitStringBuffer BitString::operator&(const BitString& i_bs) const
{
// Get the length of the smallest string.
uint64_t actLen = std::min(getBitLen(), i_bs.getBitLen());
@@ -317,7 +317,7 @@
//------------------------------------------------------------------------------
-BitStringBuffer BitString::operator|(const BitString & i_bs) const
+BitStringBuffer BitString::operator|(const BitString& i_bs) const
{
// Get the length of the smallest string.
uint64_t actLen = std::min(getBitLen(), i_bs.getBitLen());
@@ -376,15 +376,15 @@
//------------------------------------------------------------------------------
-uint8_t * BitString::getRelativePosition(uint64_t & o_relPos,
- uint64_t i_absPos) const
+uint8_t* BitString::getRelativePosition(uint64_t& o_relPos,
+ uint64_t i_absPos) const
{
HEI_ASSERT(nullptr != getBufAddr()); // must to have a valid address
HEI_ASSERT(i_absPos < getBitLen()); // must be a valid position
o_relPos = (i_absPos + iv_offset) % UINT8_BIT_LEN;
- return ((uint8_t *)iv_bufAddr + ((i_absPos + iv_offset) / UINT8_BIT_LEN));
+ return ((uint8_t*)iv_bufAddr + ((i_absPos + iv_offset) / UINT8_BIT_LEN));
}
//##############################################################################
@@ -401,12 +401,12 @@
BitStringBuffer::~BitStringBuffer()
{
- delete [] (uint8_t *)getBufAddr();
+ delete [] (uint8_t*)getBufAddr();
}
//------------------------------------------------------------------------------
-BitStringBuffer::BitStringBuffer(const BitString & i_bs) :
+BitStringBuffer::BitStringBuffer(const BitString& i_bs) :
BitString(i_bs.getBitLen(), nullptr)
{
initBuffer();
@@ -415,7 +415,7 @@
//------------------------------------------------------------------------------
-BitStringBuffer::BitStringBuffer(const BitStringBuffer & i_bsb) :
+BitStringBuffer::BitStringBuffer(const BitStringBuffer& i_bsb) :
BitString(i_bsb.getBitLen(), nullptr)
{
initBuffer();
@@ -424,11 +424,11 @@
//------------------------------------------------------------------------------
-BitStringBuffer & BitStringBuffer::operator=(const BitString & i_bs)
+BitStringBuffer& BitStringBuffer::operator=(const BitString& i_bs)
{
// The initBuffer() function will deallocate the buffer as well, however we
// also need to deallocate the buffer here before we set the length.
- delete [] (uint8_t *)getBufAddr();
+ delete [] (uint8_t*)getBufAddr();
setBufAddr(nullptr);
setBitLen(i_bs.getBitLen());
@@ -440,13 +440,13 @@
//------------------------------------------------------------------------------
-BitStringBuffer & BitStringBuffer::operator=(const BitStringBuffer & i_bsb)
+BitStringBuffer& BitStringBuffer::operator=(const BitStringBuffer& i_bsb)
{
if (this != &i_bsb) // Check for assignment to self
{
// The initBuffer() function will deallocate the buffer as well, however
// we also need to deallocate the buffer here before we set the length.
- delete [] (uint8_t *)getBufAddr();
+ delete [] (uint8_t*)getBufAddr();
setBufAddr(nullptr);
setBitLen(i_bsb.getBitLen());
@@ -462,7 +462,7 @@
void BitStringBuffer::initBuffer()
{
// Deallocate the current buffer.
- delete [] (uint8_t *)getBufAddr();
+ delete [] (uint8_t*)getBufAddr();
// create new buffer, initialized to 0's
setBufAddr(new uint8_t[ getMinBytes(getBitLen()) ]());
diff --git a/src/util/hei_bit_string.hpp b/src/util/hei_bit_string.hpp
index 7f83624..a227ffc 100755
--- a/src/util/hei_bit_string.hpp
+++ b/src/util/hei_bit_string.hpp
@@ -76,7 +76,7 @@
* @pre Use getMinBytes() to calulate the minimum number of bytes needed
* to allocate sufficient memory space for this bit string.
*/
- BitString(uint64_t i_bitLen, void * i_bufAddr, uint64_t i_offset = 0) :
+ BitString(uint64_t i_bitLen, void* i_bufAddr, uint64_t i_offset = 0) :
iv_bitLen(i_bitLen), iv_bufAddr(i_bufAddr), iv_offset(i_offset)
{}
@@ -88,7 +88,7 @@
/** @return The address of the bit string buffer. Note that this may
* return nullptr. */
- void * getBufAddr() const { return iv_bufAddr; }
+ void* getBufAddr() const { return iv_bufAddr; }
/**
* @param i_bitLen The number of bits for a bit string.
@@ -257,7 +257,7 @@
* string, then the extra bits in this string are not modified.
* @note This string and the source string may specify overlapping memory.
*/
- void setString(const BitString & i_sStr, uint64_t i_sPos, uint64_t i_sLen,
+ void setString(const BitString& i_sStr, uint64_t i_sPos, uint64_t i_sLen,
uint64_t i_dPos = 0);
/**
@@ -268,7 +268,7 @@
* @note See the other definition of this function for details and
* restrictions.
*/
- void setString(const BitString & i_sStr)
+ void setString(const BitString& i_sStr)
{
setString(i_sStr, 0, i_sStr.getBitLen());
}
@@ -282,7 +282,7 @@
* @note If the length of the given string is less than the length of this
* string, then the extra bits in this string are not modified.
*/
- void maskString(const BitString & i_mask);
+ void maskString(const BitString& i_mask);
/**
* @param i_str The string to compare.
@@ -290,7 +290,7 @@
* @pre Both strings must be of equal length and have same values to be
* equal.
*/
- bool isEqual(const BitString & i_str) const;
+ bool isEqual(const BitString& i_str) const;
/** @return True if there are no bit set(1) in this bit string, false
* otherwise. */
@@ -309,16 +309,16 @@
uint64_t getSetCount() const { return getSetCount(0, getBitLen()); }
/** @brief Comparison operator. */
- bool operator==(const BitString & i_str) const { return isEqual(i_str); }
+ bool operator==(const BitString& i_str) const { return isEqual(i_str); }
/** @brief Bitwise NOT operator. */
BitStringBuffer operator~() const;
/** @brief Bitwise AND operator. */
- BitStringBuffer operator&(const BitString & i_bs) const;
+ BitStringBuffer operator&(const BitString& i_bs) const;
/** @brief Bitwise OR operator. */
- BitStringBuffer operator|(const BitString & i_bs) const;
+ BitStringBuffer operator|(const BitString& i_bs) const;
/** @brief Right shift operator. */
BitStringBuffer operator>>(uint64_t i_shift) const;
@@ -329,10 +329,10 @@
/**
* @brief Explicitly disables copy from BitString.
*
- * Prevents assigning a BitString & to a BitString, which would strip
+ * Prevents assigning a BitString& to a BitString, which would strip
* polymorphism.
*/
- BitString(const BitString & i_bs) = delete;
+ BitString(const BitString& i_bs) = delete;
/**
* @brief Explicitly disables assignment from BitStringBuffer.
@@ -340,7 +340,7 @@
* Allowing this would be dangerous if the BitStringBuffer goes out of scope
* because the BitString would point to memory that is no longer in context.
*/
- BitString & operator=(const BitStringBuffer & i_bsb) = delete;
+ BitString& operator=(const BitStringBuffer& i_bsb) = delete;
/**
* @brief Explicitly disables copy from BitStringBuffer.
@@ -348,7 +348,7 @@
* Allowing this would be dangerous if the BitStringBuffer goes out of scope
* because the BitString would point to memory that is no longer in context.
*/
- BitString(const BitStringBuffer & i_bsb) = delete;
+ BitString(const BitStringBuffer& i_bsb) = delete;
protected: // functions
@@ -357,7 +357,7 @@
* @pre Before calling this function, make sure you deallocate the old
* buffer to avoid memory leaks.
*/
- void setBufAddr(void * i_newBufAddr) { iv_bufAddr = i_newBufAddr; }
+ void setBufAddr(void* i_newBufAddr) { iv_bufAddr = i_newBufAddr; }
/** @param i_newBitLen The new bit length of this bit string buffer. */
void setBitLen(uint64_t i_newBitLen) { iv_bitLen = i_newBitLen; }
@@ -374,14 +374,14 @@
* @pre nullptr != getBufAddr()
* @pre i_absPos < getBitLen()
*/
- uint8_t * getRelativePosition(uint64_t & o_relPos,
- uint64_t i_absPos) const;
+ uint8_t* getRelativePosition(uint64_t& o_relPos,
+ uint64_t i_absPos) const;
private: // instance variables
- uint64_t iv_bitLen; ///< The bit length of this buffer.
- void * iv_bufAddr; ///< The beginning address of this buffer.
- uint64_t iv_offset; ///< Start position offset
+ uint64_t iv_bitLen; ///< The bit length of this buffer.
+ void* iv_bufAddr; ///< The beginning address of this buffer.
+ uint64_t iv_offset; ///< Start position offset
};
//##############################################################################
@@ -407,16 +407,16 @@
~BitStringBuffer();
/** @brief Copy constructor from BitString */
- BitStringBuffer(const BitString & i_bs);
+ BitStringBuffer(const BitString& i_bs);
/** @brief Copy constructor from BitStringBuffer */
- BitStringBuffer(const BitStringBuffer & i_bsb);
+ BitStringBuffer(const BitStringBuffer& i_bsb);
/** @brief Assignment from BitString */
- BitStringBuffer & operator=(const BitString & i_bs);
+ BitStringBuffer& operator=(const BitString& i_bs);
/** @brief Assignment from BitStringBuffer */
- BitStringBuffer & operator=(const BitStringBuffer & i_bsb);
+ BitStringBuffer& operator=(const BitStringBuffer& i_bsb);
private: // functions
diff --git a/src/util/hei_flyweight.hpp b/src/util/hei_flyweight.hpp
index de0f055..d6ce023 100644
--- a/src/util/hei_flyweight.hpp
+++ b/src/util/hei_flyweight.hpp
@@ -21,15 +21,15 @@
~Flyweight() { clear(); }
/** @brief Default copy constructor. */
- Flyweight(const Flyweight &) = delete;
+ Flyweight(const Flyweight&) = delete;
/** @brief Default assignment operator. */
- Flyweight & operator=(const Flyweight &) = delete;
+ Flyweight& operator=(const Flyweight&) = delete;
public:
/** @brief Provides access to a singleton instance of this object. */
- static Flyweight & getSingleton()
+ static Flyweight& getSingleton()
{
static Flyweight theFlyweight;
return theFlyweight;
@@ -41,13 +41,13 @@
* @param The target entry.
* @return A reference to this entry in the factory.
*/
- T & get(const T & i_entry)
+ T& get(const T& i_entry)
{
// The index is sorted by the value of the T objects. Check to see if
// this entry already exists in the factory.
auto itr =
std::lower_bound(iv_index.begin(), iv_index.end(), &i_entry,
- [](const T * a, const T * b) { return *a < *b; });
+ [](const T* a, const T* b) { return *a < *b; });
// std::lower_bound() will return the first element that does not
// compare less than i_entry. So if an entry is found, we must make sure