📄 addressbase.cpp
字号:
return burstModeMaxEntries_;}void AddressBase::setBurstModeMaxEntries(int burstModeMaxEntries){ if (burstModeMaxEntries < -1) { burstModeMaxEntries_ = 1; } else if (burstModeMaxEntries == 0) { log_.warn(ME, string("<burstMode maxEntries='") + lexical_cast<std::string>(burstModeMaxEntries) + string("'> is not supported and may cause strange behavior")); burstModeMaxEntries_ = burstModeMaxEntries; } else { burstModeMaxEntries_ = burstModeMaxEntries; }}long AddressBase::getBurstModeMaxBytes() const{ return burstModeMaxBytes_;}void AddressBase::setBurstModeMaxBytes(long burstModeMaxBytes){ if (burstModeMaxBytes < -1) burstModeMaxBytes_ = -1; else burstModeMaxBytes_ = burstModeMaxBytes;}/** * How long to wait between pings to the callback server. * @return The pause time between pings in millis */long AddressBase::getPingInterval() const{ return pingInterval_;}/** * How long to wait between pings to the callback server. * @param pingInterval The pause time between pings in millis */void AddressBase::setPingInterval(long pingInterval){ if (pingInterval <= 0) pingInterval_ = 0; else if (pingInterval < 10) { log_.warn(ME, string("pingInterval=") + lexical_cast<std::string>(pingInterval) + string(" msec is too short, setting it to 10 millis")); pingInterval_ = 10; } else pingInterval_ = pingInterval;}/** * How often shall we retry callback attempt on callback failure * @return -1 forever, 0 no retry, > 0 number of retries */int AddressBase::getRetries() const{ return retries_;}/** * How often shall we retry callback attempt on callback failure * @param -1 forever, 0 no retry, > 0 number of retries */void AddressBase::setRetries(int retries){ if (retries < -1) retries_ = -1; else retries_ = retries;}/** * Delay between callback retries in milliseconds, defaults to one minute * @return The delay in millisconds */long AddressBase::getDelay() const{ return delay_;}/** * Delay between callback retries in milliseconds, defaults to one minute */void AddressBase::setDelay(long delay){ if (delay < 0) delay_ = 0; else delay_ = delay;}/** * Shall the publish() or callback update() message be oneway. * Is only with CORBA and our native SOCKET protocol supported * @return true if you want to force oneway sending */bool AddressBase::oneway() const{ return oneway_;}/** * Shall the publish() or callback update() message be oneway. * Is only with CORBA and our native SOCKET protocol supported * @param oneway false is default */void AddressBase::setOneway(bool oneway){ oneway_ = oneway;}bool AddressBase::isDispatcherActive() const{ return dispatcherActive_;}void AddressBase::setDispatcherActive(bool dispatcherActive){ dispatcherActive_ = dispatcherActive;}/** * @param Set if we accept point to point messages */void AddressBase::setPtpAllowed(bool ptpAllowed){ ptpAllowed_ = ptpAllowed;}/** * @return true if we may send PtP messages */bool AddressBase::isPtpAllowed(){ return ptpAllowed_;}void AddressBase::setCompressType(const string& compressType){ compressType_ = compressType; // TODO !!! if (compressType != "") log_.warn(ME, "Compression of messages is not yet supported");}/** * The identifier sent to the callback client, the client can decide if he trusts this invocation * @return never null */string AddressBase::getSecretSessionId() const{ return sessionId_;}/** The identifier sent to the callback client, the client can decide if he trusts this invocation */void AddressBase::setSecretSessionId(const string& sessionId){ sessionId_ = sessionId;}/** * Get the compression method. * @return "" No compression */string AddressBase::getCompressType() const{ return compressType_;}/** * Messages bigger this size in bytes are compressed. * <br /> * Note: This value is only used if compressType is set to a supported value * @return size in bytes */long AddressBase::getMinSize() const{ return minSize_;}/** * Messages bigger this size in bytes are compressed. * <br /> * Note: This value is only evaluated if compressType is set to a supported value * @return size in bytes */void AddressBase::setMinSize(long minSize){ minSize_ = minSize;}/** * Specify your dispatcher plugin configuration. * <p> * Set to "undef" to switch off, or to e.g. "Priority,1.0" to access the PriorizedDispatchPlugin * </p> * <p> * This overwrites the xmlBlaster.properties default setting e.g.: * <pre> * DispatchPlugin[Priority][1.0]=org.xmlBlaster.util.dispatch.plugins.prio.PriorizedDispatchPlugin * DispatchPlugin[SlowMotion][1.0]=org.xmlBlaster.util.dispatch.plugins.motion.SlowMotion * DispatchPlugin/defaultPlugin=Priority,1.0 * </pre> * </p> * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/dispatch.control.plugin.html">The dispatch.control.plugin requirement</a> */void AddressBase::setDispatchPlugin(const string& dispatchPlugin){ dispatchPlugin_ = dispatchPlugin;}/** * @return "undef" or e.g. "Priority,1.0" */string AddressBase::getDispatchPlugin() const{ return dispatchPlugin_;}void AddressBase::addAttribute(const ClientProperty& attribute){ attributes_.insert(ClientPropertyMap::value_type(attribute.getName(), attribute)); }const AddressBase::ClientPropertyMap& AddressBase::getAttributes() const{ return attributes_;}string AddressBase::dumpAttributes(const string& extraOffset, bool clearText) const{ string ret = ""; QosData::ClientPropertyMap::const_iterator iter = attributes_.begin(); while (iter != attributes_.end()) { const ClientProperty& cp = (*iter).second; ret += cp.toXml(extraOffset, clearText, ATTRIBUTE_TAG); iter++; } return ret;}/** * Dump state of this object into a XML ASCII string. * <br> * Only none default values are dumped for performance reasons * @param extraOffset indenting of tags for nice output * @return The xml representation */string AddressBase::toXml(const string& extraOffset) const{ //if (log_.call()) log_.call(ME, "::toXml"); string ret; string offset = Constants::OFFSET + extraOffset; string offset2 = offset + Constants::INDENT; // <address type='SOCKET' bootstrapHostname='127.0.0.1' dispatchPlugin='undef'> ... ret += offset + string("<") + rootTag_ + string(" type='") + getType() + string("'"); if ( (getVersion()!="") && (getVersion()!=DEFAULT_version)) ret += string(" version='") + getVersion() + string("'"); if (getHostname() != "") ret += string(" bootstrapHostname='") + getHostname() + string("'"); if (DEFAULT_port != getPort()) ret += string(" bootstrapPort='") + lexical_cast<std::string>(getPort()) + string("'"); if (DEFAULT_sessionId != getSecretSessionId()) ret += string(" sessionId='") + getSecretSessionId() + string("'"); if (defaultPingInterval_ != getPingInterval()) ret += string(" pingInterval='") + lexical_cast<std::string>(getPingInterval()) + string("'"); if (defaultRetries_ != getRetries()) ret += string(" retries='") + lexical_cast<std::string>(getRetries()) + string("'"); if (defaultDelay_ != getDelay()) ret += string(" delay='") + lexical_cast<std::string>(getDelay()) + string("'"); if (DEFAULT_oneway != oneway()) { ret += string(" oneway='") + lexical_cast<std::string>(oneway()) + string("'"); } if (DEFAULT_dispatcherActive != isDispatcherActive()) { ret += string(" dispatcherActive='") + lexical_cast<std::string>(isDispatcherActive()) + string("'"); } if (DEFAULT_useForSubjectQueue != useForSubjectQueue_) { ret += string(" useForSubjectQueue='") + lexical_cast<std::string>(useForSubjectQueue_) + string("'"); } if (DEFAULT_dispatchPlugin != dispatchPlugin_) ret += string(" dispatchPlugin='") + dispatchPlugin_ + string("'"); ret += string(">"); if (getRawAddress() != "") ret += offset + string(" ") + getRawAddress(); if (getCollectTime() != DEFAULT_collectTime || getBurstModeMaxEntries() != DEFAULT_burstModeMaxEntries || getBurstModeMaxBytes() != DEFAULT_burstModeMaxBytes) { ret += offset2 + string("<burstMode"); if (getCollectTime() != DEFAULT_collectTime) ret += string(" collectTime='") + lexical_cast<std::string>(getCollectTime()) + string("'"); if (getBurstModeMaxEntries() != DEFAULT_burstModeMaxEntries) ret += string(" maxEntries='") + lexical_cast<std::string>(getBurstModeMaxEntries()) + string("'"); if (getBurstModeMaxBytes() != DEFAULT_burstModeMaxBytes) ret += string(" maxBytes='") + lexical_cast<std::string>(getBurstModeMaxBytes()) + string("'"); ret += string("/>"); } if (getCompressType() != DEFAULT_compressType) ret += offset2 + string("<compress type='") + getCompressType() + string("' minSize='") + lexical_cast<std::string>(getMinSize()) + string("'/>"); if (ptpAllowed_ != DEFAULT_ptpAllowed) { ret += offset2 + string("<ptp>") + lexical_cast<std::string>(ptpAllowed_) + string("</ptp>"); } ret += dumpAttributes(offset2); ret += offset + string("</") + rootTag_ + string(">"); return ret;}}}}}} // namespaces
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -