Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.1 on 2022-01-26 at 16:00 UTC+1 (a few minutes of down time)

Commit c4b2b758 authored by Aivan_2008's avatar Aivan_2008
Browse files

Merge with MockCompsTest

--HG--
branch : DeploymentQt
......@@ -173,6 +173,10 @@
<CppCompile Include="..\..\..\Core\Application\UProject.cpp">
<BuildOrder>94</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Application\UProjectDeployer.cpp">
<DependentOn>..\..\..\Core\Application\UProjectDeployer.h</DependentOn>
<BuildOrder>127</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Application\URpcCommand.cpp">
<BuildOrder>95</BuildOrder>
</CppCompile>
......@@ -226,6 +230,9 @@
<CppCompile Include="..\..\..\Core\Engine\UAModel.cpp">
<BuildOrder>62</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Engine\UBasePropCreator.cpp">
<BuildOrder>125</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Engine\UBinaryEnvSerialize.cpp">
<DependentOn>..\..\..\Core\Engine\UBinaryEnvSerialize.h</DependentOn>
<BuildOrder>63</BuildOrder>
......@@ -296,6 +303,9 @@
<DependentOn>..\..\..\Core\Engine\ULoggerEnv.h</DependentOn>
<BuildOrder>119</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Engine\UMockUNet.cpp">
<BuildOrder>126</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Engine\UModule.cpp">
<BuildOrder>80</BuildOrder>
</CppCompile>
......@@ -1005,12 +1015,12 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
</Deployment>
</BorlandProject>
......
This diff is collapsed.
......@@ -9,7 +9,9 @@
#include <QMutex>
#include <thread>
#include <mutex>
#ifdef __unix__
#include <curl/curl.h>
#endif
struct FtpFile {
const char *filename;
......
......@@ -181,7 +181,7 @@ void UServerTransportTcpQt::ServerNewConnection()
connect(sqt, SIGNAL(onDisconnected(std::string)), this, SLOT(SocketDisconnected(std::string)));
serverSockets[bnd] = sqt;
Application->GetServerControl()->GetServerTransport()->ConnectClient(bnd);
Application->GetServerControl()->GetServerTransport()->ClientConnect(bnd);
//Application->GetServerControl()->ProcessIncomingData(bnd, Application->GetServerControl()->GetServerTransport());
}
}
......@@ -194,7 +194,7 @@ void UServerTransportTcpQt::SocketReadyRead(std::string bind)
void UServerTransportTcpQt::SocketDisconnected(std::string bind)
{
Application->GetServerControl()->GetServerTransport()->DisconnectClient(bind);
Application->GetServerControl()->GetServerTransport()->ClientDisconnect(bind);
//
std::map<std::string, UServerSocketQt*>::iterator I = serverSockets.find(bind);
if(I!=serverSockets.end())
......
......@@ -46,6 +46,7 @@ UApplication::UApplication(void)
ModelsMainPath="../../../Models/";
ChangeUseNewXmlFormatProjectFile(false);
ChangeUseNewProjectFilesStructure(false);
StorageBuildMode = 1;
//SetStandartXMLInCatalog();
......@@ -309,8 +310,40 @@ bool UApplication::IsInit(void) const
{
return AppIsInit;
}
// --------------------------
///
void UApplication::SetStorageBuildMode(int mode)
{
//
if(StorageBuildMode == mode)
return;
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::UELockPtr<RDK::UStorage> storage = RDK::GetStorageLock();
if(!storage->CreateMockLibs())
return;
storage->SaveMockLibs();
}
// --------------------------
//
// --------------------------
......@@ -1871,8 +1904,8 @@ bool UApplication::LoadModelFromFile(int channel_index, const std::string &file_
if(!data.empty())
{
MModel_Destroy(channel_index);
MModel_LoadComponent(channel_index, "",data.c_str());
return true;
if(MModel_LoadComponent(channel_index, "",data.c_str()) == RDK_SUCCESS)
return true;
}
return false;
}
......
......@@ -93,6 +93,14 @@ bool AppIsInit;
/// xml ( /Bin/Models)
std::list<StandartXMLInCatalog> xmlInCatalog;
/// :
// 1 - . , . ( )
// 2 - . , -, .
// , - .
// ( -, ) - .
// 3 - . -, . ( )
int StorageBuildMode;
protected: //
///
UEPtr<URpcDispatcher> RpcDispatcher;
......@@ -220,7 +228,15 @@ bool IsCloseAfterTest(void) const;
///
bool IsInit(void) const;
///
void SetStorageBuildMode(int mode);
///
int GetStorageBuildMode();
// --------------------------
/// -
void CreateSaveMockLibs();
// --------------------------
//
......
......@@ -51,7 +51,7 @@ void UProjectDeployer::SetDatabaseAccess(const std::string &db_address,
int UProjectDeployer::GetDeploymentState()
{
return 0;
}
int UProjectDeployer::GetStageCap()
......
......@@ -114,13 +114,13 @@ void UServerTransport::SendResponseBuffer(std::vector<unsigned char> buffer, std
}
void UServerTransport::ConnectClient(std::string& bind)
void UServerTransport::ClientConnect(std::string& bind)
{
PacketReaders[bind].ResetProcessing();
PacketReaders[bind].ClearPacketList();
}
void UServerTransport::DisconnectClient(std::string& bind)
void UServerTransport::ClientDisconnect(std::string& bind)
{
std::map<std::string, RDK::UTransferReader>::iterator I=PacketReaders.find(bind);
if(I != PacketReaders.end())
......
......@@ -66,10 +66,10 @@ virtual void SendResponseBuffer(std::vector<unsigned char> buffer, std::string &
///
/// -
virtual void ConnectClient(std::string& bind);
virtual void ClientConnect(std::string& bind);
///
/// -
virtual void DisconnectClient(std::string& bind);
virtual void ClientDisconnect(std::string& bind);
/// ,
virtual void ServerStop();
/// ServerStop,
......
This diff is collapsed.
#ifndef UBASEPROPCREATOR_H
#define UBASEPROPCREATOR_H
#include "UCreatorPropTemplate.h"
extern std::vector<std::string> ForbiddenInputs;
extern std::vector<std::string> ForbiddenOutputs;
//
class UBasePropCreator
{
public:
UBasePropCreator();
static bool BaseCrPropMock(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// ()
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreateProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// ,
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static bool CreateSimpleTypeProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
};
#endif // UBASEPROPCREATOR_H
......@@ -22,20 +22,21 @@ namespace RDK {
//
// --------------------------
UController::UController(void)
: Component(0)
{
Enabled=false;
}
UController::~UController(void)
{
UnLinkAll();
UnLink();
}
// --------------------------
// --------------------------
//
// --------------------------
//
//
bool UController::IsEnabled(void) const
{
return Enabled;
......@@ -49,32 +50,24 @@ bool UController::IsEnabled(bool value)
Enabled=value;
return true;
}
// --------------------------
// --------------------------
//
// --------------------------
//
size_t UController::GetNumComponents(void) const
{
return Components.size();
}
//
UContainer* UController::GetComponents(size_t index)
//
std::string UController::GetComponentName(void) const
{
return Components[index];
std::string result;
if(Component)
{
result=Component->GetFullName();
result=result.substr(result.find_first_of(".")+1);
}
return result;
}
//
int UController::FindComponent(UContainer* component) const
std::string UController::GetComponentName(UContainer *level) const
{
vector<UContainer*>::const_iterator I=find(Components.begin(),Components.end(),component);
if(I != Components.end())
return int(I-Components.begin());
return -1;
if(Component)
return Component->GetLongName(level);
return std::string("");
}
// --------------------------
......@@ -84,16 +77,19 @@ int UController::FindComponent(UContainer* component) const
//
bool UController::Link(UContainer* component, bool forchilds)
{
if(find(Components.begin(),Components.end(),component) != Components.end())
if(!component)
return false;
if(Component == component)
return true;
Components.push_back(component);
component->AddController(this,forchilds);
Component=component;
Component->AddController(this,forchilds);
if(!ALink(component))
{
component->DelController(this,forchilds);
Components.erase(Components.begin()+(Components.size()-1));
Component=0;
return false;
}
......@@ -101,50 +97,302 @@ bool UController::Link(UContainer* component, bool forchilds)
}
//
bool UController::UnLink(int index, bool forchilds)
bool UController::UnLink(bool forchilds)
{
if(index<0 || index> int(Components.size()))
if(!AUnLink(forchilds))
return false;
if(!AUnLink(index,forchilds))
return false;
Components[index]->DelController(this,forchilds);
Components.erase(Components.begin()+index);
if(Component)
Component->DelController(this,forchilds);
Component=0;
return true;
}
bool UController::UnLink(UContainer* component, bool forchilds)
//
bool UController::Update(void)
{
int index=FindComponent(component);
if(!Enabled)
return true;
if(index < 0)
if(!Component)
return true;
return UnLink(index, forchilds);
return AUpdate();
}
//
bool UController::ALink(UContainer* component, bool forchilds)
{
return true;
}
//
bool UController::AUnLink(bool forchilds)
{
return true;
}
// --------------------------
UControllerData::UControllerData(void)
: NumPoints(1)
{
}
///
void UControllerData::SetNumPoints(int value)
{
if(value<0)
return;
NumPoints=value;
}
std::string UControllerData::GetPropertyName(void) const
{
if(Property)
return Property->GetName();
return std::string("");
}
///
const type_info& UControllerData::GetDataType(void) const
{
if(Property)
return Property->GetLanguageType();
// TODO:
}
bool UController::UnLinkAll(bool forchilds)
// *****************************************************************
UControllerDataReader::UControllerDataReader(void)
: MRow(0), MCol(0), PropertyType(0)
{
bool res=true;
while(Components.begin() != Components.end())
}
///
void UControllerDataReader::SetTimeInterval(double value)
{
TimeInterval=value;
if(value>0)
SetNumPoints(value*Component->GetTimeStep());
else
SetNumPoints(100000);
}
///
void UControllerDataReader::SetMatrixCoord(int row, int col)
{
MRow=row;
MCol=col;
}
//
bool UControllerDataReader::AUnLink(bool forchilds)
{
PropertyType=0;
return UControllerData::AUnLink(forchilds);
}
///
bool UControllerDataReader::AUpdate(void)
{
if(!Property)
return false;
double x(0.0), y(0.0);
if(PropertyType == 1)
{
const double *data=reinterpret_cast<const double*>(Property->GetMemoryArea());
if(!data)
return false;
y=*data;
}
else
if(PropertyType == 2)
{
const int *data=reinterpret_cast<const int*>(Property->GetMemoryArea());
if(!data)
return false;
y=*data;
}
else
if(PropertyType == 3)
{
const MDMatrix<double> *data=reinterpret_cast<const MDMatrix<double>*>(Property->GetMemoryArea());
if(!data)
return false;
if(data->GetCols()<=MCol)
return false;
if(data->GetRows()<=MRow)
return false;
y=(*data)(MRow,MCol);
}
else
if(PropertyType == 4)
{
res &= UnLink(int(Components.size())-1,forchilds);
const MDMatrix<int> *data=reinterpret_cast<const MDMatrix<int>*>(Property->GetMemoryArea());
if(!data)
return false;
if(data->GetCols()<=MCol)
return false;
if(data->GetRows()<=MRow)
return false;
y=(*data)(MRow,MCol);
}
else
return false;
return res;
x=Component->GetTime().GetDoubleTime();
XData.push_back(x);
YData.push_back(y);
if(int(XData.size())>NumPoints)
XData.erase(XData.begin());
if(int(YData.size())>NumPoints)
YData.erase(YData.begin());
return true;
}
///
void UControllerDataReader::Clear(void)
{
XData.clear();
YData.clear();
}
//
bool UController::Update(void)
///
bool UControllerDataReader::Configure(UContainer *container, UEPtr<UIProperty> property)
{
if(!Enabled)
if(Property == property && Component == container)
return true;
return AUpdate();
UnLink();
Clear();
if(!Link(container))
return false;
if(!property)
{
UnLink();
return false;
}
if(property->GetLanguageType() == typeid(double))
{
PropertyType=1;
}
else
if(property->GetLanguageType() == typeid(double))
{
PropertyType=2;
}
else
if(property->GetLanguageType() == typeid(MDMatrix<double>))
{
PropertyType=3;
}
else
if(property->GetLanguageType() == typeid(MDMatrix<int>))
{
PropertyType=4;
}
else
{
UnLink();
return false;
}
Property=property;
Enabled=true;
return true;
}
// --------------------------
///
void UControllerDataReader::SetNumPoints(int value)
{
UControllerData::SetNumPoints(value);
}
// *********************************************************************
UControllerDataReaderTimeEvents::UControllerDataReaderTimeEvents(void)
{
}
///
void UControllerDataReaderTimeEvents::SetMatrixCoord(int row, int col)
{
UControllerDataReader::SetMatrixCoord(row, col);
}
///
bool UControllerDataReaderTimeEvents::AUpdate(void)
{
if(!Property)
return false;
if(PropertyType != 3)
return false;
double x(0.0), y(0.0);
const MDMatrix<double> *data=reinterpret_cast<const MDMatrix<double>*>(Property->GetMemoryArea());
if(!data)
return false;
if(data->GetCols()>0 && data->GetRows()>0)
{
for(int i=0;i<data->GetCols();i++)
{
x=(*data)(0,i);
std::list<double>::iterator I=XData.begin();
bool check(false);
for(;I != XData.end();I++)
{
if(*I == x)
{
check=true;
break;