OverlayAccess Class Reference

Gives access to the overlay. More...

#include <OverlayAccess.h>

List of all members.

Public Member Functions

BaseOverlayget (cModule *refMod)

Detailed Description

Gives access to the overlay.

Definition at line 36 of file OverlayAccess.h.


Member Function Documentation

BaseOverlay* OverlayAccess::get ( cModule *  refMod  )  [inline]

Definition at line 41 of file OverlayAccess.h.

00042     {
00043         // obtains the overlay related to the module, taking in account the index in case of SMOHs
00044         BaseOverlay *overlay = NULL;
00045         cModule *tmpMod = refMod;
00046         cModule *tmpParent = NULL; // parent of tmpMod
00047 
00048         // go up from refMod until we get a NotificationBoard module, then we're at root
00049         // this will fail if the overlay is not in a container module!
00050         while (true) {
00051             tmpParent = tmpMod->getParentModule(); // get parent
00052             // search for a "notificationBoard" module
00053             cModule *notBoard = tmpParent->getSubmodule("notificationBoard"); 
00054             // is this a real NotificationBoard? then we're at root
00055             if (dynamic_cast<NotificationBoard*>(notBoard) != NULL) break; 
00056             tmpMod = tmpParent; // else keep going up
00057             if (!tmpParent) throw cRuntimeError("OverlayAccess::get(): Overlay module not found!");
00058         }
00059         // get the overlay container, with the proper index
00060         cModule *overlayContainer = tmpParent->getSubmodule("overlay", tmpMod->getIndex()); 
00061         overlay = dynamic_cast<BaseOverlay*>
00062                 (overlayContainer->gate("appIn")->getNextGate()->getOwnerModule()); // get the contained overlay module
00063         
00064         if (!overlay) throw cRuntimeError("OverlayAccess::get(): Overlay module not found!");
00065         
00066         return overlay;
00067     }


The documentation for this class was generated from the following file:
Generated on Wed May 26 16:21:18 2010 for OverSim by  doxygen 1.6.3