Adobe.com
Contents Suites Classes Class Index Member Index

AICountedObjectSuite Struct Reference
[API Suite List]

These functions allow you to maintain the reference count for Illustrator object types that are returned through plug-in APIs. More...

#include <AICountedObject.h>

List of all members.

Public Attributes

AIAPI ai::int32(* AddRef )(void *object)
 Increments an object reference count.
AIAPI ai::int32(* Release )(void *object)
 Decrements an object reference count.

Detailed Description

These functions allow you to maintain the reference count for Illustrator object types that are returned through plug-in APIs.

Suites for object types that are reference counted provide their own functions for incrementing and decrementing the count. You can use either those functions, or the functions in this suite, which work with any reference-counted object type.

Reference-counted objects follow these conventions:

  • A function that returns a pointer to a reference-counted object increments the count before returning the object. The caller must decrement the count when the object is no longer needed.
  • If a plug-in passes a reference-counted object in a message to another plug-in or as a parameter to a callback function, the plug-in should not decrement the count.
  • If a plug-in passes a reference counted-object to a function that needs to keep the object beyond the duration of the call, that function increments the count. The plug-in should still decrement its count if necessary when done with the object.
See also:
AIEntrySuite for an exception to these rules.
Note:
Correctly managing reference counts can be difficult. Failure to do so results in memory leaks. It is recommended that C++ client code use the ai::Ref template class to automatically manage these counts.

Member Data Documentation

AIAPI ai::int32(* AICountedObjectSuite::AddRef)(void *object)

Increments an object reference count.

(Note that this function returns a numeric value, not an error code.)

Parameters:
object The object. Can be null.
Returns:
The number of references after the increment.

Referenced by ai::Ref< X >::Assign(), ai::Ref< X >::operator=(), ai::Ref< X >::Ref(), and ai::Ref< X >::to().

AIAPI ai::int32(* AICountedObjectSuite::Release)(void *object)

Decrements an object reference count.

(Note that this function returns a numeric value, not an error code.)

Parameters:
object The object. Can be null.
Returns:
The number of references after the decrement.

Referenced by ai::Ref< X >::Assign(), ai::Ref< X >::operator<<(), ai::Ref< X >::operator=(), and ai::Ref< X >::~Ref().


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


Contents Suites Classes Class Index Member Index
Adobe Solutions Network
 
Copyright © 2016 Adobe Systems Incorporated. All rights reserved.
Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks