Ramy Al Zuhouri
Ramy Al Zuhouri

Reputation: 21986

How to get the module connected to a gate?

Inside a module, I can get a cGate pointer calling the method:

const cGate* cModule::gate  (   const char *    gatename, int   index = -1) 

But once obtained the cGate pointer, I don't see a way to get the associate module that is connected (in output) to the gate. I don't see it in the cChannel class either. Is there a way?

Upvotes: 0

Views: 780

Answers (1)

Rudi
Rudi

Reputation: 6681

Check the cGate::getPathStartGate() and cGate::getPathEndGate() methods. Depending on the direction of the connection those will give you the endpoint gates (it will follow the connections even across module boundaries until it finds a simple module at the other side of the connection chain). (cGate::getNextGate() and cGate::getPreviousGate() gives only the next/prev gate on the chain)

Once you have the cGate object from the other side, you can get the module using cGate::getOwnerModule()

Upvotes: 1

Related Questions