Public Member Functions | |
DDSConnection (const std::string applicationName, const int partitionNumber) | |
~DDSConnection () | |
bool | supportsDestination (const base::RmsDestination &candidateDestination) |
std::string | getApplicationName () const |
int | getPartitionNumber () const |
void | close () |
const std::string | getUUID () |
std::string | getHostName () |
template<class T > | |
void | dumpMessage (T const &message, bool isIncomingMessage) |
template<class T > | |
void | sendMessage (unsigned int senderHandle, T &message) |
template<class T > | |
void | receiveMessage (unsigned int receiverHandle, T &message) |
template<class T > | |
bool | receiveMessage (unsigned int receiverHandle, T &message, unsigned int usecTimeout) |
template<class T > | |
unsigned int | registerSender (T const &sampleMessage, base::RmsDestination const &dest) |
void | unRegisterSender (unsigned int senderHandle) |
template<class T > | |
unsigned int | registerReceiver (T const &sampleMessage, base::RmsDestination const &dest) |
void | unRegisterReceiver (unsigned int receiverHandle) |
Private Attributes | |
util::UUIDGenerator * | _uuidGenerator |
std::string | _applicationName |
int | _partitionNumber |
std::map< unsigned int, boost::shared_ptr< base::RmsCloseable > > | _writerTable |
std::map< unsigned int, std::pair< std::string, std::string > > | _targetChannelTable |
unsigned int | _writerCounter |
std::map< unsigned int, boost::shared_ptr< base::RmsCloseable > > | _readerTable |
unsigned int | _readerCounter |
std::string | _myHostName |
boost::mutex | _registrationMutex |
int | _debugFlag |
Static Private Attributes | |
static int | _instanceCount = 0 |
static boost::mutex | _staticMutex |
This class takes care of setting up and managing connections to DDS for RMS.
Definition at line 35 of file DDSConnection.h.
gov::fnal::cd::rms::provider::DDSConnection::DDSConnection | ( | const std::string | applicationName, |
const int | partitionNumber | ||
) |
Creates a new DDSConnection given the application name and partition.
applicationName | The name of the application generating/receiving messages. |
applicationPartition | The partition of the application that is generating/receiving messages. |
Definition at line 27 of file DDSConnection.cpp.
References _applicationName, _debugFlag, _instanceCount, _myHostName, _partitionNumber, _staticMutex, _uuidGenerator, om::cerr, gov::fnal::cd::rms::provider::DPSingleton::connect_participant(), allTimeWatchdog::endl, cet::getenv(), gov::fnal::cd::rms::provider::DPSingleton::Instance(), datagram_client::sl, and string.
gov::fnal::cd::rms::provider::DDSConnection::~DDSConnection | ( | ) |
Destructor.
Definition at line 73 of file DDSConnection.cpp.
References _instanceCount, _staticMutex, close(), gov::fnal::cd::rms::provider::DPSingleton::disconnect_participant(), gov::fnal::cd::rms::provider::DPSingleton::Instance(), and datagram_client::sl.
void gov::fnal::cd::rms::provider::DDSConnection::close | ( | ) |
Closes the connection. After calling this method, the connection should no longer be used since it will no longer be connected to the underlying provider system.
Definition at line 98 of file DDSConnection.cpp.
References _uuidGenerator.
Referenced by getPartitionNumber(), and ~DDSConnection().
|
inline |
Definition at line 64 of file DDSConnection.h.
References novadaq::convertTimevalToDouble(), om::cout, allTimeWatchdog::endl, and datagram_client::message.
Referenced by receiveMessage(), and sendMessage().
|
inline |
Definition at line 45 of file DDSConnection.h.
References _applicationName.
Referenced by sendMessage().
|
inline |
Definition at line 59 of file DDSConnection.h.
References _myHostName.
|
inline |
Definition at line 46 of file DDSConnection.h.
References _partitionNumber, and close().
Referenced by sendMessage().
|
inline |
Get a new human readable UUID from the UUID generator.
Definition at line 55 of file DDSConnection.h.
References _uuidGenerator, and gov::fnal::cd::rms::util::UUIDGenerator::getUUIDHex().
Referenced by sendMessage().
|
inline |
Receives a message of the specified type from the specified destination.
dest | The destination to send the message to. |
message | The message received from the destination. |
Definition at line 159 of file DDSConnection.h.
References _debugFlag, _readerTable, _registrationMutex, dumpMessage(), makeTrainCVSamples::int, datagram_client::sl, and gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::take_wait().
|
inline |
Waits for a message of the specified type to arrive from the specified destination, but returns after the specified timeout if no message has arrived.
dest | The destination to send the message to. |
message | The message received from the destination. |
usecTimeout | Amount of time to wait for a message (microseconds). |
Definition at line 190 of file DDSConnection.h.
References _debugFlag, _readerTable, _registrationMutex, om::cout, dumpMessage(), allTimeWatchdog::endl, makeTrainCVSamples::int, datagram_client::message, datagram_client::sl, fabricate::status, and gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::take_timed_wait().
|
inline |
Definition at line 275 of file DDSConnection.h.
References _partitionNumber, _readerCounter, _readerTable, _registrationMutex, gov::fnal::cd::rms::base::RmsDestination::CHANNEL_PROPERTY_NAME, cet::replace_all(), datagram_client::sl, string, and gov::fnal::cd::rms::base::RmsDestination::TARGET_PROPERTY_NAME.
|
inline |
Definition at line 231 of file DDSConnection.h.
References _partitionNumber, _registrationMutex, _targetChannelTable, _writerCounter, _writerTable, gov::fnal::cd::rms::base::RmsDestination::CHANNEL_PROPERTY_NAME, make_pair(), cet::replace_all(), datagram_client::sl, string, and gov::fnal::cd::rms::base::RmsDestination::TARGET_PROPERTY_NAME.
|
inline |
Sends a message of the specified type to the specified destination.
dest | The destination to send the message to. |
message | The message to be sent to the destination. |
Definition at line 105 of file DDSConnection.h.
References _debugFlag, _myHostName, _registrationMutex, _targetChannelTable, _writerTable, dumpMessage(), getApplicationName(), getPartitionNumber(), getUUID(), makeTrainCVSamples::int, datagram_client::sl, string, and gov::fnal::cd::rms::provider::DDSTopicWriterClass< TT_ >::write().
bool gov::fnal::cd::rms::provider::DDSConnection::supportsDestination | ( | const base::RmsDestination & | dest | ) |
Determine if the given destination can be reached with the DDS provider.
dest | The destination to check to see if messages can be sent to it. |
Definition at line 89 of file DDSConnection.cpp.
|
inline |
Definition at line 296 of file DDSConnection.h.
References _readerTable, _registrationMutex, makeTrainCVSamples::int, and datagram_client::sl.
|
inline |
Definition at line 254 of file DDSConnection.h.
References _registrationMutex, _targetChannelTable, _writerTable, makeTrainCVSamples::int, and datagram_client::sl.
|
private |
Definition at line 313 of file DDSConnection.h.
Referenced by DDSConnection(), and getApplicationName().
|
private |
Definition at line 328 of file DDSConnection.h.
Referenced by DDSConnection(), receiveMessage(), and sendMessage().
|
staticprivate |
Definition at line 330 of file DDSConnection.h.
Referenced by DDSConnection(), and ~DDSConnection().
|
private |
Definition at line 324 of file DDSConnection.h.
Referenced by DDSConnection(), getHostName(), and sendMessage().
|
private |
Definition at line 314 of file DDSConnection.h.
Referenced by DDSConnection(), getPartitionNumber(), registerReceiver(), and registerSender().
|
private |
Definition at line 322 of file DDSConnection.h.
Referenced by registerReceiver().
|
private |
Definition at line 321 of file DDSConnection.h.
Referenced by receiveMessage(), registerReceiver(), and unRegisterReceiver().
|
mutableprivate |
Definition at line 326 of file DDSConnection.h.
Referenced by receiveMessage(), registerReceiver(), registerSender(), sendMessage(), unRegisterReceiver(), and unRegisterSender().
|
staticprivate |
Definition at line 331 of file DDSConnection.h.
Referenced by DDSConnection(), and ~DDSConnection().
|
private |
Definition at line 318 of file DDSConnection.h.
Referenced by registerSender(), sendMessage(), and unRegisterSender().
|
private |
Definition at line 312 of file DDSConnection.h.
Referenced by close(), DDSConnection(), and getUUID().
|
private |
Definition at line 319 of file DDSConnection.h.
Referenced by registerSender().
|
private |
Definition at line 316 of file DDSConnection.h.
Referenced by registerSender(), sendMessage(), and unRegisterSender().