Table of Contents
Objectifs:
- Understand ewol basic ewol::Object
- Use ewol::Object correctly
Basis of the ewol::Object
An object in Ewol is a simple class: ewol::Object This object is the basis of all element in the ewol system. This is designed to manage many common things:
- Unique ID
- Name
- Parameters
- Signal generation
- Xml configuration
- Removing
Note:
Create an Object:
Creating an object is really simple:
Note that all object created are ememory::SharedPtr base for the current version on std::shared_ptr. We wrapped it because the current inplementation of std::shared_ptr is not thread safe, and we want use a thread-safe version of it.
Note:
Set the name of the object:
Remove an Object:
Simply use the function:
This function request his parrent to remove the ememory::SharedPtr it keep on it. And when all ememory::SharedPtr is removed the object will be really removed.
At his point we can think an object is alive all the time someone keep a reference on it, then when you are not a parrent of the object, do not keep a ememory::SharedPtr but a ememory::WeakPtr.
Note:
Retrieve an Object:
In Ewol this is possible to get a object with his name.
Find a global Object (ouside an Object)
Find a global Object (inside an Object)
Find a sub-object
retriving your object type
It could be really interesting to retrive your own instance: