Teamcenter C++ API Reference  2312
Public Member Functions | List of all members
Teamcenter::StringArrayFreer Struct Reference

Deallocator for an SM allocated unpacked array strings. More...

#include <ScopedPtr.hxx>

Public Member Functions

void operator() (char **bucket)
 
void operator() (const char **bucket)
 

Detailed Description

Deallocator for an SM allocated unpacked array strings.

By unpacked array, we mean that an array of pointers, where the pointer points to an array allocated separately.
Both the array of pointers and the character array should be allocated via SM API.

void allocateStringArray( char*** ptr )
{
// this allocates an SM array of pointer
// and then allocates space for each array.
}
int main()
{
// allocate an array of char* using SM.
// The pointer in the array inturn points to character array allocated using SM.
char** stringArray;
allocateStringArray( &stringArray );
// Declaring a scoped_smptr with appropriate deallocator will take care of deallocation.
scoped_ptr< char*, StringArrayFreer > myFreer( stringArray );
// Recommended usage : where possible, instead of two named variables use the scoped_ptr in the
// place of normal pointer.
scoped_ptr< char*, StringArrayFreer > stringArray2;
allocateStringArray( &stringArray2 );
char tmp = stringArray2[0][0]; // use like a normal array.
}

Definition at line 204 of file ScopedPtr.hxx.

Member Function Documentation

void Teamcenter::StringArrayFreer::operator() ( char **  bucket)
inline

Definition at line 206 of file ScopedPtr.hxx.

void Teamcenter::StringArrayFreer::operator() ( const char **  bucket)
inline

Definition at line 207 of file ScopedPtr.hxx.


The documentation for this struct was generated from the following file: