本文整理汇总了C++中NamedList类的典型用法代码示例。如果您正苦于以下问题:C++ NamedList类的具体用法?C++ NamedList怎么用?C++ NamedList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NamedList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setFuncList
void ScaleScript::setFuncList(const NamedList &l)
{
func_hash.clear();
for(auto it = l.begin(); it != l.end(); ++it){
ScriptScaleStruct::fromNamedMap((*it).value< NamedMap >(), func_hash);
}
}
示例2: initialize
void TestPlugin::initialize()
{
NamedList* httpdconf = 0;
Output("Initializing module TestHttpBase");
Configuration cfg;
cfg = Engine::configFile("httpserver");
cfg.load();
for (unsigned int i = 0; i < cfg.sections(); i++) {
httpdconf = cfg.getSection(i);
String name = httpdconf ? httpdconf->c_str() : "";
if (! name.startSkip("listener ",false))
continue;
name.trimBlanks();
httpdconf->String::operator=(name);
break; // XXX only first listener
}
if (m_first)
m_testThread = new TestThread;
m_testThread->configure(*httpdconf);
if (m_first) {
m_first = false;
m_testThread->startup();
Engine::install(new TestHandler("http.request"));
}
// delete httpdconf;
}
示例3: fillParam
void CallInfo::fillParam(NamedList& target, const String& name, bool clear)
{
NamedString* param = getParam(name);
if (param)
target.setParam(name,param->c_str());
else if (clear)
target.clearParam(name);
}
示例4: configure
void TestThread::configure(const NamedList& conf)
{
Lock mylock(this);
m_serverAddr = conf.getValue("addr", "0.0.0.0");
if(m_serverAddr == "0.0.0.0")
m_serverAddr = "127.0.0.1";
m_serverPort = conf.getIntValue("port", 80);
}
示例5: putNamedList
// Append all paramters from one named list to another, inserting keys prefix
static void putNamedList(NamedList& dst, const NamedList& src, String prefix)
{
unsigned int n = src.length();
for (unsigned int i = 0; i < n; i++) {
const NamedString* param = src.getParam(i);
if (param)
dst.addParam(prefix + param->name(),*param);
}
}
示例6: stats
void RTPReceiver::stats(NamedList& stat) const
{
if (m_session)
stat.setParam("remoteip",m_session->UDPSession::transport()->remoteAddr().host());
stat.setParam("lostpkts",String(m_ioLostPkt));
stat.setParam("synclost",String(m_syncLost));
stat.setParam("wrongssrc",String(m_wrongSSRC));
stat.setParam("seqslost",String(m_seqLost));
}
示例7:
SDPSession::SDPSession(SDPParser* parser, NamedList& params)
: m_parser(parser), m_mediaStatus(MediaMissing),
m_rtpForward(false), m_sdpForward(false), m_rtpMedia(0),
m_sdpSession(0), m_sdpVersion(0)
{
m_rtpForward = params.getBoolValue("rtp_forward");
m_secure = params.getBoolValue("secure",parser->m_secure);
m_rfc2833 = parser->m_rfc2833;
setRfc2833(params.getParam("rfc2833"));
}
示例8: putMedia
// Put the list of net media in a parameter list
void SDPMedia::putMedia(NamedList& msg, bool putPort)
{
msg.addParam("media" + suffix(),"yes");
msg.addParam("formats" + suffix(),formats());
msg.addParam("transport" + suffix(),transport());
if (mappings())
msg.addParam("rtp_mapping" + suffix(),mappings());
if (isAudio())
msg.addParam("rtp_rfc2833",rfc2833());
if (putPort)
msg.addParam("rtp_port" + suffix(),remotePort());
if (remoteCrypto())
msg.addParam("crypto" + suffix(),remoteCrypto());
// must handle encryption differently
const char* enc = getValue("encryption");
if (enc)
msg.addParam("encryption" + suffix(),enc);
clearParam("encryption");
unsigned int n = length();
for (unsigned int i = 0; i < n; i++) {
const NamedString* param = getParam(i);
if (param)
msg.addParam("sdp" + suffix() + "_" + param->name(),*param);
}
}
示例9: c
void SS7Testing::setParams(const NamedList& params, bool setSeq)
{
if (!m_timer.interval() || params.getParam(YSTRING("interval")))
m_timer.interval(params,"interval",20,1000,true);
m_len = params.getIntValue(YSTRING("length"),m_len);
m_sharing = params.getBoolValue(YSTRING("sharing"),m_sharing);
if (m_len > 1024)
m_len = 1024;
if (setSeq || !m_seq)
m_seq = params.getIntValue(YSTRING("sequence"),m_seq);
const String* lbl = params.getParam(YSTRING("address"));
if (!TelEngine::null(lbl)) {
// TYPE,opc,dpc,sls,spare
SS7PointCode::Type t = SS7PointCode::Other;
ObjList* l = lbl->split(',');
const GenObject* o = l->at(0);
if (o) {
t = SS7PointCode::lookup(o->toString());
if (t == SS7PointCode::Other)
t = m_lbl.type();
}
if (t != SS7PointCode::Other) {
o = l->at(1);
if (o) {
SS7PointCode c(m_lbl.opc());
if (c.assign(o->toString(),t))
m_lbl.assign(t,m_lbl.dpc(),c,m_lbl.sls(),m_lbl.spare());
}
o = l->at(2);
if (o) {
SS7PointCode c(m_lbl.dpc());
if (c.assign(o->toString(),t))
m_lbl.assign(t,c,m_lbl.opc(),m_lbl.sls(),m_lbl.spare());
}
o = l->at(3);
if (o) {
int sls = o->toString().toInteger(-1);
if (sls >= 0)
m_lbl.setSls(sls);
}
o = l->at(4);
if (o) {
int spare = o->toString().toInteger(-1);
if (spare >= 0)
m_lbl.setSpare(spare);
}
}
delete l;
}
}
示例10: generateActionPointMapping
ActionPointMapping MetaSprite::generateActionPointMapping(const NamedList<ActionPointFunction>& apFunctions, ErrorList& err)
{
bool valid = true;
auto addError = [&](const std::string msg) {
err.addError(std::move(msg));
valid = false;
};
auto addApfError = [&](const ActionPointFunction& apf, const std::string msg) {
err.addError(std::make_unique<ListItemError>(&apf, std::move(msg)));
valid = false;
};
ActionPointMapping ret;
if (apFunctions.empty()) {
addError("Expected at least one action point function");
return ret;
}
if (apFunctions.size() > MAX_ACTION_POINT_FUNCTIONS) {
addError("Too many action point functions (max " + std::to_string(MAX_ACTION_POINT_FUNCTIONS) + ")");
return ret;
}
ret.reserve(apFunctions.size());
for (unsigned i = 0; i < apFunctions.size(); i++) {
const unsigned romValue = (i + 1) * 2;
assert(romValue <= 255 - 2);
const ActionPointFunction& apf = apFunctions.at(i);
if (not apf.name.isValid()) {
addApfError(apf, "Missing action point function name");
}
auto success = ret.emplace(apf.name, romValue);
if (success.second == false) {
addApfError(apf, "Action point function name already exists: " + apf.name);
}
}
if (not valid) {
ret.clear();
}
return ret;
}
示例11: return
unsigned char SS7Layer4::getSIO(const NamedList& params, unsigned char sif, unsigned char prio, unsigned char ni)
{
if ((prio & 0x30) == 0)
prio <<= 4;
if ((ni & 0xc0) == 0)
ni <<= 6;
sif = params.getIntValue(YSTRING("service"),sif & 0x0f);
prio = SS7MSU::getPriority(params.getValue(YSTRING("priority")),prio & 0x30);
if ((prio & 0x30) == 0)
prio <<= 4;
ni = SS7MSU::getNetIndicator(params.getValue(YSTRING("netindicator")),ni & 0xc0);
if ((ni & 0xc0) == 0)
ni <<= 6;
return (sif & 0x0f) | (prio & 0x30) | (ni & 0xc0);
}
示例12: itemComplete
bool SS7Testing::control(NamedList& params)
{
String* ret = params.getParam(YSTRING("completion"));
const String* oper = params.getParam(YSTRING("operation"));
const char* cmp = params.getValue(YSTRING("component"));
int cmd = oper ? oper->toInteger(s_dict_control,-1) : -1;
if (ret) {
if (oper && (cmd < 0))
return false;
String part = params.getValue(YSTRING("partword"));
if (cmp) {
if (toString() != cmp)
return false;
for (const TokenDict* d = s_dict_control; d->token; d++)
Module::itemComplete(*ret,d->token,part);
return true;
}
return Module::itemComplete(*ret,toString(),part);
}
if (!(cmp && toString() == cmp))
return false;
if (cmd >= 0) {
Lock mylock(this);
setParams(params,true);
switch (cmd) {
case CMD_STOP:
m_timer.stop();
return true;
case CMD_START:
if (!(m_timer.interval() && m_lbl.length()))
return false;
m_timer.start();
return sendTraffic();
case CMD_SINGLE:
if (!m_lbl.length())
return false;
m_timer.stop();
return sendTraffic();
case CMD_RESET:
m_timer.stop();
m_lbl.assign(SS7PointCode::Other,m_lbl.opc(),m_lbl.dpc(),m_lbl.sls());
return true;
}
}
return SignallingComponent::control(params);
}
示例13: readPalette
void readPalette(const XmlTag* tag, NamedList<PaletteInput>& palettes)
{
assert(tag->name == "palette");
palettes.insert_back();
auto& palette = palettes.back();
palette.name = tag->getAttributeId("name");
palette.paletteImageFilename = tag->getAttributeFilename("image");
palette.rowsPerFrame = tag->getAttributeUnsigned("rows-per-frame");
palette.skipFirstFrame = tag->getAttributeBoolean("skip-first");
if (tag->hasAttribute("animation-delay")) {
palette.animationDelay = tag->getAttributeUnsigned("animation-delay");
}
}
示例14: appendParam
// Append a parameter to a buffer from a list or dictionary
void appendParam(ObjList& msg, NamedList& params, unsigned char value,
TokenDict* dict, unsigned char defValue)
{
unsigned char a[3] = {value,1};
const char* name = lookup(value,ETSIModem::s_msgParams);
a[2] = lookup(params.getValue(name),dict,defValue);
msg.append(new DataBlock(a,sizeof(a)));
}
示例15: getStats
void RTPSession::getStats(NamedList& stats) const
{
if (m_send)
m_send->stats(stats);
if (m_recv)
m_recv->stats(stats);
stats.setParam("wrongsrc",String(m_wrongSrc));
}