8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 09:20:39 +01:00

Better interfaces hierarchy: all of them are derived from IVersioned

This commit is contained in:
alexpeshkoff 2011-05-19 16:24:46 +00:00
parent 85b3b5cf95
commit 4641d2de68
37 changed files with 307 additions and 230 deletions

View File

@ -350,7 +350,7 @@ void FB_UDR_TRIGGER(replicate)::initialize(ExternalContext* context, Values* val
"select data_source from replicate_config where name = ?",
SQL_DIALECT_CURRENT, NULL), statusVector);
AutoDispose<IMaster> master(funcGetMasterInterface());
IMaster* master(funcGetMasterInterface());
AutoDispose<IStatus> status(master->getStatus());
const char* table = metadata->getTriggerTable(status);

View File

@ -39,20 +39,22 @@ namespace Auth {
enum Result {AUTH_SUCCESS, AUTH_CONTINUE, AUTH_FAILED, AUTH_MORE_DATA};
class IWriter : public Firebird::IDisposable
class IWriter : public Firebird::IVersioned
{
public:
virtual void FB_CARG reset() = 0;
virtual void FB_CARG add(const char* user, const char* method, const char* details) = 0;
};
#define FB_AUTH_WRITER_VERSION (FB_VERSIONED_VERSION + 2)
class IDpbReader : public Firebird::IDisposable
class IDpbReader : public Firebird::IVersioned
{
public:
virtual int FB_CARG find(UCHAR tag) = 0;
virtual void FB_CARG add(UCHAR tag, const void* bytes, unsigned int count) = 0;
virtual void FB_CARG drop() = 0;
};
#define FB_AUTH_DPB_READER_VERSION (FB_VERSIONED_VERSION + 3)
class IServer : public Firebird::IPluginBase
{
@ -75,13 +77,14 @@ public:
};
#define FB_AUTH_CLIENT_VERSION (FB_PLUGIN_VERSION + 3)
class IUserField : public Firebird::IDisposable
class IUserField : public Firebird::IVersioned
{
public:
virtual int FB_CARG entered() = 0;
virtual int FB_CARG specified() = 0;
virtual void FB_CARG setEntered(int newValue) = 0;
};
#define FB_AUTH_FIELD_VERSION (FB_VERSIONED_VERSION + 3)
class ICharUserField : public IUserField
{
@ -89,6 +92,7 @@ public:
virtual const char* FB_CARG get() = 0;
virtual void FB_CARG set(const char* newValue) = 0;
};
#define FB_AUTH_CHAR_FIELD_VERSION (FB_AUTH_FIELD_VERSION + 2)
class IIntUserField : public IUserField
{
@ -96,8 +100,9 @@ public:
virtual int FB_CARG get() = 0;
virtual void FB_CARG set(int newValue) = 0;
};
#define FB_AUTH_INT_FIELD_VERSION (FB_AUTH_FIELD_VERSION + 2)
class IUser : public Firebird::IDisposable
class IUser : public Firebird::IVersioned
{
public:
virtual int FB_CARG operation() = 0;
@ -116,14 +121,16 @@ public:
virtual void FB_CARG clear() = 0;
};
#define FB_AUTH_USER_VERSION (FB_VERSIONED_VERSION + 11)
class IListUsers : public Firebird::IDisposable
class IListUsers : public Firebird::IVersioned
{
public:
virtual void FB_CARG list(IUser* user) = 0;
};
#define FB_AUTH_LIST_USERS_VERSION (FB_VERSIONED_VERSION + 1)
class ILogonInfo : public Firebird::IDisposable
class ILogonInfo : public Firebird::IVersioned
{
public:
virtual const char* FB_CARG name() = 0;
@ -132,6 +139,7 @@ public:
virtual const char* FB_CARG networkProtocol() = 0;
virtual const char* FB_CARG remoteAddress() = 0;
};
#define FB_AUTH_LOGON_INFO_VERSION (FB_VERSIONED_VERSION + 5)
class IManagement : public Firebird::IPluginBase
{

View File

@ -122,7 +122,7 @@ const UCHAR TPB[4] =
namespace Auth {
class SecurityDatabase : public Firebird::StdIface<Firebird::ITimer, FB_I_TIMER_VERSION>
class SecurityDatabase : public Firebird::RefCntIface<Firebird::ITimer, FB_TIMER_VERSION>
{
public:
Result verify(IWriter* authBlock, Firebird::ClumpletReader& originalDpb);

View File

@ -33,7 +33,8 @@
namespace Auth {
WriterImplementation::WriterImplementation(bool svcFlag)
: body(getPool()), sequence(0), tag(svcFlag ? isc_spb_auth_block : isc_dpb_auth_block)
: body(*getDefaultMemoryPool()),
sequence(0), tag(svcFlag ? isc_spb_auth_block : isc_dpb_auth_block)
{ }
void WriterImplementation::store(Firebird::ClumpletWriter& to)

View File

@ -41,7 +41,7 @@ namespace Auth {
bool legacy(const char* nm);
class WriterImplementation : public Firebird::StackIface<IWriter>
class WriterImplementation : public Firebird::AutoIface<IWriter, FB_AUTH_WRITER_VERSION>
{
public:
WriterImplementation(bool svcFlag);
@ -58,7 +58,7 @@ private:
unsigned char tag;
};
class DpbImplementation : public Firebird::StackIface<IDpbReader>
class DpbImplementation : public Firebird::AutoIface<IDpbReader, FB_AUTH_DPB_READER_VERSION>
{
public:
DpbImplementation(Firebird::ClumpletWriter& base);

View File

@ -30,6 +30,7 @@
#include "../common/classes/array.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/objects_array.h"
#include "../common/classes/ImplementHelper.h"
namespace Firebird {
@ -38,7 +39,8 @@ namespace Firebird {
class StatementMetadata : public PermanentStorage
{
public:
class Parameters : public IParametersMetadata, public PermanentStorage
class Parameters : public VersionedIface<IParametersMetadata, FB_PARAMETERS_METADATA_VERSION>,
public PermanentStorage
{
public:
struct Item : public PermanentStorage

View File

@ -80,8 +80,11 @@ private:
ISC_STATUS vector[40]; // FixMe - may be a kind of dynamic storage will be better?
};
class LocalStatus : public StackIface<BaseStatus>
class LocalStatus : public AutoIface<BaseStatus, FB_STATUS_VERSION>
{
public:
virtual void FB_CARG dispose()
{ }
};
class StatusHolder

View File

@ -1,7 +1,7 @@
/*
* PROGRAM: Firebird interface.
* MODULE: ImplementHelper.h
* DESCRIPTION: Tools to help write plugins.
* DESCRIPTION: Tools to help access plugins.
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
@ -50,7 +50,7 @@ class GetPlugins
{
public:
GetPlugins(unsigned int interfaceType, unsigned int desiredVersion, const char* namesList = NULL)
: masterInterface(fb_get_master_interface()), pluginInterface(masterInterface->getPluginManager()), missing(),
: masterInterface(), pluginInterface(masterInterface), missing(),
pluginSet(pluginInterface->getPlugins(interfaceType, namesList ? namesList : Config::getPlugins(interfaceType),
desiredVersion, &missing, NULL)),
currentPlugin(NULL)
@ -61,7 +61,7 @@ public:
GetPlugins(unsigned int interfaceType, unsigned int desiredVersion,
Config* knownConfig, const char* namesList = NULL)
: masterInterface(fb_get_master_interface()), pluginInterface(masterInterface->getPluginManager()), missing(),
: masterInterface(), pluginInterface(masterInterface), missing(),
pluginSet(pluginInterface->getPlugins(interfaceType, namesList ? namesList : Config::getPlugins(interfaceType),
desiredVersion, &missing, new FirebirdConf(knownConfig))),
currentPlugin(NULL)
@ -122,8 +122,8 @@ public:
}
private:
AutoPtr<IMaster, AutoDisposable> masterInterface;
AutoPtr<IPluginManager, AutoDisposable> pluginInterface;
MasterInterfacePtr masterInterface;
PluginManagerInterfacePtr pluginInterface;
M missing;
RefPtr<IPluginSet> pluginSet;
P* currentPlugin;

View File

@ -1,7 +1,7 @@
/*
* PROGRAM: Firebird interface.
* MODULE: ImplementHelper.h
* DESCRIPTION: Tools to help write plugins.
* DESCRIPTION: Tools to help create interfaces.
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
@ -59,25 +59,30 @@ public:
// Implement standard interface and plugin functions
// Helps to implement disposable interfaces
template <class C, typename S = GlobalStorage>
class DisposeIface : public C, public S
// Helps to implement generic versioned interfaces
template <class C, int V>
class VersionedIface : public C
{
public:
DisposeIface() { }
VersionedIface() { }
int FB_CARG getVersion()
{
return V;
}
private:
DisposeIface(const DisposeIface&);
DisposeIface& operator=(const DisposeIface&);
VersionedIface(const VersionedIface&);
VersionedIface& operator=(const VersionedIface&);
};
// Helps to implement disposable interfaces on stack or static
template <class C, typename S = GlobalStorage>
class StackIface : public DisposeIface<C, S>
// Helps to implement versioned interfaces on stack or static
template <class C, int V>
class AutoIface : public VersionedIface<C, V>
{
public:
void FB_CARG dispose()
{ }
AutoIface() { }
void* operator new(size_t, void* memory) throw()
{
@ -85,20 +90,23 @@ public:
}
};
// Helps to implement standard interfaces
template <class C, int V, typename S = GlobalStorage>
class StdIface : public C, public S
// Helps to implement disposable interfaces
template <class C, int V>
class DisposeIface : public VersionedIface<C, V>, public GlobalStorage
{
public:
StdIface() : refCounter(0) { }
DisposeIface() { }
};
int FB_CARG getVersion()
{
return V;
}
// Helps to implement standard interfaces
template <class C, int V>
class RefCntIface : public VersionedIface<C, V>, public GlobalStorage
{
public:
RefCntIface() : refCounter(0) { }
#ifdef DEV_BUILD
~StdIface()
~RefCntIface()
{
fb_assert(refCounter.value() == 0);
}
@ -111,30 +119,26 @@ public:
protected:
AtomicCounter refCounter;
private:
StdIface(const StdIface&);
StdIface& operator=(const StdIface&);
};
// Helps to implement plugins
template <class C, int V, typename S = GlobalStorage>
class StdPlugin : public StdIface<C, V, S>
template <class C, int V>
class StdPlugin : public RefCntIface<C, V>
{
private:
IInterface* owner;
IRefCounted* owner;
public:
StdPlugin() : owner(NULL)
{ }
IInterface* FB_CARG getOwner()
IRefCounted* FB_CARG getOwner()
{
return owner;
}
void FB_CARG setOwner(IInterface* iface)
void FB_CARG setOwner(IRefCounted* iface)
{
owner = iface;
}
@ -143,7 +147,7 @@ public:
// Trivial factory
template <class P>
class SimpleFactoryBase : public StackIface<IPluginFactory>
class SimpleFactoryBase : public AutoIface<IPluginFactory, FB_PLUGIN_FACTORY_VERSION>
{
public:
IPluginBase* FB_CARG createPlugin(IPluginConfig* factoryParameter)
@ -160,40 +164,68 @@ class SimpleFactory : public Static<SimpleFactoryBase<P> >
};
// Master interface access
class MasterInterfacePtr : public AutoPtr<IMaster, AutoDisposable>
// Base for interface type indpendent accessors
template <typename C>
class AccessAutoInterface
{
public:
MasterInterfacePtr() : AutoPtr<IMaster, AutoDisposable>(fb_get_master_interface())
AccessAutoInterface(C* aPtr)
: ptr(aPtr)
{ }
operator C*()
{
return ptr;
}
C* operator->()
{
return ptr;
}
private:
C* ptr;
};
// Master interface access
class MasterInterfacePtr : public AccessAutoInterface<IMaster>
{
public:
MasterInterfacePtr()
: AccessAutoInterface<IMaster>(fb_get_master_interface())
{ }
};
// Generic plugins interface access
class PluginManagerInterfacePtr : public AutoPtr<IPluginManager, AutoDisposable>
class PluginManagerInterfacePtr : public AccessAutoInterface<IPluginManager>
{
public:
PluginManagerInterfacePtr() : AutoPtr<IPluginManager, AutoDisposable>(fb_get_master_interface()->getPluginManager())
PluginManagerInterfacePtr()
: AccessAutoInterface<IPluginManager>(MasterInterfacePtr()->getPluginManager())
{ }
PluginManagerInterfacePtr(IMaster* master) : AutoPtr<IPluginManager, AutoDisposable>(master->getPluginManager())
PluginManagerInterfacePtr(IMaster* master)
: AccessAutoInterface<IPluginManager>(master->getPluginManager())
{ }
};
// Control timer interface access
class TimerInterfacePtr : public AutoPtr<ITimerControl, AutoDisposable>
class TimerInterfacePtr : public AccessAutoInterface<ITimerControl>
{
public:
TimerInterfacePtr() : AutoPtr<ITimerControl, AutoDisposable>(fb_get_master_interface()->getTimerControl())
TimerInterfacePtr()
: AccessAutoInterface<ITimerControl>(fb_get_master_interface()->getTimerControl())
{ }
};
// Distributed transactions coordinator access
class DtcInterfacePtr : public AutoPtr<IDtc, AutoDisposable>
class DtcInterfacePtr : public AccessAutoInterface<IDtc>
{
public:
DtcInterfacePtr() : AutoPtr<IDtc, AutoDisposable>(fb_get_master_interface()->getDtc())
DtcInterfacePtr()
: AccessAutoInterface<IDtc>(fb_get_master_interface()->getDtc())
{ }
};
@ -203,11 +235,7 @@ public:
// when yvalve is starting fb_shutdown(). This causes almost unavoidable segfault.
// To avoid it this class is added - it detects spontaneous (not by PluginManager)
// module unload and notifies PluginManager about this said fact.
class DummyStorage
{
};
class UnloadDetectorHelper : public DisposeIface<IPluginModule, DummyStorage>
class UnloadDetectorHelper : public VersionedIface<IPluginModule, FB_PLUGIN_MODULE_VERSION>
{
public:
explicit UnloadDetectorHelper(MemoryPool&)
@ -230,11 +258,6 @@ public:
return !flagOsUnload;
}
void FB_CARG dispose()
{
// delete this; -don't do that!
}
private:
bool flagOsUnload;

View File

@ -351,7 +351,7 @@ public:
};
// Implementation of interface to access master configuration file
class FirebirdConf : public Firebird::StdIface<Firebird::IFirebirdConf, FB_I_FIREBIRD_CONF_VERSION>
class FirebirdConf : public Firebird::RefCntIface<Firebird::IFirebirdConf, FB_FIREBIRD_CONF_VERSION>
{
public:
FirebirdConf(Config* existingConfig)

View File

@ -30,7 +30,7 @@
namespace Auth {
class CharField : public Firebird::StackIface<ICharUserField>
class CharField : public Firebird::AutoIface<ICharUserField, FB_AUTH_CHAR_FIELD_VERSION>
{
public:
CharField()
@ -88,7 +88,7 @@ private:
Firebird::string value;
};
class IntField : public Firebird::StackIface<IIntUserField>
class IntField : public Firebird::AutoIface<IIntUserField, FB_AUTH_INT_FIELD_VERSION>
{
public:
IntField()
@ -207,7 +207,7 @@ public:
CharField database, dba, dbaPassword, role, trustedUser;
};
class StackUserData : public Firebird::StackIface<UserData>
class StackUserData : public Firebird::AutoIface<UserData, FB_AUTH_USER_VERSION>
{
};

View File

@ -678,8 +678,9 @@ class DummyMasterImpl : public IMaster
{
public:
// IMaster implementation (almost dummy, for boot build)
virtual void FB_CARG dispose()
virtual int FB_CARG getVersion()
{
return FB_MASTER_VERSION;
}
virtual IStatus* FB_CARG getStatus()
@ -700,7 +701,7 @@ public:
return NULL;
}
virtual int FB_CARG upgradeInterface(IInterface* /*toUpgrade*/, int /*desiredVersion*/,
virtual int FB_CARG upgradeInterface(IVersioned* /*toUpgrade*/, int /*desiredVersion*/,
void* /*missingFunctionClass*/)
{
fb_assert(false);

View File

@ -152,7 +152,7 @@ public:
};
class IRoutineMetadata // : public IVersioned
class IRoutineMetadata : public IVersioned
{
public:
virtual const char* FB_CARG getPackage(IStatus* status) const = 0;
@ -162,7 +162,7 @@ public:
virtual const char* FB_CARG getTriggerTable(IStatus* status) const = 0;
virtual ExternalTrigger::Type FB_CARG getTriggerType(IStatus* status) const = 0;
};
// #define FB_I_ROUTINE_METADATA_VERSION (FB_VERSIONED_VERSION + 6)
#define FB_ROUTINE_METADATA_VERSION (FB_VERSIONED_VERSION + 6)
// In SuperServer, shared by all attachments to one database and disposed when last (non-external)

View File

@ -70,7 +70,7 @@
namespace Firebird {
// IPluginBase interface - base for master plugin interfaces (factories are registered for them)
class IPluginBase : public IInterface
class IPluginBase : public IRefCounted
{
public:
// Additional (compared with Interface) functions getOwner() and setOwner()
@ -79,13 +79,13 @@ public:
// after plugin itself, and therefore module is unloaded after release of last plugin from it.
// Releasing owner from release() of plugin will unload module and after returning control
// to missing code segfault is unavoidable.
virtual void FB_CARG setOwner(IInterface*) = 0;
virtual IInterface* FB_CARG getOwner() = 0;
virtual void FB_CARG setOwner(IRefCounted*) = 0;
virtual IRefCounted* FB_CARG getOwner() = 0;
};
#define FB_PLUGIN_VERSION (FB_INTERFACE_VERSION + 2)
#define FB_PLUGIN_VERSION (FB_REFCOUNTED_VERSION + 2)
// IPluginSet - low level tool to access plugins according to parameter from firebird.conf
class IPluginSet : public IInterface
class IPluginSet : public IRefCounted
{
public:
virtual const char* FB_CARG getName() const = 0;
@ -94,33 +94,33 @@ public:
virtual void FB_CARG next() = 0;
virtual void FB_CARG set(const char*) = 0;
};
#define FB_PLUGIN_SET_VERSION (FB_INTERFACE_VERSION + 5)
#define FB_PLUGIN_SET_VERSION (FB_REFCOUNTED_VERSION + 5)
// Interfaces to work with configuration data
class IConfig;
// Entry in configuration file
class IConfigEntry : public IInterface
class IConfigEntry : public IRefCounted
{
public:
virtual const char* FB_CARG getName() = 0;
virtual const char* FB_CARG getValue() = 0;
virtual IConfig* FB_CARG getSubConfig() = 0;
};
#define FB_I_CONFIG_PARAMETER_VERSION (FB_INTERFACE_VERSION + 3)
#define FB_CONFIG_PARAMETER_VERSION (FB_REFCOUNTED_VERSION + 3)
// Generic form of access to configuration file - find specific entry in it
class IConfig : public IInterface
class IConfig : public IRefCounted
{
public:
virtual IConfigEntry* FB_CARG find(const char* name) = 0;
virtual IConfigEntry* FB_CARG findValue(const char* name, const char* value) = 0;
virtual IConfigEntry* FB_CARG findPos(const char* name, unsigned int pos) = 0;
};
#define FB_I_CONFIG_VERSION (FB_INTERFACE_VERSION + 3)
#define FB_CONFIG_VERSION (FB_REFCOUNTED_VERSION + 3)
// Used to access config values from firebird.conf (may be DB specific)
class IFirebirdConf : public IInterface
class IFirebirdConf : public IRefCounted
{
public:
// Get integer key by it's name
@ -132,37 +132,40 @@ public:
// Use to access string values
virtual const char* FB_CARG asString(unsigned int key) = 0;
};
#define FB_I_FIREBIRD_CONF_VERSION (FB_INTERFACE_VERSION + 3)
#define FB_FIREBIRD_CONF_VERSION (FB_REFCOUNTED_VERSION + 3)
// This interface is passed to plugin's factory as it's single parameter
// and contains methods to access specific plugin's configuration data
class IPluginConfig : public IInterface
class IPluginConfig : public IRefCounted
{
public:
virtual const char* FB_CARG getConfigFileName() = 0;
virtual IConfig* FB_CARG getDefaultConfig() = 0;
virtual IFirebirdConf* FB_CARG getFirebirdConf() = 0;
};
#define FB_FACTORY_PARAMETER_VERSION (FB_INTERFACE_VERSION + 3)
#define FB_PLUGIN_CONFIG_VERSION (FB_REFCOUNTED_VERSION + 3)
// Required to creat instances of given plugin
class IPluginFactory : public IDisposable
class IPluginFactory : public IVersioned
{
public:
virtual IPluginBase* FB_CARG createPlugin(IPluginConfig* factoryParameter) = 0;
};
#define FB_PLUGIN_FACTORY_VERSION (FB_VERSIONED_VERSION + 1)
// Required to let plugins manager invoke module's cleanup routine before unloading it.
// For some OS/compiler this may be done in dtor of global variable in module itself.
// Others (Windows/VC) fail to create some very useful resources (threads) when module is unloading.
class IPluginModule : public IDisposable
class IPluginModule : public IVersioned
{
public:
virtual void FB_CARG doClean() = 0;
};
#define FB_PLUGIN_MODULE_VERSION (FB_VERSIONED_VERSION + 1)
// Interface to deal with plugins here and there, returned by master interface
class IPluginManager : public IDisposable
class IPluginManager : public IVersioned
{
public:
// Main function called by plugin modules in firebird_plugin()
@ -192,6 +195,8 @@ public:
// will cause resources leak
virtual void FB_CARG releasePlugin(IPluginBase* plugin) = 0;
};
#define FB_PLUGIN_MANAGER_VERSION (FB_VERSIONED_VERSION + 6)
typedef void PluginEntrypoint(IMaster* masterInterface);

View File

@ -39,22 +39,33 @@
namespace Firebird {
// Regular interface - base for refCounted FB interfaces
class IInterface
// Versioned interface - base for all FB interfaces
class IVersioned
{
public:
virtual int FB_CARG getVersion() = 0;
};
// If this is changed, types of all interfaces must be changed
#define FB_VERSIONED_VERSION 1
// Reference counted interface - base for refCounted FB interfaces
class IRefCounted : public IVersioned
{
public:
virtual void FB_CARG addRef() = 0;
virtual int FB_CARG release() = 0;
virtual int FB_CARG getVersion() = 0;
};
#define FB_INTERFACE_VERSION 3 // If this is changed, types of all interfaces must be changed
// If this is changed, types of refCounted interfaces must be changed
#define FB_REFCOUNTED_VERSION (FB_VERSIONED_VERSION + 2)
// Disposable interface - base for static and onStack interfaces, may be used in regular case too
// Disposable interface - base for disposable FB interfaces
class IDisposable
{
public:
virtual void FB_CARG dispose() = 0;
};
// If this is changed, types of disposable interfaces must be changed
#define FB_DISPOSABLE_VERSION (FB_VERSIONED_VERSION + 1)
// Interface to work with status vector
// Created by master interface by request
@ -69,6 +80,7 @@ public:
virtual const ISC_STATUS* FB_CARG get() const = 0;
virtual int FB_CARG isSuccess() const = 0;
};
#define FB_STATUS_VERSION (FB_DISPOSABLE_VERSION + 5)
class IProvider;
class IPluginManager;
@ -78,22 +90,20 @@ class ITransaction;
class IDtc;
// Master interface is used to access almost all other interfaces.
class IMaster : public IDisposable
class IMaster : public IVersioned
{
public:
// This interface can't be upgraded - therefore another form of version is used
const static unsigned int VERSION = 1; // To be changed each time any interface, passed
// by firebird to plugins is changed
virtual IStatus* FB_CARG getStatus() = 0;
virtual IProvider* FB_CARG getDispatcher() = 0;
virtual IPluginManager* FB_CARG getPluginManager() = 0;
virtual int FB_CARG upgradeInterface(IInterface* toUpgrade, int desiredVersion, void* missingFunctionClass) = 0;
virtual int FB_CARG upgradeInterface(IVersioned* toUpgrade, int desiredVersion, void* missingFunctionClass) = 0;
virtual const char* FB_CARG circularAlloc(const char* s, size_t len, intptr_t thr) = 0;
virtual ITimerControl* FB_CARG getTimerControl() = 0;
virtual IDtc* FB_CARG getDtc() = 0;
virtual IAttachment* registerAttachment(IProvider* provider, IAttachment* attachment) = 0;
virtual ITransaction* registerTransaction(IAttachment* attachment, ITransaction* transaction) = 0;
};
#define FB_MASTER_VERSION (FB_VERSIONED_VERSION + 6)
} // namespace Firebird

View File

@ -46,11 +46,12 @@ struct FbMessage
unsigned int bufferLength;
};
class IEventCallback
class IEventCallback : public IVersioned
{
public:
virtual void FB_CARG eventCallbackFunction(unsigned int length, const unsigned char* events) = 0;
};
#define FB_EVENT_CALLBACK_VERSION (FB_VERSIONED_VERSION + 1)
/*
class ShutdownCallback
@ -60,7 +61,7 @@ public:
};
*/
class IBlob : public IInterface
class IBlob : public IRefCounted
{
public:
virtual void FB_CARG getInfo(IStatus* status,
@ -74,9 +75,9 @@ public:
virtual void FB_CARG close(IStatus* status) = 0;
virtual int FB_CARG seek(IStatus* status, int mode, int offset) = 0; // returns position
};
#define FB_I_BLOB_VERSION (FB_INTERFACE_VERSION + 6)
#define FB_BLOB_VERSION (FB_REFCOUNTED_VERSION + 6)
class ITransaction : public IInterface
class ITransaction : public IRefCounted
{
public:
virtual void FB_CARG getInfo(IStatus* status,
@ -93,9 +94,9 @@ public:
virtual ITransaction* FB_CARG validate(IStatus* status, IAttachment* attachment) = 0;
virtual ITransaction* FB_CARG enterDtc(IStatus* status) = 0;
};
#define FB_I_TRANSACTION_VERSION (FB_INTERFACE_VERSION + 10)
#define FB_TRANSACTION_VERSION (FB_REFCOUNTED_VERSION + 10)
class IParametersMetadata // : public IVersioned
class IParametersMetadata : public IVersioned
{
public:
virtual unsigned FB_CARG getCount(IStatus* status) const = 0;
@ -109,9 +110,9 @@ public:
virtual unsigned FB_CARG getLength(IStatus* status, unsigned index) const = 0;
virtual unsigned FB_CARG getScale(IStatus* status, unsigned index) const = 0;
};
// #define FB_I_PARAMETERS_METADATA_VERSION (FB_VERSIONED_VERSION + 10)
#define FB_PARAMETERS_METADATA_VERSION (FB_VERSIONED_VERSION + 10)
class IStatement : public IInterface
class IStatement : public IRefCounted
{
public:
// Prepare flags.
@ -146,9 +147,9 @@ public:
virtual void FB_CARG insert(IStatus* status, const FbMessage* msgBuffer) = 0;
virtual void FB_CARG free(IStatus* status, unsigned int option) = 0;
};
#define FB_I_STATEMENT_VERSION (FB_INTERFACE_VERSION + 12)
#define FB_STATEMENT_VERSION (FB_REFCOUNTED_VERSION + 12)
class IRequest : public IInterface
class IRequest : public IRefCounted
{
public:
virtual void FB_CARG receive(IStatus* status, int level, unsigned int msgType,
@ -164,16 +165,16 @@ public:
virtual void FB_CARG unwind(IStatus* status, int level) = 0;
virtual void FB_CARG free(IStatus* status) = 0;
};
#define FB_I_REQUEST_VERSION (FB_INTERFACE_VERSION + 7)
#define FB_REQUEST_VERSION (FB_REFCOUNTED_VERSION + 7)
class IEvents : public IInterface
class IEvents : public IRefCounted
{
public:
virtual void FB_CARG cancel(IStatus* status) = 0;
};
#define FB_I_EVENTS_VERSION (FB_INTERFACE_VERSION + 1)
#define FB_EVENTS_VERSION (FB_REFCOUNTED_VERSION + 1)
class IAttachment : public IInterface
class IAttachment : public IRefCounted
{
public:
virtual void FB_CARG getInfo(IStatus* status,
@ -212,9 +213,9 @@ public:
virtual void FB_CARG detach(IStatus* status) = 0;
virtual void FB_CARG drop(IStatus* status) = 0;
};
#define FB_I_ATTACHMENT_VERSION (FB_INTERFACE_VERSION + 17)
#define FB_ATTACHMENT_VERSION (FB_REFCOUNTED_VERSION + 17)
class IService : public IInterface
class IService : public IRefCounted
{
public:
virtual void FB_CARG detach(IStatus* status) = 0;
@ -225,7 +226,7 @@ public:
virtual void FB_CARG start(IStatus* status,
unsigned int spbLength, const unsigned char* spb) = 0;
};
#define FB_I_SERVICE_VERSION (FB_INTERFACE_VERSION + 3)
#define FB_SERVICE_VERSION (FB_REFCOUNTED_VERSION + 3)
class IProvider : public IPluginBase
{
@ -238,7 +239,7 @@ public:
unsigned int spbLength, const unsigned char* spb) = 0;
virtual void FB_CARG shutdown(IStatus* status, unsigned int timeout, const int reason) = 0;
};
#define FB_I_PROVIDER_VERSION (FB_PLUGIN_VERSION + 4)
#define FB_PROVIDER_VERSION (FB_PLUGIN_VERSION + 4)
// DtcStart - structure to start transaction over >1 attachments (former TEB)
struct DtcStart
@ -249,12 +250,13 @@ struct DtcStart
};
// Distributed transactions coordinator
class IDtc : public IDisposable
class IDtc : public IVersioned
{
public:
virtual ITransaction* FB_CARG start(IStatus* status, unsigned int cnt, DtcStart* components) = 0;
virtual ITransaction* FB_CARG join(IStatus* status, ITransaction* one, ITransaction* two) = 0;
};
#define FB_DTC_VERSION (FB_VERSIONED_VERSION + 2)
} // namespace Firebird

View File

@ -35,17 +35,17 @@ namespace Firebird {
// Identifies particular timer.
// Callback function is invoked when timer fires.
class ITimer : public IInterface
class ITimer : public IRefCounted
{
public:
virtual void FB_CARG handler() = 0;
};
#define FB_I_TIMER_VERSION (FB_INTERFACE_VERSION + 1)
#define FB_TIMER_VERSION (FB_REFCOUNTED_VERSION + 1)
typedef ISC_INT64 TimerDelay;
// Interface to set timer for particular time
class ITimerControl : public IDisposable
class ITimerControl : public IVersioned
{
public:
// Set timer
@ -53,6 +53,7 @@ public:
// Stop timer
virtual void FB_CARG stop(ITimer* timer) = 0;
};
#define FB_TIMER_CONTROL_VERSION (FB_VERSIONED_VERSION + 2)
} // namespace Firebird

View File

@ -42,7 +42,7 @@ class Service;
class JAttachment;
class JProvider;
class JBlob : public Firebird::StdIface<Firebird::IBlob, FB_I_BLOB_VERSION>
class JBlob : public Firebird::RefCntIface<Firebird::IBlob, FB_BLOB_VERSION>
{
public:
// IBlob implementation
@ -79,7 +79,7 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JTransaction : public Firebird::StdIface<Firebird::ITransaction, FB_I_TRANSACTION_VERSION>
class JTransaction : public Firebird::RefCntIface<Firebird::ITransaction, FB_TRANSACTION_VERSION>
{
public:
// ITransaction implementation
@ -137,7 +137,7 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JStatement : public Firebird::StdIface<Firebird::IStatement, FB_I_STATEMENT_VERSION>
class JStatement : public Firebird::RefCntIface<Firebird::IStatement, FB_STATEMENT_VERSION>
{
public:
// IStatement implementation
@ -185,7 +185,7 @@ private:
void freeEngineData(Firebird::IStatus* status, unsigned int option);
};
class JRequest : public Firebird::StdIface<Firebird::IRequest, FB_I_REQUEST_VERSION>
class JRequest : public Firebird::RefCntIface<Firebird::IRequest, FB_REQUEST_VERSION>
{
public:
// IRequest implementation
@ -226,7 +226,7 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JEvents : public Firebird::StdIface<Firebird::IEvents, FB_I_EVENTS_VERSION>
class JEvents : public Firebird::RefCntIface<Firebird::IEvents, FB_EVENTS_VERSION>
{
public:
// IEvents implementation
@ -256,7 +256,7 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JAttachment : public Firebird::StdIface<Firebird::IAttachment, FB_I_ATTACHMENT_VERSION>
class JAttachment : public Firebird::RefCntIface<Firebird::IAttachment, FB_ATTACHMENT_VERSION>
{
public:
// IAttachment implementation
@ -334,7 +334,7 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JService : public Firebird::StdIface<Firebird::IService, FB_I_SERVICE_VERSION>
class JService : public Firebird::RefCntIface<Firebird::IService, FB_SERVICE_VERSION>
{
public:
// IService implementation
@ -356,7 +356,7 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JProvider : public Firebird::StdPlugin<Firebird::IProvider, FB_I_PROVIDER_VERSION>
class JProvider : public Firebird::StdPlugin<Firebird::IProvider, FB_PROVIDER_VERSION>
{
public:
explicit JProvider(Firebird::IPluginConfig*)

View File

@ -33,6 +33,7 @@
#include "../common/classes/NestConst.h"
#include "../common/classes/auto.h"
#include "../common/classes/rwlock.h"
#include "../common/classes/ImplementHelper.h"
///#include "../dsql/Nodes.h"
struct dsc;
@ -61,7 +62,8 @@ private:
template <typename T> class ContextManager;
class TransactionImpl;
class RoutineMetadata : public Firebird::IRoutineMetadata, public Firebird::PermanentStorage
class RoutineMetadata : public Firebird::VersionedIface<Firebird::IRoutineMetadata, FB_ROUTINE_METADATA_VERSION>,
public Firebird::PermanentStorage
{
public:
RoutineMetadata(MemoryPool& pool)

View File

@ -71,7 +71,7 @@ UserManagement::UserManagement(jrd_tra* tra)
fb_assert(manager);
manager->addRef();
class UserIdInfo : public StackIface<Auth::ILogonInfo>
class UserIdInfo : public AutoIface<Auth::ILogonInfo, FB_AUTH_LOGON_INFO_VERSION>
{
public:
explicit UserIdInfo(const Attachment* pAtt)

View File

@ -54,7 +54,7 @@ protected:
class UserManagement : public DataDump
{
public:
class Display : public Firebird::StackIface<Auth::IListUsers>
class Display : public Firebird::AutoIface<Auth::IListUsers, FB_AUTH_LIST_USERS_VERSION>
{
public:
explicit Display(UserManagement* um)

View File

@ -1969,16 +1969,24 @@ static void dyn_user(Global* gbl, const UCHAR** ptr)
ISC_STATUS_ARRAY status;
try
{
class DisposeableUserData : public Firebird::DisposeIface<Auth::UserData, pool_alloc<type_user_data> >
class DynamicUserData : public Firebird::VersionedIface<Auth::UserData, FB_AUTH_USER_VERSION>
{
public:
void FB_CARG dispose()
#ifdef DEBUG_GDS_ALLOC
void* operator new(size_t size, Firebird::MemoryPool& pool, const char* fileName, int line)
{
delete this;
return pool.allocate(size, fileName, line);
}
#else // DEBUG_GDS_ALLOC
void* operator new(size_t size, Firebird::MemoryPool& pool)
{
return pool.allocate(size);
}
#endif // DEBUG_GDS_ALLOC
};
DisposeableUserData* userData = FB_NEW(*tra->tra_pool) DisposeableUserData;
DynamicUserData* userData = FB_NEW(*tra->tra_pool) DynamicUserData;
UCHAR verb;
while ((verb = *(*ptr)++) != isc_user_end)
{

View File

@ -315,7 +315,7 @@ public:
static GlobalPtr<ShutdownBeforeUnload, InstanceControl::PRIORITY_DETECT_UNLOAD> shutdownBeforeUnload;
class EngineFactory : public StackIface<IPluginFactory>
class EngineFactory : public AutoIface<IPluginFactory, FB_PLUGIN_FACTORY_VERSION>
{
public:
// IPluginFactory implementation
@ -745,7 +745,7 @@ private:
/// trace manager support
class TraceFailedConnection : public StackIface<TraceConnection>
class TraceFailedConnection : public AutoIface<TraceConnection, FB_TRACE_CONNECTION_VERSION>
{
public:
TraceFailedConnection(const char* filename, const DatabaseOptions* options);

View File

@ -37,7 +37,7 @@
struct PerformanceInfo;
class TraceConnection : public Firebird::IDisposable
class TraceConnection : public Firebird::IVersioned
{
public:
virtual int FB_CARG getConnectionID() = 0;
@ -52,6 +52,7 @@ public:
virtual int FB_CARG getRemoteProcessID() = 0;
virtual const char* FB_CARG getRemoteProcessName() = 0;
};
#define FB_TRACE_CONNECTION_VERSION (FB_VERSIONED_VERSION + 10)
enum ntrace_tra_isolation_t
{
@ -61,7 +62,7 @@ enum ntrace_tra_isolation_t
tra_iso_read_committed_norecver
};
class TraceTransaction : public Firebird::IDisposable
class TraceTransaction : public Firebird::IVersioned
{
public:
virtual int FB_CARG getTransactionID() = 0;
@ -70,22 +71,25 @@ public:
virtual ntrace_tra_isolation_t FB_CARG getIsolation() = 0;
virtual PerformanceInfo* FB_CARG getPerf() = 0;
};
#define FB_TRACE_TRANSACTION_VERSION (FB_VERSIONED_VERSION + 5)
typedef int ntrace_relation_t;
class TraceParams : public Firebird::IDisposable
class TraceParams : public Firebird::IVersioned
{
public:
virtual size_t FB_CARG getCount() = 0;
virtual const struct dsc* FB_CARG getParam(size_t idx) = 0;
};
#define FB_TRACE_PARAMS_VERSION (FB_VERSIONED_VERSION + 2)
class TraceStatement : public Firebird::IDisposable
class TraceStatement : public Firebird::IVersioned
{
public:
virtual int FB_CARG getStmtID() = 0;
virtual PerformanceInfo* FB_CARG getPerf() = 0;
};
#define FB_TRACE_STATEMENT_VERSION (FB_VERSIONED_VERSION + 2)
class TraceSQLStatement : public TraceStatement
{
@ -95,6 +99,7 @@ public:
virtual TraceParams* FB_CARG getInputs() = 0;
virtual const char* FB_CARG getTextUTF8() = 0;
};
#define FB_TRACE_SQL_STATEMENT_VERSION (FB_TRACE_STATEMENT_VERSION + 4)
class TraceBLRStatement : public TraceStatement
{
@ -103,32 +108,36 @@ public:
virtual size_t FB_CARG getDataLength() = 0;
virtual const char* FB_CARG getText() = 0;
};
#define FB_TRACE_BLR_STATEMENT_VERSION (FB_TRACE_STATEMENT_VERSION + 3)
class TraceDYNRequest : public Firebird::IDisposable
class TraceDYNRequest : public Firebird::IVersioned
{
public:
virtual const unsigned char* FB_CARG getData() = 0;
virtual size_t FB_CARG getDataLength() = 0;
virtual const char* FB_CARG getText() = 0;
};
#define FB_TRACE_DYN_REQUEST_VERSION (FB_VERSIONED_VERSION + 3)
class TraceContextVariable : public Firebird::IDisposable
class TraceContextVariable : public Firebird::IVersioned
{
public:
virtual const char* FB_CARG getNameSpace() = 0;
virtual const char* FB_CARG getVarName() = 0;
virtual const char* FB_CARG getVarValue() = 0;
};
#define FB_TRACE_CONTEXT_VARIABLE_VERSION (FB_VERSIONED_VERSION + 3)
class TraceProcedure : public Firebird::IDisposable
class TraceProcedure : public Firebird::IVersioned
{
public:
virtual const char* FB_CARG getProcName() = 0;
virtual TraceParams* FB_CARG getInputs() = 0;
virtual PerformanceInfo* FB_CARG getPerf() = 0;
};
#define FB_TRACE_PROCEDURE_VERSION (FB_VERSIONED_VERSION + 3)
class TraceTrigger : public Firebird::IDisposable
class TraceTrigger : public Firebird::IVersioned
{
public:
virtual const char* FB_CARG getTriggerName() = 0;
@ -137,10 +146,11 @@ public:
virtual int FB_CARG getWhich() = 0;
virtual PerformanceInfo* FB_CARG getPerf() = 0;
};
#define FB_TRACE_TRIGGER_VERSION (FB_VERSIONED_VERSION + 5)
typedef void* ntrace_service_t;
class TraceService : public Firebird::IDisposable
class TraceService : public Firebird::IVersioned
{
public:
virtual ntrace_service_t FB_CARG getServiceID() = 0;
@ -155,6 +165,7 @@ public:
virtual int FB_CARG getRemoteProcessID() = 0;
virtual const char* FB_CARG getRemoteProcessName() = 0;
};
#define FB_TRACE_SERVICE_VERSION (FB_VERSIONED_VERSION + 10)
// Plugin-specific argument. Passed by the engine to each hook
@ -221,14 +232,14 @@ struct PerformanceInfo
ntrace_counter_t pin_records_fetched; // records fetched from statement/procedure
};
class TraceLogWriter : public Firebird::IInterface
class TraceLogWriter : public Firebird::IRefCounted
{
public:
virtual size_t FB_CARG write(const void* buf, size_t size) = 0;
};
#define FB_TRACE_LOG_WRITER_VERSION (FB_INTERFACE_VERSION + 1)
#define FB_TRACE_LOG_WRITER_VERSION (FB_REFCOUNTED_VERSION + 1)
class TraceInitInfo : public Firebird::IDisposable
class TraceInitInfo : public Firebird::IVersioned
{
public:
virtual const char* FB_CARG getConfigText() = 0;
@ -239,10 +250,11 @@ public:
virtual TraceConnection* FB_CARG getConnection() = 0;
virtual TraceLogWriter* FB_CARG getLogWriter() = 0;
};
#define FB_TRACE_INIT_INFO_VERSION (FB_VERSIONED_VERSION + 7)
// API of trace plugin. Used to deliver notifications for each database
class TracePlugin : public Firebird::IInterface
class TracePlugin : public Firebird::IRefCounted
{
public:
// Function to return error string for hook failure
@ -295,7 +307,7 @@ public:
const ntrace_byte_t* recv_items, ntrace_result_t query_result) = 0;
virtual int FB_CARG trace_service_detach(TraceService* service, ntrace_result_t detach_result) = 0;
};
#define FB_TRACE_PLUGIN_VERSION (FB_INTERFACE_VERSION + 18)
#define FB_TRACE_PLUGIN_VERSION (FB_REFCOUNTED_VERSION + 18)
// Trace plugin second level factory (this is what is known to PluginManager as "trace plugin")
class TraceFactory : public Firebird::IPluginBase

View File

@ -70,7 +70,7 @@ private:
void checkFile();
void touchFile();
class TouchFile : public Firebird::StdIface<Firebird::ITimer, FB_I_TIMER_VERSION>
class TouchFile : public Firebird::RefCntIface<Firebird::ITimer, FB_TIMER_VERSION>
{
public:
void FB_CARG handler();

View File

@ -427,7 +427,7 @@ const char* TraceTriggerImpl::getRelationName()
/// TraceLogWriterImpl
class TraceLogWriterImpl : public StdIface<TraceLogWriter, FB_TRACE_LOG_WRITER_VERSION>
class TraceLogWriterImpl : public RefCntIface<TraceLogWriter, FB_TRACE_LOG_WRITER_VERSION>
{
public:
TraceLogWriterImpl(const TraceSession& session) :

View File

@ -49,7 +49,7 @@ class Database;
class Attachment;
class jrd_tra;
class TraceConnectionImpl : public Firebird::StackIface<TraceConnection>
class TraceConnectionImpl : public Firebird::AutoIface<TraceConnection, FB_TRACE_CONNECTION_VERSION>
{
public:
TraceConnectionImpl(const Attachment* att) :
@ -73,7 +73,7 @@ private:
};
class TraceTransactionImpl : public Firebird::StackIface<TraceTransaction>
class TraceTransactionImpl : public Firebird::AutoIface<TraceTransaction, FB_TRACE_TRANSACTION_VERSION>
{
public:
TraceTransactionImpl(const jrd_tra* tran, PerformanceInfo* perf = NULL) :
@ -94,7 +94,7 @@ private:
};
class BLRPrinter : public Firebird::StackIface<TraceBLRStatement>
class BLRPrinter : public Firebird::AutoIface<TraceBLRStatement, FB_TRACE_BLR_STATEMENT_VERSION>
{
public:
BLRPrinter(const unsigned char* blr, size_t length) :
@ -147,7 +147,7 @@ public:
};
class TraceSQLStatementImpl : public Firebird::StackIface<TraceSQLStatement>
class TraceSQLStatementImpl : public Firebird::AutoIface<TraceSQLStatement, FB_TRACE_SQL_STATEMENT_VERSION>
{
public:
TraceSQLStatementImpl(const dsql_req* stmt, PerformanceInfo* perf) :
@ -166,7 +166,7 @@ public:
virtual const char* FB_CARG getTextUTF8();
private:
class DSQLParamsImpl : public Firebird::StackIface<TraceParams>
class DSQLParamsImpl : public Firebird::AutoIface<TraceParams, FB_TRACE_PARAMS_VERSION>
{
public:
DSQLParamsImpl(Firebird::MemoryPool& pool, const Firebird::Array<dsql_par*>* params) :
@ -192,7 +192,7 @@ private:
};
class TraceFailedSQLStatement : public Firebird::StackIface<TraceSQLStatement>
class TraceFailedSQLStatement : public Firebird::AutoIface<TraceSQLStatement, FB_TRACE_SQL_STATEMENT_VERSION>
{
public:
TraceFailedSQLStatement(Firebird::string& text) :
@ -213,7 +213,7 @@ private:
};
class TraceContextVarImpl : public Firebird::StackIface<TraceContextVariable>
class TraceContextVarImpl : public Firebird::AutoIface<TraceContextVariable, FB_TRACE_CONTEXT_VARIABLE_VERSION>
{
public:
TraceContextVarImpl(const char* ns, const char* name, const char* value) :
@ -233,7 +233,7 @@ private:
const char* const m_value;
};
class TraceProcedureImpl : public Firebird::StackIface<TraceProcedure>
class TraceProcedureImpl : public Firebird::AutoIface<TraceProcedure, FB_TRACE_PROCEDURE_VERSION>
{
public:
TraceProcedureImpl(jrd_req* request, PerformanceInfo* perf) :
@ -252,7 +252,7 @@ public:
virtual PerformanceInfo* FB_CARG getPerf() { return m_perf; };
private:
class JrdParamsImpl : public Firebird::StackIface<TraceParams>
class JrdParamsImpl : public Firebird::AutoIface<TraceParams, FB_TRACE_PARAMS_VERSION>
{
public:
JrdParamsImpl(Firebird::MemoryPool& pool, jrd_req* request, const ValueListNode* params) :
@ -278,7 +278,7 @@ private:
};
class TraceTriggerImpl : public Firebird::StackIface<TraceTrigger>
class TraceTriggerImpl : public Firebird::AutoIface<TraceTrigger, FB_TRACE_TRIGGER_VERSION>
{
public:
TraceTriggerImpl(const jrd_req* trig, SSHORT which, PerformanceInfo* perf) :
@ -301,7 +301,7 @@ private:
};
class TraceServiceImpl : public Firebird::StackIface<TraceService>
class TraceServiceImpl : public Firebird::AutoIface<TraceService, FB_TRACE_SERVICE_VERSION>
{
public:
TraceServiceImpl(const Service* svc) :
@ -340,7 +340,7 @@ private:
};
class TraceInitInfoImpl : public Firebird::StackIface<TraceInitInfo>
class TraceInitInfoImpl : public Firebird::AutoIface<TraceInitInfo, FB_TRACE_INIT_INFO_VERSION>
{
public:
TraceInitInfoImpl(const Firebird::TraceSession& session, const Attachment* att,

View File

@ -132,7 +132,7 @@ namespace Remote {
class Attachment;
class Blob : public Firebird::StdIface<Firebird::IBlob, FB_I_BLOB_VERSION>
class Blob : public Firebird::RefCntIface<Firebird::IBlob, FB_BLOB_VERSION>
{
public:
// IBlob implementation
@ -173,7 +173,7 @@ int Blob::release()
return 0;
}
class Transaction : public Firebird::StdIface<Firebird::ITransaction, FB_I_TRANSACTION_VERSION>
class Transaction : public Firebird::RefCntIface<Firebird::ITransaction, FB_TRANSACTION_VERSION>
{
public:
// ITransaction implementation
@ -235,7 +235,7 @@ int Transaction::release()
return 0;
}
class Statement : public Firebird::StdIface<Firebird::IStatement, FB_I_STATEMENT_VERSION>
class Statement : public Firebird::RefCntIface<Firebird::IStatement, FB_STATEMENT_VERSION>
{
public:
// IStatement implementation
@ -289,7 +289,7 @@ int Statement::release()
return 0;
}
class Request : public Firebird::StdIface<Firebird::IRequest, FB_I_REQUEST_VERSION>
class Request : public Firebird::RefCntIface<Firebird::IRequest, FB_REQUEST_VERSION>
{
public:
// IRequest implementation
@ -333,7 +333,7 @@ int Request::release()
return 0;
}
class Events : public Firebird::StdIface<Firebird::IEvents, FB_I_EVENTS_VERSION>
class Events : public Firebird::RefCntIface<Firebird::IEvents, FB_EVENTS_VERSION>
{
public:
// IEvents implementation
@ -363,7 +363,7 @@ int Events::release()
return 0;
}
class Attachment : public Firebird::StdIface<Firebird::IAttachment, FB_I_ATTACHMENT_VERSION>
class Attachment : public Firebird::RefCntIface<Firebird::IAttachment, FB_ATTACHMENT_VERSION>
{
public:
// IAttachment implementation
@ -446,7 +446,7 @@ int Attachment::release()
return 0;
}
class Service : public Firebird::StdIface<Firebird::IService, FB_I_SERVICE_VERSION>
class Service : public Firebird::RefCntIface<Firebird::IService, FB_SERVICE_VERSION>
{
public:
// IService implementation
@ -482,7 +482,7 @@ int Service::release()
return 0;
}
class Provider : public Firebird::StdPlugin<Firebird::IProvider, FB_I_PROVIDER_VERSION>
class Provider : public Firebird::StdPlugin<Firebird::IProvider, FB_PROVIDER_VERSION>
{
public:
explicit Provider(IPluginConfig*)

View File

@ -252,7 +252,7 @@ int gsec(Firebird::UtilSvc* uSvc)
fb_assert(user_data->trustedUser.entered());
if (user_data->trustedUser.entered())
{
class GsecInfo : public Firebird::StackIface<Auth::ILogonInfo>
class GsecInfo : public Firebird::AutoIface<Auth::ILogonInfo, FB_AUTH_LOGON_INFO_VERSION>
{
public:
GsecInfo(const char* pTrustedUser, const char* pRole, int pTrustedRole,
@ -335,7 +335,7 @@ int gsec(Firebird::UtilSvc* uSvc)
}
}
class Display : public Firebird::StackIface<Auth::IListUsers>
class Display : public Firebird::AutoIface<Auth::IListUsers, FB_AUTH_LIST_USERS_VERSION>
{
public:
explicit Display(tsec* t)

View File

@ -47,7 +47,7 @@
#include <sys/stat.h>
class PluginLogWriter : public Firebird::StdIface<TraceLogWriter, FB_TRACE_LOG_WRITER_VERSION>
class PluginLogWriter : public Firebird::RefCntIface<TraceLogWriter, FB_TRACE_LOG_WRITER_VERSION>
{
public:
PluginLogWriter(const char* fileName, size_t maxSize);

View File

@ -44,7 +44,7 @@
// Bring in off_t
#include <sys/types.h>
class TracePluginImpl : public Firebird::StdIface<TracePlugin, FB_TRACE_PLUGIN_VERSION>
class TracePluginImpl : public Firebird::RefCntIface<TracePlugin, FB_TRACE_PLUGIN_VERSION>
{
public:
// Serialize exception to TLS buffer to return it to user

View File

@ -43,7 +43,7 @@ using namespace Firebird;
namespace {
class DTransaction : public StdIface<ITransaction, FB_I_TRANSACTION_VERSION>
class DTransaction : public RefCntIface<ITransaction, FB_TRANSACTION_VERSION>
{
public:
DTransaction()
@ -178,7 +178,7 @@ bool DTransaction::prepareCommit(IStatus* status, TdrBuffer& tdr)
return true;
}
class Dtc : public StackIface<IDtc>
class Dtc : public AutoIface<IDtc, FB_DTC_VERSION>
{
public:
// IDtc implementation

View File

@ -51,7 +51,7 @@ namespace Why {
// getStatus()
//
class UserStatus : public Firebird::DisposeIface<Firebird::BaseStatus>
class UserStatus : public Firebird::DisposeIface<Firebird::BaseStatus, FB_STATUS_VERSION>
{
private:
// IStatus implementation
@ -106,7 +106,7 @@ namespace
GlobalPtr<RWLock> mapLock;
}
int FB_CARG MasterImplementation::upgradeInterface(IInterface* toUpgrade,
int FB_CARG MasterImplementation::upgradeInterface(IVersioned* toUpgrade,
int desiredVersion,
void* missingFunctionClass)
{
@ -466,7 +466,7 @@ THREAD_ENTRY_DECLARE TimerEntry::timeThread(THREAD_ENTRY_PARAM)
} // namespace
class TimerImplementation : public StackIface<ITimerControl>
class TimerImplementation : public AutoIface<ITimerControl, FB_TIMER_CONTROL_VERSION>
{
public:
// ITimerControl implementation

View File

@ -37,14 +37,14 @@ namespace Why
{
extern Firebird::IProvider* dispatcherPtr;
class MasterImplementation : public Firebird::StackIface<Firebird::IMaster>
class MasterImplementation : public Firebird::AutoIface<Firebird::IMaster, FB_MASTER_VERSION>
{
public:
// IMaster implementation
Firebird::IStatus* FB_CARG getStatus();
Firebird::IProvider* FB_CARG getDispatcher();
Firebird::IPluginManager* FB_CARG getPluginManager();
int FB_CARG upgradeInterface(Firebird::IInterface* toUpgrade, int desiredVersion, void* missingFunctionClass);
int FB_CARG upgradeInterface(Firebird::IVersioned* toUpgrade, int desiredVersion, void* missingFunctionClass);
const char* FB_CARG circularAlloc(const char* s, size_t len, intptr_t thr);
Firebird::ITimerControl* FB_CARG getTimerControl();
Firebird::IAttachment* registerAttachment(Firebird::IProvider* provider,

View File

@ -126,10 +126,10 @@ namespace
bool flShutdown = false;
class ConfigParameterAccess : public StdIface<IConfigEntry, FB_I_CONFIG_PARAMETER_VERSION>
class ConfigParameterAccess : public RefCntIface<IConfigEntry, FB_CONFIG_PARAMETER_VERSION>
{
public:
ConfigParameterAccess(IInterface* c, const ConfigFile::Parameter* p) : cf(c), par(p) { }
ConfigParameterAccess(IRefCounted* c, const ConfigFile::Parameter* p) : cf(c), par(p) { }
// IConfigEntry implementation
const char* FB_CARG getName()
@ -156,11 +156,11 @@ namespace
}
private:
RefPtr<IInterface> cf;
RefPtr<IRefCounted> cf;
const ConfigFile::Parameter* par;
};
class ConfigAccess : public StdIface<IConfig, FB_I_CONFIG_VERSION>
class ConfigAccess : public RefCntIface<IConfig, FB_CONFIG_VERSION>
{
public:
ConfigAccess(RefPtr<ConfigFile> c) : confFile(c) { }
@ -338,11 +338,6 @@ namespace
}
*prev = next;
for (unsigned int i = 0; i < regPlugins.getCount(); ++i)
{
regPlugins[i].factory->dispose();
}
if (cleanup)
{
cleanup->doClean();
@ -453,7 +448,7 @@ namespace
};
// Delays destruction of ConfiguredPlugin instance
class PluginDestroyTimer : public Firebird::StdIface<Firebird::ITimer, FB_I_TIMER_VERSION>
class PluginDestroyTimer : public RefCntIface<ITimer, FB_TIMER_VERSION>
{
public:
PluginDestroyTimer(ConfiguredPlugin* cp)
@ -480,7 +475,7 @@ namespace
};
// Provides per-database configuration from aliases.conf.
class FactoryParameter : public StdIface<IPluginConfig, FB_FACTORY_PARAMETER_VERSION>
class FactoryParameter : public RefCntIface<IPluginConfig, FB_PLUGIN_CONFIG_VERSION>
{
public:
FactoryParameter(ConfiguredPlugin* cp, IFirebirdConf* fc)
@ -633,7 +628,7 @@ namespace
}
// Provides access to plugins of given type / name.
class PluginSet : public StdIface<IPluginSet, FB_PLUGIN_SET_VERSION>
class PluginSet : public RefCntIface<IPluginSet, FB_PLUGIN_SET_VERSION>
{
public:
// IPluginSet implementation
@ -663,7 +658,7 @@ namespace
: interfaceType(pinterfaceType), namesList(getPool()),
desiredVersion(pdesiredVersion), missingFunctionClass(pmissingFunctionClass),
currentName(getPool()), currentPlugin(NULL),
firebirdConf(fbConf), masterInterface(fb_get_master_interface())
firebirdConf(fbConf)
{
namesList.assign(pnamesList);
namesList.alltrim(" \t");
@ -691,7 +686,7 @@ namespace
RefPtr<ConfiguredPlugin> currentPlugin; // Missing data in this field indicates EOF
RefPtr<IFirebirdConf> firebirdConf;
AutoPtr<IMaster, AutoDisposable> masterInterface;
MasterInterfacePtr masterInterface;
RefPtr<PluginModule> loadModule(const PathName& modName);
@ -924,7 +919,7 @@ void FB_CARG PluginManager::releasePlugin(IPluginBase* plugin)
{
MutexLockGuard g(plugins->mutex);
IInterface* parent = plugin->getOwner();
IRefCounted* parent = plugin->getOwner();
if (plugin->release() == 0)
{

View File

@ -38,7 +38,7 @@
namespace Firebird {
class PluginManager : public StackIface<IPluginManager>
class PluginManager : public AutoIface<IPluginManager, FB_PLUGIN_MANAGER_VERSION>
{
public:
// IPluginManager implementation

View File

@ -189,7 +189,7 @@ static RefPtr<T> translateHandle(GlobalPtr<GenericMap<Pair<NonPooled<FB_API_HAND
namespace Why
{
// StatusVector: Provides correct status vector for operation and init() it.
class StatusVector : public StackIface<IStatus>
class StatusVector : public AutoIface<IStatus, FB_STATUS_VERSION>
{
public:
explicit StatusVector(ISC_STATUS* v) throw()
@ -211,6 +211,9 @@ namespace Why
}
// IStatus implementation
void FB_CARG dispose()
{ }
void FB_CARG set(unsigned int length, const ISC_STATUS* value)
{
fb_utils::copyStatus(localVector, FB_NELEM(localStatus), value, length);
@ -706,7 +709,7 @@ namespace Why
RefPtr<Intf> next;
};
class YEvents : public YHelper<YEvents, IEvents, FB_I_EVENTS_VERSION>
class YEvents : public YHelper<YEvents, IEvents, FB_EVENTS_VERSION>
{
public:
static const ISC_STATUS ERROR_CODE = isc_bad_events_handle;
@ -730,7 +733,7 @@ namespace Why
bool deleteCallback;
};
class YRequest : public YHelper<YRequest, IRequest, FB_I_REQUEST_VERSION>
class YRequest : public YHelper<YRequest, IRequest, FB_REQUEST_VERSION>
{
public:
static const ISC_STATUS ERROR_CODE = isc_bad_req_handle;
@ -757,7 +760,7 @@ namespace Why
FB_API_HANDLE* userHandle;
};
class YTransaction : public YHelper<YTransaction, ITransaction, FB_I_TRANSACTION_VERSION>
class YTransaction : public YHelper<YTransaction, ITransaction, FB_TRANSACTION_VERSION>
{
public:
static const ISC_STATUS ERROR_CODE = isc_bad_trans_handle;
@ -790,7 +793,7 @@ namespace Why
private:
YTransaction(YTransaction* from)
: YHelper<YTransaction, ITransaction, FB_I_TRANSACTION_VERSION>(from->next),
: YHelper<YTransaction, ITransaction, FB_TRANSACTION_VERSION>(from->next),
attachment(from->attachment),
childBlobs(getPool()),
cleanupHandlers(getPool())
@ -802,7 +805,7 @@ namespace Why
}
};
class YBlob : public YHelper<YBlob, IBlob, FB_I_BLOB_VERSION>
class YBlob : public YHelper<YBlob, IBlob, FB_BLOB_VERSION>
{
public:
static const ISC_STATUS ERROR_CODE = isc_bad_segstr_handle;
@ -825,7 +828,7 @@ namespace Why
YTransaction* transaction;
};
class YStatement : public YHelper<YStatement, IStatement, FB_I_STATEMENT_VERSION>
class YStatement : public YHelper<YStatement, IStatement, FB_STATEMENT_VERSION>
{
public:
static const ISC_STATUS ERROR_CODE = isc_bad_stmt_handle;
@ -881,13 +884,13 @@ namespace Why
Mutex enterMutex;
};
class YAttachment : public YHelper<YAttachment, IAttachment, FB_I_ATTACHMENT_VERSION>, public EnterCount
class YAttachment : public YHelper<YAttachment, IAttachment, FB_ATTACHMENT_VERSION>, public EnterCount
{
public:
static const ISC_STATUS ERROR_CODE = isc_bad_db_handle;
explicit YAttachment(IProvider* aProvider, IAttachment* aNext, const PathName& aDbPath)
: YHelper<YAttachment, IAttachment, FB_I_ATTACHMENT_VERSION>(aNext),
: YHelper<YAttachment, IAttachment, FB_ATTACHMENT_VERSION>(aNext),
provider(aProvider),
dbPath(getPool(), aDbPath),
childBlobs(getPool()),
@ -959,13 +962,13 @@ namespace Why
StatusHolder savedStatus; // Do not use raise() method of this class in yValve.
};
class YService : public YHelper<YService, IService, FB_I_SERVICE_VERSION>, public EnterCount
class YService : public YHelper<YService, IService, FB_SERVICE_VERSION>, public EnterCount
{
public:
static const ISC_STATUS ERROR_CODE = isc_bad_svc_handle;
explicit YService(IProvider* aProvider, IService* aNext)
: YHelper<YService, IService, FB_I_SERVICE_VERSION>(aNext),
: YHelper<YService, IService, FB_SERVICE_VERSION>(aNext),
provider(aProvider)
{
provider->addRef();
@ -993,7 +996,7 @@ namespace Why
IProvider* provider;
};
class Dispatcher : public StdPlugin<IProvider, FB_I_PROVIDER_VERSION>
class Dispatcher : public StdPlugin<IProvider, FB_PROVIDER_VERSION>
{
public:
void* operator new(size_t, void* memory) throw()
@ -1086,7 +1089,7 @@ namespace Why
YEntry(const YEntry&); // prohibit copy constructor
private:
RefPtr<IInterface> ref;
RefPtr<IRefCounted> ref;
EnterCount* counter;
};
} // namespace Why
@ -2773,7 +2776,7 @@ ISC_STATUS API_ROUTINE isc_wait_for_event(ISC_STATUS* userStatus, FB_API_HANDLE*
StatusVector status(userStatus);
YEvents* events = NULL;
class Callback : public IEventCallback
class Callback : public AutoIface<IEventCallback, FB_EVENT_CALLBACK_VERSION>
{
public:
explicit Callback(UCHAR* aBuffer)
@ -2997,7 +3000,8 @@ ISC_STATUS API_ROUTINE isc_que_events(ISC_STATUS* userStatus, FB_API_HANDLE* dbH
///nullCheck(id, isc_bad_events_handle);
class Callback : public IEventCallback
class Callback : public VersionedIface<IEventCallback, FB_EVENT_CALLBACK_VERSION>,
public GlobalStorage
{
public:
Callback(FPTR_EVENT_CALLBACK aAst, void* aArg)
@ -3680,7 +3684,7 @@ ITransaction* MasterImplementation::registerTransaction(IAttachment* attachment,
YEvents::YEvents(YAttachment* aAttachment, IEvents* aNext, IEventCallback* aCallback)
: YHelper<YEvents, IEvents, FB_I_EVENTS_VERSION>(aNext),
: YHelper<YEvents, IEvents, FB_EVENTS_VERSION>(aNext),
attachment(aAttachment),
callback(aCallback),
deleteCallback(false)
@ -3721,7 +3725,7 @@ void YEvents::cancel(IStatus* status)
YRequest::YRequest(YAttachment* aAttachment, IRequest* aNext)
: YHelper<YRequest, IRequest, FB_I_REQUEST_VERSION>(aNext),
: YHelper<YRequest, IRequest, FB_REQUEST_VERSION>(aNext),
attachment(aAttachment),
userHandle(NULL)
{
@ -3853,7 +3857,7 @@ void YRequest::free(IStatus* status)
YBlob::YBlob(YAttachment* aAttachment, YTransaction* aTransaction, IBlob* aNext)
: YHelper<YBlob, IBlob, FB_I_BLOB_VERSION>(aNext),
: YHelper<YBlob, IBlob, FB_BLOB_VERSION>(aNext),
attachment(aAttachment),
transaction(aTransaction)
{
@ -3969,7 +3973,7 @@ int YBlob::seek(IStatus* status, int mode, int offset)
YStatement::YStatement(YAttachment* aAttachment, IStatement* aNext)
: YHelper<YStatement, IStatement, FB_I_STATEMENT_VERSION>(aNext),
: YHelper<YStatement, IStatement, FB_STATEMENT_VERSION>(aNext),
attachment(aAttachment),
userHandle(NULL),
prepared(false)
@ -4209,7 +4213,7 @@ void YStatement::free(IStatus* status, unsigned int option)
YTransaction::YTransaction(YAttachment* aAttachment, ITransaction* aNext)
: YHelper<YTransaction, ITransaction, FB_I_TRANSACTION_VERSION>(aNext),
: YHelper<YTransaction, ITransaction, FB_TRANSACTION_VERSION>(aNext),
attachment(aAttachment),
childBlobs(getPool()),
cleanupHandlers(getPool())
@ -5009,7 +5013,7 @@ YAttachment* Dispatcher::attachDatabase(IStatus* status, const char* filename,
ResolveDatabaseAlias(expandedFilename, dummy, &config);
for (GetPlugins<IProvider, NoEntrypoint> providerIterator(PluginType::Provider,
FB_I_PROVIDER_VERSION, config);
FB_PROVIDER_VERSION, config);
providerIterator.hasData();
providerIterator.next())
{
@ -5132,7 +5136,7 @@ YAttachment* Dispatcher::createDatabase(IStatus* status, const char* filename,
***/
for (GetPlugins<IProvider, NoEntrypoint> providerIterator(PluginType::Provider,
FB_I_PROVIDER_VERSION/***, config***/);
FB_PROVIDER_VERSION/***, config***/);
providerIterator.hasData();
providerIterator.next())
{
@ -5196,7 +5200,7 @@ YService* Dispatcher::attachServiceManager(IStatus* status, const char* serviceN
try
{
for (GetPlugins<IProvider, NoEntrypoint> providerIterator(PluginType::Provider,
FB_I_PROVIDER_VERSION);
FB_PROVIDER_VERSION);
providerIterator.hasData();
providerIterator.next())
{
@ -5285,7 +5289,7 @@ void Dispatcher::shutdown(IStatus* userStatus, unsigned int timeout, const int r
// Shutdown providers (if any present).
for (GetPlugins<IProvider, NoEntrypoint> providerIterator(
PluginType::Provider, FB_I_PROVIDER_VERSION);
PluginType::Provider, FB_PROVIDER_VERSION);
providerIterator.hasData();
providerIterator.next())
{