Compare commits

...

3 Commits
main ... dev

8 changed files with 92 additions and 107 deletions

5
.gitignore vendored
View File

@ -1,3 +1,8 @@
__pycache__
.bck
out
target
build
# Compiled Object files
*.slo
*.lo

28
GLD_ememory-test.json Normal file
View File

@ -0,0 +1,28 @@
{
"type":"BINARY",
"sub-type":"TEST",
"group-id":"com.atria-soft",
"description":"e-memory test-unit",
"license":"MPL-2",
"license-file":"file://LICENSE",
"maintainer":"file://authors.txt",
"author":"file://authors.txt",
"version":"file://version.txt",
"code-quality":"MEDIUM",
"source": [
"test/main.cpp",
"test/testUnique.cpp",
"test/testRef.cpp",
"test/testShared.cpp",
"test/testWeak.cpp",
"test/testEnableSharedFromThis.cpp",
"test/testCasts.cpp"
],
"dependency": [
"cxx",
"ememory",
"test-debug",
"etest"
]
}

43
GLD_ememory.json Normal file
View File

@ -0,0 +1,43 @@
{
"type":"LIBRARY",
"group-id":"com.atria-soft",
"description":"Ewol memory basic interface (have a thread safe shared_ptr with constness)",
"license":"MPL-2",
"license-file":"file://LICENSE",
"maintainer":"file://authors.txt",
"author":"file://authors.txt",
"version":"file://version.txt",
"code-quality":"MEDIUM",
"source": [
"ememory/debug.cpp",
"ememory/Counter.cpp",
"ememory/RefCounter.cpp"
],
"header": [
"ememory/debug.hpp",
"ememory/memory.hpp",
"ememory/Counter.hpp",
"ememory/RefCounter.hpp",
"ememory/RefPtr.hpp",
"ememory/SharedPtr.hpp",
"ememory/UniquePtr.hpp",
"ememory/WeakPtr.hpp",
"ememory/EnableSharedFromThis.hpp",
"ememory/details/memory.hxx",
"ememory/details/SharedPtr.hxx",
"ememory/details/RefPtr.hxx",
"ememory/details/WeakPtr.hxx",
"ememory/details/EnableSharedFromThis.hxx"
],
"path":[
"."
],
"compilation-version": {
"c++": 2011
},
"dependency": [
"etk-core",
"elog"
]
}

View File

@ -39,6 +39,12 @@ void ememory::RefCounter::refKeep() {
void ememory::RefCounter::refRelease() {
int refCount = --m_refCount;
if (refCount == 0) {
m_refCount++;
destroyRequested();
refCount = --m_refCount;
if (refCount != 0) {
return;
}
// No more element ==> remove it.
this->~RefCounter();
ETK_DELETE(ememory::RefCounter, this);

View File

@ -50,11 +50,20 @@ namespace ememory {
* @return Request const SharedPtr
*/
//const ememory::RefPtr<EMEMORY_TYPE> refFromThis() const;
#ifdef DEBUG
int32_t getUid() const {
return m_uid;
}
#endif
protected:
/**
* @brief get the RAW pointer value of this element (for debug only)
*/
uint64_t getRawPointer() const;
/**
* @brief Call befor destroy the object.
*/
virtual void destroyRequested() {}
};
#ifdef DEBUG
void resetDebugRefCounter();

View File

@ -1,44 +0,0 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.tools as tools
def get_type():
return "BINARY"
def get_sub_type():
return "TEST"
def get_desc():
return "e-memory test-unit"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return "authors.txt"
def configure(target, my_module):
my_module.add_src_file([
'test/main.cpp',
'test/testUnique.cpp',
'test/testRef.cpp',
'test/testShared.cpp',
'test/testWeak.cpp',
'test/testEnableSharedFromThis.cpp',
'test/testCasts.cpp'
])
my_module.add_depend([
'cxx',
'ememory',
'test-debug',
'etest',
])
return True

View File

@ -1,62 +0,0 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.tools as tools
def get_type():
return "LIBRARY"
def get_desc():
return "Ewol memory basic interface (have a thread safe shared_ptr with constness)"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return "authors.txt"
def get_version():
return "version.txt"
def configure(target, my_module):
my_module.add_extra_flags()
# add the file to compile:
my_module.add_src_file([
'ememory/debug.cpp',
'ememory/Counter.cpp',
'ememory/RefCounter.cpp',
])
my_module.add_header_file([
'ememory/debug.hpp',
'ememory/memory.hpp',
'ememory/Counter.hpp',
'ememory/RefCounter.hpp',
'ememory/RefPtr.hpp',
'ememory/SharedPtr.hpp',
'ememory/UniquePtr.hpp',
'ememory/WeakPtr.hpp',
'ememory/EnableSharedFromThis.hpp',
'ememory/details/memory.hxx',
'ememory/details/SharedPtr.hxx',
'ememory/details/RefPtr.hxx',
'ememory/details/WeakPtr.hxx',
'ememory/details/EnableSharedFromThis.hxx',
])
# build in C++ mode
my_module.compile_version("c++", 2011)
# add dependency of the generic C++ library:
my_module.add_depend('etk-core')
my_module.add_optionnal_depend('elog')
my_module.add_path(".")
return True

View File

@ -1 +1 @@
1.0.0
1.0.0-dev