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 400c0127 authored by vlad_burin's avatar vlad_burin
Browse files

Mock-classes UnKnown and SimpleVector removed.

Template specializations replace by just functions in UBasePropCreator

--HG--
branch : MockCompsTest
parent 6d6bff86ad33
This diff is collapsed.
......@@ -2,16 +2,20 @@
#define UBASEPROPCREATOR_H
#include "UCreatorPropTemplate.h"
extern std::vector<std::string> ForbiddenInputs;
extern std::vector<std::string> ForbiddenOutputs;
namespace RDK {
//
class UBasePropCreator
{
public:
UBasePropCreator();
static const std::vector<std::string>& GetForbiddenInputs();
static const std::vector<std::string>& GetForbiddenOutputs();
// ( Storage)
static bool BaseCrPropMock(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// ()
......@@ -22,6 +26,59 @@ public:
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static bool CreateSimpleTypeProperty(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);
// (simpleVector)
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertySimpleVector(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// 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 CreatePropertyVectorOfPair(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);
// list
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyList(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);
// std::pair
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyPair(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
// std::map
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
static void CreatePropertyMap(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
};
}
#endif // UBASEPROPCREATOR_H
......@@ -4,14 +4,23 @@
#include "UMockUNet.h"
#include "../../Deploy/Include/rdk.h"
namespace RDK {
// CreatePropertyByType.
// , -
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt, typename T>
class CreatorProperty
{
public:
static bool CreatePropertyByType(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);
static void CreatePropertyByType(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet)
{
std::string prop_name = serstorage->GetNodeName();
PropType<T, UMockUNet, TypeInt>* p = new PropType<T, UMockUNet, TypeInt>(prop_name, mock_unet);
p->Load(serstorage);
}
};
}
#endif // UCREATORPROPTEMPLATE_H
......@@ -7,7 +7,7 @@
namespace RDK {
// TODO Logger
/* *************************************************************************** */
// --------------------------
//
......@@ -60,10 +60,10 @@ UMockUNet::UMockUNet(RDK::USerStorageXML *serstorage, UStorage* storage)
{
if(CreatedProps.find((*p).first) == CreatedProps.end())
{
if(std::find(ForbiddenInputs.begin(),ForbiddenInputs.end(),(*p).first) != ForbiddenInputs.end())
if(std::find(UBasePropCreator::GetForbiddenInputs().begin(),UBasePropCreator::GetForbiddenInputs().end(),(*p).first) != UBasePropCreator::GetForbiddenInputs().end())
continue;
if(std::find(ForbiddenOutputs.begin(),ForbiddenOutputs.end(),(*p).first) != ForbiddenOutputs.end())
if(std::find( UBasePropCreator::GetForbiddenOutputs().begin(), UBasePropCreator::GetForbiddenOutputs().end(),(*p).first) != UBasePropCreator::GetForbiddenOutputs().end())
continue;
if(GetStorage()->GetLogger())
{
......
......@@ -3,9 +3,6 @@
#include "UNet.h"
extern std::vector<std::string> ForbiddenInputs;
extern std::vector<std::string> ForbiddenOutputs;
// RTV UBVSObject
//#include "../../../Libraries/Rtv-BasicLib/Core/RTVSupport.h"
......
......@@ -18,7 +18,6 @@ See file license.txt for more information
#include <map>
#include <list>
#include <string>
#include "../Utilities/USupport.h"
//#include <memory.h>
......@@ -259,17 +258,6 @@ std::basic_istream<CharT>& operator >> (std::basic_istream<CharT>& stream, T dat
}
*/
template<typename CharT>
std::basic_ostream<CharT>& operator << (std::basic_ostream<CharT>& stream, const UnKnow &data)
{
return stream;
}
template<typename CharT>
std::basic_istream<CharT>& operator >> (std::basic_istream<CharT>& stream, UnKnow &data)
{
return stream;
}
}
#endif
......
......@@ -158,31 +158,6 @@ USerStorageXML& operator >> (USerStorageXML& storage, long double &data)
}
USerStorageXML& operator << (USerStorageXML& storage, const UnKnow &data)
{
storage.SetNodeAttribute("Type",std::string("UnKnow"));
return storage;
}
USerStorageXML& operator >> (USerStorageXML& storage, UnKnow &data)
{
return storage;
}
USerStorageXML& operator << (USerStorageXML& storage, const simpleVector &data)
{
storage.SetNodeAttribute("Type",std::string("simpleVector"));
return storage;
}
USerStorageXML& operator >> (USerStorageXML& storage, simpleVector &data)
{
return storage;
}
//
USerStorageXML& operator << (USerStorageXML& storage, const std::vector<bool> &data)
{
......
......@@ -169,10 +169,7 @@ USerStorageXML& operator >> (USerStorageXML& storage, T* &data)
return storage;
}
USerStorageXML& operator << (USerStorageXML& storage, const UnKnow &data);
USerStorageXML& operator >> (USerStorageXML& storage, UnKnow &data);
USerStorageXML& operator << (USerStorageXML& storage, const simpleVector &data);
USerStorageXML& operator >> (USerStorageXML& storage, simpleVector &data);
//
......
......@@ -84,31 +84,6 @@ See file license.txt for more information
#define ISNAN(x) ((x) != (x))
#endif
// ,
class UnKnow
{
private:
public:
UnKnow() {};
UnKnow(const UnKnow & value) {};
UnKnow(int value) {};
bool operator == (const UnKnow &value) const { return true; };
bool operator < (const UnKnow &value) const { return false; };
bool operator ! (void) const { return false; };
UnKnow& operator = (const int &value) { return *this; };
};
// ""
class simpleVector
{
private:
public:
simpleVector() {}
bool operator == (const simpleVector &value) const { return true; };
bool operator < (const simpleVector &value) const { return false; };
};
namespace RDK {
......
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