180
Appendix A: Cosmo Basic Types
Array Storage Class Types
The array classes store data.
• csData—stores raw data.
• csArray—is a virtual array class.
• Array-derived classes—are derivations of csArray.
The following sections describe each of these array classes.
Data Class
The csData class is similar to malloc: it stores raw data. You can use the csData class
directly, such as in storing data in arrays, but it is more common to derive your own class
from it.
The methods in the class set and delete the amount of storage necessary for the data
being stored:
void* getData () const;
int getSize () const;
void operator delete (void* ptr);
void* operator new (size_t nbytes);
getData() returns a pointer to the raw bytes of the csData.
getSize() returns the size of the data.
new() creates a new csData containing nbytes bytes.
delete() deallocates the object created by the new() method.