Read about our upcoming Code of Conduct on this issue

Commit 266cf2f8 authored by vlad_burin's avatar vlad_burin
Browse files

Lot of Core updates to proper work with UMockUnets and new possibilities like

"Rebuild" Storage (change storage build mode). Code cleaning needed

--HG--
branch : MockCompsTest
parent c1ccb16c67e9
......@@ -46,6 +46,7 @@ UApplication::UApplication(void)
ModelsMainPath="../../../Models/";
ChangeUseNewXmlFormatProjectFile(false);
ChangeUseNewProjectFilesStructure(false);
StorageBuildMode = 1;
//SetStandartXMLInCatalog();
......@@ -309,8 +310,36 @@ bool UApplication::IsInit(void) const
{
return AppIsInit;
}
// --------------------------
///
void UApplication::SetStorageBuildMode(int mode)
{
StorageBuildMode = mode;
CloseProject();
RDK::GetCoreLock()->SetStorageBuildMode(StorageBuildMode);
int size = GetNumChannels();
for(int i = 0; i<size;i++)
{
MCore_ChannelInit(i,0,(void*)ExceptionHandler);
}
}
///
int UApplication::GetStorageBuildMode()
{
return StorageBuildMode;
}
// --------------------------
/// -
void UApplication::CreateSaveMockLibs()
{
RDK::GetStorageLock()->CreateMockLibs();
RDK::GetStorageLock()->SaveMockLibs();
}
// --------------------------
//
// --------------------------
......
......@@ -94,6 +94,14 @@ bool AppIsInit;
/// xml ( /Bin/Models)
std::list<StandartXMLInCatalog> xmlInCatalog;
/// :
// 1 - . , . ( )
// 2 - . , -, .
// , - .
// ( -, ) - .
// 3 - . -, . ( )
int StorageBuildMode;
protected: //
///
UEPtr<URpcDispatcher> RpcDispatcher;
......@@ -218,7 +226,15 @@ bool IsCloseAfterTest(void) const;
///
bool IsInit(void) const;
///
void SetStorageBuildMode(int mode);
///
int GetStorageBuildMode();
// --------------------------
/// -
void CreateSaveMockLibs();
// --------------------------
//
......
......@@ -21,12 +21,6 @@ UBasePropCreator::UBasePropCreator()
}
bool UBasePropCreator::AddFuncCrPropFunc(RDK::UStorage * storage)
{
storage->AddFuncCrPropMock(BaseCrPropMock);
return true;
}
bool UBasePropCreator::BaseCrPropMock(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
// : Paramenters -> State -> Input -> Output
......@@ -335,7 +329,7 @@ public:
else
{
serstorage->SelectNode("elem",size-1);
type = serstorage->GetNodeAttribute("elemType");
type = serstorage->GetNodeAttribute("Type");
serstorage->SelectUp();
}
......@@ -425,6 +419,11 @@ public:
CreatorProperty<PropType, TypeInt, std::vector<UBitmapParam> >::CreatePropertyByType(serstorage, mock_unet);
return true;
}
if(type == "UBitmap")
{
CreatorProperty<PropType, TypeInt, std::vector<UBitmap> >::CreatePropertyByType(serstorage, mock_unet);
return true;
}
// // RTV
// if(type == "UBVSObject")
// {
......
......@@ -14,8 +14,6 @@ class UBasePropCreator
public:
UBasePropCreator();
static bool AddFuncCrPropFunc(RDK::UStorage * storage);
static bool BaseCrPropMock(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// ()
......
......@@ -21,6 +21,7 @@ See file license.txt for more information
#include "UEnvException.h"
#include "../../Deploy/Include/rdk_error_codes.h"
#include "UComponentFactory.h"
#include "UMockUNet.h"
// --------------------------------------
//
......@@ -382,6 +383,8 @@ bool UEngine::Init(UEPtr<UStorage> storage, UEPtr<UEnvironment> env)
ClassesList.clear();
if(LoadPredefinedLibraries())
return false;
if(LoadPredefinedCrPropFunctions())
return false;
if(LoadClasses())
return false;
if(LoadLibraries())
......@@ -7360,8 +7363,10 @@ void UEngine::CreateEnvironment(bool isinit, list<UContainer*>* external_classes
Storage->BuildStorage();
//Storage->CreateMockLibs();
//Storage->SaveMockLibs();
/*
Storage->CreateMockLibs();
Storage->SaveMockLibs();
*/
Logger->LogMessage(RDK_EX_DEBUG, "Build storage has been finished");
}
......@@ -7388,6 +7393,17 @@ int UEngine::LoadPredefinedLibraries(void)
return 0;
}
//
int UEngine::LoadPredefinedCrPropFunctions(void)
{
if(!Storage)
return 0;
// -
Storage->AddCrPropMockFunc(UBasePropCreator::BaseCrPropMock);
RdkLoadPredefinedCrPropFunctions(Storage);
return 0;
}
//
int UEngine::LoadClasses(void)
{
......
......@@ -23,6 +23,9 @@ namespace RDK{
///
extern RDK_LIB_TYPE bool RDK_CALL RdkLoadPredefinedLibraries(std::list<RDK::ULibrary*> &libs_list);
///
///
extern RDK_LIB_TYPE bool RDK_CALL RdkLoadPredefinedCrPropFunctions(RDK::UStorage* storage);
class RDK_LIB_TYPE UEngine: public UModule
{
......@@ -986,6 +989,9 @@ void CreateEnvironment(bool isinit=true, list<UContainer*>* external_classes=0,
//
virtual int LoadPredefinedLibraries(void);
//
virtual int LoadPredefinedCrPropFunctions(void);
//
int LoadClasses(void);
......
......@@ -180,6 +180,13 @@ const vector<string>& ULibrary::GetIncomplete(void) const
{
return Incomplete;
}
// Complete Incomplete
void ULibrary::ClearIncompleteAndComplete(void)
{
Incomplete.clear();
Complete.clear();
}
// --------------------------
// --------------------------
......
......@@ -147,6 +147,9 @@ const vector<string>& GetComplete(void) const;
//
const vector<string>& GetIncomplete(void) const;
// Complete Incomplete
void ClearIncompleteAndComplete(void);
// --------------------------
// --------------------------
......
......@@ -5,7 +5,7 @@
#include "UStorage.h"
namespace RDK {
// TODO Logger
/* *************************************************************************** */
// --------------------------
//
......@@ -22,10 +22,10 @@ UMockUNet::UMockUNet(RDK::USerStorageXML *serstorage, UStorage* storage)
//
if(!GetStorage())
return;
std::vector<funcCrPropMock> funcs = GetStorage()->GetFunctionsCrPropMock();
std::list<funcCrPropMock> funcs = GetStorage()->GetFunctionsCrPropMock();
int size = funcs.size();
size++;
for (std::vector<funcCrPropMock>::iterator f = funcs.begin();
for (std::list<funcCrPropMock>::iterator f = funcs.begin();
f != funcs.end(); ++f)
{
(*f)(serstorage, this);
......
......@@ -2,6 +2,7 @@
#define UMOCKUNET_H
#include "UNet.h"
#include "UBasePropCreator.h"
extern std::vector<std::string> ForbiddenInputs;
extern std::vector<std::string> ForbiddenOutputs;
......
......@@ -19,7 +19,7 @@ See file license.txt for more information
#include "ULibrary.h"
#include "../../Deploy/Include/rdk_exceptions.h"
#include "UEnvException.h"
#include "UBasePropCreator.h"
namespace RDK {
/* *********************************************************************** */
......@@ -106,8 +106,7 @@ bool UInstancesStorageElement::operator != (const UInstancesStorageElement &valu
// --------------------------
//
// --------------------------
UStorage::UStorage(void):
BuildMode(3)
UStorage::UStorage(void)
{
LastClassId=0;
}
......@@ -963,7 +962,17 @@ const string& UStorage::GetCollectionVersion(int index)
return CollectionList[index]->GetVersion();
}
// runtime-,
// Complete Incomplete
void UStorage::ClearAllLibsClassesNameArrays(void)
{
for(size_t i=0;i<CollectionList.size();i++)
{
UEPtr<ULibrary> lib=CollectionList[i];
lib->ClearIncompleteAndComplete();
}
}
// runtime-,
// 'buffer'
void UStorage::GetRTlibsNameList(std::string &buffer) const
{
......@@ -981,6 +990,24 @@ void UStorage::GetRTlibsNameList(std::string &buffer) const
buffer.erase(buffer.length()-1);
}
// mock-,
// 'buffer'
void UStorage::GetMocklibsNameList(std::string &buffer) const
{
buffer.clear();
for(size_t i=0;i<CollectionList.size();i++)
{
UEPtr<ULibrary> lib = CollectionList[i];
if(lib && lib->GetType() == 3)
{
buffer.append(lib->GetName());
buffer.append(",");
}
}
if(!buffer.empty())
buffer.erase(buffer.length()-1);
}
///
bool UStorage::AddClassToCollection(const std::string &new_class_name, const std::string &new_comp_name, bool force_replace, UContainer *newclass, const std::string &lib_name)
{
......@@ -1320,8 +1347,6 @@ bool UStorage::DelCollection(int index)
bool UStorage::InitMockLibs(void)
{
UBasePropCreator::AddFuncCrPropFunc(this);
// -
std::string lib_path = "../../../MockLibs/";
std::string lib_list_file = "../../../MockLibs/0_LibList.xml";
......@@ -1460,6 +1485,7 @@ bool UStorage::DelAllCollections(void)
//
bool UStorage::BuildStorage(void)
{
ClearAllLibsClassesNameArrays();
switch (BuildMode)
{
case 1:
......@@ -1709,8 +1735,20 @@ void UStorage::DelLookupClass(const NameT &name)
ClassesLookupTable.erase(I);
}
// --------------------------
//
void UStorage::SetBuildMode(int mode)
{
BuildMode = mode;
}
//
int UStorage::GetBuildMode()
{
return BuildMode;
}
// - UMockUnet-
bool UStorage::AddFuncCrPropMock(funcCrPropMock func_ptr)
bool UStorage::AddCrPropMockFunc(funcCrPropMock func_ptr)
{
//
if(func_ptr == 0)
......@@ -1724,12 +1762,12 @@ bool UStorage::AddFuncCrPropMock(funcCrPropMock func_ptr)
return true;
}
const std::vector<funcCrPropMock>& UStorage::GetFunctionsCrPropMock() const
// - UMockUnet
const std::list<funcCrPropMock>& UStorage::GetFunctionsCrPropMock() const
{
return FunctionsCrPropMock;
}
/* *************************************************************************** */
/*
// --------------------------
......
......@@ -21,6 +21,7 @@ See file license.txt for more information
#include "UComponentFactory.h"
namespace RDK {
/* *********************************************************************** */
......@@ -144,15 +145,23 @@ UId LastClassId;
int BuildMode;
// - Property MockUNet
std::vector<funcCrPropMock> FunctionsCrPropMock;
std::list<funcCrPropMock> FunctionsCrPropMock;
protected: //
public: //
bool AddFuncCrPropMock(funcCrPropMock func_ptr);
//
void SetBuildMode(int mode);
//
int GetBuildMode();
// - UMockUnet
bool AddCrPropMockFunc(funcCrPropMock func_ptr);
const std::vector<funcCrPropMock> &GetFunctionsCrPropMock() const;
// - UMockUnet
const std::list<funcCrPropMock> &GetFunctionsCrPropMock() const;
// --------------------------
//
// --------------------------
......@@ -321,10 +330,17 @@ const string& GetCollectionName(int index);
//
const string& GetCollectionVersion(int index);
// Complete Incomplete
void ClearAllLibsClassesNameArrays(void);
// runtime-,
// 'buffer'
void GetRTlibsNameList(std::string &buffer) const;
// mock-,
// 'buffer'
void GetMocklibsNameList(std::string &buffer) const;
//
//virtual bool AddClass(UContainer *newclass);
......
......@@ -35,6 +35,8 @@ URdkCoreManager::URdkCoreManager(void)
SystemLogger.SetChannelIndex(RDK_SYS_MESSAGE);
SystemLogger.SetDebugMode(true);
SystemLogger.SetDebuggerMessageFlag(false);
StorageBuildMode = 1;
}
URdkCoreManager::~URdkCoreManager(void)
......@@ -51,6 +53,19 @@ URdkCoreManager::~URdkCoreManager(void)
// --------------------------
//
// --------------------------
//
void URdkCoreManager::SetStorageBuildMode(int mode)
{
StorageBuildMode = mode;
}
//
int URdkCoreManager::GetStorageBuildMode()
{
return StorageBuildMode;
}
//
const char* URdkCoreManager::GetSystemDir(void)
{
......@@ -616,6 +631,8 @@ int URdkCoreManager::ChannelCreate(int index)
ChannelDestroy(index);
return RDK_E_CORE_STORAGE_CREATE_FAIL;
}
//
StorageList[index]->SetBuildMode(StorageBuildMode);
EnvironmentList[index]=FuncCreateNewEnvironment();
if(!EnvironmentList[index])
......
......@@ -71,6 +71,14 @@ std::string ClassesDescriptionFileName;
//
std::string CommonClassesDescriptionFileName;
//
int StorageBuildMode;
//
void SetStorageBuildMode(int mode);
//
int GetStorageBuildMode();
// ----------------------------------------------------------
//
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment