Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
source.h
Go to the documentation of this file.
1 
14 #ifndef SOURCE_INCLUDED
15 #define SOURCE_INCLUDED
16 
17 #include <valarray>
18 #include "defs.h"
19 #include "parameters.h"
20 #include "commonParameters.h"
21 #include "field.h"
22 #include "bridgeIO.h"
23 
24 #ifdef USE_FACTORY
25 #include "factory.h"
26 #endif
27 
29 
36 class Source
37 {
38  protected:
40 
41  public:
42  Source() {}
43  virtual ~Source() {}
44 
45  virtual void set_parameters(const Parameters&) = 0;
46 
48 
49  virtual void set(Field&, int) = 0;
50 
51 #ifdef USE_FACTORY
52  public:
53  typedef Source *(*ProductCreator)();
55 
56  static Source *New(const IdentifierType& subtype)
57  {
58  ProductCreator p = Factory::Find(subtype);
59 
60  return p ? (*p)() : 0;
61  }
62 #endif
63 };
64 #endif /* SOURCE_INCLUDED */