Skip to content

Commit

Permalink
Base: [skip ci] allow to replace twin object of PyObjectBase
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 28, 2020
1 parent 2a510a2 commit afd6f39
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Base/PyObjectBase.cpp
Expand Up @@ -62,6 +62,16 @@ PyObjectBase::~PyObjectBase()
Py_XDECREF(attrDict);
}

void PyObjectBase::setPointer(void* ptr, bool del)
{
if (_pcTwinPointer == ptr)
return;

if (del)
delete _pcTwinPointer;
_pcTwinPointer = ptr;
}

/*------------------------------
* PyObjectBase Type -- Every class, even the abstract one should have a Type
------------------------------*/
Expand Down
3 changes: 3 additions & 0 deletions src/Base/PyObjectBase.h
Expand Up @@ -294,6 +294,9 @@ class BaseExport PyObjectBase : public PyObject
_pcTwinPointer = 0;
}

/// Overrides the pointer to the twin object
void setPointer(void* ptr, bool del=false);

bool isValid() {
return StatusBits.test(Valid);
}
Expand Down

0 comments on commit afd6f39

Please sign in to comment.