Commit 9ef425e4 authored by vlad_burin's avatar vlad_burin
Browse files

PType now readed from XML and set to properties

--HG--
branch : MockCompsTest
parent 4a278ccf3fbb
This diff is collapsed.
This diff is collapsed.
......@@ -29,47 +29,47 @@ template <class CreatorT>
bool BaseCrPropMockTempl(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
// : Paramenters -> State -> Input -> Output
for(int i =0, params = serstorage->GetNumNodes(); i <params; i++)
for(int i = serstorage->GetNumNodes() - 1; i >= 0; i--)
{
if(!serstorage->SelectNode(i))
return false;
std::string prop_type = serstorage->GetNodeName();
//
for(int j =0, props = serstorage->GetNumNodes(); j < props; j++)
// ( )
for(int j = 0, props = serstorage->GetNumNodes(); j < props; j++)
{
try{
if(!serstorage->SelectNode(j))
return false;
std::string prop_name = serstorage->GetNodeName();
unsigned int p_type = RDK::atoi(serstorage->GetNodeAttribute("PType"));
if(prop_type == "Parameters")
{
CreatorT::template CreateProperty<ULProperty,ptPubParameter>(serstorage,mock_unet);
CreatorT::template CreateProperty<ULProperty,ptPubParameter>(serstorage,mock_unet,p_type);
}
else if(prop_type == "State")
{
CreatorT::template CreateProperty<ULProperty,ptPubState>(serstorage,mock_unet);
CreatorT::template CreateProperty<ULProperty,ptPubState>(serstorage,mock_unet,p_type);
}
else if(prop_type == "Input")
{
//
if(std::find(CreatorT::GetForbiddenInputs().begin(),CreatorT::GetForbiddenInputs().end(),serstorage->GetNodeName()) != CreatorT::GetForbiddenInputs().end())
if(std::find(UBasePropCreatorTempl::GetForbiddenInputs().begin(), UBasePropCreatorTempl::GetForbiddenInputs().end(),serstorage->GetNodeName()) != UBasePropCreatorTempl::GetForbiddenInputs().end())
{
serstorage->SelectUp();
continue;
}
CreatorT::template CreateProperty<UPropertyInputData,ptPubInput>(serstorage,mock_unet);
CreatorT::template CreateProperty<UPropertyInputData,ptPubInput>(serstorage,mock_unet,p_type);
}
else if(prop_type == "Output")
{
//
if(std::find(CreatorT::GetForbiddenOutputs().begin(),CreatorT::GetForbiddenOutputs().end(),serstorage->GetNodeName()) != CreatorT::GetForbiddenOutputs().end())
if(std::find(UBasePropCreatorTempl::GetForbiddenOutputs().begin(),UBasePropCreatorTempl::GetForbiddenOutputs().end(),serstorage->GetNodeName()) != UBasePropCreatorTempl::GetForbiddenOutputs().end())
{
serstorage->SelectUp();
continue;
}
CreatorT::template CreateProperty<UPropertyOutputData,ptPubOutput>(serstorage,mock_unet);
CreatorT::template CreateProperty<UPropertyOutputData,ptPubOutput>(serstorage,mock_unet,p_type);
}
}
catch(UComponent::EPropertyNameAlreadyExist& e)
......
......@@ -11,61 +11,61 @@ class UBasePropCreatorVector: public UBasePropCreatorTempl
public:
// ( Storage)
static bool BaseCrPropMock(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
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 void CreateProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype);
//
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype);
// (simpleVector)
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertySimpleVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertySimpleVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype);
// std::vector<simpleVector> >
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyVectorOfSimVec(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyVectorOfSimVec(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype);
//
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyVectorOfPair(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyVectorOfPair(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype);
};
// ()
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorVector::CreateProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
void UBasePropCreatorVector::CreateProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype)
{
std::string type = serstorage->GetNodeAttribute("Type");
// NetStructure
if(type == "NetStructure")
{
CreatorProperty<PropType, TypeInt, vector<vector<vector<vector<vector<UId> > > > > >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, vector<vector<vector<vector<vector<UId> > > > > >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
// ( CreatePropertyByType) -
if(type == "std::vector")
{
CreatePropertyVector<PropType, TypeInt>(serstorage,mock_unet);
CreatePropertyVector<PropType, TypeInt>(serstorage,mock_unet, ptype);
return;
}
// (bool, int, double)
if(type == "simplevector")
{
CreatePropertySimpleVector<PropType, TypeInt>(serstorage,mock_unet);
CreatePropertySimpleVector<PropType, TypeInt>(serstorage,mock_unet, ptype);
return;
}
}
//
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorVector::CreatePropertyVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
void UBasePropCreatorVector::CreatePropertyVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype)
{
std::string prop_name = serstorage->GetNodeName();
......@@ -87,129 +87,129 @@ void UBasePropCreatorVector::CreatePropertyVector(RDK::USerStorageXML* serstorag
if(type == typeid(bool).name())
{
CreatorProperty<PropType, TypeInt, std::vector<bool> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<bool> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(char).name())
{
CreatorProperty<PropType, TypeInt, std::vector<char> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<char> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(unsigned char).name())
{
CreatorProperty<PropType, TypeInt, std::vector<unsigned char> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<unsigned char> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(short).name())
{
CreatorProperty<PropType, TypeInt, std::vector<short> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<short> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(unsigned short).name())
{
CreatorProperty<PropType, TypeInt, std::vector<unsigned short> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<unsigned short> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(int).name())
{
CreatorProperty<PropType, TypeInt, std::vector<int> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<int> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(unsigned int).name())
{
CreatorProperty<PropType, TypeInt, std::vector<unsigned int> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<unsigned int> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(long).name())
{
CreatorProperty<PropType, TypeInt, std::vector<long> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<long> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(unsigned long).name())
{
CreatorProperty<PropType, TypeInt, std::vector<unsigned long> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<unsigned long> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(long long).name())
{
CreatorProperty<PropType, TypeInt, std::vector<long long> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<long long> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(unsigned long long).name())
{
CreatorProperty<PropType, TypeInt, std::vector<unsigned long long> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<unsigned long long> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(float).name())
{
CreatorProperty<PropType, TypeInt, std::vector<float> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<float> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(double).name())
{
CreatorProperty<PropType, TypeInt, std::vector<double> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<double> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(long double).name())
{
CreatorProperty<PropType, TypeInt, std::vector<long double> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<long double> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == "UColorT")
{
CreatorProperty<PropType, TypeInt, std::vector<UColorT> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<UColorT> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == "std::string")
{
CreatorProperty<PropType, TypeInt, std::vector<std::string> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<std::string> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == "UBitmapParam")
{
CreatorProperty<PropType, TypeInt, std::vector<UBitmapParam> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<UBitmapParam> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == "UBitmap")
{
CreatorProperty<PropType, TypeInt, std::vector<UBitmap> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<UBitmap> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == "UBRect")
{
CreatorProperty<PropType, TypeInt, std::vector<UBRect> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<UBRect> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == "UBPoint")
{
CreatorProperty<PropType, TypeInt, std::vector<UBPoint> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<UBPoint> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
// RTV
// if(type == "UBVSObject")
// {
// CreatorProperty<PropType, TypeInt, std::vector<RTV::UBVSObject3D> >::CreatePropertyByType(serstorage, mock_unet);
// CreatorProperty<PropType, TypeInt, std::vector<RTV::UBVSObject3D> >::CreatePropertyByType(serstorage, mock_unet, ptype);
// return;
// }
//
if(type == "std::pair")
{
CreatePropertyVectorOfPair<PropType, TypeInt>(serstorage, mock_unet);
CreatePropertyVectorOfPair<PropType, TypeInt>(serstorage, mock_unet, ptype);
return;
}
//
if(type == "simplevector")
{
CreatePropertyVectorOfSimVec<PropType, TypeInt>(serstorage, mock_unet);
CreatePropertyVectorOfSimVec<PropType, TypeInt>(serstorage, mock_unet, ptype);
return;
}
//
if(type == "pointer")
{
CreatorProperty<PropType, TypeInt, std::vector<void*> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<void*> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
......@@ -217,31 +217,31 @@ void UBasePropCreatorVector::CreatePropertyVector(RDK::USerStorageXML* serstorag
// (simpleVector)
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorVector::CreatePropertySimpleVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
void UBasePropCreatorVector::CreatePropertySimpleVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype)
{
std::string prop_name = serstorage->GetNodeName();
std::string type = serstorage->GetNodeAttribute("elemType");
if(type == typeid(bool).name())
{
CreatorProperty<PropType, TypeInt, std::vector<char> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<char> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(int).name())
{
CreatorProperty<PropType, TypeInt, std::vector<int> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<int> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(double).name())
{
CreatorProperty<PropType, TypeInt, std::vector<double> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<double> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
}
// std::vector<simpleVector> >
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorVector::CreatePropertyVectorOfSimVec(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
void UBasePropCreatorVector::CreatePropertyVectorOfSimVec(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype)
{
std::string prop_name = serstorage->GetNodeName();
int size=serstorage->GetNumNodes();
......@@ -263,24 +263,24 @@ void UBasePropCreatorVector::CreatePropertyVectorOfSimVec(RDK::USerStorageXML* s
if(type == typeid(bool).name())
{
CreatorProperty<PropType, TypeInt, std::vector<std::vector<char> > >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<std::vector<char> > >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(int).name())
{
CreatorProperty<PropType, TypeInt, std::vector<std::vector<int> > >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<std::vector<int> > >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
if(type == typeid(double).name())
{
CreatorProperty<PropType, TypeInt, std::vector<std::vector<double> > >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<std::vector<double> > >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
}
//
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
void UBasePropCreatorVector::CreatePropertyVectorOfPair(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
void UBasePropCreatorVector::CreatePropertyVectorOfPair(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype)
{
std::string prop_name = serstorage->GetNodeName();
int size=serstorage->GetNumNodes();
......@@ -305,7 +305,7 @@ void UBasePropCreatorVector::CreatePropertyVectorOfPair(RDK::USerStorageXML* ser
{
if(second_type == typeid(bool).name())
{
CreatorProperty<PropType, TypeInt, std::pair<std::string,bool> >::CreatePropertyByType(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::pair<std::string,bool> >::CreatePropertyByType(serstorage, mock_unet, ptype);
return;
}
}
......
......@@ -11,10 +11,11 @@ template <template<typename, typename, unsigned int> class PropType, unsigned in
class CreatorProperty
{
public:
static void CreatePropertyByType(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
static void CreatePropertyByType(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype)
{
std::string prop_name = serstorage->GetNodeName();
PropType<T, UMockUNet, TypeInt>* p = new PropType<T, UMockUNet, TypeInt>(prop_name, mock_unet);
mock_unet->ChangeLookupPropertyType(prop_name,ptype);
p->Load(serstorage);
}
};
......
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