mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Hadrons: module template update
This commit is contained in:
parent
b25a59e95e
commit
325c73d051
@ -1,39 +0,0 @@
|
||||
#include <Grid/Hadrons/Modules/___FILEBASENAME___.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
/******************************************************************************
|
||||
* T___FILEBASENAME___ implementation *
|
||||
******************************************************************************/
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
T___FILEBASENAME___::T___FILEBASENAME___(const std::string name)
|
||||
: Module<___FILEBASENAME___Par>(name)
|
||||
{}
|
||||
|
||||
// dependencies/products ///////////////////////////////////////////////////////
|
||||
std::vector<std::string> T___FILEBASENAME___::getInput(void)
|
||||
{
|
||||
std::vector<std::string> in;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
std::vector<std::string> T___FILEBASENAME___::getOutput(void)
|
||||
{
|
||||
std::vector<std::string> out = {getName()};
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
// setup ///////////////////////////////////////////////////////////////////////
|
||||
void T___FILEBASENAME___::setup(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
void T___FILEBASENAME___::execute(void)
|
||||
{
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
#ifndef Hadrons____FILEBASENAME____hpp_
|
||||
#define Hadrons____FILEBASENAME____hpp_
|
||||
|
||||
#include <Grid/Hadrons/Global.hpp>
|
||||
#include <Grid/Hadrons/Module.hpp>
|
||||
#include <Grid/Hadrons/ModuleFactory.hpp>
|
||||
|
||||
BEGIN_HADRONS_NAMESPACE
|
||||
|
||||
/******************************************************************************
|
||||
* ___FILEBASENAME___ *
|
||||
******************************************************************************/
|
||||
class ___FILEBASENAME___Par: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(___FILEBASENAME___Par,
|
||||
unsigned int, i);
|
||||
};
|
||||
|
||||
class T___FILEBASENAME___: public Module<___FILEBASENAME___Par>
|
||||
{
|
||||
public:
|
||||
// constructor
|
||||
T___FILEBASENAME___(const std::string name);
|
||||
// destructor
|
||||
virtual ~T___FILEBASENAME___(void) = default;
|
||||
// dependency relation
|
||||
virtual std::vector<std::string> getInput(void);
|
||||
virtual std::vector<std::string> getOutput(void);
|
||||
// setup
|
||||
virtual void setup(void);
|
||||
// execution
|
||||
virtual void execute(void);
|
||||
};
|
||||
|
||||
MODULE_REGISTER(___FILEBASENAME___, T___FILEBASENAME___);
|
||||
|
||||
END_HADRONS_NAMESPACE
|
||||
|
||||
#endif // Hadrons____FILEBASENAME____hpp_
|
@ -25,7 +25,7 @@ public:
|
||||
// constructor
|
||||
T___FILEBASENAME___(const std::string name);
|
||||
// destructor
|
||||
virtual ~T___FILEBASENAME___(void) = default;
|
||||
virtual ~T___FILEBASENAME___(void) {};
|
||||
// dependency relation
|
||||
virtual std::vector<std::string> getInput(void);
|
||||
virtual std::vector<std::string> getOutput(void);
|
||||
|
@ -1,81 +0,0 @@
|
||||
#ifndef Hadrons____FILEBASENAME____hpp_
|
||||
#define Hadrons____FILEBASENAME____hpp_
|
||||
|
||||
#include <Grid/Hadrons/Global.hpp>
|
||||
#include <Grid/Hadrons/Module.hpp>
|
||||
#include <Grid/Hadrons/ModuleFactory.hpp>
|
||||
|
||||
BEGIN_HADRONS_NAMESPACE
|
||||
|
||||
/******************************************************************************
|
||||
* ___FILEBASENAME___ *
|
||||
******************************************************************************/
|
||||
class ___FILEBASENAME___Par: Serializable
|
||||
{
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(___FILEBASENAME___Par,
|
||||
unsigned int, i);
|
||||
};
|
||||
|
||||
template <typename FImpl>
|
||||
class T___FILEBASENAME___: public Module<___FILEBASENAME___Par>
|
||||
{
|
||||
public:
|
||||
// constructor
|
||||
T___FILEBASENAME___(const std::string name);
|
||||
// destructor
|
||||
virtual ~T___FILEBASENAME___(void) = default;
|
||||
// dependency relation
|
||||
virtual std::vector<std::string> getInput(void);
|
||||
virtual std::vector<std::string> getOutput(void);
|
||||
// setup
|
||||
virtual void setup(void);
|
||||
// execution
|
||||
virtual void execute(void);
|
||||
};
|
||||
|
||||
MODULE_REGISTER(___FILEBASENAME___, T___FILEBASENAME___<FIMPL>);
|
||||
|
||||
/******************************************************************************
|
||||
* T___FILEBASENAME___ implementation *
|
||||
******************************************************************************/
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
template <typename FImpl>
|
||||
T___FILEBASENAME___<FImpl>::T___FILEBASENAME___(const std::string name)
|
||||
: Module<___FILEBASENAME___Par>(name)
|
||||
{}
|
||||
|
||||
// dependencies/products ///////////////////////////////////////////////////////
|
||||
template <typename FImpl>
|
||||
std::vector<std::string> T___FILEBASENAME___<FImpl>::getInput(void)
|
||||
{
|
||||
std::vector<std::string> in;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
template <typename FImpl>
|
||||
std::vector<std::string> T___FILEBASENAME___<FImpl>::getOutput(void)
|
||||
{
|
||||
std::vector<std::string> out = {getName()};
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
// setup ///////////////////////////////////////////////////////////////////////
|
||||
template <typename FImpl>
|
||||
void T___FILEBASENAME___<FImpl>::setup(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
template <typename FImpl>
|
||||
void T___FILEBASENAME___<FImpl>::execute(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
END_HADRONS_NAMESPACE
|
||||
|
||||
#endif // Hadrons____FILEBASENAME____hpp_
|
@ -0,0 +1,7 @@
|
||||
#include <Grid/Hadrons/Modules/___NAMESPACE___/___FILEBASENAME___.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
using namespace ___NAMESPACE___;
|
||||
|
||||
template class Grid::Hadrons::___NAMESPACE___::T___FILEBASENAME___<FIMPL>;
|
@ -26,7 +26,7 @@ public:
|
||||
// constructor
|
||||
T___FILEBASENAME___(const std::string name);
|
||||
// destructor
|
||||
virtual ~T___FILEBASENAME___(void) = default;
|
||||
virtual ~T___FILEBASENAME___(void) {};
|
||||
// dependency relation
|
||||
virtual std::vector<std::string> getInput(void);
|
||||
virtual std::vector<std::string> getOutput(void);
|
||||
|
@ -1,31 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if (( $# != 1 && $# != 2)); then
|
||||
echo "usage: `basename $0` <module name> [<namespace>]" 1>&2
|
||||
if (( $# != 2 )); then
|
||||
echo "usage: `basename $0` <module name> <namespace>" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
NAME=$1
|
||||
NS=$2
|
||||
|
||||
if (( $# == 1 )); then
|
||||
if [ -e "Modules/${NAME}.cc" ] || [ -e "Modules/${NAME}.hpp" ]; then
|
||||
echo "error: files Modules/${NAME}.* already exists" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module.cc.template > Modules/${NAME}.cc
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module.hpp.template > Modules/${NAME}.hpp
|
||||
elif (( $# == 2 )); then
|
||||
mkdir -p Modules/${NS}
|
||||
if [ -e "Modules/${NS}/${NAME}.cc" ] || [ -e "Modules/${NS}/${NAME}.hpp" ]; then
|
||||
echo "error: files Modules/${NS}/${NAME}.* already exists" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
TMPCC=".${NS}.${NAME}.tmp.cc"
|
||||
TMPHPP=".${NS}.${NAME}.tmp.hpp"
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_in_NS.cc.template > ${TMPCC}
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_in_NS.hpp.template > ${TMPHPP}
|
||||
sed "s/___NAMESPACE___/${NS}/g" ${TMPCC} > Modules/${NS}/${NAME}.cc
|
||||
sed "s/___NAMESPACE___/${NS}/g" ${TMPHPP} > Modules/${NS}/${NAME}.hpp
|
||||
rm -f ${TMPCC} ${TMPHPP}
|
||||
mkdir -p Modules/${NS}
|
||||
if [ -e "Modules/${NS}/${NAME}.cc" ] || [ -e "Modules/${NS}/${NAME}.hpp" ]; then
|
||||
echo "error: files Modules/${NS}/${NAME}.* already exists" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
TMPCC=".${NS}.${NAME}.tmp.cc"
|
||||
TMPHPP=".${NS}.${NAME}.tmp.hpp"
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_in_NS.cc.template > ${TMPCC}
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_in_NS.hpp.template > ${TMPHPP}
|
||||
sed "s/___NAMESPACE___/${NS}/g" ${TMPCC} > Modules/${NS}/${NAME}.cc
|
||||
sed "s/___NAMESPACE___/${NS}/g" ${TMPHPP} > Modules/${NS}/${NAME}.hpp
|
||||
rm -f ${TMPCC} ${TMPHPP}
|
||||
./make_module_list.sh
|
||||
|
@ -1,28 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if (( $# != 1 && $# != 2)); then
|
||||
echo "usage: `basename $0` <module name> [<namespace>]" 1>&2
|
||||
if (( $# != 2)); then
|
||||
echo "usage: `basename $0` <module name> <namespace>" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
NAME=$1
|
||||
NS=$2
|
||||
|
||||
if (( $# == 1 )); then
|
||||
if [ -e "Modules/${NAME}.cc" ] || [ -e "Modules/${NAME}.hpp" ]; then
|
||||
echo "error: files Modules/${NAME}.* already exists" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_tmp.hpp.template > Modules/${NAME}.hpp
|
||||
elif (( $# == 2 )); then
|
||||
mkdir -p Modules/${NS}
|
||||
if [ -e "Modules/${NS}/${NAME}.cc" ] || [ -e "Modules/${NS}/${NAME}.hpp" ]; then
|
||||
echo "error: files Modules/${NS}/${NAME}.* already exists" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
TMPCC=".${NS}.${NAME}.tmp.cc"
|
||||
TMPHPP=".${NS}.${NAME}.tmp.hpp"
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_tmp_in_NS.hpp.template > ${TMPHPP}
|
||||
sed "s/___NAMESPACE___/${NS}/g" ${TMPHPP} > Modules/${NS}/${NAME}.hpp
|
||||
rm -f ${TMPCC} ${TMPHPP}
|
||||
mkdir -p Modules/${NS}
|
||||
if [ -e "Modules/${NS}/${NAME}.cc" ] || [ -e "Modules/${NS}/${NAME}.hpp" ]; then
|
||||
echo "error: files Modules/${NS}/${NAME}.* already exists" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
TMPCC=".${NS}.${NAME}.tmp.cc"
|
||||
TMPHPP=".${NS}.${NAME}.tmp.hpp"
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_tmp_in_NS.cc.template > ${TMPCC}
|
||||
sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_tmp_in_NS.hpp.template > ${TMPHPP}
|
||||
sed "s/___NAMESPACE___/${NS}/g" ${TMPCC} > Modules/${NS}/${NAME}.cc
|
||||
sed "s/___NAMESPACE___/${NS}/g" ${TMPHPP} > Modules/${NS}/${NAME}.hpp
|
||||
rm -f ${TMPCC} ${TMPHPP}
|
||||
./make_module_list.sh
|
||||
|
Loading…
Reference in New Issue
Block a user