Commit b4169751 authored by Aivan_2008's avatar Aivan_2008
Browse files

Merge with MockCompsTest

--HG--
branch : DeploymentQt
......@@ -233,6 +233,15 @@
<CppCompile Include="..\..\..\Core\Engine\UBasePropCreator.cpp">
<BuildOrder>125</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Engine\UBasePropCreatorMatrix.cpp">
<BuildOrder>130</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Engine\UBasePropCreatorTempl.cpp">
<BuildOrder>129</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Engine\UBasePropCreatorVector.cpp">
<BuildOrder>128</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\..\Core\Engine\UBinaryEnvSerialize.cpp">
<DependentOn>..\..\..\Core\Engine\UBinaryEnvSerialize.h</DependentOn>
<BuildOrder>63</BuildOrder>
......@@ -1015,13 +1024,13 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice32" 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="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
</Deployment>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
......
......@@ -27,6 +27,9 @@ DEFINES += RDK_CORE_VERSION=$$VERSION
SOURCES += \
../../../Core/Engine/UBasePropCreator.cpp \
../../../Core/Engine/UBasePropCreatorMatrix.cpp \
../../../Core/Engine/UBasePropCreatorTempl.cpp \
../../../Core/Engine/UBasePropCreatorVector.cpp \
../../../Deploy/Include/rdk.qt.cpp \
../../../Deploy/Include/myrdk.qt.cpp \
../../../Core/Engine/Engine.cpp \
......@@ -158,6 +161,9 @@ SOURCES += \
HEADERS +=\
../../../Core/Engine/UBasePropCreator.h \
../../../Core/Engine/UBasePropCreatorMatrix.h \
../../../Core/Engine/UBasePropCreatorTempl.h \
../../../Core/Engine/UBasePropCreatorVector.h \
../../../Core/Engine/UCreatorPropTemplate.h \
rdk.qt_global.h \
../../../Deploy/Include/rdk.qt.h \
......
......@@ -618,7 +618,7 @@ void UProjectDeployProcessingThread::DeployScript()
bool UProjectDeployProcessingThread::VerifyScript()
{
return true;
}
void UProjectDeployProcessingThread::DeployWeights()
......@@ -761,7 +761,7 @@ void UProjectDeployProcessingThread::DeployData()
bool UProjectDeployProcessingThread::VerifyData()
{
return true;
}
// --------------------------
......
......@@ -4,103 +4,12 @@
namespace RDK {
UBasePropCreator::UBasePropCreator()
{
}
const std::vector<std::string>& UBasePropCreator::GetForbiddenInputs()
{
static std::vector<std::string> ForbiddenInputs;
if(ForbiddenInputs.empty())
{
ForbiddenInputs.push_back("DataInput0");
ForbiddenInputs.push_back("DataInput1");
ForbiddenInputs.push_back("DataInput2");
ForbiddenInputs.push_back("DataInput3");
ForbiddenInputs.push_back("DataInput4");
ForbiddenInputs.push_back("DataInput5");
}
return ForbiddenInputs;
}
const std::vector<std::string>& UBasePropCreator::GetForbiddenOutputs()
{
static std::vector<std::string> ForbiddenOutputs;
if(ForbiddenOutputs.empty())
{
ForbiddenOutputs.push_back("DataOutput0");
ForbiddenOutputs.push_back("DataOutput1");
ForbiddenOutputs.push_back("DataOutput2");
ForbiddenOutputs.push_back("DataOutput3");
ForbiddenOutputs.push_back("DataOutput4");
ForbiddenOutputs.push_back("DataOutput5");
}
return ForbiddenOutputs;
}
// ( Storage)
bool UBasePropCreator::BaseCrPropMock(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
// : Paramenters -> State -> Input -> Output
for(int i =0, params = serstorage->GetNumNodes(); i <params; i++)
{
if(!serstorage->SelectNode(i))
return false;
std::string prop_type = serstorage->GetNodeName();
//
for(int j =0, props = serstorage->GetNumNodes(); j < props; j++)
{
try{
if(!serstorage->SelectNode(j))
return false;
std::string prop_name = serstorage->GetNodeName();
if(prop_type == "Parameters")
{
CreateProperty<ULProperty,ptPubParameter>(serstorage,mock_unet);
}
else if(prop_type == "State")
{
CreateProperty<ULProperty,ptPubState>(serstorage,mock_unet);
}
else if(prop_type == "Input")
{
//
if(std::find(GetForbiddenInputs().begin(),GetForbiddenInputs().end(),serstorage->GetNodeName()) != GetForbiddenInputs().end())
{
serstorage->SelectUp();
continue;
}
CreateProperty<UPropertyInputData,ptPubInput>(serstorage,mock_unet);
}
else if(prop_type == "Output")
{
//
if(std::find(GetForbiddenOutputs().begin(),GetForbiddenOutputs().end(),serstorage->GetNodeName()) != GetForbiddenOutputs().end())
{
serstorage->SelectUp();
continue;
}
CreateProperty<UPropertyOutputData,ptPubOutput>(serstorage,mock_unet);
}
}
catch(UComponent::EPropertyNameAlreadyExist& e)
{
return BaseCrPropMockTempl<UBasePropCreator>(serstorage,mock_unet);
}
}
catch(...)
{
}
serstorage->SelectUp();
}
serstorage->SelectUp();
}
return true;
}
}
This diff is collapsed.
#include "UBasePropCreatorMatrix.h"
#include "UComponent.h"
namespace RDK {
// ( Storage)
bool UBasePropCreatorMatrix::BaseCrPropMock(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
return BaseCrPropMockTempl<UBasePropCreatorMatrix>(serstorage,mock_unet);
}
}
#ifndef UBASEPROPCREATORMATRIX_H
#define UBASEPROPCREATORMATRIX_H
#include "UBasePropCreatorTempl.h"
namespace RDK {
//
class UBasePropCreatorMatrix: public UBasePropCreatorTempl
{
public:
// ( Storage)
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);
// MVector<T>
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyVectorOfMVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// MDMatrix<T>
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyVectorOfMDMatrix(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// MDMatrix
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyMDMatrix(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// MDVector
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyMDVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// MVector size - 2,3,4 - double
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyMVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// MMatrix [rows,cols] - [3,3][4,4] - double, int, bool
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyMMatrix(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
};
// ()
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorMatrix::CreateProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
std::string type = serstorage->GetNodeAttribute("Type");
// MDMatrix
if(type.find("MDMatrix",0) == 0)
{
CreatePropertyMDMatrix<PropType, TypeInt>(serstorage,mock_unet);
return;
}
// MDVector
if(type.find("MDVector",0) == 0)
{
CreatePropertyMDVector<PropType, TypeInt>(serstorage,mock_unet);
return;
}
// MVector
if(type.find("MVector",0) == 0)
{
CreatePropertyMVector<PropType, TypeInt>(serstorage,mock_unet);
return;
}
// MMatrix
if(type.find("MMatrix",0) == 0)
{
CreatePropertyMMatrix<PropType, TypeInt>(serstorage,mock_unet);
return;
}
if(type == "std::vector")
{
std::string prop_name = serstorage->GetNodeName();
int size=serstorage->GetNumNodes();
// - elemType
//
std::string type;
if(size == 0)
{
type = serstorage->GetNodeAttribute("elemType");
}
else
{
serstorage->SelectNode("elem",size-1);
type = serstorage->GetNodeAttribute("Type");
serstorage->SelectUp();
}
// MVector<T>
if(type.find("MVector",0) == 0)
{
CreatePropertyVectorOfMVector<PropType, TypeInt>(serstorage, mock_unet);
return;
}
// MDMatrix<T>
if(type.find("MDMatrix",0) == 0)
{
CreatePropertyVectorOfMDMatrix<PropType, TypeInt>(serstorage, mock_unet);
return;
}
}
}
// MVector<T>
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorMatrix::CreatePropertyVectorOfMVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
std::string prop_name = serstorage->GetNodeName();
std::string type;
int size;
//
if((serstorage->SelectNode("elem")))
{
type = serstorage->GetNodeAttribute("Type");
size= RDK::atoi(serstorage->GetNodeAttribute("Size"));
serstorage->SelectUp();
}
else
{
type = serstorage->GetNodeAttribute("elemType");
size = RDK::atoi(serstorage->GetNodeAttribute("elemSize"));
}
// MVector
size_t pos = type.find("MVector");
if (pos != std::string::npos)
{
type.erase(pos, std::string("MVector").length());
}
// '<' '>'
type.erase(std::remove(type.begin(), type.end(), '>'), type.end());
type.erase(std::remove(type.begin(), type.end(), '<'), type.end());
if(type == typeid(double).name())
{
if(size == 2)
{
CreatorProperty<PropType, TypeInt, std::vector<MVector<double,2> > >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(size == 3)
{
CreatorProperty<PropType, TypeInt, std::vector<MVector<double,3> > >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(size == 4)
{
CreatorProperty<PropType, TypeInt, std::vector<MVector<double,4> > >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(size == 6)
{
CreatorProperty<PropType, TypeInt, std::vector<MVector<double,6> > >::CreatePropertyByType(serstorage, mock_unet);
return;
}
}
}
// MDMatrix<T>
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorMatrix::CreatePropertyVectorOfMDMatrix(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
std::string prop_name = serstorage->GetNodeName();
int size=serstorage->GetNumNodes();
// - elemType
//
std::string type;
if(size == 0)
{
type = serstorage->GetNodeAttribute("elemType");
}
else
{
serstorage->SelectNode("elem",size-1);
type = serstorage->GetNodeAttribute("Type");
serstorage->SelectUp();
}
// MDMatrix
size_t pos = type.find("MDMatrix");
if (pos != std::string::npos)
{
type.erase(pos, std::string("MDMatrix").length());
}
// '<' '>'
type.erase(std::remove(type.begin(), type.end(), '>'), type.end());
type.erase(std::remove(type.begin(), type.end(), '<'), type.end());
if(type == typeid(bool).name())
{
CreatorProperty<PropType, TypeInt, MDVector<bool> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(char).name())
{
CreatorProperty<PropType, TypeInt, MDVector<char> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned char).name())
{
CreatorProperty<PropType, TypeInt, MDVector<unsigned char> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(short).name())
{
CreatorProperty<PropType, TypeInt, MDVector<short> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned short).name())
{
CreatorProperty<PropType, TypeInt, MDVector<unsigned short> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(int).name())
{
CreatorProperty<PropType, TypeInt, MDVector<int> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned int).name())
{
CreatorProperty<PropType, TypeInt, MDVector<unsigned int> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(long).name())
{
CreatorProperty<PropType, TypeInt, MDVector<long> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned long).name())
{
CreatorProperty<PropType, TypeInt, MDVector<unsigned long> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(long long).name())
{
CreatorProperty<PropType, TypeInt, MDVector<long long> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned long long).name())
{
CreatorProperty<PropType, TypeInt, MDVector<unsigned long long> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(float).name())
{
CreatorProperty<PropType, TypeInt, MDVector<float> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(double).name())
{
CreatorProperty<PropType, TypeInt, MDVector<double> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(long double).name())
{
CreatorProperty<PropType, TypeInt, MDVector<long double> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
}
// MDMatrix
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorMatrix::CreatePropertyMDMatrix(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
std::string type = serstorage->GetNodeAttribute("Type");
std::string prop_name = serstorage->GetNodeName();
// MDMatrix
size_t pos = type.find("MDMatrix");
if (pos != std::string::npos)
{
type.erase(pos, std::string("MDMatrix").length());
}
// '<' '>'
type.erase(std::remove(type.begin(), type.end(), '>'), type.end());
type.erase(std::remove(type.begin(), type.end(), '<'), type.end());
std::string matrix_type = type;
if(type == typeid(bool).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<bool> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(char).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<char> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned char).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<unsigned char> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(short).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<short> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned short).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<unsigned short> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(int).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<int> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned int).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<unsigned int> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(long).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<long> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned long).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<unsigned long> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(long long).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<long long> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned long long).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<unsigned long long> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(float).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<float> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(double).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<double> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(long double).name())
{
CreatorProperty<PropType, TypeInt, MDMatrix<long double> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
}
// MDVector
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorMatrix::CreatePropertyMDVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
std::string type = serstorage->GetNodeAttribute("Type");
std::string prop_name = serstorage->GetNodeName();
// MDVector
size_t pos = type.find("MDVector");
if (pos != std::string::npos)
{
type.erase(pos, std::string("MDVector").length());
}
// '<' '>'
type.erase(std::remove(type.begin(), type.end(), '>'), type.end());
type.erase(std::remove(type.begin(), type.end(), '<'), type.end());
std::string matrix_type = type;
if(type == typeid(bool).name())
{
CreatorProperty<PropType, TypeInt, MDVector<bool> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(char).name())
{
CreatorProperty<PropType, TypeInt, MDVector<char> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == typeid(unsigned char).name())
{
CreatorProperty<PropType, TypeInt, MDVector<unsigned char> >::CreatePropertyByType(serstorage, mock_unet);