MMCombo Class Reference#include <MMCombo.h>
Inheritance diagram for MMCombo:
[legend]List of all members.
Detailed Description
Contains code for both MainObj and MotoObj processes.
Why go to all this trouble? Virtual functions and polymorphism! Instead of writing my own object typing and serialization system, I would rather just use C++'s. But function lookups of the run time type information (RTTI) will break unless the object that created the object and the object that's actually calling the function agree on what object A's information is.
The easiest way to guarantee this is to compile them as one object, and then replace the strings in the source binary with strings for each of the final objects so they'll each have their own identity, but share the same code.
This is as close as I can get to a "fork", which is what i really want.
Definition at line 30 of file MMCombo.h.
|
Public Member Functions |
| MMCombo () |
| constructor
|
virtual | ~MMCombo () |
| destructor
|
virtual OStatus | DoInit (const OSystemEvent &) |
| first call (after constructor), set up memory
|
virtual OStatus | DoStart (const OSystemEvent &) |
| second call, ask for messages
|
virtual OStatus | DoStop (const OSystemEvent &) |
| next to last call, stop sending and receiving messages
|
virtual OStatus | DoDestroy (const OSystemEvent &) |
| last call (before destructor), clean up memory here
|
void | ReadyRegisterWorldState (const OReadyEvent &) |
| main only, send out the state global
|
void | GotWorldState (const ONotifyEvent &event) |
| motion only, called when state global is received
|
void | ReadyRegisterMotionManager (const OReadyEvent &) |
| motion only, send out motman global
|
void | GotMotionManager (const ONotifyEvent &event) |
| main only, called when motman global is received
|
void | ReadyRegisterEventTranslatorQueue (const OReadyEvent &) |
| main only, send out the EventTranslatorQueue
|
void | GotEventTranslatorQueue (const ONotifyEvent &event) |
| motion only, called when EventTranslatorQueue is received
|
void | ReadySendJoints (const OReadyEvent &event) |
| motion only (until main does ears again, then both) calls SendJoints, if DoStart has already been called
|
void | GotSensorFrame (const ONotifyEvent &event) |
| main only, called when new sensor information is available
|
void | GotImage (const ONotifyEvent &event) |
| main only, called when a new image is available
|
void | GotAudio (const ONotifyEvent &event) |
| main only, called when a new audio buffer is available
|
void | GotPowerEvent (void *msg) |
| main only, called when a power event occurs (can be just status events)
|
void | GotMotionMsg (const ONotifyEvent &event) |
| both, called when a new MotionManagerMsg has been received
|
void | GotSoundManager (const ONotifyEvent &event) |
| both, called when the sndman global is received
|
void | ListenCont (void *msg) |
| main only, called when //ALTODO
|
void | BindCont (void *msg) |
| main only, called when //ALTODO
|
void | ConnectCont (void *msg) |
| main only, called when //ALTODO
|
void | SendCont (void *msg) |
| main only, called when //ALTODO
|
void | ReceiveCont (void *msg) |
| main only, called when //ALTODO
|
void | CloseCont (void *msg) |
| main only, called when //ALTODO
|
bool | RPOPENR_isReady () |
| main only, called when //ALTODO
|
int | RPOPENR_send (char *buf, int bufsize) |
| main only, called when //ALTODO
|
void | RPOPENR_ready (const OReadyEvent &) |
| main only, called when //ALTODO
|
void | RPOPENR_notify (const ONotifyEvent &event) |
| main only, called when //ALTODO
|
Public Attributes |
OSubject * | subject [numOfSubject] |
| holds information for each of our subjects (data we provide)
|
OObserver * | observer [numOfObserver] |
| holds information for each of the sources we're observing
|
Protected Member Functions |
void | OpenPrimitives () |
| both, called from SetupOutputs() (mostly for motion, but main does ears), uses open to tell which to open
|
void | SetupOutputs (const bool to_open[NumOutputs]) |
| both, called from DoInit() (mostly for motion, but main does ears)
|
RCRegion * | InitRegion (unsigned int size) |
| both, called to set up a shared memory region of a given size
|
void | addRunLevel () |
| Main, checks runLevel and creates StartBehavior when ready.
|
OLEDValue | calcLEDValue (unsigned int i, float x) |
| Motion only, maintains the activation level of the LEDs, returns whether it should be 'fired'.
|
Static Protected Member Functions |
float | clipRange01 (float f) |
| returns f clipped to be between 0 and 1
|
Protected Attributes |
RCRegion * | motmanMemRgn |
| Motion creates, Main receives.
|
RCRegion * | worldStateMemRgn |
| Main creates, Motion receives.
|
RCRegion * | soundManagerMemRgn |
| SoundPlay creates, Main & Motion receives.
|
RCRegion * | eventTranslatorQueueMemRgn |
| Main creates, Motion (& SoundPlay) receive.
|
OPrimitiveID | primIDs [NumOutputs] |
| both, Main ears only, Motion the rest
|
RCRegion * | region [NUM_COMMAND_VECTOR] |
| both, the actual buffers
|
float | ledActivation [NumLEDs] |
| Motion, used for partial LED activation.
|
unsigned int | runLevel |
| Main, incremented until all sections are ready.
|
bool | open [NumOutputs] |
| both, holds information regarding which outputs are open in ("controlled by") this process
|
unsigned int | num_open |
| both, count of how many are open
|
EventTranslator | etrans |
| both, allows events to be sent between processes (from other processes besides these two too)
|
bool | RPOPENR_isready |
| true if we've received a ready message from a remote process
|
bool | isStopped |
| true if we've received a DoStart and no DoStop - we need this because sometimes an extra message seems to slip in after we've been told to stop, in which case we should ignore it
|
Static Protected Attributes |
const unsigned int | NUM_COMMAND_VECTOR = 2 |
| both, for double buffering
|
const unsigned int | readyLevel = 5 |
| Main, runLevel at which StartBehavior is created. (1st power event, 1st sensor event, motman init, sndman init, MainObj::DoStart()).
|
Private Member Functions |
| MMCombo (const MMCombo &) |
| should never be called...
|
MMCombo & | operator= (const MMCombo &) |
| should never be called...
|
Constructor & Destructor Documentation
virtual MMCombo::~MMCombo |
( |
|
) |
[inline, virtual] |
|
MMCombo::MMCombo |
( |
const MMCombo & |
|
) |
[private] |
|
|
should never be called...
|
Member Function Documentation
void MMCombo::addRunLevel |
( |
|
) |
[protected] |
|
void MMCombo::BindCont |
( |
void * |
msg |
) |
[inline] |
|
|
main only, called when //ALTODO
Definition at line 64 of file MMCombo.h. |
OLEDValue MMCombo::calcLEDValue |
( |
unsigned int |
i, |
|
|
float |
x |
|
) |
[inline, protected] |
|
|
Motion only, maintains the activation level of the LEDs, returns whether it should be 'fired'.
Definition at line 106 of file MMCombo.h.
Referenced by ReadySendJoints(). |
float MMCombo::clipRange01 |
( |
float |
f |
) |
[inline, static, protected] |
|
void MMCombo::CloseCont |
( |
void * |
msg |
) |
[inline] |
|
|
main only, called when //ALTODO
Definition at line 68 of file MMCombo.h. |
void MMCombo::ConnectCont |
( |
void * |
msg |
) |
[inline] |
|
|
main only, called when //ALTODO
Definition at line 65 of file MMCombo.h. |
OStatus MMCombo::DoDestroy |
( |
const OSystemEvent & |
|
) |
[virtual] |
|
|
last call (before destructor), clean up memory here
Definition at line 203 of file MMCombo.cc. |
OStatus MMCombo::DoInit |
( |
const OSystemEvent & |
|
) |
[virtual] |
|
|
first call (after constructor), set up memory
Definition at line 44 of file MMCombo.cc. |
OStatus MMCombo::DoStart |
( |
const OSystemEvent & |
|
) |
[virtual] |
|
|
second call, ask for messages
Definition at line 156 of file MMCombo.cc. |
OStatus MMCombo::DoStop |
( |
const OSystemEvent & |
|
) |
[virtual] |
|
|
next to last call, stop sending and receiving messages
Definition at line 187 of file MMCombo.cc. |
void MMCombo::GotAudio |
( |
const ONotifyEvent & |
event |
) |
|
|
|
main only, called when a new audio buffer is available
Definition at line 529 of file MMCombo.cc. |
void MMCombo::GotEventTranslatorQueue |
( |
const ONotifyEvent & |
event |
) |
|
|
|
motion only, called when EventTranslatorQueue is received
Definition at line 303 of file MMCombo.cc. |
void MMCombo::GotImage |
( |
const ONotifyEvent & |
event |
) |
|
|
|
main only, called when a new image is available
Definition at line 507 of file MMCombo.cc. |
void MMCombo::GotMotionManager |
( |
const ONotifyEvent & |
event |
) |
|
|
|
main only, called when motman global is received
Definition at line 269 of file MMCombo.cc. |
void MMCombo::GotMotionMsg |
( |
const ONotifyEvent & |
event |
) |
|
|
void MMCombo::GotPowerEvent |
( |
void * |
msg |
) |
|
|
|
main only, called when a power event occurs (can be just status events)
Definition at line 547 of file MMCombo.cc. |
void MMCombo::GotSensorFrame |
( |
const ONotifyEvent & |
event |
) |
|
|
|
main only, called when new sensor information is available
Definition at line 481 of file MMCombo.cc. |
void MMCombo::GotSoundManager |
( |
const ONotifyEvent & |
event |
) |
|
|
|
both, called when the sndman global is received
Definition at line 594 of file MMCombo.cc. |
void MMCombo::GotWorldState |
( |
const ONotifyEvent & |
event |
) |
|
|
|
motion only, called when state global is received
Definition at line 238 of file MMCombo.cc. |
RCRegion * MMCombo::InitRegion |
( |
unsigned int |
size |
) |
[protected] |
|
|
both, called to set up a shared memory region of a given size
Will round up size to the nearest page
Definition at line 723 of file MMCombo.cc.
Referenced by DoInit(). |
void MMCombo::ListenCont |
( |
void * |
msg |
) |
[inline] |
|
|
main only, called when //ALTODO
Definition at line 63 of file MMCombo.h. |
void MMCombo::OpenPrimitives |
( |
|
) |
[protected] |
|
|
should never be called...
|
void MMCombo::ReadyRegisterEventTranslatorQueue |
( |
const OReadyEvent & |
|
) |
|
|
|
main only, send out the EventTranslatorQueue
Called when MotoObj is initially ready as well as when it has finished processing the previous message - we only want to do this the first time otherwise we infinite loop.
Definition at line 290 of file MMCombo.cc. |
void MMCombo::ReadyRegisterMotionManager |
( |
const OReadyEvent & |
|
) |
|
|
|
motion only, send out motman global
Called when MainObj is initially ready as well as when it has finished processing the previous message - we only want to do this the first time otherwise we infinite loop.
Definition at line 256 of file MMCombo.cc. |
void MMCombo::ReadyRegisterWorldState |
( |
const OReadyEvent & |
|
) |
|
|
|
main only, send out the state global
Called when MotoObj is initially ready as well as when it has finished processing the previous message - we only want to do this the first time otherwise we infinite loop.
Definition at line 225 of file MMCombo.cc. |
void MMCombo::ReadySendJoints |
( |
const OReadyEvent & |
event |
) |
|
|
|
motion only (until main does ears again, then both) calls SendJoints, if DoStart has already been called
Definition at line 321 of file MMCombo.cc. |
void MMCombo::ReceiveCont |
( |
void * |
msg |
) |
[inline] |
|
|
main only, called when //ALTODO
Definition at line 67 of file MMCombo.h. |
bool MMCombo::RPOPENR_isReady |
( |
|
) |
[inline] |
|
|
main only, called when //ALTODO
Definition at line 70 of file MMCombo.h. |
void MMCombo::RPOPENR_notify |
( |
const ONotifyEvent & |
event |
) |
|
|
|
main only, called when //ALTODO
Definition at line 742 of file MMCombo.cc. |
void MMCombo::RPOPENR_ready |
( |
const OReadyEvent & |
|
) |
[inline] |
|
|
main only, called when //ALTODO
Definition at line 73 of file MMCombo.h. |
int MMCombo::RPOPENR_send |
( |
char * |
buf, |
|
|
int |
bufsize |
|
) |
|
|
|
main only, called when //ALTODO
Definition at line 757 of file MMCombo.cc. |
void MMCombo::SendCont |
( |
void * |
msg |
) |
[inline] |
|
|
main only, called when //ALTODO
Definition at line 66 of file MMCombo.h. |
void MMCombo::SetupOutputs |
( |
const bool |
to_open[NumOutputs] |
) |
[protected] |
|
Member Data Documentation
|
true if we've received a DoStart and no DoStop - we need this because sometimes an extra message seems to slip in after we've been told to stop, in which case we should ignore it
Definition at line 103 of file MMCombo.h.
Referenced by DoInit(), DoStart(), and DoStop(). |
|
both, for double buffering
Definition at line 87 of file MMCombo.h. |
|
Main, runLevel at which StartBehavior is created. (1st power event, 1st sensor event, motman init, sndman init, MainObj::DoStart()).
Definition at line 93 of file MMCombo.h. |
|
both, the actual buffers
Definition at line 88 of file MMCombo.h. |
The documentation for this class was generated from the following files:
|