KSeExpr  4.0.4.0
Context.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2011-2019 Disney Enterprises, Inc.
2 // SPDX-License-Identifier: LicenseRef-Apache-2.0
3 // SPDX-FileCopyrightText: 2020 L. E. Segovia <amy@amyspark.me>
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 
6 #include "Context.h"
7 
8 using namespace KSeExpr;
9 
10 Context::Context(const Context *parent)
11  : _parent(parent)
12 {
13 }
14 
15 void Context::setParameter(const std::string &parameterName, const std::string &value)
16 {
17  _parameters[parameterName] = value;
18 }
19 
21 {
22  return new Context(this);
23 }
24 
26 {
27  static Context context(nullptr);
28  return context;
29 }
static Context & global()
The global default context of the seexpr.
Definition: Context.cpp:25
ParameterMap _parameters
Attribute/value pairs.
Definition: Context.h:73
Context(const Context &)=delete
Context * createChildContext() const
Create a context that is a child of this context.
Definition: Context.cpp:20
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:15