Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
#include <MMCombo.h>
Inheritance diagram for MMCombo:
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 | 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
Definition at line 46 of file MMCombo.cc. |
|
destructor
|
|
should never be called...
|
|
Main, checks runLevel and creates StartBehavior when ready.
Definition at line 693 of file MMCombo.cc. Referenced by DoStart(), GotMotionManager(), GotPowerEvent(), GotSensorFrame(), and GotSoundManager(). |
|
main only, called when //ALTODO
|
|
Motion only, maintains the activation level of the LEDs, returns whether it should be 'fired'.
Definition at line 103 of file MMCombo.h. Referenced by ReadySendJoints(). |
|
returns f clipped to be between 0 and 1
Definition at line 121 of file MMCombo.h. Referenced by ReadySendJoints(). |
|
main only, called when //ALTODO
|
|
main only, called when //ALTODO
|
|
last call (before destructor), clean up memory here
Definition at line 183 of file MMCombo.cc. |
|
first call (after constructor), set up memory
Definition at line 60 of file MMCombo.cc. |
|
second call, ask for messages
Definition at line 141 of file MMCombo.cc. |
|
next to last call, stop sending and receiving messages
Definition at line 167 of file MMCombo.cc. |
|
motion only, called when EventTranslatorQueue is received
Definition at line 283 of file MMCombo.cc. |
|
main only, called when a new image is available
Definition at line 486 of file MMCombo.cc. |
|
main only, called when motman global is received
Definition at line 249 of file MMCombo.cc. |
|
both, called when a new MotionManagerMsg has been received
Definition at line 537 of file MMCombo.cc. |
|
main only, called when a power event occurs (can be just status events)
Definition at line 506 of file MMCombo.cc. |
|
main only, called when new sensor information is available
Definition at line 460 of file MMCombo.cc. |
|
both, called when the sndman global is received
Definition at line 553 of file MMCombo.cc. |
|
motion only, called when state global is received
Definition at line 218 of file MMCombo.cc. |
|
both, called to set up a shared memory region of a given size Will round up size to the nearest page Definition at line 684 of file MMCombo.cc. Referenced by DoInit(). |
|
main only, called when //ALTODO
|
|
both, called from SetupOutputs() (mostly for motion, but main does ears), uses open to tell which to open
Definition at line 567 of file MMCombo.cc. Referenced by SetupOutputs(). |
|
should never be called...
|
|
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 270 of file MMCombo.cc. |
|
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 236 of file MMCombo.cc. |
|
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 205 of file MMCombo.cc. |
|
motion only (until main does ears again, then both) calls SendJoints, if DoStart has already been called
Definition at line 301 of file MMCombo.cc. |
|
main only, called when //ALTODO
|
|
main only, called when //ALTODO
|
|
main only, called when //ALTODO
Definition at line 703 of file MMCombo.cc. |
|
main only, called when //ALTODO
|
|
main only, called when //ALTODO
Definition at line 718 of file MMCombo.cc. |
|
main only, called when //ALTODO
|
|
both, called from DoInit() (mostly for motion, but main does ears)
Definition at line 578 of file MMCombo.cc. Referenced by DoInit(). |
|
both, allows events to be sent between processes (from other processes besides these two too)
Definition at line 96 of file MMCombo.h. Referenced by DoInit(), GotEventTranslatorQueue(), GotImage(), GotPowerEvent(), and GotSensorFrame(). |
|
Main creates, Motion (& SoundPlay) receive.
Definition at line 81 of file MMCombo.h. Referenced by DoDestroy(), DoInit(), GotEventTranslatorQueue(), and ReadyRegisterEventTranslatorQueue(). |
|
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 100 of file MMCombo.h. Referenced by DoInit(), DoStart(), DoStop(), GotImage(), GotMotionMsg(), GotPowerEvent(), GotSensorFrame(), and ReadySendJoints(). |
|
Motion, used for partial LED activation.
Definition at line 87 of file MMCombo.h. Referenced by calcLEDValue(). |
|
Motion creates, Main receives.
Definition at line 78 of file MMCombo.h. Referenced by DoDestroy(), DoInit(), GotMotionManager(), and ReadyRegisterMotionManager(). |
|
both, for double buffering
Definition at line 84 of file MMCombo.h. Referenced by ReadySendJoints(), and SetupOutputs(). |
|
both, count of how many are open
Definition at line 94 of file MMCombo.h. Referenced by ReadySendJoints(), and SetupOutputs(). |
|
holds information for each of the sources we're observing
Definition at line 37 of file MMCombo.h. Referenced by DoInit(), GotEventTranslatorQueue(), GotImage(), GotMotionManager(), GotMotionMsg(), GotSensorFrame(), GotSoundManager(), GotWorldState(), and RPOPENR_notify(). |
|
both, holds information regarding which outputs are open in ("controlled by") this process
Definition at line 93 of file MMCombo.h. Referenced by MMCombo(), OpenPrimitives(), ReadySendJoints(), and SetupOutputs(). |
|
both, Main ears only, Motion the rest
Definition at line 83 of file MMCombo.h. Referenced by MMCombo(), OpenPrimitives(), ReadySendJoints(), and SetupOutputs(). |
|
Main, runLevel at which StartBehavior is created. (1st power event, 1st sensor event, motman init, sndman init, MainObj::DoStart()).
Definition at line 90 of file MMCombo.h. Referenced by addRunLevel(). |
|
both, the actual buffers
|
|
true if we've received a ready message from a remote process
Definition at line 98 of file MMCombo.h. Referenced by RPOPENR_isReady(), RPOPENR_ready(), and RPOPENR_send(). |
|
Main, incremented until all sections are ready.
Definition at line 89 of file MMCombo.h. Referenced by addRunLevel(). |
|
SoundPlay creates, Main & Motion receives.
Definition at line 80 of file MMCombo.h. Referenced by DoDestroy(), and GotSoundManager(). |
|
holds information for each of our subjects (data we provide)
Definition at line 36 of file MMCombo.h. Referenced by DoInit(), GotMotionManager(), GotSoundManager(), ReadyRegisterEventTranslatorQueue(), ReadyRegisterMotionManager(), ReadyRegisterWorldState(), ReadySendJoints(), and RPOPENR_send(). |
|
Main creates, Motion receives.
Definition at line 79 of file MMCombo.h. Referenced by DoDestroy(), DoInit(), GotWorldState(), and ReadyRegisterWorldState(). |
Tekkotsu v2.0 |
Generated Wed Jan 21 03:23:17 2004 by Doxygen 1.3.4 |