| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
WorldStatePool Class Reference#include <WorldStatePool.h>
Inheritance diagram for WorldStatePool: ![]() Detailed Descriptionholds multiple instances of WorldState, allows one process to be updating while another is readingUse the AutoGetReadState and AutoGetWriteState to access individual WorldState entries... their constructors and destructors allow WorldStatePool to keep track of which entries are in use. When a state wants to write, it is given the oldest unused entry to write into. During writing, other accessors can read the newest (complete) entry, or concurrently write into a different entry (in case they don't want to wait for the other process to finish). A global lock (lock) is used while choosing an entry, and individual locks (writeLocks) are used while writing into entries (to easily allow readers to block on the lock until writing is done) One point of trickiness is that entries being written are moved to the end of the list when the writing begins, not when it is complete. Readers can always scan backwards in the list to find the newest entries, but writers must check the end to see if newer (or equivalent) frames are already in progress, as well as the beginning to find the oldest unreferenced. When a writer tries to access an entry, and another writer is already processing that frame, if blocking is set then the writer will given that entry once the original is done with it (so check your frame index when you receive it so you can tell if it was already processed). If blocking is *not* set, then you will get a separate entry with no indication another process is also working on the same frame.
Definition at line 42 of file WorldStatePool.h.
Member Typedef Documentation
Constructor & Destructor Documentation
this shouldn't be called...
Member Function Documentation
called when an read access to an entry is complete
Definition at line 319 of file WorldStatePool.cc. Referenced by doReleaseResource().
called when an write access to an entry is complete
Definition at line 411 of file WorldStatePool.cc. Referenced by doReleaseResource(), and getCurrentWriteState().
does the actual work of releaseResource() this is split off as a non-virtual function to avoid some process identity issues that occur with virtual functions under Aperios Definition at line 59 of file WorldStatePool.cc.
does the actual work of useResource() this is split off as a non-virtual function to avoid some process identity issues that occur with virtual functions under Aperios Definition at line 33 of file WorldStatePool.cc.
called when access to an entry for reading is requested
Definition at line 281 of file WorldStatePool.cc. Referenced by doUseResource().
called when access to an entry for writing is requested
Definition at line 370 of file WorldStatePool.cc. Referenced by doUseResource().
registers stateLookupMap with WorldState::setWorldStateLookup()
Definition at line 197 of file WorldStatePool.h.
returns true if the specified element of states has been marked completed
Definition at line 325 of file WorldStatePool.cc. Referenced by doneWritingState(), doUseResource(), getCurrentReadState(), and isUnread().
returns true if the process should call WorldState::read (i.e. msg has new or unprocessed data (such as motion needs to supply feedback)) only one call to this can be made at a time per process (not threadsafe, but is multi-process safe)
Definition at line 93 of file WorldStatePool.cc.
shorthand to test if all three P, I, and D values are 0 for the specified joint index (relative to 0, not PIDJointOffset)
Definition at line 210 of file WorldStatePool.h.
this shouldn't be called...
completes access to an entry in the pool, you must pass the same request instance here which you originally passed to useResource()
Definition at line 184 of file WorldStatePool.h. Referenced by doReleaseResource().
returns index of buffer in states to use for write request, stores index of corresponding entry of order in idx
Definition at line 333 of file WorldStatePool.cc.
returns index of buffer in states to use for write request
Definition at line 220 of file WorldStatePool.h. Referenced by getCurrentWriteState(), and isUnread().
processes a request, passed as either a ReadRequest or WriteRequest, to access an entry in the pool
Definition at line 182 of file WorldStatePool.h. Referenced by doUseResource().
Member Data Documentation
this lock indicates/controls whether the state is available for reading The lock is set before handing out to a writer with a new frame number, and released when a writer has marked the entry complete (via the WriteRequest upon releaseResource()) Definition at line 243 of file WorldStatePool.h. Referenced by doneWritingState(), getCurrentReadState(), getCurrentWriteState(), isComplete(), and WorldStatePool().
serial numbers of corresponding entries in states, set when writing begins, should be monotonically increasing relative to order (i.e. if you run through order and look at corresponding values in frames, should be monotonically increasing serial numbers)
Definition at line 231 of file WorldStatePool.h. Referenced by getCurrentWriteState(), isUnread(), selectWriteState(), and WorldStatePool().
lock on WorldStatePool's own members
Definition at line 259 of file WorldStatePool.h. Referenced by doneReadingState(), doneWritingState(), getCurrentReadState(), and getCurrentWriteState().
indicies of entries, in the order they were written (i.e. corresponding value in frames should be monotonically increasing)
Definition at line 207 of file WorldStatePool.h. Referenced by getCurrentReadState(), getCurrentWriteState(), selectWriteState(), and WorldStatePool().
flag set when a reader is blocking for writing to finish, until read is satisified
Definition at line 233 of file WorldStatePool.h. Referenced by doneReadingState(), getCurrentReadState(), selectWriteState(), and WorldStatePool().
the current state in use by each process
Definition at line 263 of file WorldStatePool.h. Referenced by doReleaseResource(), doUseResource(), and WorldStatePool().
entries to hand out
Definition at line 229 of file WorldStatePool.h. Referenced by getCurrentReadState(), and getCurrentWriteState().
the status is intended as a bitfield to support communication between writers if they need to cooperatively fill out an entry The value is set to 0 before handing out to a writer with a new frame number Definition at line 238 of file WorldStatePool.h. Referenced by doReleaseResource(), doUseResource(), getCurrentWriteState(), and WorldStatePool().
locks to be acquired before handing out corresponding states entry for writing
Definition at line 257 of file WorldStatePool.h. Referenced by doneWritingState(), and getCurrentWriteState().
count of writers in line for access (occurs when a writer is blocking on another writer of the same frame, or no other frames are free)
Definition at line 235 of file WorldStatePool.h. Referenced by doneWritingState(), getCurrentWriteState(), selectWriteState(), and WorldStatePool().
The documentation for this class was generated from the following files: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tekkotsu v3.0 |
Generated Wed Oct 4 00:05:20 2006 by Doxygen 1.4.7 |