Commit 2dcc70ed authored by Aivan_2008's avatar Aivan_2008
Browse files

Слияние с MockCompsTest

--HG--
branch : DeploymentQt
......@@ -135,12 +135,20 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
programName=projectIniFile("General","ProgramName","Server");
configsMainPath=projectIniFile("General", "ConfigsMainPath", "../../../Configs/");
neverSleepOnMMThreadContention=atoi(projectIniFile("General","NeverSleepOnMMThreadContention","0"));
logDir=projectIniFile("Log","Dir","");
logDir=projectIniFile("Log","Dir",""); // TODO: Log/FixedLogPath
if(logDir.empty())
logDir=projectIniFile("Log","FixedLogPath",""); // TODO: Log/Dir
int logCreationMode=atoi(projectIniFile("Log","LogCreationMode","0"));
// bool SetFixedLogPath(const std::string& value);
startupDelay=atoi(projectIniFile("General","StartupDelay","0"));
useNewXmlFormatProjectFile=atoi(projectIniFile("General","UseNewXmlFormatProjectFile","0"));
useNewProjectFilesStructure=atoi(projectIniFile("General","UseNewProjectFilesStructure","0"));
std::string librariesPath=projectIniFile("General", "LibrariesPath", "../../../");
databaseMainPath=projectIniFile("General","DatabaseMainPath","");
remoteFtpDatabasePath=projectIniFile("General","RemoteFtpDatabasePath","");
......@@ -165,18 +173,26 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
application.SetApplicationFileName(application_file_name);
application.SetLogCreationMode(logCreationMode);
if(logDir.empty())
{
application.SetFixedLogPath(log_dir);
application.SetLogDir(log_dir);
}
else
{
application.SetFixedLogPath(logDir);
application.SetLogDir(logDir);
}
application.SetDebugMode(logDebugMode);
application.SetLibrariesPath(librariesPath);
application.SetConfigsMainPath(configsMainPath);
application.ChangeUseNewXmlFormatProjectFile(useNewXmlFormatProjectFile);
application.ChangeUseNewProjectFilesStructure(useNewProjectFilesStructure);
try
{
if(argc > 1)
......
......@@ -47,6 +47,7 @@ UApplication::UApplication(void)
ChangeUseNewXmlFormatProjectFile(false);
ChangeUseNewProjectFilesStructure(false);
StorageBuildMode = 1;
LogCreationMode=0;
//SetStandartXMLInCatalog();
......@@ -87,7 +88,8 @@ bool UApplication::SetWorkDirectory(const std::string& value)
if(WorkDirectory == value)
return true;
WorkDirectory=value;
UpdateLoggers();
if(FixedLogPath.empty())
UpdateLoggers();
return true;
}
......@@ -105,6 +107,20 @@ bool UApplication::SetConfigsMainPath(const std::string &value)
return true;
}
/// ( - MockLibs, RTlibs)
const std::string& UApplication::GetLibrariesPath(void) const
{
return LibrariesPath;
}
bool UApplication::SetLibrariesPath(const std::string &value)
{
if(LibrariesPath == value)
return true;
LibrariesPath=value;
return true;
}
/// ( /Bin/Configs)
const std::string& UApplication::GetDatabaseMainPath(void) const
{
......@@ -157,7 +173,8 @@ bool UApplication::SetProjectPath(const std::string& value)
if(ProjectPath == value)
return true;
ProjectPath=value;
UpdateLoggers();
if(LogCreationMode == 0 || LogCreationMode == 1)
UpdateLoggers();
// EngineControl->GetEngineStateThread()->CloseEventsLogFile();
CalcAppCaption();
return true;
......@@ -265,18 +282,53 @@ bool UApplication::SetDebugMode(bool value)
std::string UApplication::CalcCurrentLogDir(void) const
{
std::string log_dir;
if(Project && Project->GetConfig().OverrideLogParameters && !ProjectPath.empty())
switch(LogCreationMode)
{
case 0:
case 1:
{
log_dir=ProjectPath+"EventsLog/";
if(Project && Project->GetConfig().OverrideLogParameters && !ProjectPath.empty())
{
log_dir=ProjectPath+"EventsLog/";
}
else
{
if(FixedLogPath.empty())
{
log_dir=Core_GetLogDir();
if(log_dir.empty())
log_dir=WorkDirectory+"EventsLog/";
}
else
{
log_dir=FixedLogPath;
}
if(!log_dir.empty() && log_dir.find_last_of("\\/") != log_dir.size()-1)
log_dir+="/";
}
}
else
break;
case 2:
case 3:
{
log_dir=Core_GetLogDir();
if(log_dir.empty())
log_dir=WorkDirectory+"EventsLog/";
if(FixedLogPath.empty())
{
log_dir=Core_GetLogDir();
if(log_dir.empty())
log_dir=WorkDirectory+"EventsLog/";
}
else
{
log_dir=FixedLogPath;
}
if(!log_dir.empty() && log_dir.find_last_of("\\/") != log_dir.size()-1)
log_dir+="/";
}
break;
}
return log_dir;
}
......@@ -311,6 +363,43 @@ bool UApplication::IsInit(void) const
return AppIsInit;
}
///
const std::string& UApplication::GetFixedLogPath(void) const
{
return FixedLogPath;
}
bool UApplication::SetFixedLogPath(const std::string& value)
{
if(FixedLogPath == value)
return true;
FixedLogPath=value;
return true;
}
///
/// 0 - ( Reset )
/// 1 - .
/// 2 - .
/// 3 -
int UApplication::GetLogCreationMode(void) const
{
return LogCreationMode;
}
bool UApplication::SetLogCreationMode(int mode)
{
if(LogCreationMode == mode)
return true;
if(mode<0 || mode>3)
return false;
LogCreationMode=mode;
return true;
}
///
void UApplication::SetStorageBuildMode(int mode)
{
......@@ -540,6 +629,7 @@ bool UApplication::Init(void)
Core_LoadFonts();
EngineControl->Init();
RDK::GetCoreLock()->SetLibrariesPath(LibrariesPath);
UApplication::SetNumChannels(1);
// MCore_ChannelInit(0,0,(void*)ExceptionHandler);
......@@ -556,8 +646,6 @@ bool UApplication::Init(void)
}*/
SetStandartXMLInCatalog();
AppIsInit = true;
return true;
}
......@@ -1271,11 +1359,13 @@ bool UApplication::OpenProject(const std::string &filename)
ProjectFileName=extract_file_name(filename);
Project->SetProjectPath(ProjectPath);
Project->ReadFromXml(ProjectXml);
UpdateLoggers();
if(LogCreationMode != 3)
UpdateLoggers();
TProjectConfig config=Project->GetConfig();
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->SetEventsLogMode(config.EventsLogFlag);
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->Clear();
if(LogCreationMode != 3)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->Clear();
// EngineControl->GetEngineStateThread()->SetLogFlag(config.EventsLogFlag);
// EngineControl->GetEngineStateThread()->CloseEventsLogFile();
// EngineControl->GetEngineStateThread()->SetLogDir(ProjectPath);
......
......@@ -50,6 +50,9 @@ std::string WorkDirectory;
/// ( /Bin/Configs)
std::string ConfigsMainPath;
/// ( - MockLibs, RTlibs)
std::string LibrariesPath;
/// ( /Database)
std::string DatabaseMainPath;
......@@ -101,6 +104,17 @@ std::list<StandartXMLInCatalog> xmlInCatalog;
// 3 - . -, . ( )
int StorageBuildMode;
///
///
std::string FixedLogPath;
///
/// 0 - ( ResetChannel StartChannel )
/// 1 - .
/// 2 - .
/// 3 -
int LogCreationMode;
protected: //
///
UEPtr<URpcDispatcher> RpcDispatcher;
......@@ -159,6 +173,10 @@ bool SetConfigsMainPath(const std::string &value);
const std::string& GetDatabaseMainPath(void) const;
bool SetDatabaseMainPath(const std::string &value);
/// ( - MockLibs, RTLibs)
const std::string& GetLibrariesPath(void) const;
bool SetLibrariesPath(const std::string &value);
/// ( /Bin/Models)
const std::string& GetModelsMainPath(void) const;
bool SetModelsMainPath(const std::string &value);
......@@ -196,6 +214,18 @@ bool ChangeUseNewProjectFilesStructure(bool value);
const std::list<StandartXMLInCatalog>& GetStandartXMLInCatalog(void) const;
bool SetStandartXMLInCatalog(void);
///
const std::string& GetFixedLogPath(void) const;
bool SetFixedLogPath(const std::string& value);
///
/// 0 - ( ResetChannel StartChannel )
/// 1 - .
/// 2 - .
/// 3 -
int GetLogCreationMode(void) const;
bool SetLogCreationMode(int mode);
///
const std::string& GetAppCaption(void) const;
......
......@@ -263,7 +263,8 @@ void UEngineControl::StartChannel(int channel_index)
if(channel_index>=GetNumChannels())
return;
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
if(Application && Application->GetLogCreationMode() == 0)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
// EngineStateThread->RecreateEventsLogFile();
switch(ThreadMode)
{
......@@ -367,7 +368,8 @@ void UEngineControl::PauseChannel(int channel_index)
break;
}
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->Clear();
if(Application && Application->GetLogCreationMode() == 0)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->Clear();
// EngineStateThread->CloseEventsLogFile();
}
......@@ -377,7 +379,8 @@ void UEngineControl::ResetChannel(int channel_index)
if(channel_index>=GetNumChannels())
return;
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
if(Application && Application->GetLogCreationMode() == 0)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->RecreateEventsLogFile();
// EngineStateThread->RecreateEventsLogFile();
if(channel_index == -1)
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,8 @@
#define UCREATORPROPTEMPLATE_H
#include "UStorage.h"
#include "UMockUNet.h"
#include "../../Deploy/Include/rdk.h"
namespace RDK {
// CreatePropertyByType.
// , -
......@@ -10,8 +11,15 @@ template <template<typename, typename, unsigned int> class PropType, unsigned in
class CreatorProperty
{
public:
static bool CreatePropertyByType(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
static void CreatePropertyByType(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
std::string prop_name = serstorage->GetNodeName();
PropType<T, UMockUNet, TypeInt>* p = new PropType<T, UMockUNet, TypeInt>(prop_name, mock_unet);
p->Load(serstorage);
}
};
}
#endif // UCREATORPROPTEMPLATE_H
......@@ -7,7 +7,7 @@
namespace RDK {
// TODO Logger
/* *************************************************************************** */
// --------------------------
//
......@@ -60,10 +60,10 @@ UMockUNet::UMockUNet(RDK::USerStorageXML *serstorage, UStorage* storage)
{
if(CreatedProps.find((*p).first) == CreatedProps.end())
{
if(std::find(ForbiddenInputs.begin(),ForbiddenInputs.end(),(*p).first) != ForbiddenInputs.end())
if(std::find(UBasePropCreator::GetForbiddenInputs().begin(),UBasePropCreator::GetForbiddenInputs().end(),(*p).first) != UBasePropCreator::GetForbiddenInputs().end())
continue;
if(std::find(ForbiddenOutputs.begin(),ForbiddenOutputs.end(),(*p).first) != ForbiddenOutputs.end())
if(std::find( UBasePropCreator::GetForbiddenOutputs().begin(), UBasePropCreator::GetForbiddenOutputs().end(),(*p).first) != UBasePropCreator::GetForbiddenOutputs().end())
continue;
if(GetStorage()->GetLogger())
{
......
......@@ -3,9 +3,6 @@
#include "UNet.h"
extern std::vector<std::string> ForbiddenInputs;
extern std::vector<std::string> ForbiddenOutputs;
// RTV UBVSObject
//#include "../../../Libraries/Rtv-BasicLib/Core/RTVSupport.h"
......
......@@ -1122,7 +1122,7 @@ bool UStorage::CreateRuntimeCollection(const std::string &lib_name)
}
//
std::string lib_path = "../../../RTlibs/" + lib_name;
std::string lib_path = LibrariesPath + "RTlibs/" + lib_name;
URuntimeLibrary* lib=new URuntimeLibrary(lib_name,"", lib_path);
......@@ -1212,15 +1212,27 @@ bool UStorage::DeleteRuntimeCollection(const std::string &lib_name)
}
}
//
void UStorage::SetLibrariesPath(const std::string& value)
{
LibrariesPath = value;
}
//
const std::string UStorage::GetLibrariesPath() const
{
return LibrariesPath;
}
///
/// Engine
void UStorage::InitRTlibs(void)
{
// RTlibs
std::string lib_path = "../../../RTlibs";
std::string lib_path = LibrariesPath + "RTlibs";
// ,
if(RDK::CreateNewDirectory("../../../RTlibs/"))
if(RDK::CreateNewDirectory(lib_path.c_str()))
return;
// xml
......@@ -1256,7 +1268,7 @@ bool UStorage::LoadRuntimeCollection(const std::string &lib_name)
}
//
std::string lib_path = "../../../RTlibs/" + lib_name;
std::string lib_path = LibrariesPath + "RTlibs/" + lib_name;
URuntimeLibrary* lib = new URuntimeLibrary(lib_name,"",lib_path);
......@@ -1330,8 +1342,8 @@ bool UStorage::DelCollection(int index)
bool UStorage::InitMockLibs(void)
{
// -
std::string lib_path = "../../../MockLibs/";
std::string lib_list_file = "../../../MockLibs/0_LibList.xml";
std::string lib_path = LibrariesPath + "/MockLibs/";
std::string lib_list_file = lib_path + "0_LibList.xml";
USerStorageXML LibList;
if(!LibList.LoadFromFile(lib_list_file,"LibraryList"))
......@@ -1390,7 +1402,7 @@ bool UStorage::CreateMockLibs(void)
if(lib && lib->GetType()==0)
{
// ,
std::string lib_path = "../../../MockLibs/";
std::string lib_path = LibrariesPath + "MockLibs/";
if(RDK::CreateNewDirectory(lib_path.c_str()))
{
......@@ -1454,7 +1466,7 @@ bool UStorage::SaveMockLibs(void)
}
}
std::string file_name = "../../../MockLibs/0_LibList.xml";
std::string file_name = LibrariesPath + "MockLibs/0_LibList.xml";
LibList.SaveToFile(file_name);
return true;
}
......
......@@ -147,6 +147,9 @@ int BuildMode;
// - Property MockUNet
std::list<funcCrPropMock> FunctionsCrPropMock;
// ( MockLibs RTlibs)
std::string LibrariesPath;
protected: //
......@@ -331,6 +334,12 @@ void GetLibsNameListByType(std::string &buffer, int type) const;
//
//virtual bool AddClass(UContainer *newclass);
//
void SetLibrariesPath(const std::string& value);
//
const std::string GetLibrariesPath() const;
// RT-
///
/// Engine . CollectionList ( )
......
......@@ -18,7 +18,6 @@ See file license.txt for more information
#include <map>
#include <list>
#include <string>
#include "../Utilities/USupport.h"
//#include <memory.h>
......@@ -259,17 +258,6 @@ std::basic_istream<CharT>& operator >> (std::basic_istream<CharT>& stream, T dat
}
*/
template<typename CharT>
std::basic_ostream<CharT>& operator << (std::basic_ostream<CharT>& stream, const UnKnow &data)
{
return stream;
}
template<typename CharT>
std::basic_istream<CharT>& operator >> (std::basic_istream<CharT>& stream, UnKnow &data)
{
return stream;
}
}
#endif
......
......@@ -158,31 +158,6 @@ USerStorageXML& operator >> (USerStorageXML& storage, long double &data)
}
USerStorageXML& operator << (USerStorageXML& storage, const UnKnow &data)
{
storage.SetNodeAttribute("Type",std::string("UnKnow"));
return storage;
}
USerStorageXML& operator >> (USerStorageXML& storage, UnKnow &data)
{
return storage;
}
USerStorageXML& operator << (USerStorageXML& storage, const simpleVector &data)
{
storage.SetNodeAttribute("Type",std::string("simpleVector"));
return storage;
}
USerStorageXML& operator >> (USerStorageXML& storage, simpleVector &data)
{
return storage;
}
//
USerStorageXML& operator << (USerStorageXML& storage, const std::vector<bool> &data)
{
......
......@@ -169,10 +169,7 @@ USerStorageXML& operator >> (USerStorageXML& storage, T* &data)
return storage;
}
USerStorageXML& operator << (USerStorageXML& storage, const UnKnow &data);
USerStorageXML& operator >> (USerStorageXML& storage, UnKnow &data);
USerStorageXML& operator << (USerStorageXML& storage, const simpleVector &data);
USerStorageXML& operator >> (USerStorageXML& storage, simpleVector &data);
//
......
......@@ -268,6 +268,17 @@ std::string extract_file_name(const std::string& full_name)
: full_name.substr(pos+1);
}
///
std::string extract_file_name_wo_ext(const std::string& full_name)
{
std::string file_name=extract_file_name(full_name);
size_t pos = file_name.find_last_of(".");
return (std::string::npos == pos)
? file_name
: file_name.substr(0,pos);
}
///
RDK_LIB_TYPE std::string extract_file_ext(const std::string& full_name)
{
......
......@@ -84,31 +84,6 @@ See file license.txt for more information
#define ISNAN(x) ((x) != (x))
#endif
// ,
class UnKnow
{
private:
public:
UnKnow() {};
UnKnow(const UnKnow & value) {};
UnKnow(int value) {};
bool operator == (const UnKnow &value) const { return true; };
bool operator < (const UnKnow &value) const { return false; };
bool operator ! (void) const { return false; };
UnKnow& operator = (const int &value) { return *this; };
};
// ""
class simpleVector
{
private:
public:
simpleVector() {}
bool operator == (const simpleVector &value) const { return true; };
bool operator < (const simpleVector &value) const { return false; };
};
namespace RDK {
......@@ -394,6 +369,9 @@ RDK_LIB_TYPE std::string extract_file_path(const std::string& full_name);
///
RDK_LIB_TYPE std::string extract_file_name(const std::string& full_name);
///
RDK_LIB_TYPE std::string extract_file_name_wo_ext(const std::string& full_name);
///
RDK_LIB_TYPE std::string extract_file_ext(const std::string& full_name);
......
......@@ -66,6 +66,18 @@ int URdkCoreManager::GetStorageBuildMode()
return StorageBuildMode;
}