Skip to content

Commit

Permalink
Get rid of item with attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
kleag committed May 7, 2024
1 parent f0d703f commit 3f233ff
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 695 deletions.
38 changes: 7 additions & 31 deletions lima_common/src/common/MediaticData/mediaticData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,38 +902,14 @@ void MediaticDataPrivate::initEntityTypes(XMLConfigurationFileParser& configPars
#endif
}
}
catch(NoSuchList& )
catch(NoSuchList& e)
{
// no simple list: may be list of items with attributes (to deal with isA relations of entities)
auto& items = groupConf.getListOfItems("entityList");
for (const auto& i: items)
{
auto entityName = QString::fromStdString(i.getName());
#ifdef DEBUG_CD
LDEBUG << "initEntityTypes: add entityType " << i.getName() << " in group " << groupName;
#endif
auto ent = addEntity(groupName, entityName);
#ifdef DEBUG_CD
LDEBUG << "initEntityTypes: type is " << ent;
#endif
if (i.hasAttribute(QLatin1String("isA")))
{
auto parentName = utf8stdstring2limastring(i.getAttribute("isA"));
EntityType parent;
try
{
parent = getEntityType(groupName, parentName);
#ifdef DEBUG_CD
LDEBUG << "initEntityTypes: add parent link:" << ent << "->" << parent;
#endif
}
catch (const LimaException& e)
{
LIMA_EXCEPTION( "Unknown entity type" << groupName << parentName);
}
addEntityParentLink(ent, parent);
}
}
MDATALOGINIT;
QString errorString;
QTextStream qts(&errorString);
qts << "missing list 'entityList' in entity types configuration:" << e.what();
LERROR << errorString;
throw InvalidConfiguration(errorString.toStdString());
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions lima_common/src/common/XMLConfigurationFiles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ SET(lima-common-xmlconfigurationfiles_LIB_SRCS
moduleConfigurationStructure.cpp
xmlConfigurationFileParser.cpp
xmlConfigurationFileReader.cpp
itemWithAttributes.cpp
)

add_library(lima-common-xmlconfigurationfiles SHARED ${lima-common-xmlconfigurationfiles_LIB_SRCS})
Expand All @@ -38,7 +37,6 @@ install(FILES
groupConfigurationStructure.h
xmlConfigurationFileExceptions.h
moduleConfigurationStructure.h
itemWithAttributes.h
DESTINATION include/common/XMLConfigurationFiles
COMPONENT devel
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,41 +210,6 @@ getGroupConf(const std::string& moduleName,
return (*itC).second.getGroupNamed(group) ;
}

void ConfigurationStructure::
addListOfItemsForModuleAndGroup(const std::string &listName,
const std::string& moduleName,
const std::string& group)
{
getGroupConf(moduleName,group).addListOfItems(listName);
}

void ConfigurationStructure::
addItemInListOfItemsForModuleAndGroup(const ItemWithAttributes& item,
const std::string &listName,
const std::string& moduleName,
const std::string& group)
{
getGroupConf(moduleName,group).addItemInListOfItems(listName,item);
}

void ConfigurationStructure::
addMapOfItemsForModuleAndGroup(const std::string &mapName,
const std::string& moduleName,
const std::string& group)
{
getGroupConf(moduleName,group).addMapOfItems(mapName);
}

void ConfigurationStructure::
addEntryInMapOfItemsForModuleAndGroup(const std::string& key,
const ItemWithAttributes& item,
const std::string& mapName,
const std::string& moduleName,
const std::string& group)
{
getGroupConf(moduleName,group).addEntryInMapOfItems(mapName,key,item);
}

std::ostream& operator<<(std::ostream &os, const ConfigurationStructure& conf)
{
for (ConfigurationStructure::const_iterator it = conf.begin(); it != conf.end(); it++)
Expand All @@ -255,70 +220,6 @@ std::ostream& operator<<(std::ostream &os, const ConfigurationStructure& conf)
return os;
}


void ConfigurationStructure::
changeListToListOfItems(const std::string &listName,
const std::string& moduleName,
const std::string& group)
{
getGroupConf(moduleName,group).changeListToListOfItems(listName);
}

void ConfigurationStructure::
changeMapToMapOfItems(const std::string &mapName,
const std::string& moduleName,
const std::string& group)
{
getGroupConf(moduleName,group).changeMapToMapOfItems(mapName);
}

void ConfigurationStructure::addListOfItemsForModuleAndGroup(const QString &listName,
const QString& moduleName,
const QString& group)
{
addListOfItemsForModuleAndGroup(listName.toStdString(), moduleName.toStdString(), group.toStdString());
}

void ConfigurationStructure::addItemInListOfItemsForModuleAndGroup(const ItemWithAttributes& item,
const QString &listName,
const QString& moduleName,
const QString& group)
{
addItemInListOfItemsForModuleAndGroup(item, listName.toStdString(), moduleName.toStdString(), group.toStdString());
}

void ConfigurationStructure::addMapOfItemsForModuleAndGroup(const QString &mapName,
const QString& moduleName,
const QString& group)
{
addMapOfItemsForModuleAndGroup(mapName.toStdString(), moduleName.toStdString(), group.toStdString());
}

void ConfigurationStructure::addEntryInMapOfItemsForModuleAndGroup(const QString& entryKey,
const ItemWithAttributes& entryValue,
const QString& mapName,
const QString& moduleName,
const QString& groupName)
{
addEntryInMapOfItemsForModuleAndGroup(entryKey.toStdString(), entryValue, mapName.toStdString(),
moduleName.toStdString(), groupName.toStdString());
}

void ConfigurationStructure::changeListToListOfItems(const QString &listName,
const QString& moduleName,
const QString& group)
{
changeListToListOfItems(listName.toStdString(), moduleName.toStdString(), group.toStdString());
}

void ConfigurationStructure::changeMapToMapOfItems(const QString &mapName,
const QString& moduleName,
const QString& group)
{
changeMapToMapOfItems(mapName.toStdString(), moduleName.toStdString(), group.toStdString());
}


} //closing namespace XMLConfigurationFiles
} //closing namespace Common
} //closing namespace Lima
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,6 @@ class LIMA_XMLCONFIGURATIONFILES_EXPORT ConfigurationStructure : public std::map
void addAttributeForGroupInModule(const std::string& attKey,const std::string& attValue,const std::string& groupName,const std::string& moduleName);


void addListOfItemsForModuleAndGroup(const std::string &listName,
const std::string& moduleName,
const std::string& group);
void addItemInListOfItemsForModuleAndGroup(const ItemWithAttributes& item,
const std::string &listName,
const std::string& moduleName,
const std::string& group);
void addMapOfItemsForModuleAndGroup(const std::string &mapName,
const std::string& moduleName,
const std::string& group);
void addEntryInMapOfItemsForModuleAndGroup(const std::string& entryKey,
const ItemWithAttributes& entryValue,
const std::string& mapName,
const std::string& moduleName,
const std::string& groupName);

void changeListToListOfItems(const std::string &listName,
const std::string& moduleName,
const std::string& group);
void changeMapToMapOfItems(const std::string &mapName,
const std::string& moduleName,
const std::string& group);

void addParamValuePairForModuleAndGroup(const QString &param,
const QString &value,
const QString &module,
Expand All @@ -100,29 +77,6 @@ class LIMA_XMLCONFIGURATIONFILES_EXPORT ConfigurationStructure : public std::map
const QString& moduleName);


void addListOfItemsForModuleAndGroup(const QString &listName,
const QString& moduleName,
const QString& group);
void addItemInListOfItemsForModuleAndGroup(const ItemWithAttributes& item,
const QString &listName,
const QString& moduleName,
const QString& group);
void addMapOfItemsForModuleAndGroup(const QString &mapName,
const QString& moduleName,
const QString& group);
void addEntryInMapOfItemsForModuleAndGroup(const QString& entryKey,
const ItemWithAttributes& entryValue,
const QString& mapName,
const QString& moduleName,
const QString& groupName);

void changeListToListOfItems(const QString &listName,
const QString& moduleName,
const QString& group);
void changeMapToMapOfItems(const QString &mapName,
const QString& moduleName,
const QString& group);

private:

GroupConfigurationStructure&
Expand Down
Loading

0 comments on commit 3f233ff

Please sign in to comment.