Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 02d93031b6a9a1f47722eaeb72c6e7ffed244035 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package org.eclipse.papyrus.qompass.modellibs.core.xtend

import org.eclipse.uml2.uml.Operation
import static extension org.eclipse.papyrus.qompass.designer.core.UMLTool.*
import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.CppUtils.cppType
import org.eclipse.uml2.uml.Parameter

class Marshalling {
	def static marshall(Operation operation) '''
		// now marshall in and inout parameters via ASN.1
		«FOR parameter : operation.parametersInInout»
			«parameter.marshall»
		«ENDFOR»
	'''

	def static marshallOutInout(Operation operation) '''
		// now marshall out and inout parameters via ASN.1
		«FOR parameter : operation.parametersOutInout»
			«parameter.marshall»
		«ENDFOR»
	'''

	def static marshall(Parameter parameter) '''
		{
			«parameter.type.cppType» varName_ASN = «parameter.name»;
			BEncAsnContent (&pBuffer, &varName_ASN);
		}
	'''
	
	def static unmarshall(Operation operation) '''
		«FOR parameter : operation.parametersInInout.reverse»
			«parameter.unmarshall»
		«ENDFOR»
	'''
	
	def static unmarshallOutInout(Operation operation) '''
		«FOR parameter : operation.parametersOutInout.reverse»
			«parameter.unmarshall»
		«ENDFOR»
	'''

	def static unmarshall(Parameter parameter) '''
		«parameter.type.cppType» «parameter.name»
		{
			«parameter.type.cppType» varName_ASN;
			BDecAsnContent (&pBuffer, &varName_ASN);
			«parameter.name» = varName_ASN;
		}
	'''	
		
}

Back to the top