-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
29 lines (20 loc) · 956 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "src/old_library/OldDummyCrawler.h"
#include "src/NewToOldAdapter.h"
#include "src/ScraperExample.h"
#include <memory>
int main(int argc, char **argv)
{
/// simulate scraper using old crawlers
ScraperExample scraper_1;
scraper_1.registerCrawler(std::make_shared<OldDummyCrawler>(), "some-website-1.com");
scraper_1.registerCrawler(std::make_shared<OldDummyCrawler>(), "some-website-2.com");
scraper_1.registerCrawler(std::make_shared<OldDummyCrawler>(), "some-website-3.com");
scraper_1.run();
/// simulate scraper using new crawlers (using Adapter)
ScraperExample scraper_2;
scraper_2.registerCrawler(std::make_shared<NewToOldAdapter>(), "some-website-1.com");
scraper_2.registerCrawler(std::make_shared<NewToOldAdapter>(), "some-website-2.com");
scraper_2.registerCrawler(std::make_shared<NewToOldAdapter>(), "some-website-3.com");
scraper_2.run();
return 0;
}