Skip to content

Commit 55ba25e

Browse files
Debug Config file PLM
1 parent e759ce0 commit 55ba25e

File tree

37 files changed

+907
-104
lines changed

37 files changed

+907
-104
lines changed

libs/rtemodel/include/CprjFile.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "RtePackage.h"
2020
#include "RteDevice.h"
2121

22-
class RteFile;
2322
class RteFileContainer;
2423
class RteComponentContainer;
2524
class RteTarget;

libs/rtemodel/include/RteComponent.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
*/
1515
/******************************************************************************/
1616
#include "RteItem.h"
17-
#include "RteFile.h"
1817

19-
class RteFile;
2018
class RteTarget;
2119
class RteFileContainer;
2220
class RtePackage;

libs/rtemodel/include/RteDevice.h

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ class RteDeviceElement : public RteItem
6666
*/
6767
const std::string& GetVendorString() const override { return GetEffectiveAttribute("Dvendor"); }
6868

69+
/**
70+
* @brief any item associated with a device is device-dependent
71+
* @return true
72+
*/
73+
bool IsDeviceDependent() const override { return true; }
74+
6975
/**
7076
* @brief obtain for all effectively defined attributes of this device element. That is collection of all attributes defined in this element and in parent elements.
7177
* @param attributes reference to XmlItem to fill
@@ -657,12 +663,24 @@ class RteDeviceDebugVars : public RteDeviceProperty
657663
*/
658664
RteDeviceDebugVars(RteItem* parent) : RteDeviceProperty(parent) {};
659665

666+
/**
667+
* @brief returns name of the debug config file
668+
*/
669+
const std::string& GetName() const override { return GetAttribute("configfile"); }
670+
671+
/**
672+
* @brief returns true to indicate that associated configuration file is a config one and should be copied in project's RTE directory
673+
* @return true
674+
*/
675+
bool IsConfig() const override { return true; }
676+
677+
660678
protected:
661679
/**
662680
* @brief construct unique debugvars property ID
663681
* @return ID string
664682
*/
665-
std::string ConstructID() override { return RteDeviceProperty::ConstructID() + std::string(":") + GetProcessorName(); }
683+
std::string ConstructID() override { return GetTag() + std::string(":") + GetProcessorName(); }
666684
};
667685

668686

@@ -1132,9 +1150,9 @@ class RteDevice : public RteDeviceItem
11321150
public:
11331151
/**
11341152
* @brief constructor
1135-
* @param parent pointer to parent RteDeviceItem
1153+
* @param parent pointer to parent RteItem (usually RteDeviceItem)
11361154
*/
1137-
RteDevice(RteDeviceItem* parent) : RteDeviceItem(parent) {};
1155+
RteDevice(RteItem* parent) : RteDeviceItem(parent) {};
11381156

11391157
public:
11401158
/**

libs/rtemodel/include/RteExample.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515
/******************************************************************************/
1616
#include "RteItem.h"
17-
#include "RteFile.h"
1817

1918
/**
2019
* @brief class presenting an example project with related files and properties

libs/rtemodel/include/RteFile.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,19 @@ class RteFile : public RteItem
103103
* @return true if GetRole() == RteFile::COPY
104104
*/
105105
bool IsForcedCopy() const;
106+
106107
/**
107108
* @brief check if file has config role
108109
* @return true if GetRole() == RteFile::CONFIG
109110
*/
110-
bool IsConfig() const;
111+
bool IsConfig() const override;
112+
113+
/**
114+
* @brief check if file is associated with a condition that depends on selected device or parent component is device dependent
115+
* @return true if item's condition depends on selected device
116+
*/
117+
bool IsDeviceDependent() const override;
118+
111119
/**
112120
* @brief check if file is a template
113121
* @return true if GetRole() == RteFile::TEMPLATE
@@ -117,7 +125,7 @@ class RteFile : public RteItem
117125
* @brief check if file must be added to project
118126
* @return true if to add to project
119127
*/
120-
bool IsAddToProject() const;
128+
bool IsAddToProject() const override;
121129

122130
/**
123131
* @brief get file category
@@ -155,13 +163,12 @@ class RteFile : public RteItem
155163
*/
156164
std::string ConstructID() override;
157165

158-
/**
166+
/**
159167
* @brief get file name
160168
* @return file name
161169
*/
162170
const std::string& GetName() const override;
163171

164-
165172
/**
166173
* @brief get file version string
167174
* @return "version" attribute value if set, otherwise parent component version
@@ -182,6 +189,7 @@ class RteFile : public RteItem
182189
* @param paths set of path strings
183190
*/
184191
void GetAbsoluteSourcePaths(std::set<std::string>& paths) const;
192+
185193
/**
186194
* @brief construct full path including filename for a file that should be used when adding file to a project
187195
* @param deviceName name of device used in the project
@@ -191,7 +199,7 @@ class RteFile : public RteItem
191199
* @param rteFolder the "RTE" folder path used for placing files
192200
* @return full project-relative path including filename and extension
193201
*/
194-
std::string GetInstancePathName(const std::string& deviceName, int instanceIndex, const std::string& rteFolder) const;
202+
std::string GetInstancePathName(const std::string& deviceName, int instanceIndex, const std::string& rteFolder) const override;
195203

196204
/**
197205
* @brief construct absolute include path string that can be used in'-I' compiler option.

libs/rtemodel/include/RteInstance.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,25 +1406,25 @@ class RteFileInstance : public RteItemInstance
14061406
public:
14071407
/**
14081408
* @brief initialize the file instance
1409-
* @param f pointer to the original RteFile
1409+
* @param f pointer to the original RteItem, represents RteFile or an item associated with a file
14101410
* @param deviceName device name used in the target
14111411
* @param instanceIndex instance index, can be > 0 for multi-instance components
14121412
* @param rteFolder the "RTE" folder path used for placing files
14131413
*/
1414-
void Init(RteFile* f, const std::string& deviceName, int instanceIndex, const std::string& rteFolder);
1414+
void Init(RteItem* f, const std::string& deviceName, int instanceIndex, const std::string& rteFolder);
14151415

14161416
/**
14171417
* @brief update file instance
1418-
* @param f pointer to the original RteFile
1418+
* @param f pointer to the original RteFile or RteItem representing afile
14191419
* @param bUpdateComponent update information about component this file belongs to
14201420
*/
1421-
void Update(RteFile* f, bool bUpdateComponent);
1421+
void Update(RteItem* f, bool bUpdateComponent);
14221422

14231423
/**
14241424
* @brief check if this file is a config one
14251425
* @return true if "attr" attribute value is "config"
14261426
*/
1427-
bool IsConfig() const;
1427+
bool IsConfig() const override;
14281428

14291429
/**
14301430
* @brief check if a new version of a config file is available (for specified target)
@@ -1539,17 +1539,17 @@ class RteFileInstance : public RteItemInstance
15391539
* rteFolder is taken from target's parent project
15401540
* @param targetName target name to resolve file
15411541
* @param
1542-
* @return pointer to RteFile if resolved, nullptr otherwise
1542+
* @return pointer to RteFile as RteItem if resolved, nullptr otherwise
15431543
*/
1544-
RteFile* GetFile(const std::string& targetName) const;
1544+
RteItem* GetFile(const std::string& targetName) const;
15451545

15461546
/**
15471547
* @brief copy a config file from pack location to the designated project directory
1548-
* @param f pointer to RteFile to copy
1548+
* @param f pointer to RteFile (or RteItem representing a file) to copy
15491549
* @param bMerge flag indicating to merge it to the existing one (if exists), otherwise overwrite
15501550
* @return true is successful
15511551
*/
1552-
bool Copy(RteFile* f, bool bMerge);
1552+
bool Copy(RteItem* f, bool bMerge);
15531553

15541554
public:
15551555

libs/rtemodel/include/RteItem.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,17 @@ class RteItem : public XmlTreeItem<RteItem>
523523
*/
524524
virtual std::string GetOriginalAbsolutePath(const std::string& name) const;
525525

526+
/**
527+
* @brief construct full path including filename for a file that should be used when adding file to a project
528+
* @param deviceName name of device used in the project
529+
* @param instanceIndex file index for components with multiple instantiation
530+
* Gets appended as a string to the base filename before extension if its value >= 0
531+
* Value of < 0 indicates that parent component can have only one instance
532+
* @param rteFolder the "RTE" folder path used for placing files
533+
* @return full project-relative path including filename and extension
534+
*/
535+
virtual std::string GetInstancePathName(const std::string& deviceName, int instanceIndex, const std::string& rteFolder) const;
536+
526537
/**
527538
* @brief check if item provides data matching OS this code is built for: Linux, Windows or Mac OS
528539
* @return true if item data matches host platform
@@ -787,6 +798,18 @@ class RteItem : public XmlTreeItem<RteItem>
787798
*/
788799
virtual RteItem* GetLicenseSet() const;
789800

801+
/**
802+
* @brief check if this item represents or is associated with a that is a config one
803+
* @return true if "attr" attribute value is "config" in default implementation
804+
*/
805+
virtual bool IsConfig() const;
806+
807+
/**
808+
* @brief check if an associated file must be added to project
809+
* @return true if to add to project
810+
*/
811+
virtual bool IsAddToProject() const { return IsConfig();}
812+
790813
/**
791814
* @brief check if item is associated with a condition that depends on selected device
792815
* @return true if item's condition depends on selected device

libs/rtemodel/include/RteProject.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ class RteProject : public RteRootItem
838838
* @param bMerge true to merge source with destination
839839
* @return true if source can be copied to destination
840840
*/
841-
bool UpdateFileToNewVersion(RteFileInstance* fi, RteFile* f, bool bMerge);
841+
bool UpdateFileToNewVersion(RteFileInstance* fi, RteItem* f, bool bMerge);
842842

843843
/**
844844
* @brief get file name and path of "RTE_Components.h" determined by the specified target and prefix
@@ -904,14 +904,14 @@ class RteProject : public RteRootItem
904904
bool RemoveComponent(const std::string& id);
905905

906906
void AddComponentFiles(RteComponentInstance* ci, RteTarget* target);
907-
RteFileInstance* AddFileInstance(RteComponentInstance* ci, RteFile* f, int index, RteTarget* target);
907+
RteFileInstance* AddFileInstance(RteComponentInstance* ci, RteItem* f, int index, RteTarget* target);
908908
bool RemoveFileInstance(const std::string& id);
909909
void DeleteFileInstance(RteFileInstance* fi);
910910
// initializes or updates (newer version is used) existing file instance
911-
void InitFileInstance(RteFileInstance* fi, RteFile* f, int index, RteTarget* target, const std::string& savedVersion, const std::string& rteFolder);
912-
bool UpdateFileInstance(RteFileInstance* fi, RteFile* f, bool bMerge, bool bUpdateComponent);
911+
void InitFileInstance(RteFileInstance* fi, RteItem* f, int index, RteTarget* target, const std::string& savedVersion, const std::string& rteFolder);
912+
bool UpdateFileInstance(RteFileInstance* fi, RteItem* f, bool bMerge, bool bUpdateComponent);
913913
void UpdateFileInstanceVersion(RteFileInstance* fi, const std::string& savedVersion);
914-
void UpdateConfigFileBackups(RteFileInstance* fi, RteFile* f);
914+
void UpdateConfigFileBackups(RteFileInstance* fi, RteItem* f);
915915

916916
void CollectSettings(const std::string& targetName);
917917

libs/rtemodel/include/RteTarget.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class RteTarget : public RteItem
229229
* @param c given associated component
230230
* @return pointer of type RteFile
231231
*/
232-
RteFile* GetFile(const std::string& name, RteComponent* c) const;
232+
RteItem* GetFile(const std::string& name, RteComponent* c) const;
233233

234234
/**
235235
* @brief determine file given by an file name and an associated component
@@ -259,7 +259,7 @@ class RteTarget : public RteItem
259259
* @param c given pointer of type RteComponent
260260
* @return pointer of type RteFile
261261
*/
262-
RteFile* GetFile(const RteFileInstance* fi, RteComponent* c) const;
262+
RteItem* GetFile(const RteFileInstance* fi, RteComponent* c) const;
263263

264264
/**
265265
* @brief determine file given by instances of type RteFileInstance and RteComponent
@@ -268,7 +268,7 @@ class RteTarget : public RteItem
268268
* @param rteFolder the "RTE" folder path used for placing files
269269
* @return pointer of type RteFile
270270
*/
271-
RteFile* GetFile(const RteFileInstance* fi, RteComponent* c, const std::string& rteFolder) const;
271+
RteItem* GetFile(const RteFileInstance* fi, RteComponent* c, const std::string& rteFolder) const;
272272

273273
/**
274274
* @brief evaluate dependencies of selected components of the target
@@ -945,6 +945,12 @@ class RteTarget : public RteItem
945945
*/
946946
RteDeviceProperty* GetDeviceEnvironment() const { return m_deviceEnvironment; }
947947

948+
/**
949+
* @brief get <debugvars> property of device
950+
* @return RteDeviceProperty pointer
951+
*/
952+
RteDeviceProperty* GetDeviceDebugVars() const { return m_deviceDebugVars; }
953+
948954
/**
949955
* @brief get the absolute path to the generator input file
950956
* @return absolute path to the generator input file
@@ -1091,9 +1097,9 @@ class RteTarget : public RteItem
10911097

10921098
RteComponent* m_deviceStartupComponent; // device startup component being used
10931099
RteDeviceItem* m_device; // device used by target
1100+
RteDeviceProperty* m_deviceDebugVars; // to access original dbgconfig file
10941101
// environment
10951102
RteDeviceProperty* m_deviceEnvironment; // device environment property for "uv"
1096-
10971103
// template support
10981104
std::map<RteComponent*, RteFileTemplateCollection*> m_availableTemplates;
10991105
// device values:

libs/rtemodel/src/RteFile.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ bool RteFile::IsConfig() const
5454
return GetRole() == Role::ROLE_CONFIG;
5555
}
5656

57+
bool RteFile::IsDeviceDependent() const
58+
{
59+
RteComponent* c = GetComponent();
60+
if(c && c->IsDeviceDependent()) {
61+
return true;
62+
}
63+
return RteItem::IsDeviceDependent();
64+
}
65+
66+
5767
bool RteFile::IsTemplate() const
5868
{
5969
return GetRole() == Role::ROLE_TEMPLATE;

0 commit comments

Comments
 (0)