// // wcsibase.h Base Class Definitions for the WATCOM Container Skip List // Iterator Classes // // ========================================================================= // // Open Watcom Project // // Copyright (c) 2002-2010 Open Watcom Contributors. All Rights Reserved. // Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. // // This file is automatically generated. Do not edit directly. // // ========================================================================= // #ifndef _WCSIBASE_H_INCLUDED #define _WCSIBASE_H_INCLUDED #ifndef _ENABLE_AUTODEPEND #pragma read_only_file; #endif #ifndef __cplusplus #error This header file requires C++ #endif #ifndef _WCEXCEPT_H_INCLUDED #include #endif // // The WCSkipListIterBase is the base iterator class for all skip list // iterators. // // Objects of this type should never be instantiated: use the appropriate // skip list iterator defined in wcskipit.h instead. // // WCIterExcept is used as a base class to provide exception handling // template class WCSkipListIterBase : public WCIterExcept { private: typedef WCSkipListPtrs * node_ptr; const WCSkipListBase *curr_skip_list; protected: node_ptr curr; private: int at_end; WCbool base_advance(); protected: inline WCSkipListNode *base_curr_node() const { if( curr != 0 ) { return( WCSkipListBase::base_whole_node( curr ) ); } else { return( 0 ); } }; public: inline WCSkipListIterBase() : curr_skip_list( 0 ) , curr( 0 ), at_end( 0 ) {}; inline WCSkipListIterBase( const WCSkipListBase& skip_list ) : curr_skip_list( &skip_list ), curr( 0 ), at_end( 0 ) {}; inline ~WCSkipListIterBase() {}; inline const WCSkipListBase *container() const { if( curr_skip_list == 0 ) { base_throw_undef_iter(); } return( curr_skip_list ); }; Type current() const; inline void reset() { curr = 0; at_end = 0; }; inline void reset( const WCSkipListBase &skip_list ) { curr_skip_list = &skip_list; reset(); }; inline WCbool operator++() { return( base_advance() ); } inline WCbool operator()() { return( base_advance() ); } }; template WCbool WCSkipListIterBase::base_advance() { if( ( curr_skip_list == 0 )||( at_end ) ) { at_end = 1; base_throw_undef_iter(); return( FALSE ); } if( curr == 0 ) { curr = curr_skip_list->header; } curr = curr->forward[ 0 ]; if( curr == 0 ) { at_end = 1; return( FALSE ); } else { return( TRUE ); } }; template Type WCSkipListIterBase::current() const { if( curr == 0 ) { base_throw_undef_item(); Type temp; return( temp ); } return( base_curr_node()->data ); }; #endif