![]() |
VR-Forces Developer's Guide
|
DtOutputPorts are data ports owned by data producers. They are connected to DtPortConnections and send any new data placed on them to all connections which are attached.
A DtInputPort should attemptToActivate() before data is set on it. This operation will turn on any outgoing connections, if the priority of those connections is good enough. If attemptToActivate() returns false, this indicates that no input ports are connection to this port, and no one is listening to the data, so it is not necessary to calculate new values.
sendData() should be called every time the data producer has provided new values to the port and wishes those values to be propigated to the network. Derived Output Ports may automatically call sendData when new values are set.
When the user of an output port determines they no longer want to produce output, they should call either deactivate() or allowDeactivation().
This is an abstract base class. Derived classes operate on different subtypes of DtPortData. A derived class must provide a type() method that indicates the type of DtPortData this port will send, as well as a createPortData() method which creates that type of DtPortData. Also, they should provide an interface for setting the value of the port data.

Public Member Functions | |
| DtOutputPort (const DtString &portName) | |
| virtual | ~DtOutputPort () |
| virtual bool | init () |
| virtual const DtString & | name () const |
| virtual const DtString | type () const =0 |
| virtual void | createPortData ()=0 |
| virtual void | sendData () |
| virtual void | addConnection (DtPortConnection *conn) |
| virtual void | removeConnection (DtPortConnection *conn) |
| virtual bool | attemptToActivate () |
| virtual bool | attemptToActivateAtLowestPriority () |
| virtual bool | canActivate () const |
| virtual void | deactivate () |
| virtual void | allowDeactivation () |
| virtual bool | active () const |
| virtual const DtList * | connectionList () const |
| virtual void | setConnectionPriority (int priority) |
| virtual DtPortData * | data () |
| virtual const DtPortData * | data () const |
| virtual bool | enabled () const |
| virtual void | setEnabled (bool flag) |
Protected Attributes | |
| DtString | myName |
| bool | myEnabled |
| DtPortData * | myData |
| DtList | myConnectionList |
Private Member Functions | |
| DtOutputPort () | |
| DtOutputPort (const DtOutputPort &) | |
| DtOutputPort & | operator= (const DtOutputPort &) |
| DtOutputPort::DtOutputPort | ( | const DtString & | portName | ) |
Constructor. Provide a name which this port will be referenced by.
|
virtual |
Destructor.
|
private |
Default constructor not implemented.
|
private |
Not implemented.
|
private |
Not implemented.
|
virtual |
Call after the constructor. Calls createPortData()
Reimplemented in DtSensorContactListOutputPort.
|
virtual |
Returns the string name of this port.
|
pure virtual |
Override for each derrived class to return a unique type string. This type string is the type of the DtPortData which this port will send.
Implemented in DtLaserDetectorOutputPort, DtSensorContactListOutputPort, DtStringOutputPort, DtVectorOutputPort, DtOrientationOutputPort, DtCollisionOutputPort, DtAmmunitionOutputPort, DtDualAxisAnalogOutputPort, DtAnalogOutputPort, DtObjectTypesListOutputPort, DtBooleanOutputPort, DtEntityListOutputPort, and DtIntegerOutputPort.
|
pure virtual |
Override for each derived class to create and set the internal DtPortData representation.
Implemented in DtLaserDetectorOutputPort, DtSensorContactListOutputPort, DtStringOutputPort, DtVectorOutputPort, DtOrientationOutputPort, DtCollisionOutputPort, DtAmmunitionOutputPort, DtDualAxisAnalogOutputPort, DtAnalogOutputPort, DtObjectTypesListOutputPort, DtBooleanOutputPort, DtEntityListOutputPort, and DtIntegerOutputPort.
|
virtual |
Returns a pointer to the underlying port. This is used by the inputPort to get the port interface address.
|
virtual |
Returns a pointer to the underlying port. This is used by the inputPort to get the port interface address.
|
virtual |
Sends the contents of myData to all connections.
|
virtual |
Add a connection to the outgoing connection list.
|
virtual |
Remove a connection from the outgoing connection list.
|
virtual |
Calls attemptToActivate on all connections in the connection list and returns true if any one of them was able to activate. Call this when you have data which you want to supply.
|
virtual |
Calls attemptToActivate on all connections in the connection list and returns true if any one of them was able to activate, but will not override data from any others and will allow deactivation in the case another wants to provide data. Call this when you have data which you want to supply.
|
virtual |
Calls canActivate on all connections in the connection list and returns true if any one of them can be activated.
|
virtual |
Calls deactivate on all connections in the connection list. Call this when you have no data to supply.
|
virtual |
Calls allowDeactivation on all connections in the connection list. Call this when you have data to supply, but will allow your data to be overridden by others.
|
virtual |
Returns true if any one of the outgoing connection are active.
|
virtual |
Returns the list of output connections to this port.
|
virtual |
Sets the priority of all existing outgoing connections from this port to the new priority.
|
virtual |
Enables/disables the port.
|
virtual |
Enables/disables the port.
|
protected |
|
protected |
|
protected |
locally instantiated.
|
protected |
List of outgoing connections.