Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Context Struct Reference

#include <ored/scripting/context.hpp>

+ Collaboration diagram for Context:

Public Member Functions

Size varSize () const
 
bool empty () const
 
void resetSize (const std::size_t n)
 

Public Attributes

std::set< std::string > constants
 
std::set< std::string > ignoreAssignments
 
std::map< std::string, ValueTypescalars
 
std::map< std::string, std::vector< ValueType > > arrays
 

Detailed Description

Definition at line 39 of file context.hpp.

Member Function Documentation

◆ varSize()

Size varSize ( ) const

Definition at line 31 of file context.cpp.

31 {
32 QL_REQUIRE(!scalars.empty() || !arrays.empty(), "Context::varSize(): context is empty()");
33 Size res = Null<Size>();
34 for (auto const& v : scalars) {
35 if (res != Null<Size>())
36 QL_REQUIRE(size(v.second) == res, "Context::varSize(): inconsistent var sizes");
37 else
38 res = size(v.second);
39 }
40 for (auto const& v : arrays) {
41 for (auto const& a : v.second) {
42 if (res != Null<Size>())
43 QL_REQUIRE(size(a) == res, "Context::varSize(): inconsistent var sizes");
44 else
45 res = size(a);
46 }
47 }
48 return res;
49}
Size size(const ValueType &v)
Definition: value.cpp:145
std::map< std::string, ValueType > scalars
Definition: context.hpp:45
std::map< std::string, std::vector< ValueType > > arrays
Definition: context.hpp:46
+ Here is the call graph for this function:

◆ empty()

bool empty ( ) const

Definition at line 50 of file context.hpp.

50{ return scalars.empty() && arrays.empty(); }

◆ resetSize()

void resetSize ( const std::size_t  n)

Definition at line 105 of file context.cpp.

105 {
106 for (auto& [_, v] : scalars) {
107 ::ore::data::resetSize(v, n);
108 }
109 for (auto& [_, a] : arrays) {
110 for (auto& v : a) {
111 ::ore::data::resetSize(v, n);
112 }
113 }
114}

Member Data Documentation

◆ constants

std::set<std::string> constants

Definition at line 41 of file context.hpp.

◆ ignoreAssignments

std::set<std::string> ignoreAssignments

Definition at line 43 of file context.hpp.

◆ scalars

std::map<std::string, ValueType> scalars

Definition at line 45 of file context.hpp.

◆ arrays

std::map<std::string, std::vector<ValueType> > arrays

Definition at line 46 of file context.hpp.