Skip to content

Commit

Permalink
Refs #4399. Tidy up namespace name and have better file name
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Mar 1, 2012
1 parent 64b99a4 commit ec4dd34
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ namespace Mantid
{
namespace PythonInterface
{
/**
* The PyEnvironment namespace defines functions that query some aspect
* of the currently running Python environment
*/
namespace PyEnvironment
namespace Environment
{
/// Is the given function name in the call stack
DLLExport bool isInCallStack(const char * name, _frame* startFrame = NULL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Mantid
{
namespace PythonInterface
{
namespace WrapperHelpers
namespace Environment
{
/**
This namespace contains helper functions for classes that are overridden in Python
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "MantidAPI/FrameworkManager.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/IAlgorithm.h"
#include "MantidPythonInterface/kernel/Environment/PyEnvironment.h"
#include "MantidPythonInterface/kernel/Environment/CallStack.h"

#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
Expand Down Expand Up @@ -33,7 +33,7 @@ namespace
UNUSED_ARG(self);
IAlgorithm_sptr alg;
int async(0);
if( Mantid::PythonInterface::PyEnvironment::isInCallStack("PyExec") )
if( Mantid::PythonInterface::Environment::isInCallStack("PyExec") )
{
alg = AlgorithmManager::Instance().createUnmanaged(name, version);
alg->initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Mantid
{
static const char * method = "name";
std::string name;
if( WrapperHelpers::typeHasAttribute(*this, method) )
if( Environment::typeHasAttribute(*this, method) )
{
name = call<std::string>(get_override(method).ptr()); // Avoid a warning with just calling return fn() which docs say you can do.
}
Expand Down Expand Up @@ -49,7 +49,7 @@ namespace Mantid
{
static const char * method = "version";
int version(1);
if( WrapperHelpers::typeHasAttribute(*this, method) )
if( Environment::typeHasAttribute(*this, method) )
{
version = call<int>(get_override(method).ptr()); // Avoid a warning with just calling return fn() which docs say you can do.
}
Expand All @@ -73,9 +73,9 @@ namespace Mantid
{
static const char * method = "category";
std::string cat("PythonAlgorithms");
if ( WrapperHelpers::typeHasAttribute(*this, method) )
if ( Environment::typeHasAttribute(*this, method) )
{
cat = boost::python::call<std::string>(this->get_override(method).ptr());
cat = call<std::string>(this->get_override(method).ptr());
}
return cat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set ( SRC_FILES
src/Registry/SequenceTypeHandler.cpp
src/Registry/TypeRegistry.cpp
src/Registry/UpcastRegistry.cpp
src/Environment/PyEnvironment.cpp
src/Environment/CallStack.cpp
src/Environment/WrapperHelpers.cpp
)

Expand All @@ -62,7 +62,7 @@ set ( INC_FILES
${HEADER_DIR}/kernel/Registry/UpcastRegistry.h
${HEADER_DIR}/kernel/PythonObjectInstantiator.h
${HEADER_DIR}/kernel/PropertyWithValue.h
${HEADER_DIR}/kernel/Environment/PyEnvironment.h
${HEADER_DIR}/kernel/Environment/CallStack.h
${HEADER_DIR}/kernel/StlExportDefinitions.h
${HEADER_DIR}/kernel/Environment/WrapperHelpers.h
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include "MantidPythonInterface/kernel/Environment/PyEnvironment.h"
#include "MantidPythonInterface/kernel/Environment/CallStack.h"

#include <boost/python/detail/wrap_python.hpp>
#include <frameobject.h>
Expand All @@ -11,13 +11,13 @@ namespace Mantid
{
namespace PythonInterface
{
namespace PyEnvironment
namespace Environment
{
/**
* Is the given function name in the call stack
* @param name :: The name of the function call to search for
* @param startFrame :: An optional frame to start from, if NULL then the current frame is
* retrieved from the interpeter
* retrieved from the interpreter
* @return True if the function name is found in the stack, false otherwise
*/
bool isInCallStack(const char * name, PyFrameObject* startFrame)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Mantid
{
namespace PythonInterface
{
namespace WrapperHelpers
namespace Environment
{
/** Checks whether the given object's type dictionary contains the named attribute.
*
Expand Down

0 comments on commit ec4dd34

Please sign in to comment.