/*
 * Go2PartArea.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/zGo2PartArea.h>
#include <z/zGo2PartTypes.h>
#include <z/zGo2System.h>
#include <string.h>

/*
 * Go2PartArea Class 
 */

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

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

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

    *measurement = output; 

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartArea_Init(Go2PartArea measurement, Go2UInt32 id, Go2Object system)
{
    Go2PartAreaClass* obj = zHANDLE_POINTER(measurement);

    zCHECK(Go2PartMeasurement_Init(measurement, GO2_TYPE_PART_AREA, id, system)); 

    obj->Read = Go2PartArea_VRead; 
    obj->Write = Go2PartArea_VWrite; 
    
    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartArea_VRead(Go2PartArea measurement, zXml xml, zXmlItem item)
{
    Go2PartAreaClass* obj = zHANDLE_POINTER(measurement);
    
    zCHECK(Go2PartMeasurement_VRead(measurement, xml, item)); 
    zCHECK(zXml_Child32s(xml, item, "RegionEnabled", &obj->regionEnabled));

    return GO2_OK;
}

GO2_EXPORT(Go2Status) Go2PartArea_VWrite(Go2PartArea measurement, zXml xml, zXmlItem item)
{
    Go2PartAreaClass* obj = zHANDLE_POINTER(measurement);

    zCHECK(Go2PartMeasurement_VWrite(measurement, xml, item)); 
    zCHECK(zXml_SetChild32s(xml, item, "RegionEnabled", obj->regionEnabled)); 

    return GO2_OK;
}

GO2_EXPORT(Go2Status) Go2PartArea_SetId(Go2PartArea measurement, Go2UInt32 id)
{
    return Go2Measurement_SetId(measurement, id); 
}

GO2_EXPORT(Go2UInt32) Go2PartArea_Id(Go2PartArea measurement)
{
    return Go2Measurement_Id(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartArea_SetName(Go2PartArea measurement, const Go2Char* name)
{
    return Go2Measurement_SetName(measurement, name); 
}

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

GO2_EXPORT(Go2Double) Go2PartArea_DecisionMin(Go2PartArea measurement)
{
    return Go2Measurement_DecisionMin(measurement); 
}

GO2_EXPORT(Go2Double) Go2PartArea_DecisionMax(Go2PartArea measurement)
{
    return Go2Measurement_DecisionMax(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartArea_SetDecisionMin(Go2PartArea measurement, Go2Double min)
{
    return Go2Measurement_SetDecisionMin(measurement, min); 
}

GO2_EXPORT(Go2Status) Go2PartArea_SetDecisionMax(Go2PartArea measurement, Go2Double max)
{
    return Go2Measurement_SetDecisionMax(measurement, max); 
}

GO2_EXPORT(Go2Status) Go2PartArea_EnableHold(Go2PartArea measurement, Go2Bool enable)
{
    return Go2Measurement_EnableHold(measurement, enable);  
} 

GO2_EXPORT(Go2Bool) Go2PartArea_HoldEnabled(Go2PartArea measurement)
{
    return Go2Measurement_HoldEnabled(measurement);  
}

GO2_EXPORT(Go2Status) Go2PartArea_EnableSmoothing(Go2PartArea measurement, Go2Bool enable)
{
    return Go2Measurement_EnableSmoothing(measurement, enable);  
} 

GO2_EXPORT(Go2Bool) Go2PartArea_SmoothingEnabled(Go2PartArea measurement)
{
    return Go2Measurement_SmoothingEnabled(measurement);  
} 

GO2_EXPORT(Go2UInt32) Go2PartArea_SmoothingWindowMin(Go2PartArea measurement)
{
    return Go2Measurement_SmoothingWindowMin(measurement);  
} 

GO2_EXPORT(Go2UInt32) Go2PartArea_SmoothingWindowMax(Go2PartArea measurement)
{
    return Go2Measurement_SmoothingWindowMax(measurement);  
} 

GO2_EXPORT(Go2Status) Go2PartArea_SetSmoothingWindow(Go2PartArea measurement, Go2UInt32 window)
{
    return Go2Measurement_SetSmoothingWindow(measurement, window);  
} 

GO2_EXPORT(Go2UInt32) Go2PartArea_SmoothingWindow(Go2PartArea measurement)
{
    return Go2Measurement_SmoothingWindow(measurement);  
} 

GO2_EXPORT(Go2Status) Go2PartArea_SetScale(Go2PartArea measurement, Go2Double scale){
    return Go2Measurement_SetScale(measurement, scale);
}

GO2_EXPORT(Go2Double) Go2PartArea_Scale(Go2PartArea measurement){
    return Go2Measurement_Scale(measurement);
}

GO2_EXPORT(Go2Status) Go2PartArea_SetOffset(Go2PartArea measurement, Go2Double offset){
    return Go2Measurement_SetOffset(measurement, offset);
}

GO2_EXPORT(Go2Double) Go2PartArea_Offset(Go2PartArea measurement){
    return Go2Measurement_Offset(measurement);
}

GO2_EXPORT(Go2Status) Go2PartArea_EnableLink(Go2PartArea measurement, Go2Bool enable)  
{
    return Go2Measurement_EnableLink(measurement, enable);  
}

GO2_EXPORT(Go2Bool) Go2PartArea_LinkEnabled(Go2PartArea measurement)  
{
    return Go2Measurement_LinkEnabled(measurement);  
}

GO2_EXPORT(Go2Status) Go2PartArea_SetLink(Go2PartArea measurement, Go2UInt32 link) 
{
    return Go2Measurement_SetLink(measurement, link); 
}

GO2_EXPORT(Go2UInt32) Go2PartArea_Link(Go2PartArea measurement) 
{
    return Go2Measurement_Link(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartArea_EnableRegion(Go2PartArea measurement, Go2Bool enable)  
{
    return Go2PartMeasurement_EnableRegion(measurement, enable);  
}

GO2_EXPORT(Go2Bool) Go2PartArea_RegionEnabled(Go2PartArea measurement)  
{
    return Go2PartMeasurement_RegionEnabled(measurement);  
}

GO2_EXPORT(Go2PartRegion3d) Go2PartArea_Region(Go2PartArea measurement)
{
    return Go2PartMeasurement_Region(measurement);
}

GO2_EXPORT(Go2UInt32) Go2PartArea_LinkOptionCount(Go2PartArea measurement)
{
    return Go2Measurement_LinkOptionCount(measurement);
}

GO2_EXPORT(Go2UInt32) Go2PartArea_LinkOptionAt(Go2PartArea measurement, Go2UInt32 index)
{
    return Go2Measurement_LinkOptionAt(measurement, index);
}
