Skip to content

Commit

Permalink
Added a CellML, SED-ML and COMBINE file type interface (#1371).
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Jul 15, 2017
1 parent 222d989 commit 3786cbd
Show file tree
Hide file tree
Showing 15 changed files with 430 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/plugins/support/COMBINESupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ADD_PLUGIN(COMBINESupport
src/combinearchive.cpp
src/combinearchiveissue.cpp
src/combinefilemanager.cpp
src/combineinterface.cpp
src/combinesupportplugin.cpp
HEADERS_MOC
src/combinearchive.h
Expand Down
64 changes: 64 additions & 0 deletions src/plugins/support/COMBINESupport/src/combineinterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// COMBINE interface
//==============================================================================

#include "combineinterface.h"
#include "corecliutils.h"

//==============================================================================

namespace OpenCOR {
namespace COMBINESupport {

//==============================================================================

CombineInterfaceData::CombineInterfaceData(FileTypeInterface *pFileTypeInterface) :
mFileTypeInterface(pFileTypeInterface)
{
}

//==============================================================================

FileTypeInterface * CombineInterfaceData::fileTypeInterface() const
{
// Return our file type interface

return mFileTypeInterface;
}

//==============================================================================

FileTypeInterface * fileTypeInterface()
{
// Return our file type interface

return static_cast<CombineInterfaceData *>(Core::globalInstance(CombineInterfaceDataSignature))->fileTypeInterface();
}

//==============================================================================

} // namespace COMBINESupport
} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
64 changes: 64 additions & 0 deletions src/plugins/support/COMBINESupport/src/combineinterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// COMBINE interface
//==============================================================================

#pragma once

//==============================================================================

#include "filetypeinterface.h"
#include "combinesupportglobal.h"

//==============================================================================

namespace OpenCOR {
namespace COMBINESupport {

//==============================================================================

static const auto CombineInterfaceDataSignature = QStringLiteral("OpenCOR::COMBINESupport::CombineInterfaceData");

//==============================================================================

class CombineInterfaceData
{
public:
explicit CombineInterfaceData(FileTypeInterface *pFileTypeInterface);

FileTypeInterface * fileTypeInterface() const;

private:
FileTypeInterface *mFileTypeInterface;
};

//==============================================================================

FileTypeInterface COMBINESUPPORT_EXPORT * fileTypeInterface();

//==============================================================================

} // namespace COMBINESupport
} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
13 changes: 13 additions & 0 deletions src/plugins/support/COMBINESupport/src/combinesupportplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//==============================================================================

#include "combinefilemanager.h"
#include "combineinterface.h"
#include "combinesupportplugin.h"
#include "corecliutils.h"

//==============================================================================

Expand All @@ -43,6 +45,17 @@ PLUGININFO_FUNC COMBINESupportPluginInfo()
descriptions);
}

//==============================================================================

COMBINESupportPlugin::COMBINESupportPlugin()
{
// Keep track of our file type interface

static CombineInterfaceData data(qobject_cast<FileTypeInterface *>(this));

Core::globalInstance(CombineInterfaceDataSignature, &data);
}

//==============================================================================
// File interface
//==============================================================================
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/support/COMBINESupport/src/combinesupportplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class COMBINESupportPlugin : public QObject, public FileTypeInterface,
Q_INTERFACES(OpenCOR::PluginInterface)

public:
explicit COMBINESupportPlugin();

#include "filetypeinterface.inl"
#include "i18ninterface.inl"
#include "plugininterface.inl"
Expand Down
1 change: 1 addition & 0 deletions src/plugins/support/CellMLSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ADD_PLUGIN(CellMLSupport
src/cellmlfilerdftriple.cpp
src/cellmlfilerdftripleelement.cpp
src/cellmlfileruntime.cpp
src/cellmlinterface.cpp
src/cellmlsupportplugin.cpp
HEADERS_MOC
../../solverinterface.h
Expand Down
64 changes: 64 additions & 0 deletions src/plugins/support/CellMLSupport/src/cellmlinterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// CellML interface
//==============================================================================

#include "cellmlinterface.h"
#include "corecliutils.h"

//==============================================================================

namespace OpenCOR {
namespace CellMLSupport {

//==============================================================================

CellmlInterfaceData::CellmlInterfaceData(FileTypeInterface *pFileTypeInterface) :
mFileTypeInterface(pFileTypeInterface)
{
}

//==============================================================================

FileTypeInterface * CellmlInterfaceData::fileTypeInterface() const
{
// Return our file type interface

return mFileTypeInterface;
}

//==============================================================================

FileTypeInterface * fileTypeInterface()
{
// Return our file type interface

return static_cast<CellmlInterfaceData *>(Core::globalInstance(CellmlInterfaceDataSignature))->fileTypeInterface();
}

//==============================================================================

} // namespace CellMLSupport
} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
64 changes: 64 additions & 0 deletions src/plugins/support/CellMLSupport/src/cellmlinterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// CellML interface
//==============================================================================

#pragma once

//==============================================================================

#include "filetypeinterface.h"
#include "cellmlsupportglobal.h"

//==============================================================================

namespace OpenCOR {
namespace CellMLSupport {

//==============================================================================

static const auto CellmlInterfaceDataSignature = QStringLiteral("OpenCOR::CellMLSupport::CellmlInterfaceData");

//==============================================================================

class CellmlInterfaceData
{
public:
explicit CellmlInterfaceData(FileTypeInterface *pFileTypeInterface);

FileTypeInterface * fileTypeInterface() const;

private:
FileTypeInterface *mFileTypeInterface;
};

//==============================================================================

FileTypeInterface CELLMLSUPPORT_EXPORT * fileTypeInterface();

//==============================================================================

} // namespace CellMLSupport
} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
12 changes: 12 additions & 0 deletions src/plugins/support/CellMLSupport/src/cellmlsupportplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//==============================================================================

#include "cellmlfilemanager.h"
#include "cellmlinterface.h"
#include "cellmlsupportplugin.h"
#include "corecliutils.h"
#include "coreguiutils.h"
Expand Down Expand Up @@ -51,6 +52,17 @@ PLUGININFO_FUNC CellMLSupportPluginInfo()
descriptions);
}

//==============================================================================

CellMLSupportPlugin::CellMLSupportPlugin()
{
// Keep track of our file type interface

static CellmlInterfaceData data(qobject_cast<FileTypeInterface *>(this));

Core::globalInstance(CellmlInterfaceDataSignature, &data);
}

//==============================================================================
// File interface
//==============================================================================
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/support/CellMLSupport/src/cellmlsupportplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class CellMLSupportPlugin : public QObject, public FileTypeInterface,
Q_INTERFACES(OpenCOR::PluginInterface)

public:
explicit CellMLSupportPlugin();

#include "filetypeinterface.inl"
#include "guiinterface.inl"
#include "i18ninterface.inl"
Expand Down
1 change: 1 addition & 0 deletions src/plugins/support/SEDMLSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ADD_PLUGIN(SEDMLSupport
src/sedmlfile.cpp
src/sedmlfileissue.cpp
src/sedmlfilemanager.cpp
src/sedmlinterface.cpp
src/sedmlsupportplugin.cpp
HEADERS_MOC
src/sedmlfile.h
Expand Down
Loading

0 comments on commit 3786cbd

Please sign in to comment.