Commit 1a37f02a authored by Robert McGibbon's avatar Robert McGibbon
Browse files

Change function name

parent 6cd01b2c
......@@ -174,7 +174,7 @@ public:
/**
* Get any failures caused during the last call to loadPluginsFromDirectory
*/
static std::vector<std::string> getLoadFailures();
static std::vector<std::string> getPluginLoadFailures();
/**
* Get the registered Platform with a particular name. If no Platform with that name has been
* registered, this throws an exception.
......@@ -205,7 +205,7 @@ public:
* Load multiple dynamic libraries (DLLs) which contain OpenMM plugins from a single directory.
* This method loops over every file contained in the specified directory and calls loadPluginLibrary()
* for each one. If an error occurs while trying to load a particular file, that file is simply
* ignored.
* ignored. You can retrieve a list of all such errors by calling getPluginLoadFailures().
*
* @param directory the path to the directory containing libraries to load
* @return the names of all files which were successfully loaded as libraries
......@@ -237,7 +237,7 @@ private:
std::map<std::string, KernelFactory*> kernelFactories;
std::map<std::string, std::string> defaultProperties;
static std::vector<Platform*>& getPlatforms();
static std::vector<std::string> loadFailures;
static std::vector<std::string> pluginLoadFailures;
};
......
......@@ -45,19 +45,13 @@
#include <cstdlib>
#endif
#include <set>
#include <algorithm>
#include "ReferencePlatform.h"
using namespace OpenMM;
using namespace std;
std::vector<std::string> Platform::loadFailures;
static bool stringLengthComparator(string i, string j) {
return (i.size() < j.size());
}
std::vector<std::string> Platform::pluginLoadFailures;
static int registerPlatforms() {
......@@ -148,8 +142,8 @@ Platform& Platform::getPlatform(int index) {
throw OpenMMException("Invalid platform index");
}
std::vector<std::string> Platform::getLoadFailures() {
return loadFailures;
std::vector<std::string> Platform::getPluginLoadFailures() {
return pluginLoadFailures;
}
Platform& Platform::getPlatformByName(const string& name) {
......@@ -274,15 +268,14 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) {
vector<void*> plugins;
#endif
vector<string> loadedLibraries;
std::sort (files.begin(), files.end(), stringLengthComparator);
loadFailures.resize(0);
pluginLoadFailures.resize(0);
for (unsigned int i = 0; i < files.size(); ++i) {
try {
plugins.push_back(loadOneLibrary(directory+dirSeparator+files[i]));
loadedLibraries.push_back(files[i]);
} catch (OpenMMException& ex) {
loadFailures.push_back(ex.what());
pluginLoadFailures.push_back(ex.what());
}
}
initializePlugins(plugins);
......
......@@ -68,7 +68,7 @@ class WrapperGenerator:
def __init__(self, inputDirname, output):
self.skipClasses = ['OpenMM::Vec3', 'OpenMM::XmlSerializer', 'OpenMM::Kernel', 'OpenMM::KernelImpl', 'OpenMM::KernelFactory', 'OpenMM::ContextImpl', 'OpenMM::SerializationNode', 'OpenMM::SerializationProxy']
self.skipMethods = ['OpenMM::Context::getState', 'OpenMM::Platform::loadPluginsFromDirectory', 'OpenMM::Platform::getLoadFailures', 'OpenMM::Context::createCheckpoint', 'OpenMM::Context::loadCheckpoint', 'OpenMM::Context::getMolecules']
self.skipMethods = ['OpenMM::Context::getState', 'OpenMM::Platform::loadPluginsFromDirectory', 'OpenMM::Platform::getPluginLoadFailures', 'OpenMM::Context::createCheckpoint', 'OpenMM::Context::loadCheckpoint', 'OpenMM::Context::getMolecules']
self.hideClasses = ['Kernel', 'KernelImpl', 'KernelFactory', 'ContextImpl', 'SerializationNode', 'SerializationProxy']
self.nodeByID={}
......@@ -398,7 +398,7 @@ extern OPENMM_EXPORT void %(name)s_insert(%(name)s* set, %(type)s value);""" % v
Unlike the C++ versions, the return value is allocated on the heap, and you must delete it yourself. */
extern OPENMM_EXPORT OpenMM_State* OpenMM_Context_getState(const OpenMM_Context* target, int types, int enforcePeriodicBox);
extern OPENMM_EXPORT OpenMM_StringArray* OpenMM_Platform_loadPluginsFromDirectory(const char* directory);
extern OPENMM_EXPORT OpenMM_StringArray* OpenMM_Platform_getLoadFailures();
extern OPENMM_EXPORT OpenMM_StringArray* OpenMM_Platform_getPluginLoadFailures();
extern OPENMM_EXPORT char* OpenMM_XmlSerializer_serializeSystem(const OpenMM_System* system);
extern OPENMM_EXPORT char* OpenMM_XmlSerializer_serializeState(const OpenMM_State* state);
extern OPENMM_EXPORT char* OpenMM_XmlSerializer_serializeIntegrator(const OpenMM_Integrator* integrator);
......@@ -805,8 +805,8 @@ OPENMM_EXPORT OpenMM_StringArray* OpenMM_Platform_loadPluginsFromDirectory(const
vector<string> result = Platform::loadPluginsFromDirectory(string(directory));
return reinterpret_cast<OpenMM_StringArray*>(new vector<string>(result));
}
OPENMM_EXPORT OpenMM_StringArray* OpenMM_Platform_getLoadFailures() {
vector<string> result = Platform::getLoadFailures();
OPENMM_EXPORT OpenMM_StringArray* OpenMM_Platform_getPluginLoadFailures() {
vector<string> result = Platform::getPluginLoadFailures();
return reinterpret_cast<OpenMM_StringArray*>(new vector<string>(result));
}
static char* createStringFromStream(stringstream& stream) {
......@@ -1319,7 +1319,7 @@ MODULE OpenMM
character(*) directory
type(OpenMM_StringArray) result
end subroutine
subroutine OpenMM_Platform_getLoadFailures(result)
subroutine OpenMM_Platform_getPluginLoadFailures(result)
use OpenMM_Types; implicit none
type(OpenMM_StringArray) result
end subroutine
......@@ -1997,11 +1997,11 @@ OPENMM_EXPORT void openmm_platform_loadpluginsfromdirectory_(const char* directo
OPENMM_EXPORT void OPENMM_PLATFORM_LOADPLUGINSFROMDIRECTORY(const char* directory, OpenMM_StringArray*& result, int length) {
result = OpenMM_Platform_loadPluginsFromDirectory(makeString(directory, length).c_str());
}
OPENMM_EXPORT void openmm_platform_getloadfailures_(OpenMM_StringArray*& result) {
result = OpenMM_Platform_getLoadFailures();
OPENMM_EXPORT void openmm_platform_getpluginloadfailures_(OpenMM_StringArray*& result) {
result = OpenMM_Platform_getPluginLoadFailures();
}
OPENMM_EXPORT void OPENMM_PLATFORM_GETLOADFAILURES(OpenMM_StringArray*& result) {
result = OpenMM_Platform_getLoadFailures();
OPENMM_EXPORT void OPENMM_PLATFORM_GETPLUGINLOADFAILURES(OpenMM_StringArray*& result) {
result = OpenMM_Platform_getPluginLoadFailures();
}
OPENMM_EXPORT void openmm_xmlserializer_serializesystemtoc_(OpenMM_System*& system, char*& result, int& result_length) {
convertStringToChars(OpenMM_XmlSerializer_serializeSystem(system), result, result_length);
......
......@@ -180,7 +180,7 @@ UNITS = {
("*", "getParticleMass") : ("unit.amu", ()),
("*", "getPlatform") : (None, ()),
("*", "getPlatformByName") : (None, ()),
("*", "getLoadFailures"): (None, ()),
("*", "getPluginLoadFailures"): (None, ()),
("*", "getRandomNumberSeed") : (None, ()),
("*", "getReactionFieldDielectric") : (None, ()),
("*", "getSoluteDielectric") : (None, ()),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment