The ICnrAllocator class allocates and manages multiple IContainerObject objects that can be added to an IContainerControl. ICnrAllocator allows you to create an unlimited number of objects at once and then add all of them to a container with one call. This method of allocating and inserting multiple container objects greatly reduces the time it takes to load a large number of items into a container.
As items from the ICnrAllocator are added to an IContainerControl via IContainerControl::addObjects or IContainerControl::addObjectsAfter, the ICnrAllocator keeps track of all used and unused items it is managing.
The ICnrAllocator destructor frees the memory occupied by any unused objects allocated by the constructor but not added to any IContainerControl.
The Motif container widget does not allow multiple insertion of container objects with one call. The ICnrAllocator is supported but adds each object separately.
A native Windows container (that is, a container constructed without the pmCompatible style) does not allow multiple insertion of container objects with one call. The ICnrAllocator is supported but adds each object separately in this case. The pmCompatible container does insert all the objects at once.
You can construct and destruct objects of this class.
![]() |
public:
virtual ~ICnrAllocator()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
ICnrAllocator(unsigned long num, unsigned long size)
Construct the ICnrAllocator by providing the number of objects you want to allocate and the size of the object you will be adding to an IContainerControl.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These members give access to the objects allocated by ICnrAllocator.
![]() |
protected:
void* first() const
Returns the first object of the list.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
unsigned long initialized() const
Returns the number of items initialized.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
void* next(void* pRec)
Returns the object in the list which follows the object passed in.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
void* nextAvailable()
Returns the next available object that has not been initialized.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
ICnrAllocator& updateForInsert()
Updates the state of an ICnrAllocator object after IContainerControl::addObjects or IContainerControl::addObjectsAfter is called.
Windows | OS/2 | AIX |
Yes | Yes | Yes |