Changeset 2958

Show
Ignore:
Timestamp:
04/27/06 18:35:57 (3 years ago)
Author:
madcat
Message:

Added findChild method, which is faster than the static findObject method.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • hydranode/hnbase/object.cpp

    r2956 r2958  
    266266} 
    267267 
     268Object* Object::findChild(ObjectId id) const { 
     269        if (m_children) { 
     270                CIter i = m_children->find(id); 
     271                if (i != m_children->end()) { 
     272                        return (*i).second; 
     273                } 
     274        } 
     275        return 0; 
     276} 
     277 
    268278// Convenience functions 
    269279void Object::onChildAdded(ObjectId) {} 
  • hydranode/hnbase/object.h

    r2956 r2958  
    217217         */ 
    218218        boost::signal<void (Object*, ObjectEvent)> objectNotify; 
     219 
     220        /** 
     221         * Searches this objects children for an object. This is faster than 
     222         * using the static findObject() method due to the smaller size of the 
     223         * map. 
     224         * 
     225         * @param id        Id to search for 
     226         * @returns         Pointer to object if found, null if not found 
     227         */ 
     228        Object* findChild(ObjectId id) const; 
    219229 
    220230        //! Static accessors for locating an object with a specific identifier