Skip to content

Correction by review. Adding attribute types to dictionaries.#63

Merged
madf merged 44 commits intomadf:mainfrom
HelenMamontova:initial
Nov 27, 2025
Merged

Correction by review. Adding attribute types to dictionaries.#63
madf merged 44 commits intomadf:mainfrom
HelenMamontova:initial

Conversation

@HelenMamontova
Copy link
Collaborator

Implemented adding attribute types to dictionaries.
Code changed to work correctly with dictionaries.

…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.
…onary class added in test case TestConstructor.
functions add and append, debugging 'cout' added to function append of BasicDictionary class.
…ode(). Class

memeber name m_type changed to m_code.
…ype() changed to vendorAttributeCode(). Class memeber m_vendorType changed to m_vendorAttributeCode.
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.
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..
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.
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));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If flag is true you do insert_or_assign and then emplace. You, probably, do not need emplace in this case.

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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool flag = false;


void BasicDictionary::append(const BasicDictionary& basicDict)
{
bool flag(false);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool flag = false;

{
if (flag)
m_reverseDict.insert_or_assign(entry.first, entry.second);
m_reverseDict.emplace(entry.first, entry.second);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
test case TestAttributeType of test suite DictionariesTests.
… attribute type

when the flag is set, added to test case TestAttributeType of test suite DictionariesTests.
if (!tokens.empty())
{
std::string attrName;
std::string attrType;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can put attrName and attrType inside the ifs

@madf madf merged commit 0032fcb into madf:main Nov 27, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants