Base Module VST 3.7 SDK for developing VST plug-in

Classes | Namespaces | Macros | Typedefs | Functions
fobject.h File Reference

Basic Object implementing FUnknown. More...

`#include "pluginterfaces/base/funknown.h"`
`#include "pluginterfaces/base/iupdatehandler.h"`
`#include "base/source/fdebug.h"`

## Classes
class | FObject
| Implements FUnknown and IDependent. More...

## Namespaces
namespace | Steinberg
namespace | Steinberg::Singleton
| Automatic creation and destruction of singleton instances.

## Macros
#define | SMTG_DEPENDENCY_COUNT DEVELOPMENT
#define | SINGLETON(ClassName)
#define | OBJ_METHODS(className, baseClass)
#define | REFCOUNT_METHODS(BaseClass)
| Delegate refcount functions to BaseClass. More...
Macros to implement FUnknown::queryInterface ().
Examples: class Foo : public FObject, public IFoo2, public IFoo3 { ... DEFINE_INTERFACES DEF_INTERFACE (IFoo2) DEF_INTERFACE (IFoo3) END_DEFINE_INTERFACES (FObject) REFCOUNT_METHODS(FObject) // Implement IFoo2 interface ... // Implement IFoo3 interface ... ... }; DEFINE_INTERFACES #define DEFINE_INTERFACES Start defining interfaces. Definition: fobject.h:439 DEF_INTERFACE #define DEF_INTERFACE(InterfaceName) Add a interfaces. Definition: fobject.h:446 END_DEFINE_INTERFACES #define END_DEFINE_INTERFACES(BaseClass) End defining interfaces. Definition: fobject.h:452 REFCOUNT_METHODS #define REFCOUNT_METHODS(BaseClass) Delegate refcount functions to BaseClass. Definition: fobject.h:412
#define | DEFINE_INTERFACES
| Start defining interfaces. More...
#define | DEF_INTERFACE(InterfaceName) QUERY_INTERFACE (iid, obj, InterfaceName::iid, InterfaceName)
| Add a interfaces. More...
#define | END_DEFINE_INTERFACES(BaseClass)
| End defining interfaces. More...
Convenient macros to implement Steinberg::FUnknown::queryInterface ().
Examples: class Foo : public FObject, public IFoo2, public IFoo3 { ... DEF_INTERFACES_2(IFoo2,IFoo3,FObject) REFCOUNT_METHODS(FObject) ... }; DEF_INTERFACES_2 #define DEF_INTERFACES_2(InterfaceName1, InterfaceName2, BaseClass) Definition: fobject.h:478
#define | DEF_INTERFACES_1(InterfaceName, BaseClass)
#define | DEF_INTERFACES_2(InterfaceName1, InterfaceName2, BaseClass)
#define | DEF_INTERFACES_3(InterfaceName1, InterfaceName2, InterfaceName3, BaseClass)
#define | DEF_INTERFACES_4(InterfaceName1, InterfaceName2, InterfaceName3, InterfaceName4, BaseClass)
Convenient macros to implement Steinberg::FUnknown methods.
Examples: class Foo : public FObject, public IFoo2, public IFoo3 { ... FUNKNOWN_METHODS2(IFoo2,IFoo3,FObject) ... }; FUNKNOWN_METHODS2 #define FUNKNOWN_METHODS2(InterfaceName1, InterfaceName2, BaseClass) Definition: fobject.h:519
#define | FUNKNOWN_METHODS(InterfaceName, BaseClass)
#define | FUNKNOWN_METHODS2(InterfaceName1, InterfaceName2, BaseClass)
#define | FUNKNOWN_METHODS3(InterfaceName1, InterfaceName2, InterfaceName3, BaseClass)
#define | FUNKNOWN_METHODS4(InterfaceName1, InterfaceName2, InterfaceName3, InterfaceName4, BaseClass)

## Typedefs
using | FClassID = FIDString

## Functions
template<class C >
C * | FCast (const FObject *object)
| FCast overload 1 - FObject to FObject. More...
template<class C >
C * | FCast (FUnknown *unknown)
| FCast overload 2 - FUnknown to FObject. More...
template<class I >
IPtr< I > | ICast (FObject *object)
| ICast - casting from FObject to FUnknown Interface. More...
template<class I >
IPtr< I > | ICast (FUnknown *object)
| ICast - casting from FUnknown to another FUnknown Interface. More...
template<class C >
C * | FCastIsA (const FObject *object)
template<class C >
| SMTG_DEPRECATED_MSG ("use ICast<>") inline C *FUCast(FObject *object)
template<class T >
void | AssignShared (T *&dest, T *newPtr)
template<class T >
void | AssignSharedDependent (IDependent *_this, T *&dest, T *newPtr)
template<class T >
void | AssignSharedDependent (IDependent *_this, IPtr< T > &dest, T *newPtr)
template<class T >
void | SafeReleaseDependent (IDependent *_this, T *&dest)
template<class T >
void | SafeReleaseDependent (IDependent *_this, IPtr< T > &dest)
void | registerInstance (FObject **o)
| registers an instance (type FObject) More...
bool | isTerminated ()
| Returns true when singleton instances were already released. More...
void | lockRegister ()
| lock and unlock the singleton registration for multi-threading safety More...
void | unlockRegister ()
Convenience methods that call release or delete respectively
on a pointer if it is non-zero, and then set the pointer to zero. Note: you should prefer using IPtr or OPtr instead of these methods whenever possible. Examples: ~Foo () { // instead of ... if (somePointer) { somePointer->release (); somePointer = 0; } // ... just being lazy I write SafeRelease (somePointer) } Steinberg::SafeRelease void SafeRelease(I *&ptr) Definition: fobject.h:274
template<class I >
void | SafeRelease (I *&ptr)
template<class I >
void | SafeRelease (IPtr< I > &ptr)
template<class T >
void | SafeDelete (T *&ptr)

## Detailed Description

Basic Object implementing FUnknown.

## Macro Definition Documentation

## ◆ SMTG_DEPENDENCY_COUNT

#define SMTG_DEPENDENCY_COUNT DEVELOPMENT

## ◆ SINGLETON

#define SINGLETON | ( |  | ClassName | ) |

Value:
static ClassName* instance (bool create = true) \
{ \
static Steinberg::FObject* inst = nullptr; \
if (inst == nullptr && create && Steinberg::Singleton::isTerminated () == false) \
{ \
Steinberg::Singleton::lockRegister (); \
if (inst == nullptr) \
{ \
inst = NEW ClassName; \
Steinberg::Singleton::registerInstance (&inst); \
} \
Steinberg::Singleton::unlockRegister (); \
} \
return (ClassName*)inst; \
}
Steinberg::FObject
Implements FUnknown and IDependent.
Definition: fobject.h:84
NEW
#define NEW
Definition: fdebug.h:217
Steinberg::Singleton::lockRegister
void lockRegister()
lock and unlock the singleton registration for multi-threading safety
Definition: fobject.cpp:246
Steinberg::Singleton::unlockRegister
void unlockRegister()
Definition: fobject.cpp:253
Steinberg::Singleton::isTerminated
bool isTerminated()
Returns true when singleton instances were already released.
Definition: fobject.cpp:241
Steinberg::Singleton::registerInstance
void registerInstance(FObject **o)
registers an instance (type FObject)
Definition: fobject.cpp:258

## ◆ OBJ_METHODS

#define OBJ_METHODS | ( |  | className,
|  |  | baseClass
| ) |  |

Value:
static inline Steinberg::FClassID getFClassID () {return (#className);} \
virtual Steinberg::FClassID isA () const SMTG_OVERRIDE {return className::getFClassID ();} \
virtual bool isA (Steinberg::FClassID s) const SMTG_OVERRIDE {return isTypeOf (s, false);} \
virtual bool isTypeOf (Steinberg::FClassID s, bool askBaseClass = true) const SMTG_OVERRIDE \
{ return (FObject::classIDsEqual (s, #className) ? true : (askBaseClass ? baseClass::isTypeOf (s, true) : false)); }
Steinberg::FClassID
FIDString FClassID
Definition: fobject.h:54

## ◆ REFCOUNT_METHODS

#define REFCOUNT_METHODS | ( |  | BaseClass | ) |

Value:
virtual Steinberg::uint32 PLUGIN_API addRef ()SMTG_OVERRIDE{ return BaseClass::addRef (); } \
virtual Steinberg::uint32 PLUGIN_API release ()SMTG_OVERRIDE{ return BaseClass::release (); }

Delegate refcount functions to BaseClass.

BaseClase must implement ref counting.

## ◆ DEFINE_INTERFACES

#define DEFINE_INTERFACES

Value:
Steinberg::tresult PLUGIN_API queryInterface (const Steinberg::TUID iid, void** obj) SMTG_OVERRIDE \
{

Start defining interfaces.

## ◆ DEF_INTERFACE

#define DEF_INTERFACE | ( |  | InterfaceName | ) | QUERY_INTERFACE (iid, obj, InterfaceName::iid, InterfaceName)

Add a interfaces.

## ◆ END_DEFINE_INTERFACES

#define END_DEFINE_INTERFACES | ( |  | BaseClass | ) |

Value:
return BaseClass::queryInterface (iid, obj); \
}

End defining interfaces.

## ◆ DEF_INTERFACES_1

#define DEF_INTERFACES_1 | ( |  | InterfaceName,
|  |  | BaseClass
| ) |  |

Value:
DEFINE_INTERFACES \
DEF_INTERFACE (InterfaceName) \
END_DEFINE_INTERFACES (BaseClass)

## ◆ DEF_INTERFACES_2

#define DEF_INTERFACES_2 | ( |  | InterfaceName1,
|  |  | InterfaceName2,
|  |  | BaseClass
| ) |  |

Value:
DEFINE_INTERFACES \
DEF_INTERFACE (InterfaceName1) \
DEF_INTERFACE (InterfaceName2) \
END_DEFINE_INTERFACES (BaseClass)

## ◆ DEF_INTERFACES_3

#define DEF_INTERFACES_3 | ( |  | InterfaceName1,
|  |  | InterfaceName2,
|  |  | InterfaceName3,
|  |  | BaseClass
| ) |  |

Value:
DEFINE_INTERFACES \
DEF_INTERFACE (InterfaceName1) \
DEF_INTERFACE (InterfaceName2) \
DEF_INTERFACE (InterfaceName3) \
END_DEFINE_INTERFACES (BaseClass)

## ◆ DEF_INTERFACES_4

#define DEF_INTERFACES_4 | ( |  | InterfaceName1,
|  |  | InterfaceName2,
|  |  | InterfaceName3,
|  |  | InterfaceName4,
|  |  | BaseClass
| ) |  |

Value:
DEFINE_INTERFACES \
DEF_INTERFACE (InterfaceName1) \
DEF_INTERFACE (InterfaceName2) \
DEF_INTERFACE (InterfaceName3) \
DEF_INTERFACE (InterfaceName4) \
END_DEFINE_INTERFACES (BaseClass)

## ◆ FUNKNOWN_METHODS

#define FUNKNOWN_METHODS | ( |  | InterfaceName,
|  |  | BaseClass
| ) |  |

Value:
DEF_INTERFACES_1(InterfaceName,BaseClass) \
REFCOUNT_METHODS(BaseClass)
DEF_INTERFACES_1
#define DEF_INTERFACES_1(InterfaceName, BaseClass)
Definition: fobject.h:472

## ◆ FUNKNOWN_METHODS2

#define FUNKNOWN_METHODS2 | ( |  | InterfaceName1,
|  |  | InterfaceName2,
|  |  | BaseClass
| ) |  |

Value:
DEF_INTERFACES_2(InterfaceName1,InterfaceName2,BaseClass) \
REFCOUNT_METHODS(BaseClass)

## ◆ FUNKNOWN_METHODS3

#define FUNKNOWN_METHODS3 | ( |  | InterfaceName1,
|  |  | InterfaceName2,
|  |  | InterfaceName3,
|  |  | BaseClass
| ) |  |

Value:
DEF_INTERFACES_3(InterfaceName1,InterfaceName2,InterfaceName3,BaseClass) \
REFCOUNT_METHODS(BaseClass)
DEF_INTERFACES_3
#define DEF_INTERFACES_3(InterfaceName1, InterfaceName2, InterfaceName3, BaseClass)
Definition: fobject.h:485

## ◆ FUNKNOWN_METHODS4

#define FUNKNOWN_METHODS4 | ( |  | InterfaceName1,
|  |  | InterfaceName2,
|  |  | InterfaceName3,
|  |  | InterfaceName4,
|  |  | BaseClass
| ) |  |

Value:
DEF_INTERFACES_4(InterfaceName1,InterfaceName2,InterfaceName3,InterfaceName4,BaseClass) \
REFCOUNT_METHODS(BaseClass)
DEF_INTERFACES_4
#define DEF_INTERFACES_4(InterfaceName1, InterfaceName2, InterfaceName3, InterfaceName4, BaseClass)
Definition: fobject.h:493
Empty

Copyright © Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.