ARC SDK
Generator.h
1 #ifndef GENERATOR_H_
2 #define GENERATOR_H_
3 
4 #include <arc/Thread.h>
5 #include <arc/Logger.h>
6 
7 #include <arc/data-staging/Scheduler.h>
8 
9 
10 // This Generator basic implementation shows how a Generator can
11 // be written. It has one method, run(), which creates a single DTR
12 // and submits it to the Scheduler.
14 
15  private:
16 
17  // Condition to wait on until DTR has finished
18  static Arc::SimpleCondition cond;
19 
20  // DTR Scheduler
21  DataStaging::Scheduler scheduler;
22 
23  // Logger object
24  static Arc::Logger logger;
25  // Root LogDestinations to be used in receiveDTR
26  std::list<Arc::LogDestination*> root_destinations;
27 
28  public:
29 
30  // Counter for main to know how many DTRs are in the system
31  Arc::SimpleCounter counter;
32 
33  // Create a new Generator. start() must be called to start DTR threads.
34  Generator();
35  // Stop Generator and DTR threads
36  ~Generator();
37 
38  // Implementation of callback from DTRCallback - the callback method used
39  // when DTR processing is complete to pass the DTR back to the generator.
40  // It decrements counter.
41  virtual void receiveDTR(DataStaging::DTR_ptr dtr);
42 
43  // Start Generator and DTR threads
44  void start();
45 
46  // Submit a DTR with given source and destination. Increments counter.
47  void run(const std::string& source, const std::string& destination);
48 };
49 
50 #endif /* GENERATOR_H_ */