Created
March 22, 2017 14:24
-
-
Save DineshDevaraj/d30b4c15a2b746f90d832aed51148211 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Date : 22 Mar 2017 - Wed */ | |
struct ContentViewer_t; | |
struct ContentEngine_t; | |
struct RenderingEngine_t; | |
struct Callable_t | |
{ | |
virtual void callback() = 0; | |
}; | |
struct ContentEngine_t : Callable_t | |
{ | |
Callable_t *cview, *reng; | |
/* function to talk to content | |
engine from rendering engine */ | |
void callback() { /* do something */ } | |
void SetContentViewer(Callable_t *ptr) { cview=ptr; } | |
void SetRenderingEngine(Callable_t *ptr) { reng=ptr; } | |
void SaySomething() { /* do something */ } | |
void TalkWithCView() { cview->callback(); } | |
void TalkWithREng() { reng->callback(); } | |
}; | |
struct RenderingEngine_t : Callable_t | |
{ | |
Callable_t *cview, *ceng; | |
/* Function to talk to redering | |
engine from content engine */ | |
void callback() { /* do something */ } | |
void SetContentEngine(Callable_t *ptr) { ceng=ptr; } | |
void SetContentViewer(Callable_t *ptr) { cview=ptr; } | |
void SaySomething() { /* do something */ } | |
void TalkWithCView() { cview->callback(); } | |
void TalkWithCEng() { ceng->callback(); } | |
}; | |
struct ContentViewer_t : Callable_t | |
{ | |
ContentEngine_t ceng; | |
RenderingEngine_t reng; | |
void callback() { /* do something */ } | |
ContentViewer_t() | |
{ | |
reng.SetContentViewer(this); | |
reng.SetContentEngine(&ceng); | |
ceng.SetContentViewer(this); | |
ceng.SetRenderingEngine(&reng); | |
} | |
void TalkWithOthers() | |
{ | |
ceng.SaySomething(); | |
reng.SaySomething(); | |
} | |
}; | |
int main() | |
{ | |
ContentViewer_t cview; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment