ILE C/C++ Programmer's Guide

The extended_type_info Classes

Figure 333 is a code sample that uses extended_type_info classes.

The extended_type_infoclass definitions are:

size()
Size of the type represented by the extended_type_info object.

create(void*)
This function is called to create an object of the type represented by the extended_type_info object at the storage location pointed to by at.

create(void*, size_t)
This function is called to create an array of objects of the type represented by the extended_type_info object at the storage location pointed to by at. If any exceptions are thrown during construction, create() destroys the array elements that were already constructed before rethrowing the exception.

copy(void* to, const void* from)
This function is called to copy an object of the type represented by the extended_type_info object into the storage location pointed to by to, using the value of the object referred to by from.

copy(void* to, const void* from, size_t)
This function is called to copy an array of objects of the type represented by the extended_type_info object into the storage location pointed to by to, using the value of the object referred to by from. If any exceptions are thrown during construction, copy() destroys the array elements that were already constructed before rethrowing the exception.

destroy(void*)
This function is called to destroy an object of the type represented by the extended_type_info object at the storage location pointed to by at.

destroy(void*, size_t)
This function is called to destroy an array of objects of the type represented by the extended_type_info object at the storage location pointed to by at. If any exceptions are thrown during destruction, destroy() destroys the remaining array elements that were already constructed before rethrowing the exception. If another exception is encountered during the destruction of the remaining elements, destroy() calls terminate().

allocObject()
This function is called to allocate memory for an object of the type represented by the extended_type_info object. No initialization is performed. The user is expected to use the create(void*) or copy(void*, const void*) function to initialize the new memory.

allocArray(size_t)
This function is called to allocate memory for an array of objects of the type represented by the extended_type_info object. No initialization is performed. The user is expected to use the create(void*, size_t) or copy(void*, const void*, size_t) function to initialize the new memory.

deallocObject(void*)
This function is called to deallocate an object of the type represented by the extended_type_info object. No destruction is performed beforehand. The user is expected to use the destroy(void*) to terminate the object before deallocating the memory.

deallocArray(void*, size_t)
This function is called to deallocate an array of objects of the type represented by the extended_type_info object. No destruction is performed beforehand. The user is expected to use the destroy(void*, size_t) to terminate an array before deallocating the memory.

linkageInfo()
This function returns the mangled name of the class type.

Figure 333. ILE Source Showing extended_type_info Class Types


class extended_type_info : public type_info {
  public:
 ~extended_type_info();
 
    virtual size_t size() const=0;
 
    virtual void* create(void* at) const=0;  //object
    virtual void* create(void* at, size_t count) const=0; // array
 
    virtual void* copy (void* to, const void* from) const=0;  //object
    virtual void* copy (void* to, const void* from, size_t count) const=0;
    //array
 
    virtual void* destroy(void* at) const=0;  //object
    virtual void* destroy(void* at, size_t count) const=0;  //array
 
    virtual void* allocObject() const=0;  //object
    virtual void* allocArray(size_t count) const=0;  //array
 
    virtual void* deallocObject(void* at) const=0;  //object
    virtual void* deallocArray(void* at, size_t count) const=0;  //array
  };


[ Top of Page | Previous Page | Next Page | Table of Contents ]