43 |
|
#define TYPES_DATAHOLDER_HPP |
44 |
|
|
45 |
|
#include <iostream> |
46 |
– |
|
46 |
|
#include <string> |
47 |
+ |
#include <sstream> |
48 |
|
#include <map> |
49 |
|
#include <set> |
50 |
|
#include "math/Vector3.hpp" |
51 |
|
#include "utils/ParameterManager.hpp" |
52 |
|
#include "io/ParamConstraint.hpp" |
53 |
|
#include "utils/simError.h" |
54 |
+ |
#include "utils/OOPSEException.hpp" |
55 |
+ |
#include "utils/StringUtils.hpp" |
56 |
|
namespace oopse { |
57 |
|
|
58 |
|
class DataHolder { |
66 |
|
if (i != parameters_.end()) { |
67 |
|
bool result = i->second->setData(val); |
68 |
|
if (!result ) { |
69 |
< |
std::cout << "Error in parsing " << keyword << ": expect " << i->second->getParamType() <<"\n"; |
69 |
> |
std::stringstream ss; |
70 |
> |
ss << "Error in parsing " << keyword << ": expect " << i->second->getParamType() <<"\n"; |
71 |
> |
throw OOPSEException(ss.str()); |
72 |
|
} |
73 |
|
}else if (deprecatedKeywords_.find(keyword) != deprecatedKeywords_.end()){ |
74 |
|
std::cout << keyword << " is deprecated\n"; |
75 |
|
}else { |
76 |
< |
std::cout << keyword << " can not be recognized\n"; |
76 |
> |
std::stringstream ss; |
77 |
> |
ss << keyword << " can not be recognized\n"; |
78 |
> |
throw OOPSEException(ss.str()); |
79 |
|
} |
80 |
|
} |
81 |
|
|
83 |
|
ParamMap::iterator i; |
84 |
|
for (i = parameters_.begin(); i != parameters_.end(); ++i) { |
85 |
|
if (!i->second->isOptional() && i->second->empty()) { |
86 |
< |
std::cout << i->second->getKeyword() << " must be set\n"; |
86 |
> |
std::stringstream ss; |
87 |
> |
ss << i->second->getKeyword() << " must be set\n"; |
88 |
> |
throw OOPSEException(ss.str()); |
89 |
|
} |
90 |
|
} |
91 |
|
} |