当前位置: 首页>>代码示例>>C++>>正文


C++ ObjList类代码示例

本文整理汇总了C++中ObjList的典型用法代码示例。如果您正苦于以下问题:C++ ObjList类的具体用法?C++ ObjList怎么用?C++ ObjList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ObjList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: XDebug

NamedList& NamedList::copySubParams(const NamedList& original, const String& prefix,
    bool skipPrefix, bool replace)
{
    XDebug(DebugInfo,"NamedList::copySubParams(%p,\"%s\",%s,%s) [%p]",
	&original,prefix.c_str(),String::boolText(skipPrefix),
	String::boolText(replace),this);
    if (prefix) {
	unsigned int offs = skipPrefix ? prefix.length() : 0;
	ObjList* dest = &m_params;
	for (const ObjList* l = original.m_params.skipNull(); l; l = l->skipNext()) {
	    const NamedString* s = static_cast<const NamedString*>(l->get());
	    if (s->name().startsWith(prefix)) {
		const char* name = s->name().c_str() + offs;
		if (!*name)
		    continue;
		if (!replace)
		    dest = dest->append(new NamedString(name,*s));
		else if (offs)
		    setParam(name,*s);
		else
		    setParam(s->name(),*s);
	    }
	}
    }
    return *this;
}
开发者ID:0x7678,项目名称:evilbts,代码行数:26,代码来源:NamedList.cpp

示例2: lock

SIPEvent* SIPEngine::getEvent()
{
    Lock lock(this);
    ObjList* l = m_transList.skipNull();
    if (!l)
	return 0;
    u_int64_t time = Time::now();
    for (; l; l = l->skipNext()) {
	SIPTransaction* t = static_cast<SIPTransaction*>(l->get());
	SIPEvent* e = t->getEvent(true,time);
	if (e) {
	    DDebug(this,DebugInfo,"Got pending event %p (state %s) from transaction %p [%p]",
		e,SIPTransaction::stateName(e->getState()),t,this);
	    if (t->getState() == SIPTransaction::Invalid)
		m_transList.remove(t);
	    return e;
	}
    }
    time = Time::now();
    for (l = m_transList.skipNull(); l; l = l->skipNext()) {
	SIPTransaction* t = static_cast<SIPTransaction*>(l->get());
	SIPEvent* e = t->getEvent(false,time);
	if (e) {
	    DDebug(this,DebugInfo,"Got event %p (state %s) from transaction %p [%p]",
		e,SIPTransaction::stateName(e->getState()),t,this);
	    if (t->getState() == SIPTransaction::Invalid)
		m_transList.remove(t);
	    return e;
	}
    }
    return 0;
}
开发者ID:andreikabeliy,项目名称:yate,代码行数:32,代码来源:engine.cpp

示例3: printResult

// Utility: print the result of dns query
// Return the code
static int printResult(int type, int code, const char* dname, ObjList& result, String* error)
{
#ifdef DEBUG
    if (!code) {
	String s;
	int crt = 0;
	for (ObjList* o = result.skipNull(); o; o = o->skipNext()) {
	    DnsRecord* rec = static_cast<DnsRecord*>(o->get());
	    if (!s)
		s << "\r\n-----";
	    s << "\r\n" << ++crt << ":";
	    rec->dump(s);
	}
	if (s)
	    s << "\r\n-----";
	Debug(DebugAll,"%s query for '%s' got %d records%s",
	    lookup(type,Resolver::s_types),dname,result.count(),s.safe());
    }
    else {
	String dummy;
	if (!error) {
	    error = &dummy;
#ifdef _WINDOWS
	    Thread::errorString(dummy,code);
#elif defined(__NAMESER)
	    dummy = hstrerror(code);
#endif
	}
	Debug(DebugNote,"%s query for '%s' failed with code %d error=%s",
	    lookup(type,Resolver::s_types),dname,code,TelEngine::c_safe(error));
    }
#endif
    return code;
}
开发者ID:bastienhappe,项目名称:yate,代码行数:36,代码来源:Resolver.cpp

示例4: XDebug

bool HashList::resync()
{
    XDebug(DebugAll,"HashList::resync() [%p]",this);
    bool moved = false;
    for (unsigned int n = 0; n < m_size; n++) {
        ObjList* l = m_lists[n];
        while (l) {
            GenObject* obj = l->get();
            if (obj) {
                unsigned int i = obj->toString().hash() % m_size;
                if (i != n) {
                    bool autoDel = l->autoDelete();
                    m_lists[n]->remove(obj,false);
                    if (!m_lists[i])
                        m_lists[i] = new ObjList;
                    m_lists[i]->append(obj)->setDelete(autoDel);
                    moved = true;
                    continue;
                }
            }
            l = l->next();
        }
    }
    return moved;
}
开发者ID:andreikabeliy,项目名称:yate,代码行数:25,代码来源:HashList.cpp

示例5: XDebug

GenObject* ObjList::remove(bool delobj)
{
    GenObject *tmp = m_obj;

    if (m_next) {
	ObjList *n = m_next;
	m_next = n->next();
	m_obj = n->get();
	m_delete = n->m_delete;
	n->m_obj = 0;
	n->m_next = 0;
	n->destruct();
    }
    else
	m_obj = 0;

    if (delobj && tmp) {
	XDebug(DebugInfo,"ObjList::remove() deleting %p",tmp);
	// Don't use TelEngine::destruct(): the compiler will call the non-template
	// function (which doesn't reset the pointer)
	tmp->destruct();
	tmp = 0;
    }
    return tmp;
}
开发者ID:chrizzoy,项目名称:yate,代码行数:25,代码来源:ObjList.cpp

示例6: update_position

ObjList LifeForm::perceive(double rad){
    
    if (rad>100) rad=100;
    if (rad<2) rad=2;
//    int i=0;
//    assert(i==1);
//    
    update_position();
    
    
    SmartPointer<LifeForm> self = SmartPointer<LifeForm>(this);
//    cout<<this->species_name();
//    cout<<"in perceive"<<endl;
    std::vector<SmartPointer<LifeForm>> vector =  space.nearby(this->position(), rad);
    auto b = vector.begin();
    auto e = vector.end();
    ObjList info;// = vector
    while (b!=e) {
        auto in = this->info_about_them(*b);
        info.push_back(in);
        b++;
    }
    
    //energy cost
    energy-=perceive_cost(rad);
    if (energy<min_energy) {
        self->die();
    }
    return info;
};
开发者ID:zhengpenghu,项目名称:EPL-program,代码行数:30,代码来源:LifeForm.cpp

示例7: clear

void ListIterator::assign(HashList& list, int offset)
{
    clear();
    m_hashList = &list;
    m_length = list.count();
    if (!m_length)
	return;
    m_objects = new GenObject* [m_length];
    m_hashes = new unsigned int[m_length];
    offset = (m_length - offset) % m_length;
    unsigned int i = 0;
    for (unsigned int n = 0; n < list.length(); n++) {
	ObjList* l = list.getList(n);
	if (!l)
	    continue;
	for (l = l->skipNull(); i < m_length; l = l->skipNext()) {
	    if (!l)
		break;
	    unsigned int idx = ((i++) + offset) % m_length;
	    m_objects[idx] = l->get();
	    m_hashes[idx] = l->get()->toString().hash();
	}
    }
    while (i < m_length)
	m_objects[((i++) + offset) % m_length] = 0;
}
开发者ID:0x7678,项目名称:evilbts,代码行数:26,代码来源:Iterator.cpp

示例8: DDebug

void RTPGroup::run()
{
    DDebug(DebugInfo,"RTPGroup::run() [%p]",this);
    bool ok = true;
    while (ok) {
	unsigned long msec = m_sleep;
	if (msec < s_sleep)
	    msec = s_sleep;
	lock();
	Time t;
	ObjList* l = &m_processors;
	m_listChanged = false;
	for (ok = false;l;l = l->next()) {
	    RTPProcessor* p = static_cast<RTPProcessor*>(l->get());
	    if (p) {
		ok = true;
		p->timerTick(t);
		// the list is protected from other threads but can be changed
		//  from this one so if it happened we just break out and try
		//  again later rather than using an expensive ListIterator
		if (m_listChanged)
		    break;
	    }
	}
	unlock();
	Thread::msleep(msec,true);
    }
    DDebug(DebugInfo,"RTPGroup::run() ran out of processors [%p]",this);
}
开发者ID:andreikabeliy,项目名称:yate,代码行数:29,代码来源:transport.cpp

示例9: dump

String ExpEvaluator::dump() const
{
    String res;
    for (ObjList* l = m_opcodes.skipNull(); l; l = l->skipNext()) {
        const ExpOperation* o = static_cast<const ExpOperation*>(l->get());
        const char* oper = getOperator(o->opcode());
        if (oper) {
            res << " " << oper;
            continue;
        }
        switch (o->opcode()) {
        case OpcPush:
            if (o->number())
                res << " " << (int)o->number();
            else
                res << " '" << *o << "'";
            break;
        case OpcField:
            res << " " << o->name();
            break;
        case OpcFunc:
            res << " " << o->name() << "(" << (int)o->number() << ")";
            break;
        default:
            res << " [" << o->opcode() << "]";
        }
    }
    return res;
}
开发者ID:wdaniels,项目名称:yate,代码行数:29,代码来源:Evaluator.cpp

示例10:

double byf69::average_bearing(ObjList nearby) {
    double sum = 0;
    for (ObjList::iterator i = nearby.begin(); i != nearby.end(); i++) {
        sum += i->bearing;
    }
    return sum / nearby.size();
}
开发者ID:bennycooly,项目名称:school-projects,代码行数:7,代码来源:byf69.cpp

示例11: DDebug

// Update members with data taken from a SDP, return true if something changed
bool SDPMedia::update(const char* formats, int rport, int lport, bool force)
{
    DDebug(DebugAll,"SDPMedia::update('%s',%d,%d,%s) [%p]",
	formats,rport,lport,String::boolText(force),this);
    bool chg = false;
    String tmp(formats);
    if (tmp && (m_formats != tmp)) {
	if (tmp.find(',') < 0) {
	    // single format received, check if acceptable
	    if (m_formats && !force && m_formats.find(tmp) < 0) {
		Debug(DebugNote,"Not changing to '%s' from '%s' [%p]",
		    formats,m_formats.c_str(),this);
		tmp.clear();
	    }
	}
	else if (m_formats && !force) {
	    // from received list keep only already offered formats
	    ObjList* l1 = tmp.split(',',false);
	    ObjList* l2 = m_formats.split(',',false);
	    for (ObjList* fmt = l1->skipNull(); fmt; ) {
		if (l2->find(fmt->get()->toString()))
		    fmt = fmt->skipNext();
		else {
		    fmt->remove();
		    fmt = fmt->skipNull();
		}
	    }
	    tmp.clear();
	    tmp.append(l1,",");
	    TelEngine::destruct(l1);
	    TelEngine::destruct(l2);
	    if (tmp.null())
		Debug(DebugNote,"Not changing formats '%s' [%p]",m_formats.c_str(),this);
	}
	if (tmp && (m_formats != tmp)) {
	    chg = true;
	    m_formats = tmp;
	    int q = m_formats.find(',');
	    m_format = m_formats.substr(0,q);
	    Debug(DebugInfo,"Choosing offered '%s' format '%s' [%p]",
		c_str(),m_format.c_str(),this);
	}
    }
    if (rport >= 0) {
	tmp = rport;
	if (m_rPort != tmp) {
	    chg = true;
	    m_rPort = tmp;
	}
    }
    if (lport >= 0) {
	tmp = lport;
	if (m_lPort != tmp) {
	    m_localChanged = true;
	    chg = true;
	    m_lPort = tmp;
	}
    }
    return chg;
}
开发者ID:CimpianAlin,项目名称:yate,代码行数:61,代码来源:media.cpp

示例12: timerTick

void Socket::timerTick(const Time& when)
{
    for (ObjList* l = &m_filters; l; l = l->next()) {
	SocketFilter* filter = static_cast<SocketFilter*>(l->get());
	if (filter)
	    filter->timerTick(when);
    }
}
开发者ID:tws67,项目名称:yate-in-vs2008,代码行数:8,代码来源:Socket.cpp

示例13: popOpcode

ExpOperation* ExpEvaluator::popOpcode()
{
    ObjList* l = &m_opcodes;
    for (ObjList* p = l; p; p = p->next()) {
	if (p->get())
	    l = p;
    }
    return static_cast<ExpOperation*>(l->remove(false));
}
开发者ID:guyt101z,项目名称:yate,代码行数:9,代码来源:evaluator.cpp

示例14: popOne

ExpOperation* ExpEvaluator::popOne(ObjList& stack)
{
    GenObject* o = 0;
    for (ObjList* l = stack.skipNull(); l; l=l->skipNext())
        o = l->get();
    stack.remove(o,false);
    DDebug(DebugInfo,"Popped: %p",o);
    return static_cast<ExpOperation*>(o);
}
开发者ID:wdaniels,项目名称:yate,代码行数:9,代码来源:Evaluator.cpp

示例15: String

NamedList::NamedList(const NamedList& original)
    : String(original)
{
    ObjList* dest = &m_params;
    for (const ObjList* l = original.m_params.skipNull(); l; l = l->skipNext()) {
	const NamedString* p = static_cast<const NamedString*>(l->get());
	dest = dest->append(new NamedString(p->name(),*p));
    }
}
开发者ID:0x7678,项目名称:evilbts,代码行数:9,代码来源:NamedList.cpp


注:本文中的ObjList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。