souffle  2.0.2-371-g6315b36
Public Member Functions | Private Types | Private Attributes
souffle::interpreter::Context Class Reference

Evaluation context for Interpreter operations. More...

#include <Context.h>

Collaboration diagram for souffle::interpreter::Context:
Collaboration graph

Public Member Functions

void addReturnValue (RamDomain val)
 Add subroutine return value. More...
 
RamDomainallocateNewTuple (size_t size)
 Allocate a tuple. More...
 
 Context (Context &ctxt)
 This constructor is used when program enter a new scope. More...
 
 Context (size_t size=0)
 
void createView (const RelationWrapper &rel, size_t indexPos, size_t viewPos)
 Create a view in the environment. More...
 
RamDomain getArgument (size_t i) const
 Get subroutine Arguments. More...
 
const std::vector< RamDomain > & getArguments () const
 Get subroutine Arguments. More...
 
std::vector< RamDomain > & getReturnValues () const
 Get subroutine return value. More...
 
ViewWrappergetView (size_t id)
 Return a view. More...
 
const RamDomain *& operator[] (size_t index)
 
const RamDomain *const & operator[] (size_t index) const
 
void setArguments (const std::vector< RamDomain > &a)
 Set subroutine Arguments. More...
 
void setReturnValues (std::vector< RamDomain > &retVals)
 Set subroutine return value. More...
 
virtual ~Context ()=default
 

Private Types

using ViewPtr = Own< ViewWrapper >
 

Private Attributes

VecOwn< RamDomain[]> allocatedDataContainer
 @bref Allocated data More...
 
const std::vector< RamDomain > * args = nullptr
 Subroutine arguments. More...
 
std::vector< const RamDomain * > data
 Run-time value. More...
 
std::vector< RamDomain > * returnValues = nullptr
 Subroutine return value. More...
 
VecOwn< ViewWrapperviews
 Views. More...
 

Detailed Description

Evaluation context for Interpreter operations.

Definition at line 39 of file Context.h.

Member Typedef Documentation

◆ ViewPtr

Definition at line 46 of file Context.h.

Constructor & Destructor Documentation

◆ Context() [1/2]

souffle::interpreter::Context::Context ( size_t  size = 0)
inline

Definition at line 49 of file Context.h.

51 {

◆ Context() [2/2]

souffle::interpreter::Context::Context ( Context ctxt)
inline

This constructor is used when program enter a new scope.

Only Subroutine value needs to be copied

Definition at line 53 of file Context.h.

57 {

◆ ~Context()

virtual souffle::interpreter::Context::~Context ( )
virtualdefault

Member Function Documentation

◆ addReturnValue()

void souffle::interpreter::Context::addReturnValue ( RamDomain  val)
inline

Add subroutine return value.

Definition at line 88 of file Context.h.

92  {

Referenced by souffle::interpreter::Engine::execute().

◆ allocateNewTuple()

RamDomain* souffle::interpreter::Context::allocateNewTuple ( size_t  size)
inline

Allocate a tuple.

allocatedDataContainer has the ownership of those tuples.

Definition at line 69 of file Context.h.

71  {
72  returnValues = &retVals;
73  }
74 
75  /** @brief Add subroutine return value */

References returnValues.

◆ createView()

void souffle::interpreter::Context::createView ( const RelationWrapper rel,
size_t  indexPos,
size_t  viewPos 
)
inline

Create a view in the environment.

Definition at line 110 of file Context.h.

112  :
113  /** @brief Run-time value */
114  std::vector<const RamDomain*> data;
115  /** @brief Subroutine return value */
116  std::vector<RamDomain>* returnValues = nullptr;

Referenced by souffle::interpreter::Engine::execute().

◆ getArgument()

RamDomain souffle::interpreter::Context::getArgument ( size_t  i) const
inline

Get subroutine Arguments.

Definition at line 104 of file Context.h.

107  {

Referenced by souffle::interpreter::Engine::execute().

◆ getArguments()

const std::vector<RamDomain>& souffle::interpreter::Context::getArguments ( ) const
inline

Get subroutine Arguments.

Definition at line 94 of file Context.h.

98  {

◆ getReturnValues()

std::vector<RamDomain>& souffle::interpreter::Context::getReturnValues ( ) const
inline

Get subroutine return value.

Definition at line 78 of file Context.h.

◆ getView()

ViewWrapper* souffle::interpreter::Context::getView ( size_t  id)
inline

Return a view.

Definition at line 119 of file Context.h.

◆ operator[]() [1/2]

const RamDomain*& souffle::interpreter::Context::operator[] ( size_t  index)
inline

Definition at line 56 of file Context.h.

57  {
58  Own<RamDomain[]> newTuple(new RamDomain[size]);
59  allocatedDataContainer.push_back(std::move(newTuple));
60 
61  // Return the reference as raw pointer.

References allocatedDataContainer, and TCB_SPAN_NAMESPACE_NAME::detail::size().

Here is the call graph for this function:

◆ operator[]() [2/2]

const RamDomain* const& souffle::interpreter::Context::operator[] ( size_t  index) const
inline

Definition at line 63 of file Context.h.

◆ setArguments()

void souffle::interpreter::Context::setArguments ( const std::vector< RamDomain > &  a)
inline

Set subroutine Arguments.

Definition at line 99 of file Context.h.

100  {
101  views.resize(viewPos + 1);

References views.

◆ setReturnValues()

void souffle::interpreter::Context::setReturnValues ( std::vector< RamDomain > &  retVals)
inline

Set subroutine return value.

Definition at line 83 of file Context.h.

Field Documentation

◆ allocatedDataContainer

VecOwn<RamDomain[]> souffle::interpreter::Context::allocatedDataContainer
private

@bref Allocated data

Definition at line 132 of file Context.h.

Referenced by operator[]().

◆ args

const std::vector<RamDomain>* souffle::interpreter::Context::args = nullptr
private

Subroutine arguments.

Definition at line 130 of file Context.h.

◆ data

std::vector<const RamDomain*> souffle::interpreter::Context::data
private

Run-time value.

Definition at line 126 of file Context.h.

◆ returnValues

std::vector<RamDomain>* souffle::interpreter::Context::returnValues = nullptr
private

Subroutine return value.

Definition at line 128 of file Context.h.

Referenced by allocateNewTuple().

◆ views

VecOwn<ViewWrapper> souffle::interpreter::Context::views
private

Views.

Definition at line 134 of file Context.h.

Referenced by setArguments().


The documentation for this class was generated from the following file:
TCB_SPAN_NAMESPACE_NAME::detail::size
constexpr auto size(const C &c) -> decltype(c.size())
Definition: span.h:198
souffle::interpreter::Context::data
std::vector< const RamDomain * > data
Run-time value.
Definition: Context.h:126
souffle::RamDomain
int32_t RamDomain
Definition: RamTypes.h:56
souffle::interpreter::Context::returnValues
std::vector< RamDomain > * returnValues
Subroutine return value.
Definition: Context.h:128
souffle::interpreter::Context::allocatedDataContainer
VecOwn< RamDomain[]> allocatedDataContainer
@bref Allocated data
Definition: Context.h:132
souffle::interpreter::Context::views
VecOwn< ViewWrapper > views
Views.
Definition: Context.h:134