Go to the documentation of this file.
13 #include "libmesh/simple_range.h"
30 const std::string & moose_object_type,
31 bool should_auto_build)
34 for (
auto it = range.first; it != range.second; ++it)
35 if (it->second == task)
39 mooseError(
"A ", task,
" is already registered. Do you need to use appendTaskName instead?");
49 mooseError(
"A ", task,
" is not a registered task name.");
58 mooseError(
"A ", task,
" is not a registered task name.");
66 std::vector<std::string> sets, prev_names, tasks;
69 for (
unsigned int i = 0; i < sets.size(); ++i)
73 for (
unsigned int j = 0; j < tasks.size(); ++j)
76 for (
unsigned int k = 0; k < prev_names.size(); ++k)
88 mooseError(
"A ", task,
" is not a registered task name.");
99 const std::vector<std::string> &
105 const std::vector<std::vector<std::string>> &
120 mooseDeprecated(
"Syntax::isActionRequired is deprecated, use shouldAutoBuild() instead");
128 mooseAssert(map_pair !=
_registered_tasks.end(), std::string(
"Unregistered task: ") + task);
130 return map_pair->second;
135 const std::string & syntax,
136 const std::string & task,
137 const std::string & file,
141 for (
auto it = range.first; it != range.second; ++it)
142 if (it->second._action == action && it->second._task == task)
152 const std::string & syntax,
153 const std::string & task,
154 const std::string & file,
164 const std::string message =
"\"[" + syntax +
"]\" is deprecated.";
182 mooseError(
"The action syntax ", syntax,
" is not deprecated");
191 std::vector<std::string>
200 [](
const std::pair<std::string, ActionInfo> pair) {
201 return std::make_pair(pair.second._action,
202 std::make_pair(pair.first, pair.second._task));
207 std::vector<std::string> syntax;
209 for (
const auto & syntax_pair : as_range(it_pair))
211 if (task ==
"" || syntax_pair.second.second == task)
212 syntax.emplace_back(syntax_pair.second.first);
226 bool local_is_parent;
227 if (is_parent ==
nullptr)
228 is_parent = &local_is_parent;
230 std::vector<std::string> real_elements, reg_elements;
231 std::string return_value;
238 std::string reg_id = it->first;
239 if (reg_id == real_id)
244 reg_elements.clear();
246 if (real_elements.size() <= reg_elements.size())
248 bool keep_going =
true;
249 for (
unsigned int j = 0; keep_going && j < real_elements.size(); ++j)
251 if (real_elements[j] != reg_elements[j] && reg_elements[j] != std::string(
"*"))
256 if (real_elements.size() < reg_elements.size() && !*is_parent)
261 return_value = reg_id;
263 else if (real_elements.size() == reg_elements.size())
278 std::pair<std::multimap<std::string, Syntax::ActionInfo>::const_iterator,
279 std::multimap<std::string, Syntax::ActionInfo>::const_iterator>
290 for (
const auto & task_it : as_range(iters))
291 if (task == task_it.second)
303 const std::multimap<std::string, std::string> &
309 const std::multimap<std::string, Syntax::ActionInfo> &
317 const std::string & action,
318 const std::string & task)
const
std::multimap< std::string, ActionInfo > _syntax_to_actions
The syntax object to ActionInfo (Action+task) associations.
void registerTaskName(const std::string &task, bool should_auto_build=false)
Method to register a new task.
void registerActionSyntax(const std::string &action, const std::string &syntax, const std::string &task="", const std::string &file="", int line=-1)
Registration function for associating Moose Actions with syntax.
void insertDependency(const T &key, const T &value)
Insert a dependency pair - the first value or the "key" depends on the second value or the "value".
std::multimap< std::string, std::pair< std::string, std::string > > _actions_to_syntax
The ActionInfo (Action+task) to syntax associations (built only when needed) Action -> (Syntax,...
const std::vector< std::string > & getSortedTask()
Get a list of serialized tasks in a correct dependency order.
FileLineInfo getLineInfo(const std::string &syntax, const std::string &action, const std::string &task) const
Gets the file and line where the syntax/action/task combo was registered.
const std::vector< T > & getSortedValues()
This function also returns dependency resolved values but with a simpler single vector interface.
std::vector< std::string > getSyntaxByAction(const std::string &action, const std::string &task="")
Retrieve the syntax associated with the passed in action type string.
bool hasTask(const std::string &task) const
Returns a Boolean indicating whether or not a task is registered with the syntax object.
bool isActionRequired(const std::string &task) const
Returns a Boolean indicating whether the specified task is required.
std::pair< std::multimap< std::string, ActionInfo >::const_iterator, std::multimap< std::string, ActionInfo >::const_iterator > getActions(const std::string &syntax) const
Returns a pair of multimap iterators to all the ActionInfo objects associated with a given piece of s...
void deleteTaskDependencies(const std::string &task)
Deletes or removes the dependencies that this task depends on.
std::string isAssociated(const std::string &real_id, bool *is_parent) const
Method for determining whether a piece of syntax is associated with an Action TODO: I need a better n...
const std::multimap< std::string, ActionInfo > & getAssociatedActions() const
Return all Syntax to Action associations.
FileLineInfoMap _syntax_to_line
Holds file and line information.
void addItem(const T &value)
Add an independent item to the set.
void replaceActionSyntax(const std::string &action, const std::string &syntax, const std::string &task, const std::string &file="", int line=-1)
Registration function that replaces existing Moose Actions with a completely new action Note: This fu...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
void clearTaskDependencies()
Clears all tasks from the system object.
void addDependencySets(const std::string &action_sets)
Adds all dependencies in a single call.
std::multimap< std::string, std::string > _moose_systems_to_tasks
The list of Moose system objects to tasks. This map indicates which tasks are allowed to build certai...
void clear()
Clear Items from the resolver.
void registerSyntaxType(const std::string &syntax, const std::string &type)
Register a type with a block.
bool shouldAutoBuild(const std::string &task) const
Returns a Boolean indicating whether MOOSE should attempt to automatically create an Action to satisf...
const std::vector< std::vector< T > > & getSortedValuesSets()
Returns a vector of sets that represent dependency resolved values.
void deleteDependenciesOfKey(const T &key)
Removes dependencies of the given key.
bool verifyMooseObjectTask(const std::string &base, const std::string &task) const
Returns a Boolean indicating whether a task is associated with on of the MOOSE pluggable systems (BAS...
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
std::map< std::string, bool > _registered_tasks
The list of registered tasks and a flag indicating whether or not they should be auto-built.
bool isDeprecatedSyntax(const std::string &syntax) const
Returns a Boolean indicating whether the syntax has been deprecated through a call to deprecateAction...
void appendTaskName(const std::string &task, const std::string &moose_object_type)
Method to associate another "allowed" pluggable MOOSE system to an existing registered task.
void deprecateActionSyntax(const std::string &syntax)
This method deprecates previously registered syntax.
std::string deprecatedActionSyntaxMessage(const std::string syntax)
Returns the deprecation message for a given syntax that has been deprecated by deprecateActionSyntax.
const std::vector< std::vector< std::string > > & getSortedTaskSet()
Get a list of serialized tasks in a correct dependency order.
void addInfo(const std::string &key0, const std::string &file, int line)
Associate a key with file/line info.
std::multimap< std::string, std::string > _associated_types
Syntax/Type association.
const std::multimap< std::string, std::string > & getAssociatedTypes() const
Get a multimap of registered associations of syntax with type.
bool _actions_to_syntax_valid
Boolean indicating whether the _actions_to_syntax map is built and valid and synced.
void addDependency(const std::string &task, const std::string &pre_req)
Method to insert a new task in the list of existing tasks at the specified location.
FileLineInfo getInfo(const std::string &key0) const
Get file/line info for a key.
DependencyResolver< std::string > _tasks
The dependency resolver.
std::map< std::string, std::string > _deprecated_syntax
The list of deprecated syntax items and the associated deprecated message.