Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: repair collecting effective debug sequences (#694) #1138

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 1 addition & 41 deletions libs/rtemodel/include/RteDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,39 +431,6 @@ class RteSequence : public RteDevicePropertyGroup
RteDeviceProperty* CreateProperty(const std::string& tag) override;
};

/**
* @brief class to support <sequence> device property
*/
class RteSequences : public RteDevicePropertyGroup
{
public:
/**
* @brief constructor
* @param parent pointer to parent RteItem
*/
RteSequences(RteItem* parent) : RteDevicePropertyGroup(parent) {};
public:
/**
* @brief indicate the property is unique, a sequence with the same name can be listed only once per device
* @return true
*/
bool IsUnique() const override { return true; }

/**
* @brief indicate that this property type provides effective content to collect
* @return true
*/
bool IsCollectEffectiveContent() const override { return true; }

protected:
/**
* @brief create an RteDeviceProperty for given tag
* @param tag XML tag
* @return pointer to RteDeviceProperty-derived class, never null
*/
RteDeviceProperty* CreateProperty(const std::string& tag) override;
};

/**
* @brief class to support <datapatch> device property
*/
Expand Down Expand Up @@ -924,7 +891,7 @@ struct RteEffectiveProperties
/**
* @brief full property collection: map of tag to list of RteDeviceProperty pointers
*/
RteDevicePropertyMap m_properties;
RteDevicePropertyMap m_propertyMap;
};


Expand Down Expand Up @@ -1114,13 +1081,6 @@ class RteDeviceItem : public RteDeviceElement
*/
void CreateEffectiveXmlTreeElements(XMLTreeElement* parent, const std::list<RteDeviceProperty*>& properties);

/**
* @brief create an RteDeviceProperty for given tag
* @param tag XML tag
* @return pointer to RteDeviceProperty-derived class, never null
*/
RteDeviceProperty* CreateProperty(const std::string& tag) override;

/**
* @brief create a device item derived from RteDeviceItem class for given tag
* @param tag device item tag
Expand Down
33 changes: 11 additions & 22 deletions libs/rtemodel/src/RteDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ RteDeviceProperty* RteDeviceElement::CreateProperty(const string& tag)
return new RteAccessPortV1(this);
} else if (tag == "accessportV2") {
return new RteAccessPortV2(this);
} else if (tag == "sequence") {
return new RteSequence(this);
}
return new RteDeviceProperty(this);
}
Expand Down Expand Up @@ -274,15 +276,6 @@ RteDeviceProperty* RteSequence::CreateProperty(const string& tag)
return new RteDeviceProperty(this);
}

RteDeviceProperty* RteSequences::CreateProperty(const string& tag)
{
if (tag == "sequence") {
return new RteSequence(this);
}
return new RteDeviceProperty(this);
}


string RteDatapatch::ConstructID()
{
const string& ap = GetEffectiveAttribute("__ap");
Expand Down Expand Up @@ -547,6 +540,11 @@ bool RteDeviceItem::Validate()

RteItem* RteDeviceItem::CreateItem(const std::string& tag)
{
if (tag == "sequences") {
// ignore sequences element because effective properties work on directly on "sequence" properties
return this;
}

if (tag == "subFamily" || tag == "device" || tag == "variant") {
RteDeviceItem* di = CreateDeviceItem(tag);
if (di) {
Expand All @@ -566,15 +564,6 @@ RteItem* RteDeviceItem::CreateItem(const std::string& tag)
return deviceProperty;
}

RteDeviceProperty* RteDeviceItem::CreateProperty(const string& tag)
{
if (tag == "sequences") {
return new RteSequences(this);
}
return RteDeviceElement::CreateProperty(tag);
}


RteDeviceItem* RteDeviceItem::CreateDeviceItem(const string& tag)
{
// since our tags differ already by first item, use simple switch
Expand Down Expand Up @@ -763,7 +752,7 @@ void RteDeviceItem::CollectEffectiveProperties(const string& pName)
{
m_effectiveProperties[pName] = RteEffectiveProperties();
auto it = m_effectiveProperties.find(pName);
RteDevicePropertyMap& pmap = it->second.m_properties;
RteDevicePropertyMap& pmap = it->second.m_propertyMap;
CollectEffectiveProperties(pmap, pName);
for (auto itp = pmap.begin(); itp != pmap.end(); itp++) {
auto l = itp->second;
Expand All @@ -776,8 +765,8 @@ void RteDeviceItem::CollectEffectiveProperties(const string& pName)


const list<RteDeviceProperty*>& RteEffectiveProperties::GetProperties(const string& tag) const {
auto it = m_properties.find(tag);
if (it != m_properties.end()) {
auto it = m_propertyMap.find(tag);
if (it != m_propertyMap.end()) {
return it->second;
}
return EMPTY_PROPERTY_LIST;
Expand All @@ -795,7 +784,7 @@ const RteDevicePropertyMap& RteDeviceItem::GetEffectiveProperties(const string&

auto itp = m_effectiveProperties.find(pName);
if (itp != m_effectiveProperties.end()) {
return itp->second.m_properties;
return itp->second.m_propertyMap;
}

static const RteDevicePropertyMap EMPTY_PROPERTY_MAP;
Expand Down
Loading