catedrasaes-umu / emf4cpp Goto Github PK
View Code? Open in Web Editor NEWEclipse Modeling Framework for C++
Home Page: http://www.catedrasaes.org
License: GNU Lesser General Public License v3.0
Eclipse Modeling Framework for C++
Home Page: http://www.catedrasaes.org
License: GNU Lesser General Public License v3.0
Dear Team,
after some time with no response from @qvitech we suggest to revert pull request #5 completely for the following reasons:
Regards,
Matthias.
Dear Team
how to remove an element from an ELIST as it is implmented???
Regards,
DAVID
Hi,
I'm trying to parse a XMI file which has a xmi:XMI
root node (like shown in the example at https://www.euclideanspace.com/software/information/xml/xmi/index.htm):
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:types="http://www.eclipse.org/xtext/common/JavaVMTypes" xmlns:xbase="http://www.eclipse.org/xtext/xbase/Xbase">
...
</xmi:XMI>
If I try to parse this file, I get the following error:
terminate called after throwing an instance of 'std::logic_error'
what(): missing package: xmi
Aborted (core dumped)
I think that the reason is that there's no meta model found in the MetaModelRepository for the namespace xmi
.
This is the code I'm using to register the meta models in the repository:
::ecorecpp::MetaModelRepository_ptr repository = ::ecorecpp::MetaModelRepository::_instance();
::ecore::EcorePackage_ptr ecorePackage = ::ecore::EcorePackage::_instance();
repository->load(ecorePackage);
::types::TypesPackage_ptr typesPackage = ::types::TypesPackage::_instance();
repository->load(typesPackage);
::xbase::XbasePackage_ptr xbasePackage = ::xbase::XbasePackage::_instance();
repository->load(xbasePackage);
Do I have to add another package to the registry to be able to parse XMI files with a xml:XMI
root node?
Thank you in advance!
Best regards,
Mario
Hi there,
I was successfully compiling the library with VS2019.
But I'm getting runtime problems during the initialization of EcorePackage and EcoreFactory.
(Please note the change in line 179, which was Object_ptr ... casting between intrusive pointers can be problematic for derived classes right?
I also noticed that the generated classes do not contain any code for _inverseAdd and _inverseRemove.
Is there any known problem with this 'reverse setup' which Ecore is using. I know from the Java implementation
these two way references between two objects.
This is the function in my Ecore beeing generated:
PS) I have already fixed some missing code for handling more complex ecores (with inheritance over multiple ecores).
however I would wait for a running version before I'm sure this is the fix...
When I run ./generator-release.sh I always receive the following error:
System details:
Linux ubuntu 4.18.0-21-generic
cmake: 3.10.2
boost: 1.65.1.0ubuntu1
g++: 7.4.0-1ubuntu1~18.04
Qt: 5.9.5+dfsg-0ubuntu2.1
JRE: openjdk version "1.8.0_212" / with openjdk-11
[ 20%] Built target emf4cpp-edate
Scanning dependencies of target test-edate
[ 20%] Building CXX object emf4cpp.tests/edate/test/CMakeFiles/test-edate.dir/test.cpp.o
[ 20%] Linking CXX executable test-edate
../../../emf4cpp/libemf4cpp-ecore.so.0.0.1: undefined reference to `qt_version_tag'
collect2: error: ld returned 1 exit status
emf4cpp.tests/edate/test/CMakeFiles/test-edate.dir/build.make:98: recipe for target 'emf4cpp.tests/edate/test/test-edate' failed
make[2]: *** [emf4cpp.tests/edate/test/test-edate] Error 1
CMakeFiles/Makefile2:641: recipe for target 'emf4cpp.tests/edate/test/CMakeFiles/test-edate.dir/all' failed
make[1]: *** [emf4cpp.tests/edate/test/CMakeFiles/test-edate.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
using basic company example during deserializing created UMU.xmi file unable to get reference from one of the fields:
Company_ptr umu (::ecore::as< Company >(eobj));
const auto& lDepartments = umu->getDepartments();
std::cout<<lDepartments.size()<<std::endl;
const auto& manager = lDepartments[0]->getManager();
getManager() return NULL ptr;
UMU.xmi:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<company:Company xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:company="http:///com.example.company.ecore" name="UMU">
<departments number="8515" manager="//@departments.0/@employees.1">
<employees name="Andres Senac">
<phonebookEntry/>
</employees>
<employees name="Diego Sevilla"/>
</departments>
</company:Company>
edited for parsing basic example:
int main(int argc, char* argv[])
{
CompanyPackage_ptr companyPackage = CompanyPackage::_instance();
CompanyFactory_ptr companyFactory = CompanyFactory::_instance();
{
Company_ptr umu ( companyFactory->createCompany());
umu->setName("UMU");
Department_ptr catedraSAES = companyFactory->createDepartment();
catedraSAES->setNumber(8515);
Employee_ptr asenac = companyFactory->createEmployee();
asenac->setName("Andres Senac");
/* Check if a containment relation properly sets the eContainer() attribute. */
catedraSAES->getEmployees().push_back(asenac);
assert( asenac->eContainer() == catedraSAES );
catedraSAES->getEmployees().remove(asenac);
assert( asenac->eContainer() == nullptr );
catedraSAES->getEmployees().push_back(asenac);
assert( asenac->eContainer() == catedraSAES );
Employee_ptr dsevilla = companyFactory->createEmployee();
dsevilla->setName("Diego Sevilla");
catedraSAES->getEmployees().push_back(dsevilla);
/* Check if a containment relation properly sets the eContainer() attribute. */
assert( asenac->eContainer() == dsevilla->eContainer() );
/* Initially there is always no eContainer. */
PhonebookEntry_ptr phone = companyFactory->createPhonebookEntry();
assert( phone->eContainer() == nullptr );
/* Check if a containment relation properly sets the eContainer() attribute. */
asenac->setPhonebookEntry(phone);
assert( phone->eContainer() == asenac );
catedraSAES->setManager(dsevilla);
umu->getDepartments().push_back(catedraSAES);
umu->_initialize();
std::ofstream outfile ("UMU.xmi");
ecorecpp::serializer::serializer _ser(outfile);
_ser.serialize(umu);
outfile.close();
std::cout<<"Test Passed"<<std::endl;
}
::ecorecpp::MetaModelRepository::_instance()->load(companyPackage);
ecorecpp::parser::parser _dser;
EObject_ptr eobj = _dser.load ("UMU.xmi");
{
Company_ptr umu (::ecore::as< Company >(eobj));
const auto& lDepartments = umu->getDepartments();
std::cout<<lDepartments.size()<<std::endl;
const auto& manager = lDepartments[0]->getManager();
if (!manager)
std::cout<<"manager null"<<std::endl;
const auto& lemployees = lDepartments[0]->getEmployees();
std::cout<<lemployees.size()<<std::endl;
std::cout<<lemployees[0]->getName()<<std::endl;
std::cout<<lemployees[1]->getName()<<std::endl;
}
}
Is there a way to generate default documentation that is generated in the .ecore -> java process?
Does EMF4CPP support XMI? Since I only found XMLResourceFactory but not a XMIResourceFactory.
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 4 Jan 2015 at 7:35
Attachments:
I have tried creating a simple model then generated using the generator available with the "Downloads" section of your project.
But I end up always with this error:
cannot convert ‘ecore::EClass*’ to ‘ecore::EObject*’ for argument ‘1’ to ‘void ecore::intrusive_ptr_release(ecore::EObject*)’
PS: I have also used the compiled libraries from the "master" branch of the git repo as well.
System details:
Linux ubuntu 4.18.0-21-generic
cmake: 3.10.2
boost: 1.65.1.0ubuntu1
g++: 7.4.0-1ubuntu1~18.04
Qt: 5.9.5+dfsg-0ubuntu2.1
JRE: openjdk version "1.8.0_212"
ECORE:
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="root" nsURI="www.bosch.com/root" nsPrefix="root">
<eClassifiers xsi:type="ecore:EClass" name="Class_1">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="c" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="d" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Class_2">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="a" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="b" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
</ecore:EPackage>
I created a meta-model, generated the corresponding cpp code, created an xml file corresponding to my meta-model with the extension ".test_meta_model" and want to read this file. What are the steps?
Hello Team,
In the ecore I had created one EDatatype of Input stream with instanceTypeName = java.io.stream which is working in Java generated code but with equivalent C++ instanceTypeName it is not working. Can you provide a solution?
JAVA:
<eClassifiers xsi:type="ecore:EDataType" name="InputStream" instanceTypeName="java.io.stream"/>
C++:
<eClassifiers xsi:type="ecore:EDataType" name="InputStream" instanceTypeName="std::istream"/>
Regards,
Ramakrishnan
Hi,
when trying to generate C++ files for the Xbase.ecore meta model, I'm getting the following exception:
Exception in thread "main" EvaluationException : Ambiguous operations String getFQN(EClassifier this,String separator) and String getFQN(EOperation this,String separator) for param types [Void, String]
template::EClassHPP.xpt[1681,15] on line 52 'pkg.getFQN("/")'
template::Main.xpt[1551,71] on line 43 'EXPAND template::EClassHPP::hpp FOREACH EClassifiers.typeSelect(EClass)'
template::Main.xpt[1093,23] on line 30 'EXPAND package FOR this'
at org.eclipse.internal.xtend.expression.ast.Expression.evaluate(Expression.java:59)
at org.eclipse.internal.xpand2.ast.ExpressionStatement.evaluateInternal(ExpressionStatement.java:45)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
at org.eclipse.internal.xpand2.ast.ForEachStatement.evaluateInternal(ForEachStatement.java:121)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
at org.eclipse.internal.xpand2.ast.FileStatement.evaluateInternal(FileStatement.java:86)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:178)
at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:246)
at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:190)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:178)
at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:246)
at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:226)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
at org.eclipse.internal.xpand2.ast.IfStatement.evaluateInternal(IfStatement.java:101)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
at org.eclipse.internal.xpand2.ast.IfStatement.evaluateInternal(IfStatement.java:96)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:178)
at org.eclipse.xpand2.XpandFacade.evaluate2(XpandFacade.java:62)
at org.eclipse.xpand2.XpandFacade.evaluate(XpandFacade.java:43)
at org.csu.emf4cpp.generator.Generator.generate(Generator.java:102)
at org.csu.emf4cpp.generator.Generator.main(Generator.java:199)
Caused by: java.lang.RuntimeException: Ambiguous operations String getFQN(EClassifier this,String separator) and String getFQN(EOperation this,String separator) for param types [Void, String]
at org.eclipse.internal.xtend.type.baseimpl.PolymorphicResolver.getFeature(PolymorphicResolver.java:112)
at org.eclipse.internal.xtend.type.baseimpl.PolymorphicResolver.getExtension(PolymorphicResolver.java:56)
at org.eclipse.xtend.expression.ExecutionContextImpl$ExtensionsForNameAndTypeCache.createNew(ExecutionContextImpl.java:97)
at org.eclipse.xtend.expression.ExecutionContextImpl$ExtensionsForNameAndTypeCache.createNew(ExecutionContextImpl.java:1)
at org.eclipse.internal.xtend.util.Cache.get(Cache.java:26)
at org.eclipse.xtend.expression.ExecutionContextImpl.getExtensionForTypes(ExecutionContextImpl.java:371)
at org.eclipse.xtend.expression.ExecutionContextImpl.getExtension(ExecutionContextImpl.java:382)
at org.eclipse.internal.xtend.expression.ast.OperationCall.evaluateInternal(OperationCall.java:117)
at org.eclipse.internal.xtend.expression.ast.Expression.evaluate(Expression.java:51)
... 23 more
I use the following command to generate the C++ classes:
java -jar "org.csu.emf4cpp.generator_2.0.0.jar" -o ../../src/ecore Xbase.ecore
Has anyone an idea why this exception occurs? The causing call should be this one: https://github.com/catedrasaes-umu/emf4cpp/blob/master/org.csu.emf4cpp.generator/src/template/EClassHPP.xpt#L52
I'm not sure if there's a problem with the Xbase meta-model or if I configured the emf4cpp-generator the wrong way.
Thanks in advance for your help!
Regards
Mario
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.