Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

robot::control::ControllableAdaptor Class Reference

Adapts one of a Controllable's ControlInterfaces in various ways. More...

Inheritance diagram for robot::control::ControllableAdaptor:

Inheritance graph
[legend]
Collaboration diagram for robot::control::ControllableAdaptor:

Collaboration graph
[legend]
List of all members.

Public Types

enum  AdaptorType { PassThrough, Range, Stride }
enum  Param { End = -1 }

Public Member Functions

 ControllableAdaptor (AdaptorType type, ref< Controllable > controllable, const String &interfaceName="", const String &adaptedInterfaceName="", const String &adaptedInterfaceType="")
 ControllableAdaptor (const ControllableAdaptor &c)
virtual String className () const
virtual Object & clone () const
void setRanges (Int inputStart=0, Int outputStart=0, SInt inputEnd=End, SInt outputEnd=End)
 select subranges of input & output vectors

void setStrides (Int inputStart=0, Int outputStart=0, Int inputStride=1, Int outputStride=1)
 select periodic elements from input & output vectors

virtual void setControlInterface (ref< ControlInterface > controlInterface)
virtual bool isConnected () const
virtual bool iterate (const base::Time &time)
virtual ref< ControlInterfacegetControlInterface (String interfaceName="") throw (std::invalid_argument)
 Provide ControlInterface for named interface (or default/possibly-only interface).

virtual bool isSameKindAs (const ReferencedObject &) const
virtual bool isSameKindAs (const Object &) const
void reference () const
bool unreference () const
const int referenceCount () const
void enableOnUnreferenceCall (bool enabled)

Protected Member Functions

void indexOutOfRange () const
Int adaptInputIndex (Int i) const
Int adaptOutputIndex (Int i) const
virtual void onUnreference () const
 break cyclic reference with adaptorInterface


Protected Attributes

AdaptorType type
bool rangesSet
Int inputStart
Int outputStart
SInt inputEnd
SInt outputEnd
bool stridesSet
Int inputStride
Int outputStride
ref< Controllablecontrollable
 Controllable we're adapting.

ref< ControlInterfaceadaptedInterface
 interface to be adapted

ref< AdaptorControlInterfaceadaptorInterface
 interface that adapts the controllable

String newInterfaceName
String newInterfaceType
int _refCount
bool onUnreferenceEnabled

Friends

class AdaptorControlInterface

Detailed Description

Adapts one of a Controllable's ControlInterfaces in various ways.

For example, by selecting a range of inputs and outputs.

Todo:
perhaps a ControlInterfaceAdaptor would be a better idea (avoid dependance on Controllable). Could implement a ControlInterfaceCombiner to joint interfaces. Couldn't then have any active adaptation scheme as is possible with this class.

Definition at line 46 of file ControllableAdaptor.


Member Enumeration Documentation

enum robot::control::ControllableAdaptor::AdaptorType
 

Enumeration values:
PassThrough 
Range 
Stride 

Definition at line 49 of file ControllableAdaptor.

enum robot::control::ControllableAdaptor::Param
 

Enumeration values:
End 

Definition at line 50 of file ControllableAdaptor.


Constructor & Destructor Documentation

robot::control::ControllableAdaptor::ControllableAdaptor AdaptorType  type,
ref< Controllable controllable,
const String &  interfaceName = "",
const String &  adaptedInterfaceName = "",
const String &  adaptedInterfaceType = ""
 

Referenced by clone().

robot::control::ControllableAdaptor::ControllableAdaptor const ControllableAdaptor c  ) 
 


Member Function Documentation

Int robot::control::ControllableAdaptor::adaptInputIndex Int  i  )  const [protected]
 

Int robot::control::ControllableAdaptor::adaptOutputIndex Int  i  )  const [protected]
 

virtual String robot::control::ControllableAdaptor::className  )  const [inline, virtual]
 

return the name of the object's class type. Must be defined by derived classes.

Implements base::Object.

Definition at line 57 of file ControllableAdaptor.

virtual Object& robot::control::ControllableAdaptor::clone  )  const [inline, virtual]
 

Definition at line 58 of file ControllableAdaptor.

References ControllableAdaptor(), and NewObj.

void base::Referenced::enableOnUnreferenceCall bool  enabled  )  [inline, inherited]
 

If enabled, each call to unreference() will also call virtual method onUnreference()

Definition at line 115 of file Referenced.

References base::Referenced::onUnreferenceEnabled.

virtual ref<ControlInterface> robot::control::ControllableAdaptor::getControlInterface String  interfaceName = ""  )  throw (std::invalid_argument) [virtual]
 

Provide ControlInterface for named interface (or default/possibly-only interface).

Exceptions:
std::invalid_argument if the specified interface name is unknown.

Implements robot::Controllable.

void robot::control::ControllableAdaptor::indexOutOfRange  )  const [inline, protected]
 

Definition at line 86 of file ControllableAdaptor.

References Exception.

virtual bool robot::control::ControllableAdaptor::isConnected  )  const [inline, virtual]
 

Query if the Controller has been passed all the ControlInterfaces it needs via setControlInterface()

Reimplemented from robot::Controller.

Definition at line 69 of file ControllableAdaptor.

References adaptedInterface.

virtual bool base::Object::isSameKindAs const Object  )  const [inline, virtual, inherited]
 

Definition at line 47 of file Object.

virtual bool base::ReferencedObject::isSameKindAs const ReferencedObject  )  const [inline, virtual, inherited]
 

Definition at line 52 of file ReferencedObject.

virtual bool robot::control::ControllableAdaptor::iterate const base::Time time  )  [virtual]
 

Execute an iteration of the control loop. returns true if it wants to quit the loop - however this may be ignored by the user/caller.

Implements robot::Controller.

virtual void robot::control::ControllableAdaptor::onUnreference  )  const [protected, virtual]
 

break cyclic reference with adaptorInterface

Reimplemented from base::Referenced.

void base::Referenced::reference  )  const [inline, inherited]
 

Increment the reference count by one, indicating that this object has another pointer which is referencing it.

Definition at line 65 of file Referenced.

References base::Referenced::_refCount.

const int base::Referenced::referenceCount  )  const [inline, inherited]
 

Return the number pointers currently referencing this object.

Definition at line 112 of file Referenced.

References base::Referenced::_refCount.

Referenced by robot::control::ControllableAdaptor::AdaptorControlInterface::onUnreference().

virtual void robot::control::ControllableAdaptor::setControlInterface ref< ControlInterface controlInterface  )  [virtual]
 

Provide ControlInterface through which Controller may control. Can be called multiple times to pass multiple ControlInterfaces. Unknown ControlInterface types will be ignored.

Implements robot::Controller.

void robot::control::ControllableAdaptor::setRanges Int  inputStart = 0,
Int  outputStart = 0,
SInt  inputEnd = End,
SInt  outputEnd = End
 

select subranges of input & output vectors

void robot::control::ControllableAdaptor::setStrides Int  inputStart = 0,
Int  outputStart = 0,
Int  inputStride = 1,
Int  outputStride = 1
 

select periodic elements from input & output vectors

bool base::Referenced::unreference  )  const [inline, inherited]
 

Decrement the reference count by one, indicating that a pointer to this object is referencing it. If the refence count goes to zero, it is assumed that this object is nolonger referenced and is automatically deleted.

Definition at line 81 of file Referenced.

References base::Referenced::_refCount, Exception, base::Referenced::onUnreference(), and base::Referenced::onUnreferenceEnabled.


Friends And Related Function Documentation

friend class AdaptorControlInterface [friend]
 

Definition at line 136 of file ControllableAdaptor.


Member Data Documentation

int base::Referenced::_refCount [mutable, protected, inherited]
 

Definition at line 136 of file Referenced.

Referenced by base::Referenced::reference(), base::Referenced::referenceCount(), base::Referenced::Referenced(), base::Referenced::unreference(), and base::Referenced::~Referenced().

ref<ControlInterface> robot::control::ControllableAdaptor::adaptedInterface [protected]
 

interface to be adapted

Definition at line 131 of file ControllableAdaptor.

Referenced by isConnected().

ref<AdaptorControlInterface> robot::control::ControllableAdaptor::adaptorInterface [mutable, protected]
 

interface that adapts the controllable

Definition at line 132 of file ControllableAdaptor.

ref<Controllable> robot::control::ControllableAdaptor::controllable [protected]
 

Controllable we're adapting.

Definition at line 130 of file ControllableAdaptor.

SInt robot::control::ControllableAdaptor::inputEnd [mutable, protected]
 

Definition at line 80 of file ControllableAdaptor.

Int robot::control::ControllableAdaptor::inputStart [protected]
 

Definition at line 79 of file ControllableAdaptor.

Int robot::control::ControllableAdaptor::inputStride [protected]
 

Definition at line 82 of file ControllableAdaptor.

String robot::control::ControllableAdaptor::newInterfaceName [protected]
 

Definition at line 133 of file ControllableAdaptor.

String robot::control::ControllableAdaptor::newInterfaceType [protected]
 

Definition at line 134 of file ControllableAdaptor.

bool base::Referenced::onUnreferenceEnabled [protected, inherited]
 

Definition at line 137 of file Referenced.

Referenced by base::Referenced::enableOnUnreferenceCall(), base::Referenced::Referenced(), and base::Referenced::unreference().

SInt robot::control::ControllableAdaptor::outputEnd [mutable, protected]
 

Definition at line 80 of file ControllableAdaptor.

Int robot::control::ControllableAdaptor::outputStart [protected]
 

Definition at line 79 of file ControllableAdaptor.

Int robot::control::ControllableAdaptor::outputStride [protected]
 

Definition at line 82 of file ControllableAdaptor.

bool robot::control::ControllableAdaptor::rangesSet [protected]
 

Definition at line 78 of file ControllableAdaptor.

bool robot::control::ControllableAdaptor::stridesSet [protected]
 

Definition at line 81 of file ControllableAdaptor.

AdaptorType robot::control::ControllableAdaptor::type [protected]
 

Definition at line 77 of file ControllableAdaptor.


The documentation for this class was generated from the following file:
Generated on Thu Jul 29 16:42:16 2004 for OpenSim by doxygen 1.3.6