int edt = 0;
int mem = 0;
string queue = "";
+ LIBBATCH_UNUSED(nbproc);
+ LIBBATCH_UNUSED(edt);
+ LIBBATCH_UNUSED(mem);
// Mandatory parameters
if (params.find(WORKDIR) != params.end())
// TODO: replace those static declarations by an external description file (XML for instance)
#define decl_extern_Constant(constant) extern BATCH_EXPORT const std::string constant
#define def_Constant(constant) const std::string constant = #constant
+#define LIBBATCH_UNUSED(var) (void)var
namespace Batch {
using namespace std;
-ParserException::ParserException(string msg) throw()
+ParserException::ParserException(string msg) noexcept
: exception(),
_msg(msg)
{
}
-ParserException::~ParserException() throw()
+ParserException::~ParserException() noexcept
{
}
-const char * ParserException::what() const throw()
+const char * ParserException::what() const noexcept
{
return _msg.c_str();
}
-SimpleParser::SimpleParser() throw()
+SimpleParser::SimpleParser() noexcept
{
}
-SimpleParser::~SimpleParser() throw()
+SimpleParser::~SimpleParser() noexcept
{
}
-std::string SimpleParser::trim(const std::string & str) const throw()
+std::string SimpleParser::trim(const std::string & str) const noexcept
{
size_t beg = str.find_first_not_of(" \t");
if (beg == string::npos) beg = 0;
return str.substr(beg, end-beg+1);
}
-void SimpleParser::parse(const string & filename) throw(ParserException)
+void SimpleParser::parse(const string & filename)
{
ifstream fileStream(filename.c_str());
if (!fileStream) {
fileStream.close();
}
-void SimpleParser::parseTestConfigFile() throw(ParserException)
+void SimpleParser::parseTestConfigFile()
{
char * filename = getenv(TEST_CONFIG_FILE_ENV_VAR);
if (filename == NULL) {
}
}
-const string & SimpleParser::getValue(const string & key) const throw(ParserException)
+const string & SimpleParser::getValue(const string & key) const
{
map<string,string>::const_iterator iter = _configmap.find(key);
if (iter == _configmap.end()) {
}
const string & SimpleParser::getTestValue(const string & bmType, const string & protocolStr,
- const string & key) const throw(ParserException)
+ const string & key) const
{
string fullkey = string("TEST_") + bmType + "_" + protocolStr + "_" + key;
try {
return getValue(fullkey);
}
-int SimpleParser::getValueAsInt(const string & key) const throw(ParserException)
+int SimpleParser::getValueAsInt(const string & key) const
{
const string & valueStr = getValue(key);
const char * valueCStr = valueStr.c_str();
}
int SimpleParser::getTestValueAsInt(const string & bmType, const string & protocolStr,
- const string & key) const throw(ParserException)
+ const string & key) const
{
string fullkey = string("TEST_") + bmType + "_" + protocolStr + "_" + key;
try {
return getValueAsInt(fullkey);
}
-ostream & operator <<(ostream & os, const SimpleParser & parser) throw()
+ostream & operator <<(ostream & os, const SimpleParser & parser) noexcept
{
if (parser._configmap.empty()) {
os << "Empty map" << endl;
class ParserException : public std::exception
{
public:
- ParserException(std::string msg) throw();
- virtual ~ParserException() throw();
+ ParserException(std::string msg) noexcept;
+ virtual ~ParserException() noexcept;
- virtual const char *what() const throw();
+ virtual const char *what() const noexcept;
private:
std::string _msg;
class SimpleParser
{
public:
- SimpleParser() throw();
- virtual ~SimpleParser() throw();
+ SimpleParser() noexcept;
+ virtual ~SimpleParser() noexcept;
- void parse(const std::string & filename) throw(ParserException);
- void parseTestConfigFile() throw(ParserException);
- const std::string & getValue(const std::string & key) const throw(ParserException);
+ void parse(const std::string & filename);
+ void parseTestConfigFile();
+ const std::string & getValue(const std::string & key) const;
const std::string & getTestValue(const std::string & bmType, const std::string & protocolStr,
- const std::string & key) const throw(ParserException);
- int getValueAsInt(const std::string & key) const throw(ParserException);
+ const std::string & key) const;
+ int getValueAsInt(const std::string & key) const;
int getTestValueAsInt(const std::string & bmType, const std::string & protocolStr,
- const std::string & key) const throw(ParserException);
+ const std::string & key) const;
- friend std::ostream & operator <<(std::ostream & os, const SimpleParser & parser) throw();
+ friend std::ostream & operator <<(std::ostream & os, const SimpleParser & parser) noexcept;
private:
- std::string trim(const std::string & str) const throw();
+ std::string trim(const std::string & str) const noexcept;
std::map<std::string, std::string> _configmap;
};
try {
// Parse the configuration file
parser.parseTestConfigFile();
- } catch (ParserException e) {
+ } catch (const ParserException& e) {
cerr << "Parser error: " << e.what() << endl;
return 1;
}
eraseAll();
}
- Versatile & Versatile::operator = (const long l) throw(TypeMismatchException)
+ Versatile & Versatile::operator = (const long l)
{
checkType(LONG);
eraseAll();
return *this;
}
- Versatile & Versatile::operator = (const string & ch) throw(TypeMismatchException)
+ Versatile & Versatile::operator = (const string & ch)
{
checkType(STRING);
eraseAll();
return *this;
}
- Versatile & Versatile::operator +=(const string & ch) throw(TypeMismatchException,ListIsFullException)
+ Versatile & Versatile::operator +=(const string & ch)
{
checkType(STRING);
return *this;
}
- Versatile & Versatile::operator , (const string & ch) throw(TypeMismatchException,ListIsFullException)
+ Versatile & Versatile::operator , (const string & ch)
{
*this += ch;
return *this;
}
- Versatile & Versatile::operator = (const char * ch) throw(TypeMismatchException)
+ Versatile & Versatile::operator = (const char * ch)
{
return operator=(string(ch));
}
- Versatile & Versatile::operator +=(const char * ch) throw(TypeMismatchException,ListIsFullException)
+ Versatile & Versatile::operator +=(const char * ch)
{
return operator+=(string(ch));
}
- Versatile & Versatile::operator , (const char * ch) throw(TypeMismatchException,ListIsFullException)
+ Versatile & Versatile::operator , (const char * ch)
{
return operator,(string(ch));
}
- Versatile & Versatile::operator = (const Couple & cp) throw(TypeMismatchException)
+ Versatile & Versatile::operator = (const Couple & cp)
{
checkType(COUPLE);
eraseAll();
return *this;
}
- Versatile & Versatile::operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException)
+ Versatile & Versatile::operator +=(const Couple & cp)
{
checkType(COUPLE);
// If max size is reached, throw a ListIsFullException
return *this;
}
- Versatile & Versatile::operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException)
+ Versatile & Versatile::operator , (const Couple & cp)
{
*this += cp;
return *this;
return os;
}
- Versatile & Versatile::operator = (const int i) throw(TypeMismatchException)
+ Versatile & Versatile::operator = (const int i)
{
checkType(LONG);
eraseAll();
return *this;
}
- Versatile & Versatile::operator = (const bool b) throw(TypeMismatchException)
+ Versatile & Versatile::operator = (const bool b)
{
checkType(BOOL);
eraseAll();
return *this;
}
- void Versatile::checkType(DiscriminatorType t) const throw(TypeMismatchException)
+ void Versatile::checkType(DiscriminatorType t) const
{
if (_discriminator != t)
throw (TypeMismatchException("Trying to change type of Versatile object \"" + _name + "\""));
}
- Versatile::operator long() const throw(TypeMismatchException)
+ Versatile::operator long() const
{
// If the type does not correspond or if the list has more than one element,
// throw a TypeMismatchException
return *( static_cast<LongType *>(this->front()) );
}
- Versatile::operator bool() const throw(TypeMismatchException)
+ Versatile::operator bool() const
{
// If the type does not correspond or if the list has more than one element,
// throw a TypeMismatchException
return *( static_cast<BoolType *>(this->front()) );
}
- Versatile::operator int() const throw(TypeMismatchException)
+ Versatile::operator int() const
{
return operator long();
}
- Versatile::operator Couple() const throw(TypeMismatchException)
+ Versatile::operator Couple() const
{
// If the type does not correspond or if the list has more than one element,
// throw a TypeMismatchException
return *( static_cast<CoupleType *>(this->front()) );
}
- string Versatile::str() const throw(TypeMismatchException)
+ string Versatile::str() const
{
// If the type does not correspond, throw a TypeMismatchException
if ( _discriminator != STRING || size() == 0 ) {
return s;
}
- Versatile::operator string () const throw(TypeMismatchException)
+ Versatile::operator string () const
{
return str();
}
virtual ~Versatile();
// Affectation and concatenation operators from base types
- Versatile & operator = (const long l) throw(TypeMismatchException);
- Versatile & operator = (const std::string & ch) throw(TypeMismatchException);
- Versatile & operator +=(const std::string & ch) throw(TypeMismatchException,ListIsFullException);
- Versatile & operator , (const std::string & ch) throw(TypeMismatchException,ListIsFullException);
- Versatile & operator = (const char * ch) throw(TypeMismatchException);
- Versatile & operator +=(const char * ch) throw(TypeMismatchException,ListIsFullException);
- Versatile & operator , (const char * ch) throw(TypeMismatchException,ListIsFullException);
- Versatile & operator = (const Couple & cp) throw(TypeMismatchException);
- Versatile & operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException);
- Versatile & operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException);
- Versatile & operator = (const int i) throw(TypeMismatchException);
- Versatile & operator = (const bool b) throw(TypeMismatchException);
+ Versatile & operator = (const long l);
+ Versatile & operator = (const std::string & ch);
+ Versatile & operator +=(const std::string & ch);
+ Versatile & operator , (const std::string & ch);
+ Versatile & operator = (const char * ch);
+ Versatile & operator +=(const char * ch);
+ Versatile & operator , (const char * ch);
+ Versatile & operator = (const Couple & cp);
+ Versatile & operator +=(const Couple & cp);
+ Versatile & operator , (const Couple & cp);
+ Versatile & operator = (const int i);
+ Versatile & operator = (const bool b);
// Type conversion to base types
- operator long() const throw(TypeMismatchException);
- operator std::string() const throw(TypeMismatchException);
- operator Couple() const throw(TypeMismatchException);
- std::string str() const throw(TypeMismatchException);
- operator bool() const throw(TypeMismatchException);
- operator int() const throw(TypeMismatchException);
+ operator long() const;
+ operator std::string() const;
+ operator Couple() const;
+ std::string str() const;
+ operator bool() const;
+ operator int() const;
// Display on a stream
BATCH_EXPORT friend std::ostream & operator << (std::ostream & os, const Versatile & );
// Check the type
- void checkType(DiscriminatorType t) const throw (TypeMismatchException);
+ void checkType(DiscriminatorType t) const;
// Getter methods
DiscriminatorType getType() const;
mem = params[MAXRAMSIZE];
if (params.find(QUEUE) != params.end())
queue = params[QUEUE].str();
+ LIBBATCH_UNUSED(mem);
string::size_type p1 = fileToExecute.find_last_of("/");
string::size_type p2 = fileToExecute.find_last_of(".");