Part: Default geometry extension template encapsulate value

This commit is contained in:
Abdullah Tahiri
2019-02-10 14:20:40 +01:00
committed by wmayer
parent fb5e8b4df7
commit 69c3b7d4f8
4 changed files with 14 additions and 11 deletions

View File

@@ -37,7 +37,7 @@ using namespace Part;
//---------- Geometry Extension
template <typename T>
GeometryDefaultExtension<T>::GeometryDefaultExtension(const T& obj):value(obj)
GeometryDefaultExtension<T>::GeometryDefaultExtension(const T& val):value(val)
{
}

View File

@@ -35,9 +35,12 @@ namespace Part {
TYPESYSTEM_HEADER();
public:
GeometryDefaultExtension() = default;
GeometryDefaultExtension(const T& obj);
GeometryDefaultExtension(const T& val);
virtual ~GeometryDefaultExtension() = default;
inline void setValue(const T& val) {value = val;};
inline const T &getValue() {return value;};
// Persistence implementer ---------------------
virtual unsigned int getMemSize(void) const;
virtual void Save(Base::Writer &/*writer*/) const;
@@ -47,7 +50,7 @@ namespace Part {
virtual PyObject *getPyObject(void);
public:
private:
T value;
};

View File

@@ -34,7 +34,7 @@ using namespace Part;
std::string GeometryIntExtensionPy::representation(void) const
{
std::stringstream str;
long id = getGeometryIntExtensionPtr()->value;
long id = getGeometryIntExtensionPtr()->getValue();
str << "<GeometryIntExtension (" << id << ") >";
return str.str();
}
@@ -57,7 +57,7 @@ int GeometryIntExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
PyErr_Clear();
int Id;
if (PyArg_ParseTuple(args, "i", &Id)) {
this->getGeometryIntExtensionPtr()->value=Id;
this->getGeometryIntExtensionPtr()->setValue(Id);
return 0;
}
@@ -71,12 +71,12 @@ int GeometryIntExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
Py::Long GeometryIntExtensionPy::getValue(void) const
{
return Py::Long(this->getGeometryIntExtensionPtr()->value);
return Py::Long(this->getGeometryIntExtensionPtr()->getValue());
}
void GeometryIntExtensionPy::setValue(Py::Long value)
{
this->getGeometryIntExtensionPtr()->value=long(value);
this->getGeometryIntExtensionPtr()->setValue(long(value));
}

View File

@@ -38,7 +38,7 @@ using namespace Part;
std::string GeometryStringExtensionPy::representation(void) const
{
std::stringstream str;
str << "<GeometryStringExtension (" << getGeometryStringExtensionPtr()->value << ") >";
str << "<GeometryStringExtension (" << getGeometryStringExtensionPtr()->getValue() << ") >";
return str.str();
}
@@ -60,7 +60,7 @@ int GeometryStringExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
PyErr_Clear();
char *pstr;
if (PyArg_ParseTuple(args, "s", &pstr)) {
this->getGeometryStringExtensionPtr()->value=pstr;
this->getGeometryStringExtensionPtr()->setValue(pstr);
return 0;
}
@@ -74,12 +74,12 @@ int GeometryStringExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
Py::String GeometryStringExtensionPy::getValue(void) const
{
return Py::String(this->getGeometryStringExtensionPtr()->value);
return Py::String(this->getGeometryStringExtensionPtr()->getValue());
}
void GeometryStringExtensionPy::setValue(Py::String value)
{
this->getGeometryStringExtensionPtr()->value = value.as_std_string();
this->getGeometryStringExtensionPtr()->setValue(value.as_std_string());
}
PyObject *GeometryStringExtensionPy::getCustomAttributes(const char* /*attr*/) const