Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
MMAccessor< MC_t > Class Template ReferenceThis class allows convenient ways of accessing a motion command. More...
Detailed Descriptiontemplate<class MC_t>
|
Public Member Functions | |
MMAccessor (MotionManager::MC_ID id, bool ckout=true) | |
constructor, checks out by default | |
MMAccessor (MC_t &ptr, bool ckout=true) | |
constructor, allows objects to provide uniform access to MotionCommands, regardless of whether they are currently in the MotionManager | |
MMAccessor (const MMAccessor &a) | |
copy constructor - will reference the same mc_id - checkin/checkouts are independent between this and a; however, if a is checked out, this will check itself out as well | |
~MMAccessor () | |
destructor, checks in if needed | |
MMAccessor< MC_t > | operator= (const MMAccessor< MC_t > &a) |
allows assignment of MMAccessor's, similar to the copy constructor - the two MMAccessor's will control the same MotionCommand | |
MC_t * | checkout (bool throwOnNULL=true) |
So you can check out if not done by default (or you checked in already). | |
MC_t * | mc () const |
Returns the motion command's address so you can call functions. | |
void | checkin () |
Checks in the motion. | |
template<class Ret_t > | |
Ret_t | checkin (Ret_t ret) |
Checks in the motion, passing through the value it is passed. | |
MC_t * | operator-> () |
smart pointer to the underlying MotionCommand | |
const MC_t * | operator-> () const |
smart pointer to the underlying MotionCommand | |
MC_t & | operator* () |
smart pointer to the underlying MotionCommand | |
const MC_t & | operator* () const |
smart pointer to the underlying MotionCommand | |
MC_t & | operator[] (int i) |
smart pointer to the underlying MotionCommand | |
const MC_t & | operator[] (int i) const |
smart pointer to the underlying MotionCommand | |
Protected Attributes | |
MotionManager::MC_ID | mc_id |
the MC_ID that this Accessor was constructed with | |
unsigned int | checkOutCnt |
counter so we know how many times checkout was called | |
MC_t * | mcptr |
a pointer to the motion command, should always be valid even when not checked out so you can access member fields (which is reasonably safe) |
MMAccessor< MC_t >::MMAccessor | ( | MotionManager::MC_ID | id, | |
bool | ckout = true | |||
) |
constructor, checks out by default
id | the motion command to check out | |
ckout | if true (default) will checkout upon creation. otherwise it just gets current address (so you can peek at member fields, which should be safe) |
Definition at line 74 of file MMAccessor.h.
MMAccessor< MC_t >::MMAccessor | ( | MC_t & | ptr, | |
bool | ckout = true | |||
) |
constructor, allows objects to provide uniform access to MotionCommands, regardless of whether they are currently in the MotionManager
if ckout is true (default parameter), will attempt to check out the motion if the motion reports it has a valid ID
Definition at line 83 of file MMAccessor.h.
MMAccessor< MC_t >::MMAccessor | ( | const MMAccessor< MC_t > & | a | ) |
copy constructor - will reference the same mc_id - checkin/checkouts are independent between this and a; however, if a is checked out, this
will check itself out as well
If the original was checked out, this will checkout as well (so checkOutCnt will be 1)
Definition at line 90 of file MMAccessor.h.
MMAccessor< MC_t >::~MMAccessor | ( | ) |
destructor, checks in if needed
Definition at line 96 of file MMAccessor.h.
Checks in the motion, passing through the value it is passed.
Useful in situations like this:
MMAccessor<myMC> mine(myMC_id); if(mine.mc()->foo()) //do something with motman here
But we want to check in mine ASAP - if we don't reference it anywhere in the if statement, we're leaving the MC locked longer than we need to. How about instead doing this:
bool cond; {MMAccessor<myMC> mine(myMC_id); cond=mine.mc()->foo();} if(cond) //do something with motman here
But that uses an extra variable... ewwww... so use this function as a pass through to checkin the MC:
MMAccessor<myMC> mine(myMC_id); if(mine.checkin(mine.mc()->foo())) //do something with motman here
Definition at line 162 of file MMAccessor.h.
void MMAccessor< MC_t >::checkin | ( | ) |
Checks in the motion.
Don't forget, you can also just limit the scope using extra { }'s
Definition at line 127 of file MMAccessor.h.
Referenced by MMAccessor< MC_t >::checkin(), and MMAccessor< MC_t >::~MMAccessor().
MC_t* MMAccessor< MC_t >::checkout | ( | bool | throwOnNULL = true |
) |
So you can check out if not done by default (or you checked in already).
throwOnNULL | if true, indicates an exception should be thrown if the checked out motion is NULL (indicates mc_id does not reference an active MC) |
Definition at line 114 of file MMAccessor.h.
Referenced by MMAccessor< MC_t >::MMAccessor(), and MMAccessor< MC_t >::operator=().
MC_t* MMAccessor< MC_t >::mc | ( | ) | const |
Returns the motion command's address so you can call functions.
Definition at line 123 of file MMAccessor.h.
Referenced by ControlBase::deactivate(), ControlBase::doReadStdIn(), ControlBase::doSelect(), MMAccessor< MC_t >::operator*(), MMAccessor< MC_t >::operator->(), MMAccessor< MC_t >::operator[](), and ControlBase::refresh().
const MC_t& MMAccessor< MC_t >::operator* | ( | ) | const |
smart pointer to the underlying MotionCommand
Definition at line 170 of file MMAccessor.h.
MC_t& MMAccessor< MC_t >::operator* | ( | ) |
smart pointer to the underlying MotionCommand
Definition at line 169 of file MMAccessor.h.
const MC_t* MMAccessor< MC_t >::operator-> | ( | ) | const |
smart pointer to the underlying MotionCommand
Definition at line 168 of file MMAccessor.h.
MC_t* MMAccessor< MC_t >::operator-> | ( | ) |
smart pointer to the underlying MotionCommand
Definition at line 167 of file MMAccessor.h.
MMAccessor<MC_t> MMAccessor< MC_t >::operator= | ( | const MMAccessor< MC_t > & | a | ) |
allows assignment of MMAccessor's, similar to the copy constructor - the two MMAccessor's will control the same MotionCommand
If the original was checked out, this will checkout as well (so checkOutCnt will be 1)
Definition at line 103 of file MMAccessor.h.
const MC_t& MMAccessor< MC_t >::operator[] | ( | int | i | ) | const |
smart pointer to the underlying MotionCommand
Definition at line 172 of file MMAccessor.h.
MC_t& MMAccessor< MC_t >::operator[] | ( | int | i | ) |
smart pointer to the underlying MotionCommand
Definition at line 171 of file MMAccessor.h.
unsigned int MMAccessor< MC_t >::checkOutCnt [protected] |
counter so we know how many times checkout was called
Definition at line 176 of file MMAccessor.h.
Referenced by MMAccessor< MC_t >::checkin(), MMAccessor< MC_t >::checkout(), MMAccessor< MC_t >::MMAccessor(), MMAccessor< MC_t >::operator=(), and MMAccessor< MC_t >::~MMAccessor().
MotionManager::MC_ID MMAccessor< MC_t >::mc_id [protected] |
the MC_ID that this Accessor was constructed with
Definition at line 175 of file MMAccessor.h.
Referenced by MMAccessor< MC_t >::checkin(), MMAccessor< MC_t >::checkout(), MMAccessor< MC_t >::MMAccessor(), and MMAccessor< MC_t >::operator=().
MC_t* MMAccessor< MC_t >::mcptr [protected] |
a pointer to the motion command, should always be valid even when not checked out so you can access member fields (which is reasonably safe)
Definition at line 177 of file MMAccessor.h.
Referenced by MMAccessor< MC_t >::checkin(), MMAccessor< MC_t >::checkout(), MMAccessor< MC_t >::mc(), MMAccessor< MC_t >::MMAccessor(), and MMAccessor< MC_t >::operator=().
Tekkotsu v5.1CVS |
Generated Mon May 9 04:59:13 2016 by Doxygen 1.6.3 |