- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# ICountedObject.hpp File Reference

Go to the source code of this file.

## Namespaces

- namespace Exponent
- namespace Exponent::Basics

## Classes

- interface Exponent::Basics::ICountedObject
    Interface to a counted object. More...

## Defines

- #define EXCHANGE_COUNTED_OBJECTS(x, y) if ((x) != (y)) { if (x) { (x)->dereference(); } (x) = (y); if (x) { (x)->referenced(); } }
- #define FORGET_COUNTED_OBJECT(x) if(x) { (x)->dereference(); } (x) = NULL;

## Define Documentation

#define EXCHANGE_COUNTED_OBJECTS | ( | x,
|  | y |  | ) | if ((x) != (y)) { if (x) { (x)->dereference(); } (x) = (y); if (x) { (x)->referenced(); } }

Swaps two counted objects, with null pointer check and correct dereferencing of old object

Note:
  DO NOT EVER CALL THIS FUNCTION IN THE FOLLOWING FASHION:
  ECHANGE_COUNTED_OBJECT(m_memberVariable, SomeClassAccesor::getCountedObject(i));
  remember that preprocessors will call this getCountedObject multiple times, which doesnt necessarily give the right results...

Definition at line 96 of file ICountedObject.hpp.

Referenced by Exponent::GUI::Graphics::CImageManager::CImageReference::setImage(), Exponent::GUI::Controls::CMenuItem::setImages(), Exponent::GUI::Controls::CModulatedXYPad::setModulationHandle(), and Exponent::GUI::Controls::CSelectableMenuItem::setUnCheckedImage().

#define FORGET_COUNTED_OBJECT | ( | x |  | ) | if(x) { (x)->dereference(); } (x) = NULL;

Dereferences an object and sets it to NULL

Definition at line 102 of file ICountedObject.hpp.