Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
b9077fbd
Commit
b9077fbd
authored
14 years ago
by
Peterson, Peter
Browse files
Options
Downloads
Patches
Plain Diff
Fixing eol property. Refs #1256.
parent
a95ff951
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/Mantid/PythonAPI/inc/MantidPythonAPI/SimplePythonAPI.h
+116
-116
116 additions, 116 deletions
Code/Mantid/PythonAPI/inc/MantidPythonAPI/SimplePythonAPI.h
with
116 additions
and
116 deletions
Code/Mantid/PythonAPI/inc/MantidPythonAPI/SimplePythonAPI.h
+
116
−
116
View file @
b9077fbd
#ifndef MANTID_PYTHONAPI_SIMPLEPYTHONAPI
#define MANTID_PYTHONAPI_SIMPLEPYTHONAPI
//------------------------------------------
// Includes
//------------------------------------------
#include
<map>
#include
"MantidKernel/System.h"
#include
"MantidKernel/Property.h"
namespace
Mantid
{
namespace
PythonAPI
{
/** @class SimplePythonAPI SimplePythonAPI.h PythonAPI/SimplePythonAPI.h
SimplePythonAPI is a static class designed to write out a Python module containing
function definitions for all loaded algorithms. A particular function, when called, will
create an instance of the named Algorithm.
@author Martyn Gigg, Tessella Support Services plc
@date 13/10/2008
Copyright © 2008 STFC Rutherford Appleton Laboratories
This file is part of Mantid.
Mantid 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.
Mantid 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/>.
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class
DLLExport
SimplePythonAPI
{
public:
/// Typedef a vector of strings
typedef
std
::
vector
<
std
::
string
>
StringVector
;
/// Typedef a vector of Property pointers
typedef
std
::
vector
<
Mantid
::
Kernel
::
Property
*>
PropertyVector
;
/// Typedef a map of a string to a integer for versioning
typedef
std
::
map
<
std
::
string
,
int
>
VersionMap
;
/// Typedef a vector of a pair of strings for help commands
typedef
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>
>
IndexVector
;
/// Public methods
/// Create the simple API module
static
void
createModule
(
bool
gui
);
/// Create and return the full-qualified path name for the module
static
std
::
string
getModuleFilename
();
private:
///private constructor
SimplePythonAPI
();
// Private methods
/// Creates a map between algorithms and versions
static
void
createVersionMap
(
VersionMap
&
versionMap
,
const
StringVector
&
algorithmKeys
);
/// Gets the algorithm name from a fully qualified name
static
std
::
string
extractAlgName
(
const
std
::
string
&
algKey
);
/// Writes the Python function definition for the given algorithm
static
void
writeFunctionDef
(
std
::
ostream
&
module
,
const
std
::
string
&
algName
,
const
PropertyVector
&
properties
,
bool
async
);
/// Writes the GUI version of the Python function definition for the given algorithm
static
void
writeGUIFunctionDef
(
std
::
ostream
&
module
,
const
std
::
string
&
algName
,
const
PropertyVector
&
properties
);
/// Writes the global help command
static
void
writeGlobalHelp
(
std
::
ostream
&
output
,
const
VersionMap
&
versionMap
,
bool
gui
);
/// Creates a help string for the given algorithm
static
std
::
string
createHelpString
(
const
std
::
string
&
algm
,
const
PropertyVector
&
properties
,
bool
dialog
);
/// Writes the given help strings to the Python module
static
void
writeFunctionHelp
(
std
::
ostream
&
output
,
const
IndexVector
&
helpStrings
,
const
std
::
map
<
std
::
string
,
std
::
set
<
std
::
string
>
>&
categories
);
/// Write string to run algorithm asynchronously
static
void
writeAsyncFunctionCall
(
std
::
ostream
&
output
,
const
std
::
string
&
alg_name
,
const
std
::
string
&
prefix
=
""
);
/// Convert EOL characters to their string representation
static
std
::
string
convertEOLToString
(
const
std
::
string
&
value
);
/// Removes all non-alphanumeric characters (those not [0-9, a-z, A-Z])
static
std
::
string
removeCharacters
(
const
std
::
string
&
value
,
const
std
::
string
&
cs
=
""
,
bool
eol_to_space
=
false
);
/// A split function that mimics Python's split function
static
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
str
,
const
std
::
string
&
delim
=
" "
);
///Functor for use with std::sort to put the properties that do not
///have valid values first
struct
PropertyOrdering
{
///Comparator operator for sort algorithm, places optional properties lower in the list
bool
operator
()(
const
Mantid
::
Kernel
::
Property
*
p1
,
const
Mantid
::
Kernel
::
Property
*
p2
)
const
{
//this is false, unless p1 is not valid and p2 is valid
return
(
p1
->
isValid
()
!=
""
)
&&
(
p2
->
isValid
()
==
""
);
}
};
/// The full name of the module file
static
std
::
string
g_module_name
;
};
}
}
#endif //MANTID_PYTHONAPI_SIMPLEPYTHONAPI
#ifndef MANTID_PYTHONAPI_SIMPLEPYTHONAPI
#define MANTID_PYTHONAPI_SIMPLEPYTHONAPI
//------------------------------------------
// Includes
//------------------------------------------
#include
<map>
#include
"MantidKernel/System.h"
#include
"MantidKernel/Property.h"
namespace
Mantid
{
namespace
PythonAPI
{
/** @class SimplePythonAPI SimplePythonAPI.h PythonAPI/SimplePythonAPI.h
SimplePythonAPI is a static class designed to write out a Python module containing
function definitions for all loaded algorithms. A particular function, when called, will
create an instance of the named Algorithm.
@author Martyn Gigg, Tessella Support Services plc
@date 13/10/2008
Copyright © 2008 STFC Rutherford Appleton Laboratories
This file is part of Mantid.
Mantid 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.
Mantid 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/>.
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class
DLLExport
SimplePythonAPI
{
public:
/// Typedef a vector of strings
typedef
std
::
vector
<
std
::
string
>
StringVector
;
/// Typedef a vector of Property pointers
typedef
std
::
vector
<
Mantid
::
Kernel
::
Property
*>
PropertyVector
;
/// Typedef a map of a string to a integer for versioning
typedef
std
::
map
<
std
::
string
,
int
>
VersionMap
;
/// Typedef a vector of a pair of strings for help commands
typedef
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>
>
IndexVector
;
/// Public methods
/// Create the simple API module
static
void
createModule
(
bool
gui
);
/// Create and return the full-qualified path name for the module
static
std
::
string
getModuleFilename
();
private:
///private constructor
SimplePythonAPI
();
// Private methods
/// Creates a map between algorithms and versions
static
void
createVersionMap
(
VersionMap
&
versionMap
,
const
StringVector
&
algorithmKeys
);
/// Gets the algorithm name from a fully qualified name
static
std
::
string
extractAlgName
(
const
std
::
string
&
algKey
);
/// Writes the Python function definition for the given algorithm
static
void
writeFunctionDef
(
std
::
ostream
&
module
,
const
std
::
string
&
algName
,
const
PropertyVector
&
properties
,
bool
async
);
/// Writes the GUI version of the Python function definition for the given algorithm
static
void
writeGUIFunctionDef
(
std
::
ostream
&
module
,
const
std
::
string
&
algName
,
const
PropertyVector
&
properties
);
/// Writes the global help command
static
void
writeGlobalHelp
(
std
::
ostream
&
output
,
const
VersionMap
&
versionMap
,
bool
gui
);
/// Creates a help string for the given algorithm
static
std
::
string
createHelpString
(
const
std
::
string
&
algm
,
const
PropertyVector
&
properties
,
bool
dialog
);
/// Writes the given help strings to the Python module
static
void
writeFunctionHelp
(
std
::
ostream
&
output
,
const
IndexVector
&
helpStrings
,
const
std
::
map
<
std
::
string
,
std
::
set
<
std
::
string
>
>&
categories
);
/// Write string to run algorithm asynchronously
static
void
writeAsyncFunctionCall
(
std
::
ostream
&
output
,
const
std
::
string
&
alg_name
,
const
std
::
string
&
prefix
=
""
);
/// Convert EOL characters to their string representation
static
std
::
string
convertEOLToString
(
const
std
::
string
&
value
);
/// Removes all non-alphanumeric characters (those not [0-9, a-z, A-Z])
static
std
::
string
removeCharacters
(
const
std
::
string
&
value
,
const
std
::
string
&
cs
=
""
,
bool
eol_to_space
=
false
);
/// A split function that mimics Python's split function
static
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
str
,
const
std
::
string
&
delim
=
" "
);
///Functor for use with std::sort to put the properties that do not
///have valid values first
struct
PropertyOrdering
{
///Comparator operator for sort algorithm, places optional properties lower in the list
bool
operator
()(
const
Mantid
::
Kernel
::
Property
*
p1
,
const
Mantid
::
Kernel
::
Property
*
p2
)
const
{
//this is false, unless p1 is not valid and p2 is valid
return
(
p1
->
isValid
()
!=
""
)
&&
(
p2
->
isValid
()
==
""
);
}
};
/// The full name of the module file
static
std
::
string
g_module_name
;
};
}
}
#endif //MANTID_PYTHONAPI_SIMPLEPYTHONAPI
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment