Correction by review. Adding attribute types to dictionaries.#63
Merged
Correction by review. Adding attribute types to dictionaries.#63
Conversation
…n changed, class member variables m_rightDict, m_reverseDict declaration changed in BasicDictionary class. The VendorDictionary class declaration added. The return type changed in vendorNames function declaration, type of m_vendorNames variable declaration changed in the Dictionaries class.
…tions definition added, the 'add' and 'append' functions definition changed in BasicDictionary class. The functions definition of VendorDictionary class added. The constructor Dictionaries changed, return type of vendorNames function changed in the Dictionaries class.
BasicDictionary class.
functions of BasicDictionary class added.
…onary class added in test case TestAppend.
…onary class added in test case TestAppend.
…onary class added in test case TestConstructor.
functions add and append, debugging 'cout' added to function append of BasicDictionary class.
the test case TestAdd, TestAppend.
…ode(). Class memeber name m_type changed to m_code.
…ass memeber m_type changed to m_code.
…ype() changed to vendorAttributeCode(). Class memeber m_vendorType changed to m_vendorAttributeCode.
…type() changed to code().
…ss memeber m_type changed to m_code.
and corresponding message changed in function message().
…ion type() changed to code(). Variable type changed to code. Class member m_type changed to m_code.
type changed to code in function packetCodeToString.
…ion vendorType() changed to vendorAttributeCode(). Variable vendorType changed to vendorAttributeCode. Class member m_vendorType changed to m_vendorAttributeCode.
vendorAttributeCode().
vendorType() changed to vendorAttributeCode().Function type() changed to code(). The set types changed to codes. TestCase(PacketDataConstructorThrowMakeAttributeInvalidType) changed to TestCase(PacketDataConstructorThrowMakeAttributeInvalidCode).
…ion vendorType() changed to vendorAttributeCode().Function type() changed to code(). The set types changed to codes.
…eter type changed to code in function findAttribute..
function message().
and VendorDictionary::add.
Exception messages changed in the VendorDictionary::add function. In the constructor Dictionary: the type of variable attrName changed to std::string; the code for search the code with a dot by the attribute added; the condition for filling dictionaries of value changed.
madf
requested changes
Nov 11, 2025
src/dictionaries.cpp
Outdated
| m_rightDict.insert_or_assign(code, std::make_pair(name, type)); | ||
| if (flag) | ||
| m_reverseDict.insert_or_assign(name, std::make_pair(code, type)); | ||
| m_reverseDict.emplace(name, std::make_pair(code, type)); |
Owner
There was a problem hiding this comment.
If flag is true you do insert_or_assign and then emplace. You, probably, do not need emplace in this case.
src/dictionaries.cpp
Outdated
| void BasicDictionary::add(uint32_t code, const std::string& name) | ||
| void BasicDictionary::add(uint32_t code, const std::string& name, const std::string& type) | ||
| { | ||
| bool flag(false); |
src/dictionaries.cpp
Outdated
|
|
||
| void BasicDictionary::append(const BasicDictionary& basicDict) | ||
| { | ||
| bool flag(false); |
src/dictionaries.cpp
Outdated
| { | ||
| if (flag) | ||
| m_reverseDict.insert_or_assign(entry.first, entry.second); | ||
| m_reverseDict.emplace(entry.first, entry.second); |
Owner
There was a problem hiding this comment.
Same as above, if flag is true you do insert_or_assign and then emplace.
…nt added, the condition else added when flag is checked, function emplace added in function BasicDictionary::add.
else added when flag is checked in function BasicDictionary::append.
when vector excludeAttr is checked in constructor Dictionaries.
BasicDictionary::add, BasicDictionary::append.
constructor Dictionaries.
test case TestAttributeType of test suite DictionariesTests.
… attribute type when the flag is set, added to test case TestAttributeType of test suite DictionariesTests.
madf
requested changes
Nov 21, 2025
src/dictionaries.cpp
Outdated
| if (!tokens.empty()) | ||
| { | ||
| std::string attrName; | ||
| std::string attrType; |
Owner
There was a problem hiding this comment.
I think you can put attrName and attrType inside the ifs
below in conctructor Dictionaries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented adding attribute types to dictionaries.
Code changed to work correctly with dictionaries.