void playMovie() { dvd->on(); projector->on(); amplifier->on(); dvd->play(); }
void listenToRadio(double frequency) { std::cout << "Tuning in the airwaves..." << std::endl; _tuner->on(); _tuner->setFrequency(frequency); _amp->on(); _amp->setVolume(5); _amp->setTuner(_tuner); }
void listenToCd(std::string cdTitle) { std::cout << "Get ready for an audiopile experence..." << std::endl; _lights->on(); _amp->on(); _amp->setVolume(5); _amp->setCd(_cd); _amp->setStereoSound(); _cd->on(); _cd->play(cdTitle); }
void listenToRadio( double frequency ) { HUM_TRACE(ACE_TEXT("HomeTheaterFacade::listenToRadio")); std::cout << "Tuning in the airwaves..." << std::endl; _tuner->on(); _tuner->setFrequency( frequency ); _amp->on(); _amp->setVolume( 5 ); _amp->setTuner( _tuner ); }
void listenToCd( std::string cdTitle ) { HUM_TRACE(ACE_TEXT("HomeTheaterFacade::listenToCd")); std::cout << "Get ready for an audiopile experence..." << std::endl; _lights->on(); _amp->on(); _amp->setVolume( 5 ); _amp->setCd( _cd ); _amp->setStereoSound(); _cd->on(); _cd->play( cdTitle ); }
void watchMovie(std::string movie) { std::cout << "Get ready to watch a movie..." << std::endl; _popper->on(); _popper->pop(); _lights->dim(10); _screen->down(); _projector->on(); _projector->wideScreenMode(); _amp->on(); _amp->setDvd(_dvd); _amp->setSurroundSound(); _amp->setVolume(5); _dvd->on(); _dvd->play(movie); }
void watchMovie( std::string movie ) { HUM_TRACE(ACE_TEXT("HomeTheaterFacade::watchMovie")); std::cout << "Get ready to watch a movie..." << std::endl; _popper->on(); _popper->pop(); _lights->dim( 10 ); _screen->down(); _projector->on(); _projector->wideScreenMode(); _amp->on(); _amp->setDvd( _dvd ); _amp->setSurroundSound(); _amp->setVolume( 5 ); _dvd->on(); _dvd->play( movie ); }
int main() { DVD dvd; Amplifier amplifier; Projector projector; // non-facade method // play movie cout<<"################# Non-facade Pattern ####################"<<endl; dvd.on(); projector.on(); amplifier.on(); dvd.play(); // using facade pattern cout<<"################# Facade Pattern ####################"<<endl; FacadeThreater ft(&dvd, &lifier, &projector); ft.playMovie(); return 0; }