| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2019 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: EPTF_CLL_UIHandler_ChartDataTypeRingBuffer_Functions |
| // |
| // Purpose: |
| // This module contains type definitions, include statements and macro definitions |
| // for a ChartDataType type ringbuffer. THIS IS A GENERATED FILE FROM EPTF_CLL_UIHandler_ChartDataTypeRingBuffer_Functions.ttcnpp. |
| // If this file changeing, this file should be regenerated. |
| // |
| // Module depends on: |
| // EPTF_CLL_RingBuffer_Definitions |
| // |
| // Current Owner: |
| // Balazs Lugossy (eballug) |
| // |
| // Last Review Date: |
| // 2012-09-14 |
| // |
| /////////////////////////////////////////////////////////// |
| |
| |
| # 1 "EPTF_CLL_UIHandler_ChartDataTypeRingBuffer_Functions.ttcnpp" |
| # 1 "<built-in>" |
| # 1 "<command-line>" |
| # 1 "EPTF_CLL_UIHandler_ChartDataTypeRingBuffer_Functions.ttcnpp" |
| # 36 "EPTF_CLL_UIHandler_ChartDataTypeRingBuffer_Functions.ttcnpp" |
| module EPTF_CLL_UIHandler_ChartDataTypeRingBuffer_Functions |
| { |
| type record UIHandler_ChartDataType{ |
| float data, |
| float timestamp |
| } |
| |
| # 1 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" 1 |
| # 58 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| import from EPTF_CLL_RingBuffer_Definitions all; |
| # 1 "EPTF_CLL_GenericRingBuffer_Definitions.ttcnin" 1 |
| # 82 "EPTF_CLL_GenericRingBuffer_Definitions.ttcnin" |
| type record of UIHandler_ChartDataType UIHandler_ChartDataTypeList; |
| # 98 "EPTF_CLL_GenericRingBuffer_Definitions.ttcnin" |
| type record UIHandler_ChartDataTypeRingBuffer {EPTF_RingBufferStatus status, UIHandler_ChartDataTypeList data} |
| # 60 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" 2 |
| # 98 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_init( inout UIHandler_ChartDataTypeRingBuffer pl_buffer, in integer pl_capacity := c_EPTF_RB_default_capacity ) { pl_buffer.data := {}; pl_buffer.status := c_EPTF_emptyRingBufferStatus; if (pl_capacity > 0) { pl_buffer.status.capacity := pl_capacity; } f_EPTF_UIHandler_ChartDataType_RB_clear(pl_buffer) } |
| # 122 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_size( in UIHandler_ChartDataTypeRingBuffer pl_buffer ) return integer { return pl_buffer.status.content_size; } |
| # 146 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_capacity( in UIHandler_ChartDataTypeRingBuffer pl_buffer ) return integer { return pl_buffer.status.capacity; } |
| # 170 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_empty( in UIHandler_ChartDataTypeRingBuffer pl_buffer ) return boolean { return (pl_buffer.status.content_size == 0); } |
| # 198 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_front( in UIHandler_ChartDataTypeRingBuffer pl_buffer ) return UIHandler_ChartDataType { return pl_buffer.data[pl_buffer.status.head]; } |
| # 226 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_back( in UIHandler_ChartDataTypeRingBuffer pl_buffer ) return UIHandler_ChartDataType { return(pl_buffer.data[pl_buffer.status.tail]); } |
| # 262 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_push_back( inout UIHandler_ChartDataTypeRingBuffer pl_buffer, in UIHandler_ChartDataType pl_dataItem ) { f_EPTF_RB_increment_tail(pl_buffer.status); pl_buffer.data[pl_buffer.status.tail] := pl_dataItem; if (pl_buffer.status.content_size > pl_buffer.status.capacity) { f_EPTF_RB_increment_head(pl_buffer.status); } } |
| # 298 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_push_front( inout UIHandler_ChartDataTypeRingBuffer pl_buffer, in UIHandler_ChartDataType pl_dataItem ) { f_EPTF_RB_decrement_head(pl_buffer.status); pl_buffer.data[pl_buffer.status.head] := pl_dataItem; if (pl_buffer.status.content_size > pl_buffer.status.capacity) { f_EPTF_RB_decrement_tail(pl_buffer.status); } } |
| # 327 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_pop_front( inout UIHandler_ChartDataTypeRingBuffer pl_buffer ) { if (pl_buffer.status.content_size != 0) { f_EPTF_RB_increment_head(pl_buffer.status); } } |
| # 356 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_pop_back( inout UIHandler_ChartDataTypeRingBuffer pl_buffer ) { if (pl_buffer.status.content_size != 0) { f_EPTF_RB_decrement_tail(pl_buffer.status); } } |
| # 382 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_clear( inout UIHandler_ChartDataTypeRingBuffer pl_buffer ) { pl_buffer.status.head := 0; pl_buffer.status.tail := pl_buffer.status.capacity - 1; pl_buffer.status.content_size := 0; } |
| # 414 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_get( in UIHandler_ChartDataTypeRingBuffer pl_buffer, in integer pl_index ) return UIHandler_ChartDataType { return( pl_buffer.data[ (pl_buffer.status.head + pl_index) mod pl_buffer.status.capacity ] );} |
| # 453 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_at( in UIHandler_ChartDataTypeRingBuffer pl_buffer, in integer pl_index, out UIHandler_ChartDataType pl_dataItem ) return boolean { if (pl_index < 0 or pl_index >= f_EPTF_UIHandler_ChartDataType_RB_size(pl_buffer)) { return false; } pl_dataItem := f_EPTF_UIHandler_ChartDataType_RB_get(pl_buffer, pl_index); return true; } |
| # 484 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| public function f_EPTF_UIHandler_ChartDataType_RB_dump( in UIHandler_ChartDataTypeRingBuffer pl_buffer, out UIHandler_ChartDataTypeList pl_dest ) { pl_dest:= {}; for (var integer i:=0; i<pl_buffer.status.content_size; i:= i+1) { pl_dest[i] := pl_buffer.data[(pl_buffer.status.head + i) mod pl_buffer.status.capacity]; } } |
| # 503 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| private function f_EPTF_RB_increment_tail( inout EPTF_RingBufferStatus pl_status ) |
| { |
| pl_status.content_size := pl_status.content_size + 1; |
| pl_status.tail := (pl_status.tail + 1) mod pl_status.capacity; |
| } |
| # 525 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| private function f_EPTF_RB_increment_head( inout EPTF_RingBufferStatus pl_status ) |
| { |
| pl_status.head := (pl_status.head + 1) mod pl_status.capacity; |
| pl_status.content_size := pl_status.content_size - 1; |
| } |
| # 547 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| private function f_EPTF_RB_decrement_tail( inout EPTF_RingBufferStatus pl_status ) |
| { |
| pl_status.tail := (pl_status.tail - 1) mod pl_status.capacity; |
| pl_status.content_size := pl_status.content_size - 1; |
| } |
| # 566 "EPTF_CLL_GenericRingBuffer_Functions.ttcnin" |
| private function f_EPTF_RB_decrement_head( inout EPTF_RingBufferStatus pl_status ) |
| { |
| pl_status.content_size := pl_status.content_size + 1; |
| pl_status.head := (pl_status.head - 1) mod pl_status.capacity; |
| } |
| # 44 "EPTF_CLL_UIHandler_ChartDataTypeRingBuffer_Functions.ttcnpp" 2 |
| |
| } |