-
Notifications
You must be signed in to change notification settings - Fork 298
/
FactoryExport.cpp
104 lines (99 loc) · 4.58 KB
/
FactoryExport.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <Core/ModelicaDefine.h>
#include <Core/Modelica.h>
#if defined(__TRICORE__) || defined(__vxworks)
#include <Core/DataExchange/FactoryExport.h>
#include <Core/DataExchange/SimData.h>
#include <Core/DataExchange/XmlPropertyReader.h>
#include <Core/DataExchange/Writer.h>
#include <Core/DataExchange/Policies/TextfileWriter.h>
#include <Core/DataExchange/Policies/MatfileWriter.h>
#include <Core/DataExchange/Policies/BufferReaderWriter.h>
#include <Core/DataExchange/Policies/DefaultWriter.h>
#include <Core/DataExchange/HistoryImpl.h>
shared_ptr<IHistory> createMatFileWriterFactory(IGlobalSettings& globalSettings,size_t dim)
{
shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<MatFileWriter >(globalSettings,dim) );
return writer;
}
shared_ptr<IHistory> createTextFileWriterFactory(IGlobalSettings& globalSettings,size_t dim)
{
shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<TextFileWriter >(globalSettings,dim) );
return writer;
}
shared_ptr<IHistory> createBufferReaderWriterFactory(IGlobalSettings& globalSettings,size_t dim)
{
shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<BufferReaderWriter >(globalSettings,dim) );
return writer;
}
shared_ptr<IHistory> createDefaultWriterFactory(IGlobalSettings& globalSettings,size_t dim)
{
shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<DefaultWriter>(globalSettings,dim) );
return writer;
}
#elif defined(OMC_BUILD) && !defined(RUNTIME_STATIC_LINKING)
#include <Core/DataExchange/FactoryExport.h>
#include <Core/DataExchange/SimData.h>
#include <Core/DataExchange/XmlPropertyReader.h>
#include <Core/DataExchange/Writer.h>
#include <Core/DataExchange/Policies/TextfileWriter.h>
#include <Core/DataExchange/Policies/MatfileWriter.h>
#include <Core/DataExchange/Policies/BufferReaderWriter.h>
#include <Core/DataExchange/Policies/DefaultWriter.h>
#include <Core/DataExchange/HistoryImpl.h>
BOOST_EXTENSION_TYPE_MAP_FUNCTION {
types.get<map<string, boost::extensions::factory<ISimData > > >()
["SimData"].set<SimData>();
types.get<map<string, boost::extensions::factory<IHistory,IGlobalSettings&,size_t > > >()
["MatFileWriter"].set<HistoryImpl<MatFileWriter > >();
types.get<map<string, boost::extensions::factory<IHistory,IGlobalSettings&,size_t > > >()
["TextFileWriter"].set<HistoryImpl<TextFileWriter > >();
types.get<map<string, boost::extensions::factory<IHistory,IGlobalSettings&,size_t > > >()
["BufferReaderWriter"].set<HistoryImpl<BufferReaderWriter > >();
types.get<map<string, boost::extensions::factory<IHistory,IGlobalSettings&,size_t > > >()
["DefaultWriter"].set<HistoryImpl<DefaultWriter > >();
/* used late for factory methode createXMLReader
types.get<std::map<std::string, factory<IPropertyReader,string > > >()
["PropertyReader"].set<XmlPropertyReader>();*/
}
#elif defined(OMC_BUILD) && defined(RUNTIME_STATIC_LINKING)
#include <Core/DataExchange/FactoryExport.h>
#include <Core/DataExchange/SimData.h>
#include <Core/DataExchange/XmlPropertyReader.h>
#include <Core/DataExchange/Writer.h>
#include <Core/DataExchange/Policies/TextfileWriter.h>
#include <Core/DataExchange/Policies/MatfileWriter.h>
#include <Core/DataExchange/Policies/BufferReaderWriter.h>
#include <Core/DataExchange/Policies/DefaultWriter.h>
#include <Core/DataExchange/HistoryImpl.h>
shared_ptr<IHistory> createMatFileWriterFactory(IGlobalSettings& globalSettings,size_t dim)
{
shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<MatFileWriter >(globalSettings,dim) );
return writer;
}
shared_ptr<IHistory> createTextFileWriterFactory(IGlobalSettings& globalSettings,size_t dim)
{
shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<TextFileWriter >(globalSettings,dim) );
return writer;
}
shared_ptr<IHistory> createBufferReaderWriterFactory(IGlobalSettings& globalSettings,size_t dim)
{
shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<BufferReaderWriter >(globalSettings,dim) );
return writer;
}
shared_ptr<IHistory> createDefaultWriterFactory(IGlobalSettings& globalSettings,size_t dim)
{
shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<DefaultWriter>(globalSettings,dim) );
return writer;
}
#elif defined(SIMSTER_BUILD)
#include <Core/ModelicaDefine.h>
#include <Core/Modelica.h>
#include <Core/DataExchange/SimData.h>
/*Simster factory*/
extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_dataExchange(boost::extensions::factory_map & fm)
{
fm.get<ISimData,int>()[1].set<SimData>();
}
#else
error "operating system not supported"
#endif