NAOqi Core - Overview | API | Tutorial
Namespace : AL
#include <alproxies/almemoryproxy.h>
As any module, this module inherits methods from ALModule API. It also has the following specific methods:
Declares an event to allow future subscriptions to the event
Parameters: |
|
---|
Declares an event to allow future subscriptions to the event
Parameters: |
|
---|
Gets the value of a key-value pair stored in memory
Parameters: |
|
---|---|
Returns: | The data as an AL::ALValue. This can often be cast transparently into the original type. |
Deprecated since version 1.12: use the version of this method with no second parameter.
Gets the value of a key-value pair stored in memory
Parameters: |
|
---|---|
Returns: | The data as an AL::ALValue |
Gets a list of all key names that contain a given string
Parameters: |
|
---|---|
Returns: | A list of all the data key names that contain the given string. |
Gets the key names for all the key-value pairs in memory
Returns: | A list containing the keys in memory |
---|
Blocks the caller until the value of a key changes
Deprecated since version 1.12: call ALMemoryProxy::getData() on your own and compare when the data change.
Parameters: |
|
---|---|
Returns: | an array containing all the retrieved data |
Gets a pointer to 32 a bit data item. Beware, the pointer will only be valid during the lifetime of the ALMemoryProxy object. Use with care, at initialization, not every loop.
Parameters: |
|
---|---|
Returns: | A pointer converted to int |
Gets a description of all given keys
Parameters: |
|
---|---|
Returns: | An array of (key, type, description) where type is “data” or “event” |
Parameters: |
|
---|---|
Returns: | A list of all the data key names that contain the given string. |
Gets a list containing the names of all the declared events
Returns: | A list containing the names of all events |
---|
Gets memoryKey value and its timestamps.
Parameters: |
|
---|---|
Returns: | An ALValue with 3 items: * memoryKey value, * first part of the timestamp (seconds), * second part of the timestamp (microseconds). |
Gets the list of all events generated by a given extractor
Parameters: |
|
---|---|
Returns: | A list containing the names of the events associated with the given extractor |
Gets the values associated with the given list of keys. This is more efficient than calling getData many times, especially over the network.
Parameters: |
|
---|---|
Returns: | An array containing all the values corresponding to the given keys. |
Gets a list containing the names of all the declared micro events
Returns: | A list containing the names of all the microEvents |
---|
Gets a list containing the names of subscribers to an event.
Parameters: |
|
---|---|
Returns: | List of subscriber names |
Gets the storage class of the stored data. This is not the underlying POD type.
Parameters: |
|
---|---|
Returns: | String type: Data, Event, MicroEvent |
Inserts a key-value pair into memory, where value is an int
Parameters: |
|
---|
Inserts a key-value pair into memory, where value is a float
Parameters: |
|
---|
Inserts a key-value pair into memory, where value is a string
Parameters: |
|
---|
Inserts a key-value pair into memory, where value is an ALValue
Parameters: |
|
---|
Inserts a list of key-value pairs into memory.
Parameters: |
|
---|
Publishes the given data to all subscribers.
Parameters: |
|
---|
Publishes the given data to all subscribers.
Parameters: |
|
---|
Removes a key-value pair from memory
Parameters: |
|
---|
Removes a micro event from memory and unsubscribes any existing subscribers.
Parameters: |
|
---|
Sets the description of a memory entry.
Parameters: |
|
---|
Subscribes to an event and automatically launches the module that declared itself as the generator of the event if required.
Parameters: |
|
---|
Look at the following example for details: Creating events
C++ callback signature:
class MyModule : public AL::ALModule {
public:
void myCallback(const std::string &key, const AL::ALValue &value, const AL::ALValue &message);
};
Python callback signature:
# create python module
class MyModule(ALModule):
""" Mandatory docstring.
comment needed to create a new python module
"""
def myCallback(self, key, value, message):
""" Mandatory docstring.
comment needed to create a bound method
"""
pass
Deprecated since version 1.12: use the version without the callbackMessage parameter.
Subscribes to event and automatically launches the module capable of generating the event if it is not already running. Use the version without the callbackMessage parameter.
Parameters: |
|
---|
Subscribes to a microEvent. Subscribed modules are notified on their callback method whenever the data is updated, even if the new value is the same as the old value.
Parameters: |
|
---|
Look at the following example for details: Creating events
C++ callback signature:
class MyModule : public AL::ALModule {
public:
void myCallback(const std::string &key, const AL::ALValue &value, const AL::ALValue &message);
};
Python callback signature:
# create python module
class MyModule(ALModule):
""" Mandatory docstring.
comment needed to create a new python module
"""
def myCallback(self, key, value, message):
""" Mandatory docstring.
comment needed to create a bound method
"""
pass
Informs ALMemoryProxy that a module doesn’t exist anymore.
Parameters: |
|
---|
Unsubscribes a module from the given event. No further notifications will be received. The module capable of generating the event is automatically stopped when the last subscriber unsubscribes.
Parameters: |
|
---|
Unsubscribes from the given event. No further notifications will be received.
Parameters: |
|
---|
Raised when all the auto-loaded modules have been loaded. See How it works to understand what is an auto-loaded module.
Raised after a key is created in ALMemory, carrying the name of the freshly created key.
Raised after a key is removed from ALMemory, carrying the name of the concerned key.
Raised after a key’s type is changed, for example when declaring a data key as an event.