Forwards CompositionObj::getEventForwards(Component child, std::string name)
{
    if (children.find(name) == children.end()) {
        if (this->getName() != "root-knot") {
            std::cerr << "This is really bad !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! could not find child " << name << std::endl;
            assert(false);
        }
        return Forwards();
    }
    if (children[name].lock() != child) {
        if (!child->isFullfilling(children[name].lock()->getName())) {
            throw std::invalid_argument("Cannot get argument forwards, the child " + children[name].lock()->getName() + " does not equal the given child " + child->getName() + " for role " + name);
        }
    }

    /*
    std::cout << "Forwards for " << this->getName() << " and child " << child->getName() << std::endl;
    for (auto e : event_forwards[child]) {
        std::cout << "-\t" << e.first << " to " << e.second << std::endl;
    }
    if (!hasChild(child)) {
        std::cout << "THIS IS BADDDDDDDDDDDDDDDDDDDDDDDD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
    } else {
        std::cout << "THIS IS GOOOOOOOOOOOOOOOOODDDDDDDDD" << std::endl;
    }
    */

    return event_forwards[name];
}
예제 #2
0
//Description: Picks up code on PORTD and executes the function corresponding to the code
//Return:		error code of 0 for no error
int TreadAxisDecode()
{
	unsigned char cmd = 0;
	cmd = PIND;
	if(FORWARD == (cmd & TREAD_MASK))
		Forwards();
	else if(BACKWARD == (cmd & TREAD_MASK))
		Backwards();
	else if(LEFT == (cmd & TREAD_MASK))
		Left();
	else if(RIGHT == (cmd & TREAD_MASK))
		Right();
	else if(HALT == (cmd & TREAD_MASK))
		Hold();
	else
		Hold();
	return 0;
}