示例#1
0
文件: Events.C 项目: FeCastle/arum
//
// returns true if parseEvent successfully completed an event and if the
// new node could be created; otherwise returns false
//
bool
Events::addNode(Arch & a)
{
    bool rv;

    EventNode * add = new EventNode;
    if (add == NULL) { // no memory
        rv = false;
    } else {
        add->setCount = 0;
        rv = a.parseEvent(add);
        if (rv != true) {
           //printf ("EVENTS:addNode: call to parseEvent returned false!!\n");
           delete add;
        }
        if (rv == true) {
           add->next = NULL;
           add->index = this->count;
           this->count++;
           if (this->head == NULL) {
               this->head = add;
           } else {
               this->tail->next = add;
           }
           this->tail = add;
        }
    }
    return rv;
}