wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/genscanlistiterator.cpp
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of the ScanListIterator class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "genscanlist.h"
       
    20 #include "genscanlistiterator.h"
       
    21 
       
    22 // ================= MEMBER FUNCTIONS =======================
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // ---------------------------------------------------------------------------
       
    26 //
       
    27 ScanListIterator::ScanListIterator(
       
    28     const ScanList& scan_list ) :
       
    29     current_m( &scan_list.data_m[0] ),
       
    30     scan_list_m( scan_list )
       
    31     {
       
    32     }
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 const ScanFrame* ScanListIterator::First()
       
    38     {
       
    39     if ( !scan_list_m.size_m )
       
    40         {
       
    41         return NULL;
       
    42         }
       
    43 
       
    44     /**
       
    45      * Data exist, set the iterator to the beginning of the container.
       
    46      */
       
    47     current_m = &scan_list_m.data_m[0];
       
    48     return current_m;
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 const ScanFrame* ScanListIterator::Next()
       
    55     {
       
    56     if ( !scan_list_m.size_m )
       
    57         {
       
    58         return NULL;
       
    59         }
       
    60     
       
    61     current_m += ScanList::AddPadding( Size() );
       
    62     return Current();
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 const ScanFrame* ScanListIterator::Current() const
       
    69     {
       
    70     if( current_m >= scan_list_m.data_m + scan_list_m.size_m )
       
    71         {
       
    72         return NULL;
       
    73         }
       
    74 
       
    75     return current_m;
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 bool_t ScanListIterator::IsDone() const
       
    82     {
       
    83     return ( current_m >= scan_list_m.data_m + scan_list_m.size_m );
       
    84     }