SeExpr
ContextUtils.cpp
Go to the documentation of this file.
1 /*
2 * Copyright Disney Enterprises, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License
6 * and the following modification to it: Section 6 Trademarks.
7 * deleted and replaced with:
8 *
9 * 6. Trademarks. This License does not grant permission to use the
10 * trade names, trademarks, service marks, or product names of the
11 * Licensor and its affiliates, except as required for reproducing
12 * the content of the NOTICE file.
13 *
14 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
16 */
17 
18 #include "ContextUtils.h"
19 #include "Context.h"
20 
21 namespace SeExpr2 {
22 
23 namespace /* anonymous */ {
24 const std::string disableThreading = "disableThreading";
25 } // namespace anonymous
26 
27 void ContextUtils::DisableThreading(Context& context) { context.setParameter(disableThreading, "true"); }
28 
30  bool isThreading = true;
31 
32  std::string result;
33  if (context.lookupParameter(disableThreading, result) && result == "true") {
34  isThreading = false;
35  }
36 
37  return isThreading;
38 }
39 
40 } // namespace SeExpr2
bool lookupParameter(const std::string &parameterName, std::string &value) const
Lookup a Context parameter by name.
Definition: Context.h:27
void setParameter(const std::string &parameterName, const std::string &value)
Set a parameter. NOTE: this must be done when no threads are accessing lookupParameter for safety...
Definition: Context.cpp:23
static void DisableThreading(Context &context)
If a scalar is used in a vector context
Definition: userdoc.txt:456
static bool IsThreading(const Context &context)