3 #ifndef __STATE_OBSERVER_HPP__
4 #define __STATE_OBSERVER_HPP__
48 bool await(
void * raw =
nullptr);
51 bool notify(
const void * raw =
nullptr, std::size_t len = 0);
93 template<
typename T,
typename NonFundamentalType =
void>
109 { *
static_cast<T *
>(
getRemoteStorage()) = *
static_cast<const T *
>(remote); }
132 bool notify(
const std::uint8_t * raw, std::size_t len)
151 bool notify(
const std::uint8_t * raw, std::size_t len)
Base class for a state observer.
Definition: StateObserver.hpp:29
StateObserverBase & operator=(const StateObserverBase &)=delete
Deleted copy assignment operator.
bool notify(const void *raw=nullptr, std::size_t len=0)
Wake up a thread that waits on this object's monitor.
Definition: StateObserver.cpp:188
bool await(void *raw=nullptr)
Causes the current thread to wait until notify is invoked or the timeout elapses.
Definition: StateObserver.cpp:183
StateObserverBase(double timeout)
Constructor, configure with timeout in seconds.
Definition: StateObserver.cpp:159
virtual void setRemoteStorage(const void *ptr, std::size_t len)
Set data storage to notify observers with.
Definition: StateObserver.cpp:178
void * getRemoteStorage()
Retrieve modifiable handle to notified data storage.
Definition: StateObserver.cpp:168
double getTimeout() const
Retrieve configured timeout (in seconds).
Definition: StateObserver.hpp:44
virtual ~StateObserverBase()=0
Virtual destructor.
Definition: StateObserver.cpp:163
StateObserverBase(const StateObserverBase &)=delete
Deleted copy constructor.
Data-free state observer.
Definition: StateObserver.hpp:75
bool notify()
Wakes up a waiting thread.
Definition: StateObserver.hpp:84
bool await()
Wait with timeout until another thread invokes notify.
Definition: StateObserver.hpp:80
bool await(T *raw)
Wait with timeout until another thread invokes notify.
Definition: StateObserver.hpp:124
bool notify(T raw)
Wakes up a waiting thread.
Definition: StateObserver.hpp:128
bool notify(const std::uint8_t *raw, std::size_t len)
Wakes up a waiting thread with byte array.
Definition: StateObserver.hpp:132
bool await(std::uint8_t *raw)
Wait with timeout until another thread invokes notify.
Definition: StateObserver.hpp:147
bool notify(const std::uint8_t *raw, std::size_t len)
Wakes up a waiting thread.
Definition: StateObserver.hpp:151
Type state observer for non-arithmetic types.
Definition: StateObserver.hpp:95
bool await(T &remote)
Wait with timeout until another thread invokes notify.
Definition: StateObserver.hpp:100
void setRemoteStorage(const void *remote, std::size_t len) override
Set data storage to notify observers with.
Definition: StateObserver.hpp:108
bool notify(const T &remote)
Wakes up a waiting thread.
Definition: StateObserver.hpp:104
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6