ImplementationDataType

XML tag <IMPLEMENTATION-DATA-TYPE>
Module autosar.datatype
Inherits autosar.element.Element

Implementation Data Types is a very generic container and can define almost any data type.

Usage

import autosar

def setup():
    ws = autosar.workspace(version="4.2.2")
    package=ws.createPackage('DataTypes', role='DataType')
    package.createSubPackage('CompuMethods', role='CompuMethod')
    package.createSubPackage('DataConstrs', role='DataConstraint')
    baseTypes=package.createSubPackage('BaseTypes')
    baseTypes.createSwBaseType('dtRef_const_VOID', encoding = 'VOID', nativeDeclaration = 'void')
    baseTypes.createSwBaseType('uint8', 8, nativeDeclaration='uint8')
    package.createSubPackage('ImplementationTypes')
    return ws

ws = setup()
implTypes = ws.find('/DataTypes/ImplementationTypes')

#Basic Implementation Type
uint8_BaseRef = '/DataTypes/BaseTypes/uint8'
uint8_Impl = implTypes.createImplementationDataType('uint8', lowerLimit=0, upperLimit=255,
    baseTypeRef = uint8_BaseRef, typeEmitter='Platform_Type')
#Type Reference
implTypes.createImplementationDataTypeRef('OffOn_T', implementationTypeRef = uint8_Impl.ref,
    valueTable = ['OffOn_Off', 'OffOn_On', 'OffOn_Error', 'OffOn_NotAvailable'])

#Pointer Type
dtRef_const_VOID_BaseRef = '/DataTypes/BaseTypes/dtRef_const_VOID'
implTypes.createImplementationDataTypePtr('dtRef_const_VOID', dtRef_const_VOID_BaseRef, swImplPolicy = 'CONST')

ws.saveXML('DataTypes.arxml')

Factory Methods

Basic Implementation Types

In its simplest form, an implementation data type is just a reference to a SwBaseType with optional data constraint and compuMethod. Use the Package.createImplementationDataType method to create basic implementation types.

Type References

You can also create an implementation data type that references another implementation data type. This is known as typedef in the C programming language. Use the Package.createImplementationDataTypeRef method to create type references.

Pointer Types

You can create data types that are pointers to base types. A future release should be able to support pointers to other implementation types. Use the Package.createImplementationDataTypePtr method to create pointer types.

Array Types

You can create implementation data types that are arrays of other implementation data types. Use the createImplementationArrayDataType to create array data types.

Record Types

You can create implementation data types that are records of other implementation data types. Use the createImplementationRecordDataType to create record data types.

Note: Record types are sometimes called structs or structure types.

Constructor

datatype.ImplementationDataType(name[, variantProps = None][, dynamicArraySizeProfile = None][, typeEmitter = None][, category='VALUE'][, parent = None][, adminData = None])
Parameters:
  • name (str) – Short name.
  • variantProps (None, SwDataDefPropsConditional, list) – variant properties.
  • dynamicArraySizeProfile (None, str) – Dynamic array size profile.
  • typeEmitter (None, str) – Type emitter
  • category (None, str) – Category string.
  • parent (None, Package) – Parent package.
  • adminData (None, AdminData) – Admin data.

Attributes

For inherited attributes see autosar.element.Element.

Name Type Description
dynamicArraySizeProfile None, str <DYNAMIC-ARRAY-SIZE-PROFILE>
subElements list of ImplementationDataTypeElement <SUB-ELEMENTS>
symbolProps None, SymbolProps <SYMBOL-PROPS>
typeEmitter None, str <TYPE-EMITTER>
variantProps list of SwDataDefPropsConditional <SW-DATA-DEF-PROPS>

Properties

Name Type Access Type Description
arraySize int Get Returns the array size of first subElements element
baseTypeRef str Get Returns the base type reference of first subElements element
compuMethodRef str Get Returns the CompuMethod reference of first subElements element
dataConstraintRef str Get Returns the data constraint reference of first subElements element
implementationTypeRef str Get Returns the implementation type reference of first subElements element

Public Methods

Method Description

setSymbolProps

ImplementationDataType.setSymbolProps([name = None][, symbol = None])
Parameters:
  • name (None, str) – Short name.
  • symbol (None, str) – Symbol name.

Assigns the symbolProps attribute by creating a new instance of SymbolProps.