/*
 * Go2PartPositionY.c
 * 
 * Gocator system communication library
 * Copyright (C) 2013 by LMI Technologies Inc.
 * 
 * Licensed under The MIT License.
 * Redistributions of files must retain the above copyright notice.
 */

#include <z/Go2Measurements/zGo2PartPositionY.h>
#include <z/zGo2PartTypes.h>
#include <z/zGo2System.h>
#include <string.h>

/*
 * Go2PartPositionY Class 
 */

GO2_EXPORT(Go2Status) Go2PartPositionY_Construct(Go2PartPositionY* measurement, Go2UInt32 id, Go2Object system)
{
    Go2PartPositionY output = zNIL; 
    Go2Status status = zOK; 

    zCHECK(zCalloc(&output, 1, sizeof(Go2PartPositionYClass))); 

    if (!zSUCCESS(status = Go2PartPositionY_Init(output, id, system)))
    {
        zCHECK(Go2Object_Destroy(output)); 
        return status; 
    }

    *measurement = output; 

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_Init(Go2PartPositionY measurement, Go2UInt32 id, Go2Object system)
{
    Go2PartPositionYClass* obj = zHANDLE_POINTER(measurement);
    
    zCHECK(Go2PartMeasurement_Init(measurement, GO2_TYPE_PART_POSITION_Y, id, system)); 

    obj->Release = Go2PartPositionY_VRelease;
    obj->Read = Go2PartPositionY_VRead; 
    obj->Write = Go2PartPositionY_VWrite; 

    zCHECK(Go2PartFeature3d_Construct(&obj->feature, system));
    
    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_VRelease(Go2PartPositionY measurement)
{
    Go2PartPositionYClass* obj = zHANDLE_POINTER(measurement);

    zCHECK(Go2PartFeature3d_VRelease(obj->feature));
    zCHECK(Go2PartMeasurement_VRelease(measurement));  
        
    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_VRead(Go2PartPositionY measurement, zXml xml, zXmlItem item)
{
    Go2PartPositionYClass* obj = zHANDLE_POINTER(measurement);
    zXmlItem featureItem = GO2_NULL;

    zCHECK(Go2PartMeasurement_VRead(measurement, xml, item)); 

    featureItem = zXml_Child(xml, item, "Feature"); 
    zCHECK(Go2PartFeature3d_Read(obj->feature, xml, featureItem));

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_VWrite(Go2PartPositionY  measurement, zXml xml, zXmlItem item)
{
    Go2PartPositionYClass* obj = zHANDLE_POINTER(measurement);
    zXmlItem featureItem = GO2_NULL;

    zCHECK(Go2PartMeasurement_VWrite(measurement, xml, item)); 
    zCHECK(zXml_AddItem(xml, item, "Feature", &featureItem));
    zCHECK(Go2PartFeature3d_Write(obj->feature, xml, featureItem));


    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_SetId(Go2PartPositionY measurement, Go2UInt32 id)
{
    return Go2Measurement_SetId(measurement, id); 
}

GO2_EXPORT(Go2UInt32) Go2PartPositionY_Id(Go2PartPositionY measurement)
{
    return Go2Measurement_Id(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_SetName(Go2PartPositionY measurement, const Go2Char* name)
{
    return Go2Measurement_SetName(measurement, name); 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_Name(Go2PartPositionY measurement, Go2Char* name, Go2UInt32 capacity)
{
    return Go2Measurement_Name(measurement, name, capacity); 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_SetDecisionMin(Go2PartPositionY measurement, Go2Double min)
{
    return Go2Measurement_SetDecisionMin(measurement, min); 
}

GO2_EXPORT(Go2Double) Go2PartPositionY_DecisionMin(Go2PartPositionY measurement)
{
    return Go2Measurement_DecisionMin(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_SetDecisionMax(Go2PartPositionY measurement, Go2Double max)
{
    return Go2Measurement_SetDecisionMax(measurement, max); 
}

GO2_EXPORT(Go2Double) Go2PartPositionY_DecisionMax(Go2PartPositionY measurement)
{
    return Go2Measurement_DecisionMax(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartPositionY_EnableHold(Go2PartPositionY measurement, Go2Bool enable)
{
    return Go2Measurement_EnableHold(measurement, enable);  
} 

GO2_EXPORT(Go2Bool) Go2PartPositionY_HoldEnabled(Go2PartPositionY measurement)
{
    return Go2Measurement_HoldEnabled(measurement);  
}

GO2_EXPORT(Go2Status) Go2PartPositionY_EnableSmoothing(Go2PartPositionY measurement, Go2Bool enable)
{
    return Go2Measurement_EnableSmoothing(measurement, enable);  
} 

GO2_EXPORT(Go2Bool) Go2PartPositionY_SmoothingEnabled(Go2PartPositionY measurement)
{
    return Go2Measurement_SmoothingEnabled(measurement);  
} 

GO2_EXPORT(Go2UInt32) Go2PartPositionY_SmoothingWindowMin(Go2PartPositionY measurement)
{
    return Go2Measurement_SmoothingWindowMin(measurement);  
} 

GO2_EXPORT(Go2UInt32) Go2PartPositionY_SmoothingWindowMax(Go2PartPositionY measurement)
{
    return Go2Measurement_SmoothingWindowMax(measurement);  
} 

GO2_EXPORT(Go2Status) Go2PartPositionY_SetSmoothingWindow(Go2PartPositionY measurement, Go2UInt32 window)
{
    return Go2Measurement_SetSmoothingWindow(measurement, window);  
} 

GO2_EXPORT(Go2UInt32) Go2PartPositionY_SmoothingWindow(Go2PartPositionY measurement)
{
    return Go2Measurement_SmoothingWindow(measurement);  
} 

GO2_EXPORT(Go2PartFeature3d) Go2PartPositionY_Feature( Go2PartPositionY measurement )
{
    Go2PartPositionYClass* obj = zHANDLE_POINTER(measurement); 
    return obj->feature;      
}

GO2_EXPORT(Go2Status) Go2PartPositionY_SetScale(Go2PartPositionY measurement, Go2Double scale){
    return Go2Measurement_SetScale(measurement, scale);
}

GO2_EXPORT(Go2Double) Go2PartPositionY_Scale(Go2PartPositionY measurement){
    return Go2Measurement_Scale(measurement);
}

GO2_EXPORT(Go2Status) Go2PartPositionY_SetOffset(Go2PartPositionY measurement, Go2Double offset){
    return Go2Measurement_SetOffset(measurement, offset);
}

GO2_EXPORT(Go2Double) Go2PartPositionY_Offset(Go2PartPositionY measurement){
    return Go2Measurement_Offset(measurement);
}

GO2_EXPORT(Go2Status) Go2PartPositionY_EnableLink(Go2PartPositionY measurement, Go2Bool enable)  
{
    return Go2Measurement_EnableLink(measurement, enable);  
}

GO2_EXPORT(Go2Bool) Go2PartPositionY_LinkEnabled(Go2PartPositionY measurement)  
{
    return Go2Measurement_LinkEnabled(measurement);  
}

GO2_EXPORT(Go2Status) Go2PartPositionY_SetLink(Go2PartPositionY measurement, Go2UInt32 link) 
{
    return Go2Measurement_SetLink(measurement, link); 
}

GO2_EXPORT(Go2UInt32) Go2PartPositionY_Link(Go2PartPositionY measurement) 
{
    return Go2Measurement_Link(measurement); 
}

GO2_EXPORT(Go2UInt32) Go2PartPositionY_LinkOptionCount(Go2PartPositionY measurement)
{
    return Go2Measurement_LinkOptionCount(measurement);
}

GO2_EXPORT(Go2UInt32) Go2PartPositionY_LinkOptionAt(Go2PartPositionY measurement, Go2UInt32 index)
{
    return Go2Measurement_LinkOptionAt(measurement, index);
}
