AERA
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
TestMem< O, S > Class Template Reference

#include <test_mem.h>

Inheritance diagram for TestMem< O, S >:
r_exec::MemExec< O, S >

Classes

class  _Thread
 

Public Member Functions

bool load (const std::vector< r_code::Code * > *objects, uint32 stdin_oid, uint32 stdout_oid, uint32 self_oid) override
 
r_code::Codeeject (r_code::Code *command) override
 
void on_diagnostic_time_tick () override
 
- Public Member Functions inherited from r_exec::MemExec< O, S >
r_code::Codebuild_object (r_code::SysObject *source) const override
 
r_code::Code_build_object (Atom head) const override
 
r_code::Codebuild_object (Atom head) const override
 
r_code::Codecheck_existence (r_code::Code *object) override
 
void inject (O *object, View *view)
 

Protected Member Functions

void on_time_tick ()
 
void startTimeTickThread ()
 

Static Protected Member Functions

static thread_ret thread_function_call timeTickRun (void *args)
 

Protected Attributes

std::ofstream ofs
 
ThreadtimeTickThread_
 
Timestamp lastInjectTime_
 
float velocity_y_
 
float position_y_
 
float force_y_
 
float next_velocity_y_
 
float next_position_y_
 
float next_theta_y_
 
float next_omega_y_
 
r_code::Codeposition_y_obj_
 
r_code::Codecart_position_y_obj_
 
r_code::Codeposition_property_
 
r_code::Codeposition_y_property_
 
r_code::Codevelocity_y_property_
 
r_code::Codeforce_y_property_
 
r_code::Codetheta_y_property_
 
r_code::Codeomega_y_property_
 
r_code::Codeprimary_group_
 
uint16 ready_opcode_
 
uint16 set_velocity_y_opcode_
 
uint16 set_force_y_opcode_
 
uint16 move_y_plus_opcode_
 
uint16 move_y_minus_opcode_
 
Timestamp lastCommandTime_
 
r_code::CodeyEnt_ [10]
 
r_code::CodediscretePositionObj_
 
r_code::CodediscretePosition_
 
r_code::CodenextDiscretePosition_
 
int babbleState_
 

Detailed Description

template<class O, class S>
class TestMem< O, S >

TestMem extends Mem so that we can override load and eject, and to implement the behavior of the external environment for pong.2.goal.replicode, etc. If a program does not call a(cmd ...) for the implemented external environment, then it does nothing. (If this external environment is not needed, then main() can just create the parent class r_exec::Mem .)

Definition at line 98 of file test_mem.h.

Member Function Documentation

◆ eject()

template<class O , class S >
Code * TestMem< O, S >::eject ( r_code::Code command)
override

Override eject to check for (cmd set_velocity_y ...) and other implemented commands.

Parameters
commandThe command from the Replicode (cmd ...).
Returns
The given command if it is executed as-is, or a new command object of the command that is actually executed. The program controller will make a fact from the command and inject it as the efferent copy. However, if the command is not executed, then return NULL and the program controller will put an anti-fact of the command in the mk.rdx reduction.

Definition at line 165 of file test_mem.cpp.

◆ load()

template<class O , class S >
bool TestMem< O, S >::load ( const std::vector< r_code::Code * > *  objects,
uint32  stdin_oid,
uint32  stdout_oid,
uint32  self_oid 
)
override

Call the parent class load(), then set up the objects for the external environment.

Definition at line 135 of file test_mem.cpp.

◆ on_diagnostic_time_tick()

template<class O , class S >
void TestMem< O, S >::on_diagnostic_time_tick ( )
inlineoverride

This is called when run_in_diagnostic_time() updates the tickTime. Just call on_time_tick(), because there is no real - time timer thread to call it.

Definition at line 124 of file test_mem.h.

◆ startTimeTickThread()

template<class O , class S >
void TestMem< O, S >::startTimeTickThread
protected

If not running in diagnostic time, start the timeTickThread_. If it is already started, do nothing.

Definition at line 547 of file test_mem.cpp.

◆ timeTickRun()

template<class O , class S >
thread_ret thread_function_call TestMem< O, S >::timeTickRun ( void *  args)
staticprotected

This runs in the timeTickThread_ to periodicaly call on_time_tick(). (Only used if not running in diagnostic time.)

Parameters
args
Returns

Definition at line 561 of file test_mem.cpp.


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