Base Module: fobject.h File Reference
Author: Steinberg

Base Module VST 3.7 SDK for developing VST plug-in

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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.
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 | DEFINE_INTERFACES
| Start defining interfaces.
#define | DEF_INTERFACE(InterfaceName) QUERY_INTERFACE (iid, obj, InterfaceName::iid, InterfaceName)
| Add a interfaces.
#define | END_DEFINE_INTERFACES(BaseClass)
| End defining interfaces.
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) ... };
#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) ... };
#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.
template<class C >
C * | FCast (FUnknown *unknown)
| FCast overload 2 - FUnknown to FObject.
template<class I >
IPtr< I > | ICast (FObject *object)
| ICast - casting from FObject to FUnknown Interface.
template<class I >
IPtr< I > | ICast (FUnknown *object)
| ICast - casting from FUnknown to another FUnknown Interface.
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)
bool | isTerminated ()
| Returns true when singleton instances were already released.
void | lockRegister ()
| lock and unlock the singleton registration for multi-threading safety
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) }
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

#define SMTG_DEPENDENCY_COUNT DEVELOPMENT

#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; \
}

#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)); }

#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 DEFINE_INTERFACES

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

Start defining interfaces.

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

Add a interfaces.

#define END_DEFINE_INTERFACES | ( |  | BaseClass | ) |

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

End defining interfaces.

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

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

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

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

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

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

#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)

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

Value:
DEF_INTERFACES_1(InterfaceName,BaseClass) \
REFCOUNT_METHODS(BaseClass)

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

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

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

Value:
DEF_INTERFACES_3(InterfaceName1,InterfaceName2,InterfaceName3,BaseClass) \
REFCOUNT_METHODS(BaseClass)

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

Value:
DEF_INTERFACES_4(InterfaceName1,InterfaceName2,InterfaceName3,InterfaceName4,BaseClass) \
REFCOUNT_METHODS(BaseClass)
Empty

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