Jerryscript::ContextList< ClassType > Class Template Reference
Manages a list of contexts. More...
#include <Context.h>
Inheritance diagram for Jerryscript::ContextList< ClassType >:
Collaboration diagram for Jerryscript::ContextList< ClassType >:
Public Types | |
using | Callback = Delegate< void(ClassType &ctx)> |
![]() | |
using | Iterator = typename LinkedObjectTemplate< ClassType >::template IteratorTemplate< ClassType, ClassType *, ClassType & > |
using | ConstIterator = typename LinkedObjectTemplate< ClassType >::template IteratorTemplate< const ClassType, const ClassType *, const ClassType & > |
Public Member Functions | |
void | foreach (Callback callback) |
Invoke callback once for each context via task queue. More... | |
![]() | |
OwnedLinkedObjectListTemplate ()=default | |
OwnedLinkedObjectListTemplate (const OwnedLinkedObjectListTemplate &other)=delete | |
OwnedLinkedObjectListTemplate & | operator= (const OwnedLinkedObjectListTemplate &other)=delete |
~OwnedLinkedObjectListTemplate () | |
bool | remove (ClassType *object) |
void | clear () |
![]() | |
LinkedObjectListTemplate ()=default | |
LinkedObjectListTemplate (ClassType *object) | |
ClassType * | head () |
const ClassType * | head () const |
Iterator | begin () |
ConstIterator | begin () const |
Iterator | end () |
ConstIterator | end () const |
bool | add (ClassType *object) |
bool | add (const ClassType *object) |
bool | insert (ClassType *object) |
bool | insert (const ClassType *object) |
ClassType * | pop () |
size_t | count () const |
bool | contains (const ClassType &object) const |
![]() | |
LinkedObjectList () | |
LinkedObjectList (LinkedObject *object) | |
bool | add (LinkedObject *object) |
bool | add (const LinkedObject *object) |
bool | insert (LinkedObject *object) |
bool | insert (const LinkedObject *object) |
bool | remove (LinkedObject *object) |
LinkedObject * | pop () |
void | clear () |
LinkedObject * | head () |
const LinkedObject * | head () const |
bool | isEmpty () const |
Additional Inherited Members | |
![]() | |
LinkedObject * | mHead {nullptr} |
Detailed Description
template<class ClassType>
class Jerryscript::ContextList< ClassType >
Manages a list of contexts.
Member Typedef Documentation
◆ Callback
template<class ClassType >
using Jerryscript::ContextList< ClassType >::Callback = Delegate<void(ClassType& ctx)> |
Member Function Documentation
◆ foreach()
template<class ClassType >
|
inline |
Invoke callback once for each context via task queue.
When calling into contexts we can do this:
JS::ContextList<MyContext> contexts;
...
int value = 12;
for(auto& ctx: contexts) {
ctx.customNotify(str, value);
}
However, with many containers system responsiveness may be adversely affected. Instead, separate the calls out like this:
Note that all parameters are captured by copy (using [=]
) as, for example, str
will be destroyed when it goes out of scope.
The documentation for this class was generated from the following file:
#define F(string_literal)
Wrap a string literal stored in flash and access it using a String object.
Definition: WString.h:113
Manages a list of contexts.
Definition: Libraries/jerryscript/src/include/Jerryscript/Context.h:204