start working on 0.7.x branch
- added FileLog which stores content to the file log - now Log is only a wrapper - it puts messages to the local buffer and when logsave is used then the buffer is put to FileLog - new base classes: WinixBase (Log, Config*, Synchro*) WinixModel : public WinixBase (morm::ModelConnector*, Plugin*) WinixSystem : public WinixModel (System*) WinixRequest : public WinixSystem (SLog, Cur*) - singletons: log, slog, plugin are depracated - now references to them are in base classses (WinixBase, WinixModel) - DbBase, DbConn and Db are depracated - now we are using Morm project (in WinixModel there is a model_connector pointer) each thread will have its own ModelConnector git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1146 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2014, Tomasz Sowa
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "plugindata.h"
|
||||
#include "plugin.h"
|
||||
#include "log.h"
|
||||
#include "session.h"
|
||||
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -46,7 +46,6 @@ namespace Winix
|
||||
|
||||
PluginData::PluginData()
|
||||
{
|
||||
session = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +62,6 @@ PluginData & PluginData::operator=(const PluginData & p)
|
||||
// we don't copy all pointers - only resize the table
|
||||
// pointers will be set to zero
|
||||
Resize(p.Size());
|
||||
session = 0;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -72,15 +70,10 @@ return *this;
|
||||
|
||||
PluginData::~PluginData()
|
||||
{
|
||||
DeleteAll();
|
||||
//DeleteAll();
|
||||
}
|
||||
|
||||
|
||||
void PluginData::SetSession(Session * ses)
|
||||
{
|
||||
session = ses;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PluginData::Assign(size_t index, PluginDataBase * data)
|
||||
@@ -92,16 +85,16 @@ void PluginData::Assign(size_t index, PluginDataBase * data)
|
||||
}
|
||||
|
||||
|
||||
void PluginData::Assign(PluginDataBase * data)
|
||||
{
|
||||
if( plugin.current_plugin == -1 )
|
||||
{
|
||||
log << log1 << "PD: Assign(PluginDataBase*) should be called only from plugins" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
Assign(plugin.current_plugin, data);
|
||||
}
|
||||
//void PluginData::Assign(PluginDataBase * data)
|
||||
//{
|
||||
// if( plugin.current_plugin == -1 )
|
||||
// {
|
||||
// log << log1 << "PD: Assign(PluginDataBase*) should be called only from plugins" << logend;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Assign(plugin.current_plugin, data);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@@ -114,31 +107,23 @@ return table[index];
|
||||
}
|
||||
|
||||
|
||||
PluginDataBase * PluginData::Get()
|
||||
{
|
||||
if( plugin.current_plugin == -1 )
|
||||
{
|
||||
log << log1 << "PD: Get() should be called only from plugins" << logend;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Get(plugin.current_plugin);
|
||||
}
|
||||
//PluginDataBase * PluginData::Get()
|
||||
//{
|
||||
// if( plugin.current_plugin == -1 )
|
||||
// {
|
||||
// log << log1 << "PD: Get() should be called only from plugins" << logend;
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
//return Get(plugin.current_plugin);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
void PluginData::DeleteAll()
|
||||
bool PluginData::HasAllocatedData()
|
||||
{
|
||||
bool all_null = true;
|
||||
|
||||
/*
|
||||
when we copy a session's object (and this object then)
|
||||
we resize the table and there are only null pointers there
|
||||
consequently if all pointers are null there is no sens
|
||||
to send WINIX_PLUGIN_SESSION_DATA_REMOVE
|
||||
*/
|
||||
|
||||
for(size_t i=0 ; i<table.size() ; ++i)
|
||||
{
|
||||
if( table[i] != 0 )
|
||||
@@ -148,19 +133,40 @@ void PluginData::DeleteAll()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
in the future this message may be removed
|
||||
and we directly 'delete' the pointers
|
||||
*/
|
||||
|
||||
if( !all_null )
|
||||
plugin.Call(session, WINIX_PLUGIN_SESSION_DATA_REMOVE);
|
||||
|
||||
table.clear();
|
||||
return !all_null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//void PluginData::DeleteAll()
|
||||
//{
|
||||
// bool all_null = true;
|
||||
//
|
||||
// when we copy a session's object (and this object then)
|
||||
// we resize the table and there are only null pointers there
|
||||
// consequently if all pointers are null there is no sens
|
||||
// to send WINIX_PLUGIN_SESSION_DATA_REMOVE
|
||||
//
|
||||
// for(size_t i=0 ; i<table.size() ; ++i)
|
||||
// {
|
||||
// if( table[i] != 0 )
|
||||
// {
|
||||
// all_null = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// in the future this message may be removed
|
||||
// and we directly 'delete' the pointers
|
||||
//
|
||||
// if( !all_null )
|
||||
// plugin.Call(session, WINIX_PLUGIN_SESSION_DATA_REMOVE);
|
||||
//
|
||||
// table.clear();
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
size_t PluginData::Size() const
|
||||
|
||||
Reference in New Issue
Block a user