OMCompiler/SimulationRuntime/cpp/Core/DataExchange/FactoryExport.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file belongs to the OpenModelica Run-Time System | ||
| 3 | * | ||
| 4 | * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC), c/o Linköpings | ||
| 5 | * universitet, Department of Computer and Information Science, SE-58183 Linköping, Sweden. All rights | ||
| 6 | * reserved. | ||
| 7 | * | ||
| 8 | * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE | ||
| 9 | * AGPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8. ANY | ||
| 10 | * USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S | ||
| 11 | * ACCEPTANCE OF THE BSD NEW LICENSE OR THE OSMC PUBLIC LICENSE OR THE AGPL | ||
| 12 | * VERSION 3, ACCORDING TO RECIPIENTS CHOICE. | ||
| 13 | * | ||
| 14 | * The OpenModelica software and the OSMC (Open Source Modelica Consortium) Public License | ||
| 15 | * (OSMC-PL) are obtained from OSMC, either from the above address, from the URLs: | ||
| 16 | * http://www.openmodelica.org or https://github.com/OpenModelica/ or | ||
| 17 | * http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica distribution. GNU | ||
| 18 | * AGPL version 3 is obtained from: https://www.gnu.org/licenses/licenses.html#GPL. The BSD NEW | ||
| 19 | * License is obtained from: http://www.opensource.org/licenses/BSD-3-Clause. | ||
| 20 | * | ||
| 21 | * This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY | ||
| 23 | * SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF | ||
| 24 | * OSMC-PL. | ||
| 25 | * | ||
| 26 | */ | ||
| 27 | |||
| 28 | #include <Core/ModelicaDefine.h> | ||
| 29 | #include <Core/Modelica.h> | ||
| 30 | #if defined(__TRICORE__) || defined(__vxworks) | ||
| 31 | |||
| 32 | #include <Core/DataExchange/FactoryExport.h> | ||
| 33 | #include <Core/DataExchange/SimData.h> | ||
| 34 | #include <Core/DataExchange/XmlPropertyReader.h> | ||
| 35 | #include <Core/DataExchange/Writer.h> | ||
| 36 | #include <Core/DataExchange/Policies/TextfileWriter.h> | ||
| 37 | #include <Core/DataExchange/Policies/MatfileWriter.h> | ||
| 38 | #include <Core/DataExchange/Policies/BufferReaderWriter.h> | ||
| 39 | #include <Core/DataExchange/Policies/DefaultWriter.h> | ||
| 40 | #include <Core/DataExchange/HistoryImpl.h> | ||
| 41 | shared_ptr<IHistory> createMatFileWriterFactory(IGlobalSettings& globalSettings,size_t dim) | ||
| 42 | { | ||
| 43 | shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<MatFileWriter >(globalSettings,dim) ); | ||
| 44 | return writer; | ||
| 45 | } | ||
| 46 | shared_ptr<IHistory> createTextFileWriterFactory(IGlobalSettings& globalSettings,size_t dim) | ||
| 47 | { | ||
| 48 | shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<TextFileWriter >(globalSettings,dim) ); | ||
| 49 | return writer; | ||
| 50 | } | ||
| 51 | shared_ptr<IHistory> createBufferReaderWriterFactory(IGlobalSettings& globalSettings,size_t dim) | ||
| 52 | { | ||
| 53 | shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<BufferReaderWriter >(globalSettings,dim) ); | ||
| 54 | return writer; | ||
| 55 | } | ||
| 56 | shared_ptr<IHistory> createDefaultWriterFactory(IGlobalSettings& globalSettings,size_t dim) | ||
| 57 | { | ||
| 58 | shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<DefaultWriter>(globalSettings,dim) ); | ||
| 59 | return writer; | ||
| 60 | } | ||
| 61 | #elif defined(OMC_BUILD) && !defined(RUNTIME_STATIC_LINKING) | ||
| 62 | #include <Core/DataExchange/FactoryExport.h> | ||
| 63 | #include <Core/DataExchange/SimData.h> | ||
| 64 | #include <Core/DataExchange/XmlPropertyReader.h> | ||
| 65 | #include <Core/DataExchange/Writer.h> | ||
| 66 | #include <Core/DataExchange/Policies/TextfileWriter.h> | ||
| 67 | #include <Core/DataExchange/Policies/MatfileWriter.h> | ||
| 68 | #include <Core/DataExchange/Policies/BufferReaderWriter.h> | ||
| 69 | #include <Core/DataExchange/Policies/DefaultWriter.h> | ||
| 70 | #include <Core/DataExchange/HistoryImpl.h> | ||
| 71 | 80 | BOOST_EXTENSION_TYPE_MAP_FUNCTION { | |
| 72 | types.get<map<string, boost::extensions::factory<ISimData > > >() | ||
| 73 |
1/1✓ Branch 2 taken 80 times.
|
160 | ["SimData"].set<SimData>(); |
| 74 | types.get<map<string, boost::extensions::factory<IHistory,IGlobalSettings&,size_t > > >() | ||
| 75 |
1/1✓ Branch 2 taken 80 times.
|
160 | ["MatFileWriter"].set<HistoryImpl<MatFileWriter > >(); |
| 76 | types.get<map<string, boost::extensions::factory<IHistory,IGlobalSettings&,size_t > > >() | ||
| 77 |
1/1✓ Branch 2 taken 80 times.
|
160 | ["TextFileWriter"].set<HistoryImpl<TextFileWriter > >(); |
| 78 | types.get<map<string, boost::extensions::factory<IHistory,IGlobalSettings&,size_t > > >() | ||
| 79 |
1/1✓ Branch 2 taken 80 times.
|
160 | ["BufferReaderWriter"].set<HistoryImpl<BufferReaderWriter > >(); |
| 80 | types.get<map<string, boost::extensions::factory<IHistory,IGlobalSettings&,size_t > > >() | ||
| 81 |
1/1✓ Branch 2 taken 80 times.
|
80 | ["DefaultWriter"].set<HistoryImpl<DefaultWriter > >(); |
| 82 | /* used late for factory methode createXMLReader | ||
| 83 | types.get<std::map<std::string, factory<IPropertyReader,string > > >() | ||
| 84 | ["PropertyReader"].set<XmlPropertyReader>();*/ | ||
| 85 | 80 | } | |
| 86 | #elif defined(OMC_BUILD) && defined(RUNTIME_STATIC_LINKING) | ||
| 87 | #include <Core/DataExchange/FactoryExport.h> | ||
| 88 | #include <Core/DataExchange/SimData.h> | ||
| 89 | #include <Core/DataExchange/XmlPropertyReader.h> | ||
| 90 | #include <Core/DataExchange/Writer.h> | ||
| 91 | #include <Core/DataExchange/Policies/TextfileWriter.h> | ||
| 92 | #include <Core/DataExchange/Policies/MatfileWriter.h> | ||
| 93 | #include <Core/DataExchange/Policies/BufferReaderWriter.h> | ||
| 94 | #include <Core/DataExchange/Policies/DefaultWriter.h> | ||
| 95 | #include <Core/DataExchange/HistoryImpl.h> | ||
| 96 | shared_ptr<IHistory> createMatFileWriterFactory(IGlobalSettings& globalSettings,size_t dim) | ||
| 97 | { | ||
| 98 | shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<MatFileWriter >(globalSettings,dim) ); | ||
| 99 | return writer; | ||
| 100 | } | ||
| 101 | shared_ptr<IHistory> createTextFileWriterFactory(IGlobalSettings& globalSettings,size_t dim) | ||
| 102 | { | ||
| 103 | shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<TextFileWriter >(globalSettings,dim) ); | ||
| 104 | return writer; | ||
| 105 | } | ||
| 106 | shared_ptr<IHistory> createBufferReaderWriterFactory(IGlobalSettings& globalSettings,size_t dim) | ||
| 107 | { | ||
| 108 | shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<BufferReaderWriter >(globalSettings,dim) ); | ||
| 109 | return writer; | ||
| 110 | } | ||
| 111 | shared_ptr<IHistory> createDefaultWriterFactory(IGlobalSettings& globalSettings,size_t dim) | ||
| 112 | { | ||
| 113 | shared_ptr<IHistory> writer= shared_ptr<IHistory>(new HistoryImpl<DefaultWriter>(globalSettings,dim) ); | ||
| 114 | return writer; | ||
| 115 | } | ||
| 116 | |||
| 117 | #elif defined(SIMSTER_BUILD) | ||
| 118 | |||
| 119 | #include <Core/ModelicaDefine.h> | ||
| 120 | #include <Core/Modelica.h> | ||
| 121 | #include <Core/DataExchange/SimData.h> | ||
| 122 | |||
| 123 | /*Simster factory*/ | ||
| 124 | extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_dataExchange(boost::extensions::factory_map & fm) | ||
| 125 | { | ||
| 126 | fm.get<ISimData,int>()[1].set<SimData>(); | ||
| 127 | } | ||
| 128 | |||
| 129 | #else | ||
| 130 | error "operating system not supported" | ||
| 131 | #endif | ||
| 132 |