38 #include <boost/core/ignore_unused.hpp>
53 "Remove one of the existing fields");
58 ConfigOption(
false,
"NotSet",
"Name for field to be removed, required");
67 boost::ignore_unused(vm);
70 string fieldNames =
m_config[
"fieldname"].as<
string>();
71 vector<string> fieldName;
72 ASSERTL0(fieldNames !=
"NotSet",
"A fieldname is required");
75 "Failed to interpret fields string");
79 for (
int i = 0; i < fieldName.size(); ++i)
84 ASSERTL0(it !=
m_f->m_variables.end(),
"Field does not exist");
86 int fieldID = std::distance(
m_f->m_variables.begin(), it);
88 m_f->m_variables.erase(it);
89 m_f->m_exp.erase(
m_f->m_exp.begin() + fieldID);
91 if (
m_f->m_comm->TreatAsRankZero())
93 cout <<
"Field " << fieldName[i] <<
" has been erased" << endl;
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
Abstract base class for processing modules.
virtual void Process(po::variables_map &vm)
virtual ~ProcessRemoveField()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
The above copyright notice and this permission notice shall be included.
Represents a command-line configuration option.