C++ mpi module for stochmagnet_main Package
MPI_ClassFactory.h
1 #ifndef MPI_ClassFactory_H
2 #define MPI_ClassFactory_H
3 
4 //include the base class of the package
5 #include "CORE_ClassFactory.h"
6 
7 
8 #include "MPI_CoreToCoreWMessage.h"
9 #include "MPI_CoreToCoreIMessage.h"
10 //#include "MPI_CoreToCoreBMessage.h"
11 //#include "MPI_CoreToCoreSMessage.h"
12 
18 class MPI_ClassFactory : public CORE_ClassFactory { // class
19 
20 
21  // ASSOCIATION
22 
23 
24 
25  // ATTRIBUTES
26 
27 private:
28 
29 
30  // ASSOCIATIONS
31 
32 
33 
34  // METHODS
35 
36 
37 public:
38  // CONSTRUCTORS
42 
43 
44 
45 
46  // DESTRUCTORS
50  virtual ~MPI_ClassFactory(void);
51 
52 
53 
54 
55 
56 public:
57 
58 
59  //MEMORY
60 
74  virtual tMemSize getMemorySize() const override {
75  return sizeof(*this)+getContentsMemorySize();
76  }
77 
78 
79  // SET
80 
81 
82 
83 
84 
85 public:
86 
87  //New class Factory
91  inline static CORE_UniquePointer<MPI_ClassFactory> New() {
92  return CORE_UniquePointer<MPI_ClassFactory>(new MPI_ClassFactory(),MPI_ClassFactory::Delete());
93  }
94 
95  // OTHERS
96 
97 
104  virtual CORE_UniquePointer<CORE_Object> NewInstance(const tString& name,
105  const CORE_OptionsList& arguments) const override;
106 
107 
108 
113  template<typename T>
114  inline static CORE_UniquePointer<MPI_CoreToCoreMessage<T>> NewMessage(const tChar& type) {
115  switch(type) {
116  case 'W':
118  case 'I':
120  }
122  }
123 
124 
125 
126 
127 
128 };
129 
130 #endif
this class describes a class factory to generate classes
Definition: CORE_ClassFactory.h:24
virtual tMemSize getContentsMemorySize() const override
return the memory size in byte
Definition: CORE_ClassFactory.h:84
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class is an list of options.
Definition: CORE_OptionsList.h:36
this class describes a class factory to generate classes of the package
Definition: MPI_ClassFactory.h:18
virtual ~MPI_ClassFactory(void)
destroy a MPI_ClassFactory
Definition: MPI_ClassFactory.cpp:10
MPI_ClassFactory()
build a MPI_ClassFactory
Definition: MPI_ClassFactory.cpp:6
static CORE_UniquePointer< MPI_CoreToCoreMessage< T > > NewMessage(const tChar &type)
create a core to core message
Definition: MPI_ClassFactory.h:114
virtual tMemSize getMemorySize() const override
return the memory size of the class and the memory size of all its attributes/associations
Definition: MPI_ClassFactory.h:74
static CORE_UniquePointer< MPI_ClassFactory > New()
build a new instance of default class factory
Definition: MPI_ClassFactory.h:91
virtual CORE_UniquePointer< CORE_Object > NewInstance(const tString &name, const CORE_OptionsList &arguments) const override
create an unique instance of a class
Definition: MPI_ClassFactory.cpp:14
static CORE_UniquePointer< SelfClass > New()
create an unique instance of the class This
Definition: MPI_CoreToCoreIMessage.h:62
static CORE_UniquePointer< SelfClass > New()
create an unique instance of the class This
Definition: MPI_CoreToCoreWMessage.h:49