
''' Generated by OTF2 Template Engine '''

import ctypes

from .Config import conf, StrParam
from .ErrorCodes import ErrorCode, HandleErrorCode
from .GeneralDefinitions import *
from .AttributeList import AttributeList


class EventSizeEstimator(ctypes.Structure):
    pass

def EventSizeEstimator_New():
    c_New = conf.lib.OTF2_EventSizeEstimator_New
    c_New.argtypes = []
    c_New.restype = ctypes.POINTER(EventSizeEstimator)
    # NOTE: Do not errcheck here. This function returns a value, not an error code
    return c_EventSizeEstimator_New()

def EventSizeEstimator_Delete(estimator):
    c_Delete = conf.lib.OTF2_EventSizeEstimator_Delete
    c_Delete.argtypes = [ ctypes.POINTER(EventSizeEstimator) ]
    c_Delete.restype = ErrorCode
    c_Delete.errcheck = HandleErrorCode
    c_Delete(estimator)

@otf2 for entry in MappingType.entries:
def EventSizeEstimator_SetNumberOf@@entry.def.ref_name@@Definitions(estimator, numberOf@@entry.def.ref_name@@Definitions):
    c_SetNumberOf@@entry.def.ref_name@@Definitions = conf.lib.OTF2_EventSizeEstimator_SetNumberOf@@entry.def.ref_name@@Definitions
    c_SetNumberOf@@entry.def.ref_name@@Definitions.argtypes = [ ctypes.POINTER(EventSizeEstimator), @@entry.def.self_attr.type.py_argtype@@ ]
    c_SetNumberOf@@entry.def.ref_name@@Definitions.restype = ErrorCode
    c_SetNumberOf@@entry.def.ref_name@@Definitions.errcheck = HandleErrorCode
    c_SetNumberOf@@entry.def.ref_name@@Definitions(estimator, numberOf@@entry.def.ref_name@@Definitions)

@otf2 endfor
def EventSizeEstimator_GetDefChunkSize(estimator):
    c_GetDefChunkSize = conf.lib.OTF2_EventSizeEstimator_GetDefChunkSize
    c_GetDefChunkSize.argtypes = [ ctypes.POINTER(EventSizeEstimator) ]
    c_GetDefChunkSize.restype = ctypes.c_size_t
    return c_GetDefChunkSize(estimator)

def EventSizeEstimator_GetSizeOfTimestamp(estimator):
    c_GetSizeOfTimestamp = conf.lib.OTF2_EventSizeEstimator_GetSizeOfTimestamp
    c_GetSizeOfTimestamp.argtypes = [ ctypes.POINTER(EventSizeEstimator) ]
    c_GetSizeOfTimestamp.restype = ctypes.c_size_t
    return c_EventSizeEstimator_GetSizeOfTimestamp(estimator)

def EventSizeEstimator_GetSizeOfAttributeList(estimator, attributeList):
    c_GetSizeOfAttributeList = conf.lib.OTF2_EventSizeEstimator_GetSizeOfAttributeList
    c_GetSizeOfAttributeList.argtypes = [ ctypes.POINTER(EventSizeEstimator), ctypes.POINTER(AttributeList) ]
    c_GetSizeOfAttributeList.restype = ctypes.c_size_t
    return c_GetSizeOfAttributeList(estimator, attributeList)

@otf2 for event in events:
def EventSizeEstimator_GetSizeOf@@event.name@@Event(estimator@@event.py_funcargs(attributes=event.array_attributes, resolve_array_attributes=False)@@):
    c_GetSizeOf@@event.name@@Event = conf.lib.OTF2_EventSizeEstimator_GetSizeOf@@event.name@@Event
    c_GetSizeOf@@event.name@@Event.argtypes = [ ctypes.POINTER(EventSizeEstimator)@@event.py_funcargtypes(attributes=event.array_attributes, resolve_array_attributes=False)@@ ]
    c_GetSizeOf@@event.name@@Event.restype = ctypes.c_size_t
    return c_EventSizeEstimator_GetSizeOf@@event.name@@Event(estimator@@event.py_callargs(attributes=event.array_attributes, resolve_array_attributes=False)@@)

@otf2 endfor
__all__ = [
    'EventSizeEstimator',
    'EventSizeEstimator_New',
    'EventSizeEstimator_Delete',
    'EventSizeEstimator_GetDefChunkSize',
    'EventSizeEstimator_GetSizeOfTimestamp',
    'EventSizeEstimator_GetSizeOfAttributeList',
    @otf2 for entry in MappingType.entries:
    'EventSizeEstimator_SetNumberOf@@entry.def.ref_name@@Definitions',
    @otf2 endfor
    @otf2 for event in events:
    'EventSizeEstimator_GetSizeOf@@event.name@@Event',
    @otf2 endfor
]
