Wide Studio Object Reference

Wide Studio Home
Up to


Class Name

WSClistData

Methods

  • WSClistData();   :WSClistData
  • WSClistData(long);   :WSClistData
  • WSClistData(WSClistData &);   :WSClistData
  • long add(void* data,long pos=-1);   :WSClistData
  • void setData(long pos,void* data);   :WSClistData
  • void* getData(long pos);   :WSClistData
  • long getNum();   :WSClistData
  • void** getBuf();   :WSClistData
  • long del(void*);   :WSClistData
  • long delPos(long pos);   :WSClistData
  • void clear();   :WSClistData
  • WSClistData & operator = (WSClistData &);   :WSClistData
  • void* & operator[] (long pos);   :WSClistData


Specification of methods



WSClistData method

Form
WSClistData()
Function
This is the constructor of WSClistData. Creates a instance.
Description
Parameters
Nothing.
Return value
Returns a new instance.
Notice



WSClistData method

Form
WSClistData(long segment_size)
Function
This is the constructor of WSClistData. Creates a instance which has specified segment size. The segment size is the memory size to add. If you manage a lot of data, add and remove many times, large size is better. The default is 16 which can contain 16 pointers.
Description
Parameters
(in)long segment_size the segment size

Return value
Returns a new instance.
Notice
If specified the size is minus, 256 or more, adjusts to 255.



add method

Form
long add(void* data,long pos = -1)
Function
Adds the data into the specified position.
Description
If you do not specify the position or specify -1, it adds the data into bottom of the list. if you specify a position, it pushes(not replace) the data into there.
Parameters
(in)void* data the data
(in)long pos the position to add(top:0,..,N,-1:bottom

Return value
0
Notice
If the position is larger than the number:N of the list, it adds the data to the bottom.



setData method

Form
void setData(long pos,void* data)
Function
Replaces the data of the specified position.
Description
Parameters
(in)long pos
(in)long pos the position to replace(top:0,..,N-1,-1:bottom
(in)void* data the data

Return value
Nothing.
Notice
If the position is larger than the number:N-1 of the list, it ignores.



getData method

Form
void* getData(long pos)
Function
Returns the value of the specified position.
Description
Parameters
(in)long pos the position to replace(top:0,..,N-1,-1:bottom

Return value
Returns the value.
Notice
If the position is larger than the number:N-1 of the list, it returns NULL.



getNum method

Form
long getNum()
Function
Returns the number of data which the list contains.
Description
Parameters
Nothing.
Return value
Returns the number of data:N.
Notice



getBuf method

Form
void** getBuf()
Function
Returns the data buffer which the list contains.
Description
Parameters
Nothing.
Return value
Returns the data buffer.
Notice
Do not delete the return value.



del method

Form
long del(void*)
Function
Removes the value from the list.
Description
Parameters
(in)void* data the value

Return value
Returns 0 if it suceeded; returns -1 if it failed.
Notice
If several values exit, removes first one.



delPos method

Form
long delPos(long pos)
Function
Removes the data of the specified position.
Description
Removes the bottom one, if specified -1.
Parameters
(in)long pos the position (top:0,..,N-1,-1:bottom)

Return value
Returns 0 if it suceeded; returns -1 if it failed.
Notice



clear method

Form
void clear()
Function
Clears the data buffer,
Description
becomes no data is contained.
Parameters
Nothing.
Return value
Nothing.
Notice



= operator

Form
WSClistData & operator = (WSClistData &)
Function
Copies the list.
Description
Parameters
(in)WSClistData & src the list of source

Return value
Notice



[]operator

Form
void* & operator[](long pos)
Function
Return the data of the specified position. It seems like the elements of a array.
Description
Parameters
(in)long pos the position(top:0,..,N-1)

Return value
Return the data.
Notice
For example:
  WSClistData list();
  list.add( (void*)100 );
  list.add( (void*)200 );
      :
  void* d0 = list[0]; //same as list.getData(0) 
  void* d1 = list[1]; //same as list.getData(1)


Document Release 1.0

For Use with Wide Studio Release 1.0, Summer 2000


Wide Stuido Home | Up to

Copyright(C) T. Hirabayashi, 2000 Last modified: July 01, 2000