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:
2018-11-21 11:03:53 +00:00
parent a7c47140ae
commit a2ffc1e81c
121 changed files with 7832 additions and 6662 deletions

View File

@@ -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,8 +35,12 @@
#include <dlfcn.h>
#include <string.h>
#include "plugin.h"
#include "pluginmsg.h"
#include "misc.h"
#include "system.h"
#include "sessionmanager.h"
#include "functions/functions.h"
#include "templates/templates.h"
#include "winixsystem.h"
namespace Winix
@@ -61,14 +65,13 @@ Plugin::Plugin()
{
current_plugin = -1;
db = 0;
config = 0;
cur = 0;
system = 0;
functions = 0;
templates = 0;
synchro = 0;
session_manager = 0;
db = nullptr;
cur = nullptr;
system = nullptr;
functions = nullptr;
templates = nullptr;
session_manager = nullptr;
winix_system = nullptr;
}
@@ -83,10 +86,10 @@ void Plugin::SetDb(Db * pdb)
db = pdb;
}
void Plugin::SetConfig(Config * pconfig)
{
config = pconfig;
}
//void Plugin::SetConfig(Config * pconfig)
//{
// config = pconfig;
//}
void Plugin::SetCur(Cur * pcur)
@@ -113,10 +116,10 @@ void Plugin::SetTemplates(Templates * ptemplates)
}
void Plugin::SetSynchro(Synchro * psynchro)
{
synchro = psynchro;
}
//void Plugin::SetSynchro(Synchro * psynchro)
//{
// synchro = psynchro;
//}
void Plugin::SetSessionManager(SessionManager * psession_manager)
@@ -125,6 +128,12 @@ void Plugin::SetSessionManager(SessionManager * psession_manager)
}
void Plugin::SetWinixSystem(WinixSystem * winix_system)
{
this->winix_system = winix_system;
}
void Plugin::Lock()
{
@@ -142,10 +151,10 @@ void Plugin::Unlock()
bool Plugin::SetPointers(PluginInfo & info)
bool Plugin::SetDependency(PluginInfo & info)
{
// for safety we call a plugin function only when all our pointers are not null
bool res = (db && config && cur && system && functions && templates && synchro && session_manager);
bool res = (db && config && cur && system && functions && templates && synchro && session_manager && winix_system);
if( !res )
{
@@ -162,6 +171,9 @@ bool Plugin::SetPointers(PluginInfo & info)
info.templates = templates;
info.synchro = synchro;
info.session_manager = session_manager;
info.winix_system = winix_system;
info.plugin = this;
info.log.SetDependency(&log);
return res;
}
@@ -233,7 +245,7 @@ void * plugin_handle;
int old_current_plugin;
PluginInfo info;
if( !SetPointers(info) )
if( !SetDependency(info) )
return;
if( !(plugin_handle = LoadInitFun(filename, fun_init)) )
@@ -293,7 +305,7 @@ bool Plugin::HasMessage(int message)
void Plugin::Call(Session * ses, int message, Slots::iterator & slot, PluginInfo & info)
{
if( !SetPointers(info) )
if( !SetDependency(info) )
return;
current_plugin = slot->second.index;