Commit bf2a390b authored by Peter Eastman's avatar Peter Eastman
Browse files

Minor API changes

parent de099a02
......@@ -120,7 +120,7 @@ public:
* @return true if this Platform provides implementations of all the kernels in the list,
* false if there are any which it does not support
*/
bool supportsKernels(std::vector<std::string> kernelNames) const ;
bool supportsKernels(const std::vector<std::string>& kernelNames) const ;
/**
* Create a Kernel object. If you call this method multiple times for different contexts with the same name,
* the returned Kernels are independent and do not interact with each other. This means
......@@ -167,7 +167,7 @@ public:
* @return the fastest registered Platform which supports all of the requested kernels. If no
* Platform exists which supports all of them, this will throw an exception.
*/
static Platform& findPlatform(std::vector<std::string> kernelNames);
static Platform& findPlatform(const std::vector<std::string>& kernelNames);
/**
* Load a dynamic library (DLL) which contains an OpenMM plugin. Typically, each Platform
* is distributed as a separate dynamic library. This method can then be called at runtime
......@@ -198,7 +198,7 @@ public:
*
* @return the path to the default plugin directory
*/
static std::string getDefaultPluginsDirectory();
static const std::string& getDefaultPluginsDirectory();
private:
// Retarded visual studio compiler complains about being unable to
......
......@@ -88,7 +88,7 @@ void Platform::registerStreamFactory(string name, StreamFactory* factory) {
streamFactories[name] = factory;
}
bool Platform::supportsKernels(vector<string> kernelNames) const {
bool Platform::supportsKernels(const vector<string>& kernelNames) const {
for (int i = 0; i < (int) kernelNames.size(); ++i)
if (kernelFactories.find(kernelNames[i]) == kernelFactories.end())
return false;
......@@ -124,7 +124,7 @@ Platform& Platform::getPlatform(int index) {
return *getPlatforms()[index];
}
Platform& Platform::findPlatform(vector<string> kernelNames) {
Platform& Platform::findPlatform(const vector<string>& kernelNames) {
Platform* best = 0;
vector<Platform*>& platforms = getPlatforms();
double speed = 0.0;
......@@ -197,7 +197,7 @@ vector<string> Platform::loadPluginsFromDirectory(string directory) {
return loadedLibraries;
}
string Platform::getDefaultPluginsDirectory() {
const string& Platform::getDefaultPluginsDirectory() {
char* dir = getenv("OPENMM_PLUGIN_DIR");
#ifdef _MSC_VER
if (dir != NULL)
......@@ -207,8 +207,10 @@ string Platform::getDefaultPluginsDirectory() {
return "C:\\\\Program Files\\OpenMM\\lib\\plugins";
return string(dir)+"\\OpenMM\\lib\\plugins";
#else
static string directory;
if (dir == NULL)
return "/usr/local/openmm/lib/plugins";
return string(dir);
directory = "/usr/local/openmm/lib/plugins";
directory = string(dir);
return directory;
#endif
}
......@@ -48,14 +48,16 @@ public:
* This is the name of the parameter which stores the current temperature of the
* heat bath (in Kelvin).
*/
static std::string Temperature() {
return "AndersenTemperature";
static const std::string& Temperature() {
static const std::string key = "AndersenTemperature";
return key;
}
/**
* This is the name of the parameter which store the current collision frequency (in 1/ps).
*/
static std::string CollisionFrequency() {
return "AndersenCollisionFrequency";
static const std::string& CollisionFrequency() {
static const std::string key = "AndersenCollisionFrequency";
return key;
}
/**
* Create an AndersenThermostat.
......
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