Documentation
¶
Overview ¶
aml package which provides simplified APIs for aml data parsing.
Index ¶
- Constants
- func CreateAMLData() (*AMLData, AMLErrorCode)
- func CreateAMLObject(deviceId string, timeStamp string) (*AMLObject, AMLErrorCode)
- func CreateAMLObjectWithID(deviceId string, timeStamp string, id string) (*AMLObject, AMLErrorCode)
- func CreateRepresentation(filePath string) (*Representation, AMLErrorCode)
- type AMLData
- func (dataInstance *AMLData) DestroyAMLData() AMLErrorCode
- func (dataInstance *AMLData) GetKeys() ([]string, AMLErrorCode)
- func (dataInstance *AMLData) GetValueAMLData(key string) (*AMLData, AMLErrorCode)
- func (dataInstance *AMLData) GetValueStr(key string) (string, AMLErrorCode)
- func (dataInstance *AMLData) GetValueStrArr(key string) ([]string, AMLErrorCode)
- func (dataInstance *AMLData) GetValueType(key string) (AMLValueType, AMLErrorCode)
- func (dataInstance *AMLData) SetValueAMLData(key string, value *AMLData) AMLErrorCode
- func (dataInstance *AMLData) SetValueStr(key string, value string) AMLErrorCode
- func (dataInstance *AMLData) SetValueStrArr(key string, values []string) AMLErrorCode
- type AMLErrorCode
- type AMLObject
- func (amlInstance *AMLObject) AddData(name string, data *AMLData) AMLErrorCode
- func (amlInstance *AMLObject) DestroyAMLObject() AMLErrorCode
- func (amlInstance *AMLObject) GetData(name string) (*AMLData, AMLErrorCode)
- func (amlInstance *AMLObject) GetDataNames() ([]string, AMLErrorCode)
- func (amlInstance *AMLObject) GetDeviceId() (string, AMLErrorCode)
- func (amlInstance *AMLObject) GetId() (string, AMLErrorCode)
- func (amlInstance *AMLObject) GetTimeStamp() (string, AMLErrorCode)
- type AMLValueType
- type Representation
- func (repInstance *Representation) AmlToData(amlStr string) (*AMLObject, AMLErrorCode)
- func (repInstance *Representation) ByteToData(data []byte) (*AMLObject, AMLErrorCode)
- func (repInstance *Representation) DataToAml(amlObject *AMLObject) (string, AMLErrorCode)
- func (repInstance *Representation) DataToByte(amlObject *AMLObject) ([]byte, AMLErrorCode)
- func (repInstance *Representation) DestroyRepresentation() AMLErrorCode
- func (repInstance *Representation) GetConfigInfo() (*AMLObject, AMLErrorCode)
- func (repInstance *Representation) GetRepresentationId() (string, AMLErrorCode)
Constants ¶
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.
const ( AMLVALTYPE_STRING = 0 AMLVALTYPE_STRINGARRAY = 1 AMLVALTYPE_AMLDATA = 2 )
Constants represents AML value types.
Variables ¶
This section is empty.
Functions ¶
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.