diff --git a/src/rsb/ParticipantConfig.cpp b/src/rsb/ParticipantConfig.cpp index 79c0c96..ce8cb06 100644 --- a/src/rsb/ParticipantConfig.cpp +++ b/src/rsb/ParticipantConfig.cpp @@ -68,6 +68,16 @@ ParticipantConfig::Transport::ConverterNames ParticipantConfig::Transport::getCo return this->converters; } +void ParticipantConfig::Transport::addConverter(const string &wireschema, const string &datatype) +{ + this->converters.insert(make_pair(wireschema, datatype)); +} + +void ParticipantConfig::Transport::addConverters(const ParticipantConfig::Transport::ConverterNames &converters) +{ + this->converters.insert(converters.begin(), converters.end()); +} + rsc::runtime::Properties ParticipantConfig::Transport::getOptions() const { return this->options; } @@ -103,7 +113,7 @@ void ParticipantConfig::Transport::handleOption(const vector& key, "Option key `%1%' has invalid number of components; converter-related keys for transports has to have three components") % key)); } - this->converters.insert(make_pair(key[2], value)); + this->addConverter(key[2], value); } else if ((key.size() >= 2) && (key[0] == "converter")) { // ignore converters for other languages } else { diff --git a/src/rsb/ParticipantConfig.h b/src/rsb/ParticipantConfig.h index 852b92c..766be84 100644 --- a/src/rsb/ParticipantConfig.h +++ b/src/rsb/ParticipantConfig.h @@ -74,6 +74,9 @@ public: public rsc::config::OptionHandler, public rsc::runtime::Printable { public: + /** + * The set of preferred converters lists (wire-schema, data-type) pairs. + */ typedef std::set > ConverterNames; /** @@ -95,9 +98,23 @@ public: */ std::string getName() const; + /** + * Return the set of preferred converters. + * This list is typically initialized from options. See @a handleOption(). + */ ConverterNames getConverters() const; /** + * add a preferred converter + */ + void addConverter(const std::string &wireschema, const std::string &datatype); + + /** + * add preferred converters + */ + void addConverters(const ConverterNames& converters); + + /** * Returns the specified options for the transport. * * @return copy of options for the transport