SoundController Class Reference

Inheritance diagram for SoundController:

Capability List of all members.

Detailed Description

Instantiation of SoundController interface.

Please read the documentation for Capabilities for other important functions. Data structures will be placed behind accessor functions in the future.

Definition at line 78 of file SoundController.H.

Public Member Functions

 SoundController (const std::string &streamname)
 Standard constructor.
 SoundController (const ConnectionStrategy &strategy, const std::string &gblName)
 Auto-wiring constructor.
 SoundController (const std::string &streamname, const std::string &gblName)
 Like the standard constructor, but explicitly sets the global name.
 ~SoundController ()
void init (const std::string &streamname, const ConnectionStrategy &strategy, const std::string &gblName)
 Initialization function, used by above.
void runUpdate ()
 Does all necessary work to update the data/info provided by the object.
void setManager (CommsManager *myManager_)
 Gives the object a reference to the global CORBAHelper.
void setCOMObject (COMBase *object)
 Returns the ID number of the instantiated interface.
void disconnect ()
 Does all necessary work to clean up the object's connection.
void activateSupplier ()
 Sets up the object as a supplier of data.
void activateConsumer ()
 Sets up the object as a consumer of data.
std::string getInterfaceName ()
 Returns the name of the interface.
void setStreamName (const std::string &name)
 Sets the name of the stream we're using.
void setGlobalName (const std::string &name)
 Sets the global name of this object.
bool newData ()
 True if there is new data.
bool newInfo ()
 True if there is new info/requests (depending on supplier/consumer mode).
void setAutoPing (const bool &val)
 Sets the state of the auto-ping function.
void doPing ()
 Manually tells the object to do a ping.
bool getQueueMode ()
 True if events are being queued, otherwise false.
void setQueueMode (const bool &val)
 Turn queue mode on or off.
SoundControllerDataStruct getNextData ()
 Returns a struct containing the next event in the queue.
SoundControllerInfoStruct getNextInfo ()
 Returns a struct containing the next event in the queue.
SoundControllerInfoStruct getNextRequest ()
 Convenience function, calls getNextInfo().
void publishData ()
 Informs the object to publish data on the next update.
void publishInfo ()
 Informs the object to publish info on the next update.

Public Attributes

SoundControllerDataStruct data
 The data structure.
SoundControllerInfoStruct info
 Information-- read if consumer, write if supplier.
SoundControllerInfoStruct requests
 Requests-- read if supplier, write if consumer.

Protected Attributes

COMObject< SoundControllerInfoStruct,
SoundControllerDataStruct > * 
myCOMObject
bool m_queue
bool m_initialize
std::queue< SoundControllerDataStructm_dataVector
std::queue< SoundControllerInfoStructm_infoVector
std::queue< SoundControllerInfoStructm_requestVector


Constructor & Destructor Documentation

SoundController ( const std::string &  streamname  )  [explicit]

Standard constructor.

Automatically generates a (hopefully) unique global name. If two of the same (consumer) binaries are running, it *will* fail. This is the only constructor you should use for suppliers.

Definition at line 37 of file SoundController.cpp.

References SoundController::init(), Capability::m_haveGlobalname, and WURDE::STRAT_NORMAL.

SoundController ( const ConnectionStrategy strategy,
const std::string &  gblName 
)

Auto-wiring constructor.

Submits a request to MCP for a stream to connect to, based on global name. ConnectionStrategy should be auto for now.

Definition at line 44 of file SoundController.cpp.

References SoundController::init(), Capability::m_haveGlobalname, Capability::m_haveStream, and WURDE::STRAT_NORMAL.

SoundController ( const std::string &  streamname,
const std::string &  gblName 
)

Like the standard constructor, but explicitly sets the global name.

Use this when starting multiple instances of the same binary, so that each instance can be assigned a separate name.

Definition at line 58 of file SoundController.cpp.

References SoundController::init(), and WURDE::STRAT_NORMAL.

~SoundController (  ) 

Definition at line 102 of file SoundController.cpp.

References SoundController::myCOMObject, and Capability::myManager.


Member Function Documentation

void init ( const std::string &  streamname,
const ConnectionStrategy strategy,
const std::string &  gblName 
)

Initialization function, used by above.

Definition at line 62 of file SoundController.cpp.

References SoundController::info, Capability::m_doAutoPing, Capability::m_doPublishData, Capability::m_doPublishInfo, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, SoundController::m_initialize, SoundController::m_queue, Capability::m_sourceModule, Capability::m_strategy, Capability::m_streamname, Capability::m_streamRequest, Capability::m_supplier, SoundController::myCOMObject, Time::now(), SoundController::requests, SoundControllerInfoStruct::source, WURDE::STAT_NULL, SoundControllerInfoStruct::target, and SoundControllerInfoStruct::timestamp.

Referenced by SoundController::SoundController().

void runUpdate (  )  [virtual]

Does all necessary work to update the data/info provided by the object.

Implements Capability.

Definition at line 249 of file SoundController.cpp.

References Capability::m_doPublishData, Capability::m_doPublishInfo, and SoundController::myCOMObject.

void setManager ( CommsManager myManager_  )  [virtual]

Gives the object a reference to the global CORBAHelper.

This will be changed soon to be less adaptor specific.

Implements Capability.

Definition at line 260 of file SoundController.cpp.

References SoundController::myCOMObject, and Capability::myManager.

void setCOMObject ( COMBase object  )  [inline, virtual]

Returns the ID number of the instantiated interface.

Implements Capability.

Definition at line 130 of file SoundController.H.

References SoundController::myCOMObject.

void disconnect (  )  [inline, virtual]

Does all necessary work to clean up the object's connection.

Implements Capability.

Definition at line 131 of file SoundController.H.

References SoundController::myCOMObject.

void activateSupplier (  )  [virtual]

Sets up the object as a supplier of data.

Implements Capability.

Definition at line 111 of file SoundController.cpp.

References SoundControllerDataStruct::availableSounds, WURDE::C_CONSUMER, WURDE::C_SUPPLIER, SoundControllerInfoStruct::currentSet, SoundControllerInfoStruct::currentSound, SoundController::data, WURDE::g_fatal(), SoundController::info, SoundController::m_dataVector, Capability::m_doAutoPing, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, SoundController::m_infoVector, SoundController::m_initialize, SoundController::m_queue, SoundController::m_requestVector, Capability::m_streamname, Capability::m_supplier, SoundController::myCOMObject, SoundControllerInfoStruct::playSound, SoundControllerInfoStruct::repeat, SoundController::requests, SoundControllerInfoStruct::secondsToLive, Writable::setCMode(), SoundControllerDataStruct::soundSets, SoundControllerInfoStruct::source, and SoundControllerDataStruct::source.

Referenced by SoundController::setStreamName().

void activateConsumer (  )  [virtual]

Sets up the object as a consumer of data.

Implements Capability.

Definition at line 179 of file SoundController.cpp.

References SoundControllerDataStruct::availableSounds, WURDE::C_CONSUMER, WURDE::C_SUPPLIER, SoundControllerInfoStruct::currentSet, SoundControllerInfoStruct::currentSound, SoundController::data, WURDE::g_fatal(), CommsManager::getName(), SoundController::info, SoundController::m_dataVector, Capability::m_doAutoPing, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, SoundController::m_infoVector, SoundController::m_initialize, SoundController::m_queue, SoundController::m_requestVector, Capability::m_strategy, Capability::m_streamname, Capability::m_supplier, SoundController::myCOMObject, Capability::myManager, SoundControllerInfoStruct::playSound, SoundControllerInfoStruct::repeat, SoundController::requests, SoundControllerInfoStruct::secondsToLive, Writable::setCMode(), SOUNDCONTROLLER, SoundControllerDataStruct::soundSets, SoundControllerDataStruct::source, SoundControllerInfoStruct::source, and WURDE::STRAT_NORMAL.

Referenced by SoundController::setStreamName().

std::string getInterfaceName (  )  [inline, virtual]

Returns the name of the interface.

We're identifying interfaces by strings, rather than an enum, as it saves us from having to autogenerate even more code

Implements Capability.

Definition at line 134 of file SoundController.H.

References SOUNDCONTROLLER.

void setStreamName ( const std::string &  name  )  [virtual]

Sets the name of the stream we're using.

Implements Capability.

Definition at line 645 of file SoundController.cpp.

References SoundController::activateConsumer(), SoundController::activateSupplier(), Capability::m_globalname, Capability::m_haveStream, SoundController::m_initialize, Capability::m_streamname, Capability::m_streamRequest, Capability::m_supplier, SoundController::myCOMObject, and WURDE::STAT_OKAY.

void setGlobalName ( const std::string &  name  )  [virtual]

Sets the global name of this object.

Implements Capability.

Definition at line 673 of file SoundController.cpp.

References Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_streamname, Capability::m_supplier, and SoundController::myCOMObject.

bool newData (  )  [virtual]

True if there is new data.

Implements Capability.

Definition at line 292 of file SoundController.cpp.

References SoundController::m_dataVector, SoundController::m_queue, and SoundController::myCOMObject.

Referenced by main().

bool newInfo (  )  [virtual]

True if there is new info/requests (depending on supplier/consumer mode).

Implements Capability.

Definition at line 304 of file SoundController.cpp.

References SoundController::m_infoVector, SoundController::m_queue, SoundController::m_requestVector, Capability::m_supplier, and SoundController::myCOMObject.

Referenced by main().

void setAutoPing ( const bool &  val  )  [virtual]

Sets the state of the auto-ping function.

If true, consumers will automatically send out a blank MESSAGE_PING to the stream source, and suppliers will automatically filter out these requests and send a copy of the last published info and data.

Should consumers be set up to send out this request on a regular basis?

Implements Capability.

Definition at line 696 of file SoundController.cpp.

References Capability::m_doAutoPing, and SoundController::myCOMObject.

void doPing (  )  [virtual]

Manually tells the object to do a ping.

If a consumer, sends a ping request to its supplier, if a supplier, sends out a copy of the last published info and data messages.

Implements Capability.

Definition at line 690 of file SoundController.cpp.

References SoundController::myCOMObject.

bool getQueueMode (  )  [inline]

True if events are being queued, otherwise false.

Definition at line 146 of file SoundController.H.

References SoundController::m_queue.

void setQueueMode ( const bool &  val  ) 

Turn queue mode on or off.

Definition at line 268 of file SoundController.cpp.

References SoundController::m_dataVector, SoundController::m_infoVector, SoundController::m_queue, SoundController::m_requestVector, and SoundController::myCOMObject.

SoundControllerDataStruct getNextData (  ) 

Returns a struct containing the next event in the queue.

Also copies the contents of that event into the data struct.

Definition at line 437 of file SoundController.cpp.

References SoundControllerDataStruct::availableSounds, SoundController::data, SoundController::m_dataVector, SoundController::m_queue, SoundController::myCOMObject, SoundControllerDataStruct::soundSets, SoundControllerDataStruct::source, and SoundControllerDataStruct::timestamp.

Referenced by main().

SoundControllerInfoStruct getNextInfo (  ) 

Returns a struct containing the next event in the queue.

Also copies the contents of that event into the info/requests struct.

Definition at line 463 of file SoundController.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, SoundControllerInfoStruct::currentSet, SoundControllerInfoStruct::currentSound, SoundController::info, SoundController::m_infoVector, SoundController::m_queue, SoundController::m_requestVector, Capability::m_supplier, SoundControllerInfoStruct::mType, SoundController::myCOMObject, SoundControllerInfoStruct::playSound, SoundControllerInfoStruct::repeat, SoundController::requests, SoundControllerInfoStruct::secondsToLive, Writable::setCMode(), SoundControllerInfoStruct::source, SoundControllerInfoStruct::target, and SoundControllerInfoStruct::timestamp.

Referenced by SoundController::getNextRequest(), and main().

SoundControllerInfoStruct getNextRequest (  )  [inline]

Convenience function, calls getNextInfo().

Definition at line 168 of file SoundController.H.

References SoundController::getNextInfo().

void publishData (  )  [virtual]

Informs the object to publish data on the next update.

Implements Capability.

Definition at line 321 of file SoundController.cpp.

References SoundControllerDataStruct::availableSounds, SoundController::data, SoundController::m_dataVector, Capability::m_doPublishData, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, SoundController::m_queue, Capability::m_supplier, Time::now(), SoundControllerDataStruct::soundSets, SoundControllerDataStruct::source, and SoundControllerDataStruct::timestamp.

void publishInfo (  )  [virtual]

Informs the object to publish info on the next update.

Implements Capability.

Definition at line 345 of file SoundController.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, SoundControllerInfoStruct::currentSet, SoundControllerInfoStruct::currentSound, SoundController::info, Capability::m_doPublishInfo, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, SoundController::m_infoVector, SoundController::m_queue, SoundController::m_requestVector, Capability::m_streamname, Capability::m_supplier, WURDE::MESSAGE_INFO, WURDE::MESSAGE_REQUEST, SoundControllerInfoStruct::mType, Time::now(), SoundControllerInfoStruct::playSound, SoundControllerInfoStruct::repeat, SoundController::requests, SoundControllerInfoStruct::secondsToLive, Writable::setCMode(), SoundControllerInfoStruct::source, SoundControllerInfoStruct::target, and SoundControllerInfoStruct::timestamp.


Member Data Documentation

SoundControllerDataStruct data

The data structure.

Read from this if you're a consumer, write to it if you're a supplier.

Definition at line 115 of file SoundController.H.

Referenced by SoundController::activateConsumer(), SoundController::activateSupplier(), SoundController::getNextData(), and SoundController::publishData().

SoundControllerInfoStruct info

Information-- read if consumer, write if supplier.

Definition at line 120 of file SoundController.H.

Referenced by SoundController::activateConsumer(), SoundController::activateSupplier(), SoundController::getNextInfo(), SoundController::init(), and SoundController::publishInfo().

SoundControllerInfoStruct requests

Requests-- read if supplier, write if consumer.

Definition at line 125 of file SoundController.H.

Referenced by SoundController::activateConsumer(), SoundController::activateSupplier(), SoundController::getNextInfo(), SoundController::init(), main(), and SoundController::publishInfo().

COMObject<SoundControllerInfoStruct, SoundControllerDataStruct>* myCOMObject [protected]

Definition at line 175 of file SoundController.H.

Referenced by SoundController::activateConsumer(), SoundController::activateSupplier(), SoundController::disconnect(), SoundController::doPing(), SoundController::getNextData(), SoundController::getNextInfo(), SoundController::init(), SoundController::newData(), SoundController::newInfo(), SoundController::runUpdate(), SoundController::setAutoPing(), SoundController::setCOMObject(), SoundController::setGlobalName(), SoundController::setManager(), SoundController::setQueueMode(), SoundController::setStreamName(), and SoundController::~SoundController().

bool m_queue [protected]

Definition at line 177 of file SoundController.H.

Referenced by SoundController::activateConsumer(), SoundController::activateSupplier(), SoundController::getNextData(), SoundController::getNextInfo(), SoundController::getQueueMode(), SoundController::init(), SoundController::newData(), SoundController::newInfo(), SoundController::publishData(), SoundController::publishInfo(), and SoundController::setQueueMode().

bool m_initialize [protected]

Definition at line 180 of file SoundController.H.

Referenced by SoundController::activateConsumer(), SoundController::activateSupplier(), SoundController::init(), and SoundController::setStreamName().

std::queue<SoundControllerDataStruct> m_dataVector [protected]

Definition at line 181 of file SoundController.H.

Referenced by SoundController::activateConsumer(), SoundController::activateSupplier(), SoundController::getNextData(), SoundController::newData(), SoundController::publishData(), and SoundController::setQueueMode().

std::queue<SoundControllerInfoStruct> m_infoVector [protected]

Definition at line 182 of file SoundController.H.

Referenced by SoundController::activateConsumer(), SoundController::activateSupplier(), SoundController::getNextInfo(), SoundController::newInfo(), SoundController::publishInfo(), and SoundController::setQueueMode().

std::queue<SoundControllerInfoStruct> m_requestVector [protected]

Definition at line 183 of file SoundController.H.

Referenced by SoundController::activateConsumer(), SoundController::activateSupplier(), SoundController::getNextInfo(), SoundController::newInfo(), SoundController::publishInfo(), and SoundController::setQueueMode().


The documentation for this class was generated from the following files:
Generated on Thu Feb 1 15:31:55 2007 for WURDE by  doxygen 1.5.1