#ifndef CONTEXT_H #define CONTEXT_H /////////////////////////////////////////////////////////////////////// // Context.h - Strategy Example Code - Sorting // // Ver: 1.1 // // Language: Visual C++ 2010 // // Platform: Dell Dimension T7400, Win 7, Pro // // Author: Jim Fawcett, CSE776 - Design Patterns, Fall 2011 // // Source: Lei Zhang, lzhang17@syr.edu // // from internet - no longer have url // /////////////////////////////////////////////////////////////////////// #include #include "SortStrategy.h" #include #include #include class Context { public: Context(SortStrategy* pSS) { _pSS = pSS; srand( static_cast(time(0))); } void setSortS(SortStrategy* pSS) { _pSS = pSS; } void recordGenerator(size_t count); void doSorting() { _pSS->sorting(num); } void display(); protected: std::vector num; SortStrategy* _pSS; }; #endif