|
AMSmartProperties
201
Core library
|
Easy way to make reposnsivity of properties. More...
|
Classes | |
| class | AMSmartProperties::AMFunction< _Res(_ArgTypes ...)> |
| AMSmartProperties::AMFunction is a function wrapper for smart properties. More... | |
| class | AMSmartProperties::AMPropertyPool |
| AMSmartProperties::AMPropertyPool is a property pool for smart properties. More... | |
| class | AMSmartProperties::AMPropertyGeneralException |
| Generic functor type for specified type of property. More... | |
| class | AMSmartProperties::AMPropertyDeletedException |
| This exception is thrown when compuded property depends on deleted property. More... | |
| class | AMSmartProperties::AMPropertyLoopException |
| This exception is thrown when loop is detected. More... | |
| class | AMSmartProperties::AMPropertyNestingException |
| This exception is thrown when too much properties was nested. More... | |
| class | AMSmartProperties::AMPropertyBase |
| Base interface and basic fuction for smart property. Most of these funcions can be used, whenever you have only reference to base class. But, in spite of this base class is not virtual, you can't instantiate it directly. More... | |
| class | AMSmartProperties::AMPropertyNonBase |
| "NULL" type class. Used by AMSmartProperties::AMProperty, when parent class is not defined. More... | |
| class | AMSmartProperties::AMPropertyRefBase |
| Smart property reference base class. More... | |
| class | AMSmartProperties::AMProperty< T, TSubProperties, TParent, pointer_member > |
| Smart property class. More... | |
Functions | |
| template<typename _Res , typename ... _Args> | |
| bool | AMSmartProperties::operator== (const AMFunction< _Res(_Args ...)> &__f, std::nullptr_t) noexcept |
| Compares an AMFunction target with nullptr. More... | |
| template<typename _Res , typename ... _Args> | |
| bool | AMSmartProperties::operator== (std::nullptr_t, const AMFunction< _Res(_Args ...)> &__f) noexcept |
| Compares an AMFunction target with nullptr. More... | |
| template<typename _Res , typename ... _Args> | |
| bool | AMSmartProperties::operator!= (const AMFunction< _Res(_Args ...)> &__f, std::nullptr_t) noexcept |
| Compares an AMFunction target with nullptr. More... | |
| template<typename _Res , typename ... _Args> | |
| bool | AMSmartProperties::operator!= (std::nullptr_t, const AMFunction< _Res(_Args ...)> &__f) noexcept |
| Compares an AMFunction target with nullptr. More... | |
| std::string | AMSmartProperties::to_string (const AMPropertyState &state) |
| Converts AMPropertyState to std::string. More... | |
Easy way to make reposnsivity of properties.
Lets imagine, that ou have nad coord of some graphical item. For this example, it represents coords of button on the screen. Lets assign lambda function to this coord rather than float number. Now, you are able to signe simple formulat such as "parent width / 2 + 300px". Your view with button is now responsive.
Smart properties are grouped into separate groups-pools represented by AMSmartProperties::AMPropertyPool class. It reduces CPU compution cost, because you typically need recompute only one group. CPU cost may grow quadratically in some case of usage. You may imagine properties as tree of SmartProperties properties with root window rect. Typically, this group is owned by one window.
Since Smart properties itself are not thread safe, Using pools allow to use in multithreaded environment. If every thread has its own separated polls, it may coexist simlutaneously and safe.
Smart properties are designed also for nesting. For example, You shlould have smart property of type rect, which consists from smart properties origin and size, and origin consists of x,y and size consists from smart properties width, height. Subproperty has only reference to real type T, because generating any data strucures on type T is unwanted. So, there is two classes in this case. One is very simple type T, frees from any data structures related to Smart properties, and isolated class with definition of Smart subpropertes.
When smart properties are set up. are a reset state, i.e. the first reading of the Smart property causes them to be executed. After the execution, the calculated value is placed into the variable. Each subsequent read then only reads this variable. There's one exception. If you save a value directly to the properties, it is copied to the variable and no calculation is should be carried out. Now the stored value is always read. And that's until you change the smart property. Smart property signals for the entire pool(AMSmartProperties::AMProperyPool) status modified. Smart properties on which Smart property depends can no longer be relied on, so the smart property must be recalculated and saved when read. Recomputing all variables on which the property may depend, it does not seem to make sense, so the calculation is calculated after each and for any reading from smart properties within the pool. It is now possible to perform a reset operation on the pool that sets up all smart properties in the pool stored. Life cycle returns to the beginning. It is advisable to perform the reset operation once per a certain time, preferably in the main thread loop.
Also, smart properties has debugging capabilities. You can trace computing path after exception, give a text names to pointers (addresses of properties) and every property has function to_string. More at Smart properties debug.
Look at tutorial Smart Properties Tutorial.
#include <include/AMSmartProperties/AMProperty.h>
Smart property state This is combined state for each property. Bits 3-4 are stored in AMSmartProperties::AMPropertyPool, bits 0-2 are stored on each property (AMSmartProperties::AMProperty) itself.
|
inlinenoexcept |
#include <include/AMSmartProperties/AMFunction.h>
Compares an AMFunction target with nullptr.
false if the wrapper has no target, true otherwise| This | function will not throw an exception. |
|
inlinenoexcept |
#include <include/AMSmartProperties/AMFunction.h>
Compares an AMFunction target with nullptr.
false if the wrapper has no target, true otherwise| This | function will not throw an exception. |
|
inlinenoexcept |
#include <include/AMSmartProperties/AMFunction.h>
Compares an AMFunction target with nullptr.
true if the wrapper has no target, false otherwise| This | function will not throw an exception. |
|
inlinenoexcept |
#include <include/AMSmartProperties/AMFunction.h>
Compares an AMFunction target with nullptr.
true if the wrapper has no target, false otherwise| This | function will not throw an exception. |
| std::string AMSmartProperties::to_string | ( | const AMPropertyState & | state | ) |
#include <include/AMSmartProperties/AMProperty.h>
Converts AMPropertyState to std::string.
| state |
Referenced by AMSmartProperties::AMPropertyBase::getState(), and AMSmartProperties::AMProperty< T, TSubProperties, TParent, pointer_member >::to_string().
1.8.13