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

/*
 * Go2PartVolume Class 
 */

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

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

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

    *measurement = output; 

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartVolume_Init(Go2PartVolume measurement, Go2UInt32 id, Go2Object system)
{
    Go2PartVolumeClass* obj = zHANDLE_POINTER(measurement);

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

    obj->Read = Go2PartVolume_VRead;
    obj->Write = Go2PartVolume_VWrite;

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartVolume_VRead(Go2PartVolume measurement, zXml xml, zXmlItem item)
{
    Go2PartVolumeClass* obj = zHANDLE_POINTER(measurement);

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

    zCHECK(zXml_Child32s(xml, item, "RegionEnabled", &obj->regionEnabled)); 

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartVolume_VWrite(Go2PartVolume measurement, zXml xml, zXmlItem item)
{
    Go2PartVolumeClass* obj = zHANDLE_POINTER(measurement);

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

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

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartVolume_SetId(Go2PartVolume measurement, Go2UInt32 id)
{
    return Go2Measurement_SetId(measurement, id); 
}

GO2_EXPORT(Go2UInt32) Go2PartVolume_Id(Go2PartVolume measurement)
{
    return Go2Measurement_Id(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartVolume_SetName(Go2PartVolume measurement, const Go2Char* name)
{
    return Go2Measurement_SetName(measurement, name); 
}

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

GO2_EXPORT(Go2Status) Go2PartVolume_SetDecisionMin(Go2PartVolume measurement, Go2Double min)
{
    return Go2Measurement_SetDecisionMin(measurement, min); 
}

GO2_EXPORT(Go2Double) Go2PartVolume_DecisionMin(Go2PartVolume measurement)
{
    return Go2Measurement_DecisionMin(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartVolume_SetDecisionMax(Go2PartVolume measurement, Go2Double max)
{
    return Go2Measurement_SetDecisionMax(measurement, max); 
}

GO2_EXPORT(Go2Double) Go2PartVolume_DecisionMax(Go2PartVolume measurement)
{
    return Go2Measurement_DecisionMax(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartVolume_EnableHold(Go2PartVolume measurement, Go2Bool enable)
{
    return Go2Measurement_EnableHold(measurement, enable);  
} 

GO2_EXPORT(Go2Bool) Go2PartVolume_HoldEnabled(Go2PartVolume measurement)
{
    return Go2Measurement_HoldEnabled(measurement);  
}

GO2_EXPORT(Go2Status) Go2PartVolume_EnableSmoothing(Go2PartVolume measurement, Go2Bool enable)
{
    return Go2Measurement_EnableSmoothing(measurement, enable);  
} 

GO2_EXPORT(Go2Bool) Go2PartVolume_SmoothingEnabled(Go2PartVolume measurement)
{
    return Go2Measurement_SmoothingEnabled(measurement);  
} 

GO2_EXPORT(Go2UInt32) Go2PartVolume_SmoothingWindowMin(Go2PartVolume measurement)
{
    return Go2Measurement_SmoothingWindowMin(measurement);  
} 

GO2_EXPORT(Go2UInt32) Go2PartVolume_SmoothingWindowMax(Go2PartVolume measurement)
{
    return Go2Measurement_SmoothingWindowMax(measurement);  
} 

GO2_EXPORT(Go2Status) Go2PartVolume_SetSmoothingWindow(Go2PartVolume measurement, Go2UInt32 window)
{
    return Go2Measurement_SetSmoothingWindow(measurement, window);  
} 

GO2_EXPORT(Go2UInt32) Go2PartVolume_SmoothingWindow(Go2PartVolume measurement)
{
    return Go2Measurement_SmoothingWindow(measurement);  
} 



GO2_EXPORT(Go2Status) Go2PartVolume_SetScale(Go2PartVolume measurement, Go2Double scale){
    return Go2Measurement_SetScale(measurement, scale);
}

GO2_EXPORT(Go2Double) Go2PartVolume_Scale(Go2PartVolume measurement){
    return Go2Measurement_Scale(measurement);
}

GO2_EXPORT(Go2Status) Go2PartVolume_SetOffset(Go2PartVolume measurement, Go2Double offset){
    return Go2Measurement_SetOffset(measurement, offset);
}

GO2_EXPORT(Go2Double) Go2PartVolume_Offset(Go2PartVolume measurement){
    return Go2Measurement_Offset(measurement);
}

GO2_EXPORT(Go2Status) Go2PartVolume_EnableLink(Go2PartVolume measurement, Go2Bool enable)  
{
    return Go2Measurement_EnableLink(measurement, enable);  
}

GO2_EXPORT(Go2Bool) Go2PartVolume_LinkEnabled(Go2PartVolume measurement)  
{
    return Go2Measurement_LinkEnabled(measurement);  
}

GO2_EXPORT(Go2Status) Go2PartVolume_SetLink(Go2PartVolume measurement, Go2UInt32 link) 
{
    return Go2Measurement_SetLink(measurement, link); 
}

GO2_EXPORT(Go2UInt32) Go2PartVolume_Link(Go2PartVolume measurement) 
{
    return Go2Measurement_Link(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartVolume_EnableRegion(Go2PartVolume measurement, Go2Bool enable)  
{
    return Go2PartMeasurement_EnableRegion(measurement, enable);  
}

GO2_EXPORT(Go2Bool) Go2PartVolume_RegionEnabled(Go2PartVolume measurement)  
{
    return Go2PartMeasurement_RegionEnabled(measurement);  
}

GO2_EXPORT(Go2PartRegion3d) Go2PartVolume_Region(Go2PartVolume measurement)
{
    return Go2PartMeasurement_Region(measurement);
}

GO2_EXPORT(Go2UInt32) Go2PartVolume_LinkOptionCount(Go2PartVolume measurement)
{
    return Go2Measurement_LinkOptionCount(measurement);
}

GO2_EXPORT(Go2UInt32) Go2PartVolume_LinkOptionAt(Go2PartVolume measurement, Go2UInt32 index)
{
    return Go2Measurement_LinkOptionAt(measurement, index);
}
