Skip to content

Commit

Permalink
[RteModel] Improve support for csolution pdsc element
Browse files Browse the repository at this point in the history
  • Loading branch information
grasci-arm authored May 15, 2024
1 parent a96723e commit cc67565
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 54 deletions.
22 changes: 5 additions & 17 deletions libs/rtemodel/include/RteModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -530,26 +530,16 @@ class RteModel : public RteItem
*/
void InsertPack(RtePackage* package);

/**
* @brief get collection of filtered <cimage> elements collected from the packs
* @return list of pointers RteItem representing cimage elements
*/
const Collection<RteItem*>& GetImageDescriptors() const { return m_imageDescriptors; }
/**
* @brief get collection of filtered <clayer> elements collected from the packs
* @return list of pointers RteItem representing clayer elements
*/
const Collection<RteItem*>& GetLayerDescriptors() const { return m_layerDescriptors; }
/**
* @brief get collection of filtered <cproject> elements collected from the packs
* @return list of pointers RteItem representing cproject elements
*/
const Collection<RteItem*>& GetProjectDescriptors() const { return m_projectDescriptors; }
/**
* @brief get collection of filtered <csolution> elements collected from the packs
* @return list of pointers RteItem representing csolution elements
* @brief get collection of filtered <template> elements collected from the packs
* @return list of pointers RteItem representing template elements
*/
const Collection<RteItem*>& GetSolutionDescriptors() const { return m_solutionDescriptors; }
const Collection<RteItem*>& GetProjectDescriptors() const { return m_templateDescriptors; }

protected:

Expand All @@ -561,7 +551,7 @@ class RteModel : public RteItem
virtual void FillDeviceTree();
virtual void FillDeviceTree(RtePackage* pack);

void AddPackItemsToList(const Collection<RteItem*>& srcCollection, Collection<RteItem*>& dstCollection);
void AddPackItemsToList(const Collection<RteItem*>& srcCollection, Collection<RteItem*>& dstCollection, const std::string& tag);

bool IsApiDominatingOrNewer(RteApi* a);

Expand Down Expand Up @@ -592,10 +582,8 @@ class RteModel : public RteItem
RtePackageFilter m_packageFilter;

// csolution-related collections
Collection<RteItem*> m_imageDescriptors;
Collection<RteItem*> m_layerDescriptors;
Collection<RteItem*> m_projectDescriptors;
Collection<RteItem*> m_solutionDescriptors;
Collection<RteItem*> m_templateDescriptors;

RteConditionContext* m_filterContext; // constructed, updated and deleted by target

Expand Down
24 changes: 0 additions & 24 deletions libs/rtemodel/include/RtePackage.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,30 +307,6 @@ class RtePackage : public RteRootItem
*/
RteItem* GetBoards() const { return m_boards; }

/**
* @brief get collection of <cimage> elements
* @return list of pointers RteItem representing cimage elements
*/
const Collection<RteItem*>& GetImageDescriptors() const { return GetGrandChildren("cimage"); }

/**
* @brief get collection of <clayer> elements
* @return list of pointers RteItem representing clayer elements
*/
const Collection<RteItem*>& GetLayerDescriptors() const { return GetGrandChildren("csolution"); }

/**
* @brief get collection of <cproject> elements
* @return list of pointers RteItem representing cproject elements
*/
const Collection<RteItem*>& GetProjectDescriptors() const { return GetGrandChildren("cprojects"); }

/**
* @brief get collection of <csolution> elements
* @return list of pointers RteItem representing csolution elements
*/
const Collection<RteItem*>& GetSolutionDescriptors() const { return GetGrandChildren("csolutions"); }

/**
* @brief get <generators> element
* @return pointer to RteGeneratorContainer representing container for generators
Expand Down
20 changes: 7 additions & 13 deletions libs/rtemodel/src/RteModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ void RteModel::ClearModel()
m_taxonomy.clear();
m_bundles.clear();

m_imageDescriptors.clear();
m_layerDescriptors.clear();
m_projectDescriptors.clear();
m_solutionDescriptors.clear();
m_templateDescriptors.clear();

m_packageDuplicates.clear();
m_packages.clear();
Expand Down Expand Up @@ -500,23 +498,19 @@ void RteModel::AddItemsFromPack(RtePackage* pack)
}
}
}
// images
AddPackItemsToList(pack->GetImageDescriptors(), m_imageDescriptors);
// layers
AddPackItemsToList(pack->GetLayerDescriptors(), m_layerDescriptors);
// projects
AddPackItemsToList(pack->GetProjectDescriptors(), m_projectDescriptors);
// projects
AddPackItemsToList(pack->GetSolutionDescriptors(), m_solutionDescriptors);
// collect layers and templates
auto& csolutionChildren = pack->GetGrandChildren("csolution");
AddPackItemsToList(csolutionChildren, m_layerDescriptors, "clayer");
AddPackItemsToList(csolutionChildren, m_templateDescriptors, "template");

// fill api and component list
pack->InsertInModel(this);
}

void RteModel::AddPackItemsToList(const Collection<RteItem*>& srcCollection, Collection<RteItem*>& dstCollection)
void RteModel::AddPackItemsToList(const Collection<RteItem*>& srcCollection, Collection<RteItem*>& dstCollection, const std::string& tag)
{
for (auto item : srcCollection) {
if (IsFiltered(item)) {
if ((tag.empty() || tag == item->GetTag()) && IsFiltered(item)) {
dstCollection.push_back(item);
}
}
Expand Down
9 changes: 9 additions & 0 deletions test/packs/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,15 @@
<clayer name="Board3" type="Board" file="Layers/board3.clayer.yml" condition="BoardTest3">
<description>"Test board layer three"</description>
</clayer>
<template name="Board1Template" file="Templates/board1.csolution.yml" condition="BoardTest1">
<description>"Test board Template one"</description>
</template>
<template name="Board2" type="Board" file="Templates/board2.csolution.yml" condition="BoardTest2">
<description>"Test board Template two"</description>
</template>
<template name="Board3" type="Board" file="Templates/board3.csolution.yml" condition="BoardTest3">
<description>"Test board Template three"</description>
</template>
<clayer name="TestVariant" type="TestVariant" file="Layers/testvariant.clayer.yml">
<description>"Test compatible layer"</description>
</clayer>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json

solution:

# TODO: specify correct csolution content

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json

solution:

# TODO: specify correct csolution content

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json

solution:

# TODO: specify correct csolution content

0 comments on commit cc67565

Please sign in to comment.