aml

package
v0.0.0-...-a8a939b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

aml package which provides simplified APIs for aml data parsing.

Index

Constants

View Source
const (
	AML_OK                 = 0
	AML_INVALID_PARAM      = 1
	AML_INVALID_DATA       = 2
	AML_INVALID_FILE_PATH  = 3
	AML_INVALID_AML_SCHEMA = 4
	AML_INVALID_XML_STRING = 5
	AML_NO_MEMORY          = 6
	AML_KEY_NOT_EXIST      = 7
	AML_KEY_ALREADY_EXIST  = 8
	AML_INVALID_DATA_TYPE  = 9
)

Constants represents AML error codes.

View Source
const (
	AMLVALTYPE_STRING      = 0
	AMLVALTYPE_STRINGARRAY = 1
	AMLVALTYPE_AMLDATA     = 2
)

Constants represents AML value types.

Variables

This section is empty.

Functions

func CreateAMLData

func CreateAMLData() (*AMLData, AMLErrorCode)

Create an instance of AMLData.

func CreateAMLObject

func CreateAMLObject(deviceId string, timeStamp string) (*AMLObject, AMLErrorCode)

Create an instance of AMLObject.

func CreateAMLObjectWithID

func CreateAMLObjectWithID(deviceId string, timeStamp string, id string) (*AMLObject, AMLErrorCode)

Create an instance of AMLObject with id.

func CreateRepresentation

func CreateRepresentation(filePath string) (*Representation, AMLErrorCode)

Contructs an instance of Representation for the given aml file.

Types

type AMLData

type AMLData struct {
	// contains filtered or unexported fields
}

Structure represents AMLData.

func (*AMLData) DestroyAMLData

func (dataInstance *AMLData) DestroyAMLData() AMLErrorCode

Destroy an instance of AMLData.

func (*AMLData) GetKeys

func (dataInstance *AMLData) GetKeys() ([]string, AMLErrorCode)

Get a list of key that AMLData has.

func (*AMLData) GetValueAMLData

func (dataInstance *AMLData) GetValueAMLData(key string) (*AMLData, AMLErrorCode)

Get AMLData value which matchs a key in AMLData.

func (*AMLData) GetValueStr

func (dataInstance *AMLData) GetValueStr(key string) (string, AMLErrorCode)

Get string value which matchs a key in AMLData.

func (*AMLData) GetValueStrArr

func (dataInstance *AMLData) GetValueStrArr(key string) ([]string, AMLErrorCode)

Get string array value which matchs a key in AMLData.

func (*AMLData) GetValueType

func (dataInstance *AMLData) GetValueType(key string) (AMLValueType, AMLErrorCode)

Get AML datatype of value for the given key.

func (*AMLData) SetValueAMLData

func (dataInstance *AMLData) SetValueAMLData(key string, value *AMLData) AMLErrorCode

Set key/value as a AMLData value to AMLData.

func (*AMLData) SetValueStr

func (dataInstance *AMLData) SetValueStr(key string, value string) AMLErrorCode

Set key/value as a string value to AMLData.

func (*AMLData) SetValueStrArr

func (dataInstance *AMLData) SetValueStrArr(key string, values []string) AMLErrorCode

Set key/value as a string array value to AMLData.

type AMLErrorCode

type AMLErrorCode int

type AMLObject

type AMLObject struct {
	// contains filtered or unexported fields
}

Structure represents AMLObject.

func (*AMLObject) AddData

func (amlInstance *AMLObject) AddData(name string, data *AMLData) AMLErrorCode

Add AMLData to AMLObject using AMLData key that to match AMLData value.

func (*AMLObject) DestroyAMLObject

func (amlInstance *AMLObject) DestroyAMLObject() AMLErrorCode

Destroy an instance of AMLObject.

func (*AMLObject) GetData

func (amlInstance *AMLObject) GetData(name string) (*AMLData, AMLErrorCode)

Get AMLData which matched input name string with AMLObject's amlDatas key.

func (*AMLObject) GetDataNames

func (amlInstance *AMLObject) GetDataNames() ([]string, AMLErrorCode)

Get a list of AMLData names that AMLObject has.

func (*AMLObject) GetDeviceId

func (amlInstance *AMLObject) GetDeviceId() (string, AMLErrorCode)

Get deviceId of AMLObject.

func (*AMLObject) GetId

func (amlInstance *AMLObject) GetId() (string, AMLErrorCode)

Get id of AMLObject.

func (*AMLObject) GetTimeStamp

func (amlInstance *AMLObject) GetTimeStamp() (string, AMLErrorCode)

Get timeStamp of AMLObject.

type AMLValueType

type AMLValueType int

type Representation

type Representation struct {
	// contains filtered or unexported fields
}

Structure represents Representation.

func (*Representation) AmlToData

func (repInstance *Representation) AmlToData(amlStr string) (*AMLObject, AMLErrorCode)

converts AML(XML) string to AMLObject to match the AML model information which is set on CreateRepresentation().

func (*Representation) ByteToData

func (repInstance *Representation) ByteToData(data []byte) (*AMLObject, AMLErrorCode)

Converts Protobuf byte data to AMLObject to match the AML model information which is set on CreateRepresentation()

func (*Representation) DataToAml

func (repInstance *Representation) DataToAml(amlObject *AMLObject) (string, AMLErrorCode)

Converts AMLObject to AML(XML) string to match the AML model information which is set on CreateRepresentation().

func (*Representation) DataToByte

func (repInstance *Representation) DataToByte(amlObject *AMLObject) ([]byte, AMLErrorCode)

AMLObject to Protobuf byte data to match the AML model information which is set on CreateRepresentation().

func (*Representation) DestroyRepresentation

func (repInstance *Representation) DestroyRepresentation() AMLErrorCode

Destroy an instance of Representation.

func (*Representation) GetConfigInfo

func (repInstance *Representation) GetConfigInfo() (*AMLObject, AMLErrorCode)

Get AMLObject that contains configuration data which is present in RoleClassLib.

func (*Representation) GetRepresentationId

func (repInstance *Representation) GetRepresentationId() (string, AMLErrorCode)

Get AutomationML SystemUnitClassLib's unique ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL