wcskipst.gml
来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 801 行 · 第 1/2 页
GML
801 行
.MONO WC&lpref.SkipList
object which is a copy of the passed list.
:SALSO.
:SAL typ='fun'.operator~b=
:SAL typ='omtyp' ocls='WCExcept'.out_of_memory
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF cltype='WC&lpref.SkipList<Type>' fmt='dtor' prot='public'.~~WC&lpref.SkipList
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
:SNPCD cd_idx='d'.virtual ~~WC&lpref.SkipList();
:eSNPL.
:SMTICS.
The
.MONO WC&lpref.SkipList<Type>
destructor is the destructor for the
.MONO WC&lpref.SkipList
class.
If the number of elements is not zero and the
.MONO not_empty
.ix not_empty exception
exception is enabled, the exception is thrown.
Otherwise, the list elements are cleared using the
.MONO clear
member function.
.if &lpref. eq Ptr .do begin
The objects which the list elements point to are not deleted unless the
.MONO clearAndDestroy
member function is explicitly called before the destructor is called.
.do end
The call to the
.MONO WC&lpref.SkipList<Type>
destructor is inserted implicitly by the compiler
at the point where the
.MONO WC&lpref.SkipList
object goes out of scope.
:RSLTS.
The call to the
.MONO WC&lpref.SkipList<Type>
destructor destroys a
.MONO WC&lpref.SkipList
object.
:SALSO.
:SAL typ='fun'.clear
.if &lpref. eq Ptr .do begin
:SAL typ='fun'.clearAndDestroy
.do end
:SAL typ='omtyp' ocls='WCExcept'.not_empty
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.clear
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
:SNPF index='clear' .void clear();
:eSNPL.
:SMTICS.
The &fn. is used to clear the list so that it has no entries.
.if &lpref. eq Val .do begin
Elements stored in the list are destroyed using
the destructors of
.MONO Type.
.do end
.el .do begin
Objects pointed to by the list elements are not deleted.
.do end
The list object is not destroyed and re-created by this function, so
the object destructor is not invoked.
:RSLTS.
The &fn. clears the list to have no elements.
:SALSO.
:SAL typ='dtor'
.if &lpref. eq Ptr .do begin
:SAL typ='fun'.clearAndDestroy
.do end
:SAL typ='fun'.operator~b=
:eSALSO.
:eLIBF.
.if &lpref. eq Ptr .do begin
:CMT.======================================================================
:LIBF fmt='mfun' cllong='yes' prot='public'.clearAndDestroy
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
:SNPF index='clearAndDestroy' .void clearAndDestroy();
:eSNPL.
:SMTICS.
The &fn. is used to clear the list and delete
the objects pointed to by the list elements.
The list object is not destroyed and re-created by this function, so
the list object destructor is not invoked.
:RSLTS.
The &fn. clears the list by deleting the objects pointed to by the
list elements, and then removing the list elements from the list.
:SALSO.
:SAL typ='fun'.clear
:eSALSO.
:eLIBF.
.do end
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.contains
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
.if &lpref. eq Val .do begin
:SNPF index='contains' .int contains( const Type & ) const;
.do end
.el .do begin
:SNPF index='contains' .int contains( const Type * ) const;
.do end
:eSNPL.
:SMTICS.
The &fn.
returns non-zero if the element is stored in
the list, or zero if there is no equivalent element.
:INCLUDE file='_valequ.gml'
:RSLTS.
The &fn. returns a non-zero value if the element is found in the list.
:SALSO.
:SAL typ='fun'.find
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.entries
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
:SNPF index='entries' .unsigned entries() const;
:eSNPL.
:SMTICS.
The &fn. is used to return the current number of elements
stored in the list.
:RSLTS.
The &fn. returns the number of elements in the list.
:SALSO.
:SAL typ='fun'.isEmpty
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.find
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
.if &lpref. eq Val .do begin
:SNPF index='find' .int find( const Type &, Type & ) const;
.do end
.el .do begin
:SNPF index='find' .Type * find( const Type * ) const;
.do end
:eSNPL.
:SMTICS.
The &fn. is used to find an element with an equivalent value in the list.
If an equivalent element is found,
.if &lpref. eq Val .do begin
a non-zero value
.do end
.el .do begin
a pointer to the element
.do end
is returned.
.if &lpref. eq Val .do begin
The reference to the element
passed as the second argument is assigned the found element's value.
.do end
Zero is returned if the element is not found.
:INCLUDE file='_valequ.gml'
:RSLTS.
The element equivalent to the passed value is located in the list.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.forAll
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
.if &lpref. eq Val .do begin
:SNPF index='forAll' .void forAll(
:SNPFLF . void (*user_fn)( Type, void * ),
:SNPFLF . void * );
.do end
.el .do begin
:SNPF index='forAll' .void forAll(
:SNPFLF . void (*user_fn)( Type *, void * ),
:SNPFLF . void * );
.do end
:eSNPL.
:SMTICS.
The &fn. causes the user supplied function to be invoked for every value
in the list.
The user function has the prototype
:XMPL.
.if &lpref. eq Val .do begin
void user_func( Type & value, void * data );
.do end
.el .do begin
void user_func( Type * value, void * data );
.do end
:eXMPL.
As the elements are visited, the user function is invoked with the
element passed as the first.
The second parameter of the
.MONO forAll
function is passed as the second parameter to the user function.
This value can be used to pass any appropriate data from the main code to the
user function.
:RSLTS.
The elements in the list are all visited, with the user function
being invoked for each one.
:SALSO.
:SAL typ='fun'.find
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.insert
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
.if &lpref. eq Val .do begin
:SNPF index='insert' .int insert( const Type & );
.do end
.el .do begin
:SNPF index='insert' .int insert( Type * );
.do end
:eSNPL.
:SMTICS.
The &fn. inserts
a value into the list.
If allocation of the
node to store the value fails, then the
.MONO out_of_memory
.ix out_of_memory exception
exception is thrown if it is enabled.
If the exception is not enabled, the insert will not be completed.
:P.
With a
.MONO WC&lpref.SkipListSet,
there must be only one equivalent element in the set.
If an element equivalent to the inserted element is already
in the list set, the list set will remain unchanged, and the
.MONO not_unique
.ix not_unique exception
exception is thrown if it is enabled.
If the exception is not enabled, the insert will not be completed.
:RSLTS.
The &fn. inserts a value into the list.
If the insert is successful, a non-zero will returned.
A zero will be returned if the insert fails.
:SALSO.
:SAL typ='fun'.operator~b=
:SAL typ='omtyp' ocls='WCExcept'.out_of_memory
:SAL typ='omtyp' ocls='WCExcept'.not_unique
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.isEmpty
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
:SNPF index='isEmpty' .int isEmpty() const;
:eSNPL.
:SMTICS.
The &fn. is used to determine if the list is empty.
:RSLTS.
The &fn. returns zero if it contains at least one entry,
non-zero if the list is empty.
:SALSO.
:SAL typ='fun'.entries
:eSALSO.
:eLIBF.
:CMT.======================================================================
:LIBF cltype='WC&lpref.SkipList<Type>' fmt='mfun' prot='public'.occurrencesOf
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
.if &lpref. eq Val .do begin
:SNPF index='occurrencesOf' .unsigned occurrencesOf( const Type & ) const;
.do end
.el .do begin
:SNPF index='occurrencesOf' .unsigned occurrencesOf( const Type * ) const;
.do end
:eSNPL.
:SMTICS.
The &fn. is used to return the current number of elements
stored in the list which are equivalent to the passed value.
:INCLUDE file='_valequ.gml'
:RSLTS.
The &fn. returns the number of elements in the list which are
equivalent to the passed value.
:SALSO.
:SAL typ='fun'.entries
:SAL typ='fun'.find
:SAL typ='fun'.isEmpty
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.operator =
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
:SNPF index='operator =' .WC&lpref.SkipList & operator =( const WC&lpref.SkipList & );
:SNPF index='operator =' .WC&lpref.SkipListSet & operator =( const WC&lpref.SkipListSet & );
:eSNPL.
:SMTICS.
The &fn. is the assignment operator for the &cls.:PERIOD.
The left hand side list is first cleared using the
.MONO clear
member function, and then the right hand side list is copied.
The list function, exception trap states, and all of the list
elements are copied.
If there is not enough memory to copy all of
the values or pointers in the list, then only some will be copied, and the
.MONO out_of_memory
.ix out_of_memory exception
exception is thrown if it is enabled.
The number of entries will correctly reflect the number copied.
:RSLTS.
The &fn. assigns the left hand side list to be a copy of the
right hand side.
:SALSO.
:SAL typ='fun'.clear
:SAL typ='omtyp' ocls='WCExcept'.out_of_memory
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public'.operator ==
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
:SNPF index='operator =='.int operator ==( const WC&lpref.SkipList & ) const;
:SNPF index='operator =='.int operator ==( const WC&lpref.SkipListSet & ) const;
:eSNPL.
:SMTICS.
The &fn. is the equivalence operator for the &cls.:PERIOD.
Two list objects are equivalent if they are the same object and share the
same address.
:RSLTS.
A TRUE (non-zero) value is returned if the left hand side and right
hand side list are the same object. A FALSE (zero) value is returned
otherwise.
:eLIBF.
:CMT.======================================================================
:LIBF fmt='mfun' prot='public'.remove
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
.if &lpref. eq Val .do begin
:SNPF index='remove' .int remove( const Type & );
.do end
.el .do begin
:SNPF index='remove' .Type * remove( const Type * );
.do end
:eSNPL.
:SMTICS.
The &fn. is used to remove the specified element from the list.
If an equivalent element is found,
.if &lpref. eq Val .do begin
a non-zero
.do end
.el .do begin
the pointer
.do end
value is returned.
Zero is returned if the element is not found.
If the list is a
.MONO WC&lpref.SkipList
and there is more than one element equivalent to the specified
element, then the last equivalent element added to the
.MONO WC&lpref.SkipList
is removed.
:INCLUDE file='_valequ.gml'
:RSLTS.
The element is removed from the list.
:eLIBF.
:CMT.======================================================================
:LIBF cltype='WC&lpref.SkipList<Type>' fmt='mfun' prot='public'.removeAll
:SNPL.
:SNPFLF .#include <wcskip.h>
:SNPFLF .public:
.if &lpref. eq Val .do begin
:SNPF index='removeAll' .unsigned removeAll( const Type & );
.do end
.el .do begin
:SNPF index='removeAll' .unsigned removeAll( const Type * );
.do end
:eSNPL.
:SMTICS.
The &fn. is used to remove all elements equivalent to the
specified element from the list.
Zero is returned if no equivalent elements are found.
:INCLUDE file='_valequ.gml'
:RSLTS.
All equivalent elements are removed from the list.
:eLIBF.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?