Classes | Typedefs | Functions | Variables
gov::fnal::cd::rms::provider Namespace Reference

Provider-specific classes and interfaces. More...

Classes

class  BufferedProviderListener
 
class  DDSConnection
 
class  DDSTopicReaderClass
 
class  DDSTopicWriterClass
 
class  DPSingleton
 
class  EpicsConnection
 
class  EpicsMessenger
 
class  LocalhostConnection
 
class  MessageAssembler
 
class  MessageFragment
 
class  MessageSplitter
 
class  ProcessSignalHandler
 
class  ProcessSignalHandlerDeleter
 
class  ProviderListener
 
class  RmsConnection
 
class  RmsConnectionFactory
 
class  SignalInhibitor
 

Typedefs

typedef std::pair< std::string, std::vector< std::string > > dds_topic_filter_t
 
typedef boost::interprocess::unique_ptr< ProcessSignalHandler, ProcessSignalHandlerDeleterProcessSignalHandler_t
 

Functions

std::string create_extended_topic_name_for (std::string const &type_name, std::string const &topic_name)
 
std::string create_content_filtered_topic_name_for (std::string const &type_name, std::string const &topic_name)
 
dds_topic_filter_tcreate_topic_filter_for (dds_topic_filter_t &filter, std::string const &type_name, std::string const &topic_name)
 
std::string unique_topic_name_for (std::string const &extended_topic_name)
 
bool string2bool (std::string const &bool_string)
 
void dumpReceivedSamples (dds::SampleInfoSeq const &infoSeq, const unsigned int length, const int status)
 
const char * getErrorName (DDS::ReturnCode_t status)
 
void checkStatus (DDS::ReturnCode_t status, const char *info)
 
void checkHandle (void *handle, const char *info)
 
static void EpicsMessengerCallback (struct event_handler_args eventHandlerArgs)
 
template<typename T >
bool equal (T *first, T *second)
 

Variables

const char * RetCodeName [13]
 

Detailed Description

Provider-specific classes and interfaces.

This package contains classes and interfaces for interacting with third-party messaging providers.

Typedef Documentation

typedef std::pair<std::string, std::vector<std::string> > gov::fnal::cd::rms::provider::dds_topic_filter_t

Definition at line 63 of file CETDDS.h.

Definition at line 107 of file ProcessSignalHandler.h.

Function Documentation

void gov::fnal::cd::rms::provider::checkHandle ( void handle,
const char *  info 
)

Check whether a valid handle has been returned. If not, then terminate.

Check whether a valid handle has been returned. If not, then throw a runtime exception.

Definition at line 78 of file CheckStatus.cpp.

References om::cerr, allTimeWatchdog::endl, and GENERATE_RMS_RUNTIME_EXCEPTION.

80  {
81 
82  if (!handle) {
83  cerr << "Error in " << info << ": Creation failed: invalid handle" << endl;
84  GENERATE_RMS_RUNTIME_EXCEPTION ("checkHandle failed");
85  }
86 }
const XML_Char XML_Encoding * info
Definition: expat.h:530
OStream cerr
Definition: OStream.cxx:7
#define GENERATE_RMS_RUNTIME_EXCEPTION(msg)
void gov::fnal::cd::rms::provider::checkStatus ( DDS::ReturnCode_t  status,
const char *  info 
)

Check the return status for errors. If there is an error, then terminate.

Check the return status for errors. If there is an error, then throw a runtime exception.

Definition at line 64 of file CheckStatus.cpp.

References om::cerr, allTimeWatchdog::endl, GENERATE_RMS_RUNTIME_EXCEPTION, and getErrorName().

Referenced by gov::fnal::cd::rms::provider::DPSingleton::connect_participant(), gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::receiveMessage(), and gov::fnal::cd::rms::provider::DDSTopicWriterClass< TT_ >::write().

66  {
67 
68 
69  if (status != DDS::RETCODE_OK && status != DDS::RETCODE_NO_DATA) {
70  cerr << "Error in " << info << ": " << getErrorName(status) << endl;
71  GENERATE_RMS_RUNTIME_EXCEPTION ("checkStatus failed");
72  }
73 }
const char * getErrorName(DDS::ReturnCode_t status)
Definition: CheckStatus.cpp:56
const XML_Char XML_Encoding * info
Definition: expat.h:530
int status
Definition: fabricate.py:1613
OStream cerr
Definition: OStream.cxx:7
#define GENERATE_RMS_RUNTIME_EXCEPTION(msg)
std::string gov::fnal::cd::rms::provider::create_content_filtered_topic_name_for ( std::string const &  type_name,
std::string const &  topic_name 
)

Definition at line 33 of file CETDDS.cpp.

References create_extended_topic_name_for().

Referenced by gov::fnal::cd::rms::provider::DDSTopicWriterClass< TT_ >::init(), gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::init(), and gov::fnal::cd::rms::Deleter< D >::operator()().

35 {
36  return create_extended_topic_name_for(type_name,topic_name.substr(topic_name.find("_")+1));
37 }
std::string create_extended_topic_name_for(std::string const &type_name, std::string const &topic_name)
Definition: CETDDS.cpp:24
std::string gov::fnal::cd::rms::provider::create_extended_topic_name_for ( std::string const &  type_name,
std::string const &  topic_name 
)

Definition at line 24 of file CETDDS.cpp.

References cet::replace_all().

Referenced by create_content_filtered_topic_name_for(), gov::fnal::cd::rms::provider::DDSTopicWriterClass< TT_ >::init(), gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::init(), and gov::fnal::cd::rms::Deleter< D >::operator()().

26 {
27  std::string extendedTopicName(topic_name);
28  extendedTopicName.append( "_" );
29  extendedTopicName.append( type_name );
30  boost::replace_all( extendedTopicName, "::", "_" );
31  return extendedTopicName;
32 }
bool replace_all(std::string &in, std::string const &from, std::string const &to)
Replace all occurrences of from in string with to.
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
dds_topic_filter_t & gov::fnal::cd::rms::provider::create_topic_filter_for ( dds_topic_filter_t filter,
std::string const &  type_name,
std::string const &  topic_name 
)

Definition at line 39 of file CETDDS.cpp.

References cet::replace_all().

Referenced by gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::init().

41 {
42  filter.first="( header.target = %0 )";
43  filter.second.clear();
44  std::string topic_name_tmp(topic_name.substr(0,topic_name.rfind("_")));
45 
46  //restore dashes replaced in DDSConnection::registerSender
47  boost::replace_all(topic_name_tmp,"_dash_","-");
48  filter.second.push_back(topic_name_tmp);
49 
50  return filter;
51 }
Module that kips a configurable number of events between each that it allows through. Note that this module really skips (N-1) events, it uses a simple modular division as its critera. This module will cut down the data sample to 1/N of its original size.
bool replace_all(std::string &in, std::string const &from, std::string const &to)
Replace all occurrences of from in string with to.
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
void gov::fnal::cd::rms::provider::dumpReceivedSamples ( dds::SampleInfoSeq const &  infoSeq,
const unsigned int  length,
const int  status 
)

Definition at line 68 of file CETDDS.cpp.

References om::cout, allTimeWatchdog::endl, compare_h5_caf::idx, makeTrainCVSamples::int, and demo0::length.

Referenced by gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::receiveMessage().

69 {
70  std::cout << "++++++++++++++++++++++++++++++++++++++++" << std::endl;
71  std::cout << "status=" << status << " topic_seq.length()=" << length << std::endl;
72 
73  for ( uint32_t idx = 0; idx < length; ++idx ) {
74  std::cout << "sample state = " << infoSeq[idx].sample_state << std::endl;
75  std::cout << "view state = " << infoSeq[idx].view_state << std::endl;
76  std::cout << "instance state = " << infoSeq[idx].instance_state << std::endl;
77  std::cout << "valid data = " << (( int ) infoSeq[idx].valid_data ) << std::endl;
78  //std::cout << "source timestamp = " << infoSeq[idx].source_timestamp << std::endl;
79  std::cout << "disposed generation count = " << infoSeq[idx].disposed_generation_count << std::endl;
80  std::cout << "no writers generation count = " << infoSeq[idx].no_writers_generation_count << std::endl;
81  std::cout << "sample rank = " << infoSeq[idx].sample_rank << std::endl;
82  std::cout << "generation rank = " << infoSeq[idx].generation_rank << std::endl;
83  std::cout << "absolute generation rank = " << infoSeq[idx].absolute_generation_rank << std::endl;
84  }
85 
86  std::cout << "----------------------------------------" << std::endl;
87 }
int status
Definition: fabricate.py:1613
length
Definition: demo0.py:21
OStream cout
Definition: OStream.cxx:6
static void gov::fnal::cd::rms::provider::EpicsMessengerCallback ( struct event_handler_args  eventHandlerArgs)
static

Callback function for handling notifications from EPICS. Calls the monitorChanged() method on the messenger object that is interited in the PV that changed.

Parameters
eventHandlerArgsParameters from EPICS

Definition at line 21 of file EpicsMessenger.cpp.

References gov::fnal::cd::rms::provider::EpicsMessenger::monitorChanged().

Referenced by gov::fnal::cd::rms::provider::EpicsMessenger::addListener().

21  {
22  EpicsMessenger *messengerObject;
23  char *messengerData;
24 
25  messengerObject = (EpicsMessenger *)eventHandlerArgs.usr;
26  messengerData = (char *)eventHandlerArgs.dbr;
27 
28  messengerObject->monitorChanged(messengerData);
29 }
template<typename T >
bool gov::fnal::cd::rms::provider::equal ( T first,
T second 
)
const char * gov::fnal::cd::rms::provider::getErrorName ( DDS::ReturnCode_t  status)

Returns the name of an error code.

Definition at line 56 of file CheckStatus.cpp.

References fabricate::status.

Referenced by checkStatus().

57 {
58  return RetCodeName[status];
59 }
int status
Definition: fabricate.py:1613
const char * RetCodeName[13]
Definition: CheckStatus.cpp:38
bool gov::fnal::cd::rms::provider::string2bool ( std::string const &  bool_string)

Definition at line 61 of file CETDDS.cpp.

Referenced by gov::fnal::cd::rms::provider::DDSTopicWriterClass< TT_ >::init(), and gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::init().

62 {
63  return !bool_string.empty() && (
64  strcasecmp(bool_string.c_str(),"true")==0
65  || atoi(bool_string.c_str()) !=0);
66 }
std::string gov::fnal::cd::rms::provider::unique_topic_name_for ( std::string const &  extended_topic_name)

Definition at line 53 of file CETDDS.cpp.

References central_limit::rand.

Referenced by gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::init().

54 {
55  static boost::mt19937 rand(static_cast<unsigned int>(std::time(0)));
56  std::string unique_extended_topic_name(extended_topic_name);
57  unique_extended_topic_name.append(boost::lexical_cast<std::string>(rand()));
58  return unique_extended_topic_name;
59 }
::xsd::cxx::tree::time< char, simple_type > time
Definition: Database.h:194
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154

Variable Documentation

const char* gov::fnal::cd::rms::provider::RetCodeName[13]
Initial value:
= {
"DDS_RETCODE_OK",
"DDS_RETCODE_ERROR",
"DDS_RETCODE_UNSUPPORTED",
"DDS_RETCODE_BAD_PARAMETER",
"DDS_RETCODE_PRECONDITION_NOT_MET",
"DDS_RETCODE_OUT_OF_RESOURCES",
"DDS_RETCODE_NOT_ENABLED",
"DDS_RETCODE_IMMUTABLE_POLICY",
"DDS_RETCODE_INCONSISTENT_POLICY",
"DDS_RETCODE_ALREADY_DELETED",
"DDS_RETCODE_TIMEOUT",
"DDS_RETCODE_NO_DATA",
"DDS_RETCODE_ILLEGAL_OPERATION" }

Definition at line 38 of file CheckStatus.cpp.