Commit 781b7127 authored by vlad_burin's avatar vlad_burin
Browse files

MockUnets Creating updates

--HG--
branch : MockCompsTest
parent 8b868310548d
......@@ -371,23 +371,37 @@ template <template<typename, typename, unsigned int> class PropType, unsigned in
void UBasePropCreator::CreatePropertyMap(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
std::string prop_name = serstorage->GetNodeName();
int size=serstorage->GetNumNodes();
if(!(serstorage->SelectNode("elem",size-1)))
return;
size=serstorage->GetNumNodes();
if(size!=2)
return;
std::string first_type;
std::string second_type;
serstorage->SelectNode("first");
first_type = serstorage->GetNodeAttribute("Type");
serstorage->SelectUp();
int size=serstorage->GetNumNodes();
//
if(serstorage->SelectNode("elem",size-1))
{
size=serstorage->GetNumNodes();
if(size!=2)
{
serstorage->SelectUp();
return;
}
serstorage->SelectNode("first");
first_type = serstorage->GetNodeAttribute("Type");
serstorage->SelectUp();
serstorage->SelectNode("second");
second_type = serstorage->GetNodeAttribute("Type");
serstorage->SelectUp();
serstorage->SelectUp();
}
else
{
first_type = serstorage->GetNodeAttribute("firstType");
second_type = serstorage->GetNodeAttribute("secondType");
}
serstorage->SelectNode("second");
second_type = serstorage->GetNodeAttribute("Type");
serstorage->SelectUp();
serstorage->SelectUp();
if(first_type == "std::string")
{
......@@ -406,19 +420,27 @@ void UBasePropCreator::CreatePropertyMap(RDK::USerStorageXML* serstorage, RDK::U
CreatorProperty<PropType, TypeInt, std::map<std::string,bool> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
// if(second_type == "UBPtzPelcoCmd")
// {
// CreatorProperty<PropType, TypeInt, std::map<std::string, UBPtzPelcoCmd> >::CreatePropertyByType(serstorage, mock_unet);
// return;
// }
}
if(second_type == "std::string")
{
if(first_type == typeid(int).name())
if(second_type.find("MDVector",0) == 0)
{
CreatorProperty<PropType, TypeInt, std::map<int,std::string> >::CreatePropertyByType(serstorage, mock_unet);
return;
// MDVector
size_t pos = second_type.find("MDVector");
if (pos != std::string::npos)
{
second_type.erase(pos, std::string("MDVector").length());
}
// '<' '>'
second_type.erase(std::remove(second_type.begin(), second_type.end(), '>'), second_type.end());
second_type.erase(std::remove(second_type.begin(), second_type.end(), '<'), second_type.end());
std::string matrix_type = second_type;
if(matrix_type == typeid(int).name())
{
CreatorProperty<PropType, TypeInt, MDVector<int> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
}
}
......@@ -429,6 +451,11 @@ void UBasePropCreator::CreatePropertyMap(RDK::USerStorageXML* serstorage, RDK::U
CreatorProperty<PropType, TypeInt, std::map<int,UColorT> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(second_type == "std::string")
{
CreatorProperty<PropType, TypeInt, std::map<int,std::string> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
}
}
......
......@@ -119,11 +119,22 @@ void UBasePropCreatorMatrix::CreatePropertyVectorOfMVector(RDK::USerStorageXML*
{
std::string prop_name = serstorage->GetNodeName();
if(!(serstorage->SelectNode("elem")))
return;
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"));
}
std::string type = serstorage->GetNodeAttribute("Type");
int size= RDK::atoi(serstorage->GetNodeAttribute("Size"));
// MVector
size_t pos = type.find("MVector");
......
......@@ -213,15 +213,23 @@ USerStorageXML& operator << (USerStorageXML& storage, const std::map<T1,T2> &dat
storage.SetNodeAttribute("Type","std::map");
storage.SetNodeAttribute("Size",sntoa(data.size()));
/* // ( )
T temp;
// ( )
T1 first;
USerStorageXML tempXML;
tempXML.Destroy();
tempXML.Create("temp");
tempXML << temp;
std::string type = tempXML.GetNodeAttribute("Type");
storage.SetNodeAttribute("elemType",type);
*/
tempXML << first;
std::string first_type = tempXML.GetNodeAttribute("Type");
storage.SetNodeAttribute("firstType",first_type);
T2 second;
tempXML.Destroy();
tempXML.Create("temp");
tempXML << second;
std::string second_type = tempXML.GetNodeAttribute("Type");
storage.SetNodeAttribute("secondType",second_type);
if(data.empty())
return storage;
......@@ -351,32 +359,48 @@ RDK_LIB_TYPE USerStorageXML& operator >> (USerStorageXML& storage, std::vector<i
template<typename T>
USerStorageXML& operator << (USerStorageXML& storage, const std::vector<T> &data)
{
{
storage.SetNodeAttribute("Type","std::vector");
size_t size=data.size();
storage.SetNodeAttribute("Size",sntoa(size));
// ( )
T temp;
USerStorageXML tempXML;
tempXML.Destroy();
tempXML.Create("temp");
tempXML << temp;
std::string elem_type = tempXML.GetNodeAttribute("Type");
std::string elem_size = tempXML.GetNodeAttribute("Size");
storage.SetNodeAttribute("elemType",elem_type);
if(!elem_size.empty())
storage.SetNodeAttribute("elemSize",elem_size);
if(elem_type == "simplevector")
{
T elem_temp;
USerStorageXML elem_tempXML;
elem_tempXML.Destroy();
elem_tempXML.Create("elem_temp");
elem_tempXML << elem_temp;
std::string elem_SV_type = elem_tempXML.GetNodeAttribute("elemType");
T elem_temp;
USerStorageXML elem_tempXML;
elem_tempXML.Destroy();
elem_tempXML.Create("elem_temp");
elem_tempXML << elem_temp;
std::string elem_SV_type = elem_tempXML.GetNodeAttribute("elemType");
storage.SetNodeAttribute("elemSVType",elem_SV_type);
}
storage.SetNodeAttribute("elemSVType",elem_SV_type);
if(elem_type == "std::vector")
{
T elem_temp;
USerStorageXML elem_tempXML;
elem_tempXML.Destroy();
elem_tempXML.Create("elem_temp");
elem_tempXML << elem_temp;
std::string elem_SV_type = elem_tempXML.GetNodeAttribute("elemType");
storage.SetNodeAttribute("elemVecType",elem_SV_type);
}
/*
......
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