Commit c3adcab0 authored by vlad_burin's avatar vlad_burin
Browse files

Update Mock Prop Creating

--HG--
branch : MockCompsTest
parent 8375fddfee8b
......@@ -110,14 +110,14 @@ void UBasePropCreator::CreateProperty(RDK::USerStorageXML* serstorage, RDK::UMoc
return;
}
/*
// pointer //
// pointer
if(type == "pointer")
{
// CreatorProperty<PropType, TypeInt, ...>::CreatePropertyByType(serstorage,this);
CreatorProperty<PropType, TypeInt, void*>::CreatePropertyByType(serstorage, mock_unet);
return;
}
*/
}
......@@ -387,6 +387,7 @@ void UBasePropCreator::CreatePropertyMap(RDK::USerStorageXML* serstorage, RDK::U
serstorage->SelectNode("second");
second_type = serstorage->GetNodeAttribute("Type");
serstorage->SelectUp();
serstorage->SelectUp();
if(first_type == "std::string")
{
......
......@@ -168,7 +168,16 @@ void UBasePropCreatorVector::CreatePropertyVector(RDK::USerStorageXML* serstorag
CreatorProperty<PropType, TypeInt, std::vector<UBitmap> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == "UBRect")
{
CreatorProperty<PropType, TypeInt, std::vector<UBRect> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
if(type == "UBPoint")
{
CreatorProperty<PropType, TypeInt, std::vector<UBPoint> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
// RTV
// if(type == "UBVSObject")
// {
......@@ -189,19 +198,14 @@ void UBasePropCreatorVector::CreatePropertyVector(RDK::USerStorageXML* serstorag
CreatePropertyVectorOfSimVec<PropType, TypeInt>(serstorage, mock_unet);
return;
}
/*
// MVector<T>
if(type.find("MVector",0) == 0)
//
if(type == "pointer")
{
CreatePropertyVectorOfMVector<PropType, TypeInt>(serstorage, mock_unet);
CreatorProperty<PropType, TypeInt, std::vector<void*> >::CreatePropertyByType(serstorage, mock_unet);
return;
}
// MDMatrix<T>
if(type.find("MDMatrix",0) == 0)
{
CreatePropertyVectorOfMDMatrix<PropType, TypeInt>(serstorage, mock_unet);
return;
} */
}
// (simpleVector)
......@@ -234,11 +238,21 @@ void UBasePropCreatorVector::CreatePropertyVectorOfSimVec(RDK::USerStorageXML* s
{
std::string prop_name = serstorage->GetNodeName();
int size=serstorage->GetNumNodes();
if(!(serstorage->SelectNode("elem",size-1)))
return;
std::string type = serstorage->GetNodeAttribute("elemType");
serstorage->SelectUp();
std::string type;
if(size==0)
{
type = serstorage->GetNodeAttribute("elemSVType");
}
else
{
if(!(serstorage->SelectNode("elem",size-1)))
return;
type = serstorage->GetNodeAttribute("elemType");
serstorage->SelectUp();
}
if(type == typeid(bool).name())
{
......
......@@ -19,6 +19,7 @@ public:
}
};
}
......
......@@ -661,10 +661,6 @@ bool UMockLibrary::AddNewCompDescription(USerStorageXML& descript)
bool UMockLibrary::SaveLibraryToFile()
{
// ,
if(RDK::CreateNewDirectory("../../../MockLibs/"))
return false;
std::string all_comps;
//
......
......@@ -21,8 +21,9 @@ UMockUNet::UMockUNet(RDK::USerStorageXML *serstorage, UStorage* storage)
this->SetName(comp_name);
std::string class_name = serstorage->GetNodeAttribute("Class");
//
//
SetStorage(storage);
SetLogger(storage->GetLogger());
//
std::list<funcCrPropMock> funcs = GetStorage()->GetFunctionsCrPropMock();
......@@ -68,14 +69,16 @@ UMockUNet::UMockUNet(RDK::USerStorageXML *serstorage, UStorage* storage)
if(std::find(UBasePropCreatorTempl::GetForbiddenOutputs().begin(), UBasePropCreatorTempl::GetForbiddenOutputs().end(), (*p).first) != UBasePropCreatorTempl::GetForbiddenOutputs().end())
continue;
LogMessageEx(RDK_EX_DEBUG, __FUNCTION__,
"In class "+ class_name + ": failed to create property: " + (*p).first + "with type" + (*p).second);
LogMessageEx(RDK_EX_WARNING, __FUNCTION__,
"In class "+ class_name + ": failed to create property: " + (*p).first + " with type: " + (*p).second);
}
}
// XML
ClassDesriptionXML.Destroy();
// TODO ( )
std::string temp;
serstorage->Save(temp);
ClassDesriptionXML.Load(temp,"");
......
......@@ -146,6 +146,7 @@ template<typename T>
USerStorageXML& operator << (USerStorageXML& storage, const T *data)
{
storage.SetNodeAttribute("Type","pointer");
std::stringstream stream;
stream<<data;
......@@ -362,19 +363,35 @@ USerStorageXML& operator << (USerStorageXML& storage, const std::vector<T> &data
tempXML.Destroy();
tempXML.Create("temp");
tempXML << temp;
std::string type = tempXML.GetNodeAttribute("Type");
std::string elem_type = tempXML.GetNodeAttribute("Type");
storage.SetNodeAttribute("elemType",elem_type);
if(type == "UBVSObject")
if(elem_type == "simplevector")
{
int k=0;
k++;
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);
}
//
if(type.empty())
/*
if(elem_type == "pointer")
{
type = typeid(T).name();
T elem_temp;
USerStorageXML elem_tempXML;
elem_tempXML.Destroy();
elem_tempXML.Create("elem_temp");
elem_tempXML << elem_temp;
std::string elem_point_type = elem_tempXML.GetNodeAttribute("pointType");
storage.SetNodeAttribute("elemPointType",elem_point_type);
}
storage.SetNodeAttribute("elemType",type);
*/
if(size == 0)
return storage;
......
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