Fleet  0.0.9
Inference in the LOT
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
VirtualMachineState< _t_input, _t_output, VM_TYPES > Class Template Reference

#include <VirtualMachineState.h>

Inheritance diagram for VirtualMachineState< _t_input, _t_output, VM_TYPES >:
Inheritance graph
[legend]
Collaboration diagram for VirtualMachineState< _t_input, _t_output, VM_TYPES >:
Collaboration graph
[legend]

Public Types

using input_t = _t_input
 
using output_t = _t_output
 
using this_t = VirtualMachineState< input_t, output_t, VM_TYPES... >
 
using FT = std::function< void(this_t *, int)>
 
template<typename T >
using VMSStack = Stack< T >
 

Public Member Functions

 VirtualMachineState (input_t x, const output_t &e, VirtualMachinePool< this_t > *po)
 
template<typename T >
std::map< std::pair< T, input_t >, output_t > & mem ()
 
template<typename T >
VMSStack< std::pair< T, input_t > > & memstack ()
 
auto operator (const VirtualMachineState &m) const
 These must be sortable by lp so that we can enumerate them from low to high probability in a VirtualMachinePool NOTE: VirtualMachineStates shouldn't be put in a set because they might evaluate to equal! More...
 
template<typename T >
VMSStack< T > & stack ()
 Returns a reference to the stack (of a given type) More...
 
template<typename T >
const VMSStack< T > & stack () const
 Const reference to top of stack. More...
 
template<typename T >
getpop ()
 Retrieves and pops the element of type T from the stack. More...
 
template<size_t n, typename... args>
auto getpop_nth ()
 Getpops the n'th element of args (useful for writing primitives) More...
 
template<typename T >
gettop ()
 Retrieves the top of the stack as a copy and does not remove. More...
 
template<typename T >
void push (T &x)
 
template<typename T >
void push (T &&x)
 
void push_x (input_t x)
 
template<typename T , typename... args>
bool _exactly_one () const
 There is one element in stack T and the rest are empty. Used to check in returning the output. More...
 
template<typename T >
bool exactly_one () const
 
output_t get_output ()
 Return the output and do some checks that the stacks are as they should be if you're reading the output. More...
 
output_t run ()
 Run. More...
 

Public Attributes

Program< this_tprogram
 
VMSStack< input_txstack
 
const output_terr
 
double lp
 
unsigned long recursion_depth
 
vmstatus_t status
 
RuntimeCounter runtime_counter
 
VirtualMachinePool< this_t > * pool
 

Additional Inherited Members

- Static Public Attributes inherited from VirtualMachineControl
static unsigned long MAX_RECURSE = 64
 
static unsigned long MAX_RUN_PROGRAM = 10000
 
static unsigned long MAX_STEPS = 512
 
static unsigned long MAX_OUTPUTS = 512
 
static double MIN_LP = -10
 

Detailed Description

template<typename _t_input, typename _t_output, typename... VM_TYPES>
class VirtualMachineState< _t_input, _t_output, VM_TYPES >

Author
piantado
Date
02/02/20

Member Typedef Documentation

◆ FT

template<typename _t_input , typename _t_output , typename... VM_TYPES>
using VirtualMachineState< _t_input, _t_output, VM_TYPES >::FT = std::function<void(this_t*,int)>

◆ input_t

template<typename _t_input , typename _t_output , typename... VM_TYPES>
using VirtualMachineState< _t_input, _t_output, VM_TYPES >::input_t = _t_input

◆ output_t

template<typename _t_input , typename _t_output , typename... VM_TYPES>
using VirtualMachineState< _t_input, _t_output, VM_TYPES >::output_t = _t_output

◆ this_t

template<typename _t_input , typename _t_output , typename... VM_TYPES>
using VirtualMachineState< _t_input, _t_output, VM_TYPES >::this_t = VirtualMachineState<input_t, output_t, VM_TYPES...>

◆ VMSStack

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
using VirtualMachineState< _t_input, _t_output, VM_TYPES >::VMSStack = Stack<T>

Constructor & Destructor Documentation

◆ VirtualMachineState()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
VirtualMachineState< _t_input, _t_output, VM_TYPES >::VirtualMachineState ( input_t  x,
const output_t e,
VirtualMachinePool< this_t > *  po 
)
inline

Member Function Documentation

◆ _exactly_one()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T , typename... args>
bool VirtualMachineState< _t_input, _t_output, VM_TYPES >::_exactly_one ( ) const
inline

There is one element in stack T and the rest are empty. Used to check in returning the output.

Returns

◆ exactly_one()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
bool VirtualMachineState< _t_input, _t_output, VM_TYPES >::exactly_one ( ) const
inline

◆ get_output()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
output_t VirtualMachineState< _t_input, _t_output, VM_TYPES >::get_output ( )
inline

Return the output and do some checks that the stacks are as they should be if you're reading the output.

Returns

◆ getpop()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
T VirtualMachineState< _t_input, _t_output, VM_TYPES >::getpop ( )
inline

Retrieves and pops the element of type T from the stack.

Returns

◆ getpop_nth()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<size_t n, typename... args>
auto VirtualMachineState< _t_input, _t_output, VM_TYPES >::getpop_nth ( )
inline

Getpops the n'th element of args (useful for writing primitives)

Returns

◆ gettop()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
T VirtualMachineState< _t_input, _t_output, VM_TYPES >::gettop ( )
inline

Retrieves the top of the stack as a copy and does not remove.

Returns

◆ mem()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
std::map<std::pair<T,input_t>,output_t>& VirtualMachineState< _t_input, _t_output, VM_TYPES >::mem ( )
inline

◆ memstack()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
VMSStack<std::pair<T,input_t> >& VirtualMachineState< _t_input, _t_output, VM_TYPES >::memstack ( )
inline

◆ operator()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
auto VirtualMachineState< _t_input, _t_output, VM_TYPES >::operator ( const VirtualMachineState< _t_input, _t_output, VM_TYPES > &  m) const
inline

These must be sortable by lp so that we can enumerate them from low to high probability in a VirtualMachinePool NOTE: VirtualMachineStates shouldn't be put in a set because they might evaluate to equal!

Parameters
m
Returns

◆ push() [1/2]

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
void VirtualMachineState< _t_input, _t_output, VM_TYPES >::push ( T &  x)
inline

Push things onto the appropriate stack

Parameters
x

◆ push() [2/2]

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
void VirtualMachineState< _t_input, _t_output, VM_TYPES >::push ( T &&  x)
inline

◆ push_x()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
void VirtualMachineState< _t_input, _t_output, VM_TYPES >::push_x ( input_t  x)
inline

◆ run()

template<typename _t_input , typename _t_output , typename... VM_TYPES>
output_t VirtualMachineState< _t_input, _t_output, VM_TYPES >::run ( )
inline

Run.

Returns

◆ stack() [1/2]

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
VMSStack<T>& VirtualMachineState< _t_input, _t_output, VM_TYPES >::stack ( )
inline

Returns a reference to the stack (of a given type)

Returns

◆ stack() [2/2]

template<typename _t_input , typename _t_output , typename... VM_TYPES>
template<typename T >
const VMSStack<T>& VirtualMachineState< _t_input, _t_output, VM_TYPES >::stack ( ) const
inline

Const reference to top of stack.

Returns

Member Data Documentation

◆ err

template<typename _t_input , typename _t_output , typename... VM_TYPES>
const output_t& VirtualMachineState< _t_input, _t_output, VM_TYPES >::err

◆ lp

template<typename _t_input , typename _t_output , typename... VM_TYPES>
double VirtualMachineState< _t_input, _t_output, VM_TYPES >::lp

◆ pool

template<typename _t_input , typename _t_output , typename... VM_TYPES>
VirtualMachinePool<this_t>* VirtualMachineState< _t_input, _t_output, VM_TYPES >::pool

◆ program

template<typename _t_input , typename _t_output , typename... VM_TYPES>
Program<this_t> VirtualMachineState< _t_input, _t_output, VM_TYPES >::program

◆ recursion_depth

template<typename _t_input , typename _t_output , typename... VM_TYPES>
unsigned long VirtualMachineState< _t_input, _t_output, VM_TYPES >::recursion_depth

◆ runtime_counter

template<typename _t_input , typename _t_output , typename... VM_TYPES>
RuntimeCounter VirtualMachineState< _t_input, _t_output, VM_TYPES >::runtime_counter

◆ status

template<typename _t_input , typename _t_output , typename... VM_TYPES>
vmstatus_t VirtualMachineState< _t_input, _t_output, VM_TYPES >::status

◆ xstack

template<typename _t_input , typename _t_output , typename... VM_TYPES>
VMSStack<input_t> VirtualMachineState< _t_input, _t_output, VM_TYPES >::xstack

The documentation for this class was generated from the following file: