[Avida-SVN] r1140 - in development/source: . cpu main tools

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Tue Dec 12 17:46:57 PST 2006


Author: brysonda
Date: 2006-12-12 20:46:56 -0500 (Tue, 12 Dec 2006)
New Revision: 1140

Modified:
   development/source/cpu/cTestCPUInterface.cc
   development/source/cpu/cTestCPUInterface.h
   development/source/defs.h
   development/source/main/cEnvironment.cc
   development/source/main/cEnvironment.h
   development/source/main/cOrgInterface.h
   development/source/main/cOrganism.cc
   development/source/main/cOrganism.h
   development/source/main/cPhenotype.cc
   development/source/main/cPhenotype.h
   development/source/main/cPopulationCell.cc
   development/source/main/cPopulationCell.h
   development/source/main/cPopulationInterface.cc
   development/source/main/cPopulationInterface.h
   development/source/main/cTaskContext.h
   development/source/main/cTaskEntry.h
   development/source/main/cTaskLib.cc
   development/source/main/cTaskLib.h
   development/source/tools/tBuffer.h
   development/source/tools/tMemTrack.h
Log:
Change cTaskContext usage to method access.   Adjust cTaskLib methods to accept a task context reference, rather then pointer.  Remove some unused data structures from the task pathway.

Modified: development/source/cpu/cTestCPUInterface.cc
===================================================================
--- development/source/cpu/cTestCPUInterface.cc	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/cpu/cTestCPUInterface.cc	2006-12-13 01:46:56 UTC (rev 1140)
@@ -35,11 +35,6 @@
 {
 }
 
-int cTestCPUInterface::GetInput()
-{
-  return m_testcpu->GetInput();
-}
-
 int cTestCPUInterface::GetInputAt(int& input_pointer)
 {
   return m_testcpu->GetInputAt(input_pointer);

Modified: development/source/cpu/cTestCPUInterface.h
===================================================================
--- development/source/cpu/cTestCPUInterface.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/cpu/cTestCPUInterface.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -37,7 +37,6 @@
   int GetNumNeighbors();
   void Rotate(int direction = 1);
   void Breakpoint() { ; }
-  int GetInput();
   int GetInputAt(int& input_pointer);
   int Debug();
   const tArray<double>& GetResources();

Modified: development/source/defs.h
===================================================================
--- development/source/defs.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/defs.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -95,8 +95,6 @@
 // Number of distinct input and outputs stored in the IOBufs (to test tasks)
 const int INPUT_BUF_SIZE = 3;
 const int OUTPUT_BUF_SIZE = 10;
-const int SEND_BUF_SIZE = 3;
-const int RECEIVE_BUF_SIZE = 3;
 #define RECEIVED_MESSAGES_SIZE 10
 const int MARKET_SIZE = 10000;
 

Modified: development/source/main/cEnvironment.cc
===================================================================
--- development/source/main/cEnvironment.cc	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cEnvironment.cc	2006-12-13 01:46:56 UTC (rev 1140)
@@ -749,7 +749,6 @@
 
 bool cEnvironment::TestOutput(cAvidaContext& ctx, cReactionResult& result,
 	      cTaskContext& taskctx,
-              const tBuffer<int>& send_buf, const tBuffer<int>& receive_buf,
               const tArray<int>& task_count, const tArray<int>& reaction_count,
 	      const tArray<double>& resource_count) const
 {
@@ -770,10 +769,10 @@
     assert(cur_task != NULL);
     
     taskctx.SetTaskEntry(cur_task); // Set task entry in the context, so that tasks can reference task settings
-    const double task_quality = m_tasklib.TestOutput(&taskctx);
+    const double task_quality = m_tasklib.TestOutput(taskctx);
     const int task_id = cur_task->GetID();
     const int task_cnt = task_count[task_id];
-	const bool on_divide = taskctx.GetOnDivide();
+    const bool on_divide = taskctx.GetOnDivide();
     
     // If this task wasn't performed, move on to the next one.
     if (task_quality == 0.0) continue;

Modified: development/source/main/cEnvironment.h
===================================================================
--- development/source/main/cEnvironment.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cEnvironment.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -105,7 +105,6 @@
                  const tBuffer<int>& outputs, const tArray<double>& resource_count ) const;
 
   bool TestOutput(cAvidaContext& ctx, cReactionResult& result, cTaskContext& taskctx,
-                  const tBuffer<int>& send_buf, const tBuffer<int>& receive_buf,
                   const tArray<int>& task_count, const tArray<int>& reaction_count,
                   const tArray<double>& resource_count) const;
 

Modified: development/source/main/cOrgInterface.h
===================================================================
--- development/source/main/cOrgInterface.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cOrgInterface.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -45,7 +45,6 @@
   virtual int GetNumNeighbors() = 0;
   virtual void Rotate(int direction = 1) = 0;
   virtual void Breakpoint() = 0;
-  virtual int GetInput() = 0;
   virtual int GetInputAt(int& input_pointer) = 0;
   virtual int Debug() = 0;
   virtual const tArray<double>& GetResources() = 0;

Modified: development/source/main/cOrganism.cc
===================================================================
--- development/source/main/cOrganism.cc	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cOrganism.cc	2006-12-13 01:46:56 UTC (rev 1140)
@@ -46,8 +46,6 @@
   , m_input_pointer(0)
   , m_input_buf(INPUT_BUF_SIZE)
   , m_output_buf(OUTPUT_BUF_SIZE)
-  , m_send_buf(SEND_BUF_SIZE)
-  , m_receive_buf(RECEIVE_BUF_SIZE)
   , m_received_messages(RECEIVED_MESSAGES_SIZE)
   , m_sent_value(0)
   , m_sent_active(false)
@@ -109,7 +107,6 @@
 {
   assert(m_interface);
   const int out_value = m_interface->ReceiveValue();
-  m_receive_buf.Add(out_value);
   return out_value;
 }
 
@@ -185,16 +182,16 @@
   // Do the testing of tasks performed...
 
   // if on IO add value to m_output_buf, if on divide don't need to
-  if (!on_divide)
-    m_output_buf.Add(value);
+  if (!on_divide) m_output_buf.Add(value);
+  
   tArray<double> res_change(resource_count.GetSize());
   tArray<int> insts_triggered;
 
   tBuffer<int>* received_messages_point = &m_received_messages;
-  if (!m_world->GetConfig().SAVE_RECEIVED.Get())
-	  received_messages_point = NULL;
+  if (!m_world->GetConfig().SAVE_RECEIVED.Get()) received_messages_point = NULL;
+  
   cTaskContext taskctx(m_input_buf, m_output_buf, other_input_list, other_output_list, net_valid, 0, on_divide, received_messages_point);
-  m_phenotype.TestOutput(ctx, taskctx, m_send_buf, m_receive_buf, resource_count, res_change, insts_triggered);
+  m_phenotype.TestOutput(ctx, taskctx, resource_count, res_change, insts_triggered);
   m_interface->UpdateResources(res_change);
 
   for (int i = 0; i < insts_triggered.GetSize(); i++) {
@@ -355,7 +352,7 @@
     tArray<double> res_change(resource_count.GetSize());
     tArray<int> insts_triggered;
     cTaskContext taskctx(m_input_buf, m_output_buf, other_input_list, other_output_list, false, completed);
-    m_phenotype.TestOutput(ctx, taskctx, m_send_buf, m_receive_buf, resource_count, res_change, insts_triggered);
+    m_phenotype.TestOutput(ctx, taskctx, resource_count, res_change, insts_triggered);
     m_interface->UpdateResources(res_change);
     
     for (int i = 0; i < insts_triggered.GetSize(); i++) {

Modified: development/source/main/cOrganism.h
===================================================================
--- development/source/main/cOrganism.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cOrganism.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -89,8 +89,6 @@
   int m_input_pointer;
   tBuffer<int> m_input_buf;
   tBuffer<int> m_output_buf;
-  tBuffer<int> m_send_buf;
-  tBuffer<int> m_receive_buf;
   tBuffer<int> m_received_messages;
   tList<tListNode<cSaleItem> > m_sold_items;
 

Modified: development/source/main/cPhenotype.cc
===================================================================
--- development/source/main/cPhenotype.cc	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cPhenotype.cc	2006-12-13 01:46:56 UTC (rev 1140)
@@ -519,9 +519,7 @@
 }
 
 bool cPhenotype::TestOutput(cAvidaContext& ctx, cTaskContext& taskctx,
-			    tBuffer<int>& send_buf, tBuffer<int>& receive_buf,
-			    const tArray<double>& res_in,
-                            tArray<double>& res_change,
+			    const tArray<double>& res_in, tArray<double>& res_change,
 			    tArray<int>& insts_triggered)
 {
   assert(initialized == true);
@@ -534,7 +532,7 @@
   cReactionResult result(num_resources, num_tasks, num_reactions);
 			
   // Run everything through the environment.
-  bool found = env.TestOutput(ctx, result, taskctx, send_buf, receive_buf, cur_task_count, cur_reaction_count, res_in);
+  bool found = env.TestOutput(ctx, result, taskctx, cur_task_count, cur_reaction_count, res_in);
 
   // If nothing was found, stop here.
   if (found == false) {
@@ -556,9 +554,6 @@
   cur_bonus *= result.GetMultBonus();
   cur_bonus += result.GetAddBonus();
 
-  // Bonus should never go negative...
-  // if (cur_bonus < 0.0) cur_bonus = 0.0;
-
   // Denote consumed resources...
   for (int i = 0; i < res_in.GetSize(); i++) {
     res_change[i] = result.GetProduced(i) - result.GetConsumed(i);

Modified: development/source/main/cPhenotype.h
===================================================================
--- development/source/main/cPhenotype.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cPhenotype.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -162,7 +162,6 @@
   // Input and Output Reaction Tests
   bool TestInput(tBuffer<int>& inputs, tBuffer<int>& outputs);
   bool TestOutput(cAvidaContext& ctx, cTaskContext& taskctx,
-		  tBuffer<int>& send_buf, tBuffer<int>& receive_buf,
                   const tArray<double>& res_in, tArray<double>& res_change,
 		  tArray<int>& insts_triggered);
 

Modified: development/source/main/cPopulationCell.cc
===================================================================
--- development/source/main/cPopulationCell.cc	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cPopulationCell.cc	2006-12-13 01:46:56 UTC (rev 1140)
@@ -21,7 +21,6 @@
   : m_world(NULL)
   , organism(NULL)
   , mutation_rates(NULL)
-  , cur_input(0)
   , organism_count(0)
 {
 }
@@ -29,7 +28,6 @@
 cPopulationCell::cPopulationCell(const cPopulationCell& in_cell)
   : m_world(in_cell.m_world)
   , organism(in_cell.organism)
-  , cur_input(in_cell.cur_input)
   , cell_id(in_cell.cell_id)
   , deme_id(in_cell.deme_id)
   , organism_count(in_cell.organism_count)
@@ -48,7 +46,6 @@
   m_world = in_cell.m_world;
   organism = in_cell.organism;
   for (int i = 0; i < nHardware::IO_SIZE; i++) input_array[i] = in_cell.input_array[i];
-  cur_input = in_cell.cur_input;
   cell_id = in_cell.cell_id;
   deme_id = in_cell.deme_id;
   organism_count = in_cell.organism_count;
@@ -91,12 +88,6 @@
 }
 
 
-int cPopulationCell::GetInput()
-{
-  if (cur_input >= nHardware::IO_SIZE) cur_input = 0;
-  return input_array[cur_input++];
-}
-
 int cPopulationCell::GetInputAt(int & input_pointer)
 {
   if (input_pointer >= nHardware::IO_SIZE) input_pointer = 0;

Modified: development/source/main/cPopulationCell.h
===================================================================
--- development/source/main/cPopulationCell.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cPopulationCell.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -37,7 +37,6 @@
   tList<cPopulationCell> connection_list;  // A list of neighboring cells.
   cMutationRates* mutation_rates;           // Mutation rates at this cell.
   tArray<int> input_array;                 // Environmental Inputs...
-  int cur_input;                           // Next input to give organism.
 
   int cell_id;           // Unique id for position of cell in population.
   int deme_id;           // ID of the deme that this cell is part of.
@@ -63,7 +62,6 @@
   cPopulationCell & GetCellFaced() { return *(connection_list.GetFirst()); }
   const cMutationRates & MutationRates() const { return *mutation_rates; }
   cMutationRates & MutationRates() { return *mutation_rates; }
-  int GetInput();
   int GetInput(int);
   int GetInputAt(int & input_pointer);
 

Modified: development/source/main/cPopulationInterface.cc
===================================================================
--- development/source/main/cPopulationInterface.cc	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cPopulationInterface.cc	2006-12-13 01:46:56 UTC (rev 1140)
@@ -58,13 +58,6 @@
   else cell.ConnectionList().CircPrev();
 }
 
-int cPopulationInterface::GetInput()
-{
-  cPopulationCell & cell = m_world->GetPopulation().GetCell(m_cell_id);
-  assert(cell.IsOccupied());
-  return cell.GetInput();
-}
-
 int cPopulationInterface::GetInputAt(int& input_pointer)
 {
   cPopulationCell& cell = m_world->GetPopulation().GetCell(m_cell_id);

Modified: development/source/main/cPopulationInterface.h
===================================================================
--- development/source/main/cPopulationInterface.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cPopulationInterface.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -46,7 +46,6 @@
   int GetNumNeighbors();
   void Rotate(int direction = 1);
   void Breakpoint() { m_world->GetDriver().SignalBreakpoint(); }
-  int GetInput();
   int GetInputAt(int& input_pointer);
   int Debug();
   const tArray<double>& GetResources();

Modified: development/source/main/cTaskContext.h
===================================================================
--- development/source/main/cTaskContext.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cTaskContext.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -22,7 +22,6 @@
 
 class cTaskContext
 {
-  friend class cTaskLib;
 private:
   const tBuffer<int>& input_buffer;
   const tBuffer<int>& output_buffer;
@@ -39,15 +38,33 @@
 public:
   cTaskContext(const tBuffer<int>& inputs, const tBuffer<int>& outputs, const tList<tBuffer<int> >& other_inputs,
                const tList<tBuffer<int> >& other_outputs, bool in_net_valid, int in_net_completed, 
-			   bool in_on_divide = false, tBuffer<int>* in_received_messages = NULL)
-    : input_buffer(inputs), output_buffer(outputs), other_input_buffers(other_inputs),
-    other_output_buffers(other_outputs), net_valid(in_net_valid), net_completed(in_net_completed), received_messages(in_received_messages), logic_id(0), 
-    on_divide(in_on_divide), task_entry(NULL)
+               bool in_on_divide = false, tBuffer<int>* in_received_messages = NULL)
+    : input_buffer(inputs)
+    , output_buffer(outputs)
+    , other_input_buffers(other_inputs)
+    , other_output_buffers(other_outputs)
+    , net_valid(in_net_valid)
+    , net_completed(in_net_completed)
+    , received_messages(in_received_messages)
+    , logic_id(0)
+    , on_divide(in_on_divide)
+    , task_entry(NULL)
   {
   }
   
+  inline const tBuffer<int>& GetInputBuffer() { return input_buffer; }
+  inline const tBuffer<int>& GetOutputBuffer() { return output_buffer; }
+  inline const tList<tBuffer<int> >& GetNeighborhoodInputBuffers() { return other_input_buffers; }
+  inline const tList<tBuffer<int> >& GetNeighborhoodOutputBuffers() { return other_output_buffers; }
+  inline bool NetIsValid() { return net_valid; }
+  inline int GetNetCompleted() { return net_completed; }
+  inline tBuffer<int>* GetReceivedMessages() { return received_messages; }
+  inline int GetLogicId() { return logic_id; }
+  inline void SetLogicId(int v) { logic_id = v; }
+  inline bool GetOnDivide() { return on_divide; }
+  
   void SetTaskEntry(cTaskEntry* in_entry) { task_entry = in_entry; }
-  bool GetOnDivide() { return on_divide; }
+  cTaskEntry* GetTaskEntry() { return task_entry; }
 };
 
 

Modified: development/source/main/cTaskEntry.h
===================================================================
--- development/source/main/cTaskEntry.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cTaskEntry.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -24,7 +24,7 @@
 class cTaskLib;
 class cTaskContext;
 
-typedef double (cTaskLib::*tTaskTest)(cTaskContext*) const;
+typedef double (cTaskLib::*tTaskTest)(cTaskContext&) const;
 
 class cTaskEntry
 {

Modified: development/source/main/cTaskLib.cc
===================================================================
--- development/source/main/cTaskLib.cc	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cTaskLib.cc	2006-12-13 01:46:56 UTC (rev 1140)
@@ -370,13 +370,14 @@
 
 void cTaskLib::SetupTests(cTaskContext& ctx) const
 {
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
   // Collect the inputs in a useful form.
-  const int num_inputs = ctx.input_buffer.GetNumStored();
+  const int num_inputs = input_buffer.GetNumStored();
   int test_inputs[3];
   for (int i = 0; i < 3; i++) {
-    test_inputs[i] = (num_inputs > i) ? ctx.input_buffer[i] : 0;
+    test_inputs[i] = (num_inputs > i) ? input_buffer[i] : 0;
   }
-  int test_output = ctx.output_buffer[0];
+  int test_output = ctx.GetOutputBuffer()[0];
   
   
   // Setup logic_out to test the output for each logical combination...
@@ -411,7 +412,7 @@
   
   // If there were any inconsistancies, deal with them.
   if (func_OK == false) {
-    ctx.logic_id = -1;
+    ctx.SetLogicId(-1);
     return;
   }
   
@@ -443,17 +444,18 @@
   int logicid = 0;
   for (int i = 0; i < 8; i++) logicid += logic_out[i] << i;
   
-  ctx.logic_id = logicid;
+  ctx.SetLogicId(logicid);
 }
 
 
 
-double cTaskLib::Task_Echo(cTaskContext* ctx) const
+double cTaskLib::Task_Echo(cTaskContext& ctx) const
 {
-  const int test_output = ctx->output_buffer[0];
-  const int logic_id = ctx->logic_id;
-  for (int i = 0; i < ctx->input_buffer.GetNumStored(); i++) {
-    if (ctx->input_buffer[i] == test_output) {
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int logic_id = ctx.GetLogicId();
+  for (int i = 0; i < input_buffer.GetNumStored(); i++) {
+    if (input_buffer[i] == test_output) {
       assert(logic_id == 170 || logic_id == 204 || logic_id == 240);
       return 1.0;
     }
@@ -462,1093 +464,1135 @@
 }
 
 
-double cTaskLib::Task_Add(cTaskContext* ctx) const
+double cTaskLib::Task_Add(cTaskContext& ctx) const
 {
-  const int test_output = ctx->output_buffer[0];
-  for (int i = 0; i < ctx->input_buffer.GetNumStored(); i++) {
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  for (int i = 0; i < input_buffer.GetNumStored(); i++) {
     for (int j = 0; j < i; j++) {
-      if (test_output == ctx->input_buffer[i] + ctx->input_buffer[j]) return 1.0;
+      if (test_output == input_buffer[i] + input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
 
-double cTaskLib::Task_Sub(cTaskContext* ctx) const
+double cTaskLib::Task_Sub(cTaskContext& ctx) const
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = ctx.GetInputBuffer().GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == ctx->input_buffer[i] - ctx->input_buffer[j]) return 1.0;
+      if (test_output == input_buffer[i] - input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Not(cTaskContext* ctx) const
+double cTaskLib::Task_Not(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 15 || logic_id == 51 || logic_id == 85) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Nand(cTaskContext* ctx) const
+double cTaskLib::Task_Nand(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 63 || logic_id == 95 || logic_id == 119) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_And(cTaskContext* ctx) const
+double cTaskLib::Task_And(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 136 || logic_id == 160 || logic_id == 192) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_OrNot(cTaskContext* ctx) const
+double cTaskLib::Task_OrNot(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 175 || logic_id == 187 || logic_id == 207 ||
       logic_id == 221 || logic_id == 243 || logic_id == 245) return 1.0;
   
   return 0.0;
 }
 
-double cTaskLib::Task_Or(cTaskContext* ctx) const
+double cTaskLib::Task_Or(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 238 || logic_id == 250 || logic_id == 252) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_AndNot(cTaskContext* ctx) const
+double cTaskLib::Task_AndNot(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 10 || logic_id == 12 || logic_id == 34 ||
       logic_id == 48 || logic_id == 68 || logic_id == 80) return 1.0;
   
   return 0.0;
 }
 
-double cTaskLib::Task_Nor(cTaskContext* ctx) const
+double cTaskLib::Task_Nor(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 3 || logic_id == 5 || logic_id == 17) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Xor(cTaskContext* ctx) const
+double cTaskLib::Task_Xor(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 60 || logic_id == 90 || logic_id == 102) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Equ(cTaskContext* ctx) const
+double cTaskLib::Task_Equ(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 153 || logic_id == 165 || logic_id == 195) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AA(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AA(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 1) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AB(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AB(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 22) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AC(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AC(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 23) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AD(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AD(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 104) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AE(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AE(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 105) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AF(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AF(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 126) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AG(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AG(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 127) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AH(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AH(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 128) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AI(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AI(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 129) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AJ(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AJ(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 150) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AK(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AK(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 151) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AL(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AL(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 232) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AM(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AM(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 233) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AN(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AN(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 254) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AO(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AO(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 2 || logic_id == 4 || logic_id == 16) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AP(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AP(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 6 || logic_id == 18 || logic_id == 20) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AQ(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AQ(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 7 || logic_id == 19 || logic_id == 21) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AR(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AR(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 8 || logic_id == 32 || logic_id == 64) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AS(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AS(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 9 || logic_id == 33 || logic_id == 65) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AT(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AT(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 14 || logic_id == 50 || logic_id == 84) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AU(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AU(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 24 || logic_id == 36 || logic_id == 66) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AV(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AV(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 25 || logic_id == 37 || logic_id == 67) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AW(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AW(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 30 || logic_id == 54 || logic_id == 86) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AX(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AX(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 31 || logic_id == 55 || logic_id == 87) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AY(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AY(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 40 || logic_id == 72 || logic_id == 96) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AZ(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_AZ(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 41 || logic_id == 73 || logic_id == 97) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BA(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BA(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 42 || logic_id == 76 || logic_id == 112) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BB(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BB(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 43 || logic_id == 77 || logic_id == 113) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BC(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BC(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 61 || logic_id == 91 || logic_id == 103) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BD(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BD(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 62 || logic_id == 94 || logic_id == 118) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BE(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BE(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 106 || logic_id == 108 || logic_id == 120) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BF(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BF(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 107 || logic_id == 109 || logic_id == 121) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BG(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BG(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 110 || logic_id == 122 || logic_id == 124) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BH(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BH(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 111 || logic_id == 123 || logic_id == 125) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BI(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BI(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 130 || logic_id == 132 || logic_id == 144) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BJ(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BJ(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 131 || logic_id == 133 || logic_id == 145) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BK(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BK(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 134 || logic_id == 146 || logic_id == 148) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BL(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BL(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 135 || logic_id == 147 || logic_id == 149) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BM(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BM(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 137 || logic_id == 161 || logic_id == 193) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BN(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BN(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 142 || logic_id == 178 || logic_id == 212) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BO(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BO(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 143 || logic_id == 179 || logic_id == 213) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BP(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BP(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 152 || logic_id == 164 || logic_id == 194) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BQ(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BQ(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 158 || logic_id == 182 || logic_id == 214) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BR(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BR(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 159 || logic_id == 183 || logic_id == 215) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BS(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BS(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 168 || logic_id == 200 || logic_id == 224) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BT(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BT(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 169 || logic_id == 201 || logic_id == 225) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BU(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BU(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 171 || logic_id == 205 || logic_id == 241) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BV(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BV(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 188 || logic_id == 218 || logic_id == 230) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BW(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BW(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 189 || logic_id == 219 || logic_id == 231) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BX(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BX(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 190 || logic_id == 222 || logic_id == 246) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BY(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BY(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 191 || logic_id == 223 || logic_id == 247) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BZ(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_BZ(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 234 || logic_id == 236 || logic_id == 248) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CA(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CA(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 235 || logic_id == 237 || logic_id == 249) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CB(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CB(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 239 || logic_id == 251 || logic_id == 253) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CC(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CC(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 11 || logic_id == 13 || logic_id == 35 ||
       logic_id == 49 || logic_id == 69 || logic_id == 81) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CD(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CD(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 26 || logic_id == 28 || logic_id == 38 ||
       logic_id == 52 || logic_id == 70 || logic_id == 82) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CE(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CE(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 27 || logic_id == 29 || logic_id == 39 ||
       logic_id == 53 || logic_id == 71 || logic_id == 83) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CF(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CF(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 44 || logic_id == 56 || logic_id == 74 ||
       logic_id == 88 || logic_id == 98 || logic_id == 100) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CG(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CG(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 45 || logic_id == 57 || logic_id == 75 ||
       logic_id == 89 || logic_id == 99 || logic_id == 101) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CH(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CH(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 46 || logic_id == 58 || logic_id == 78 ||
       logic_id == 92 || logic_id == 114 || logic_id == 116) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CI(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CI(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 47 || logic_id == 59 || logic_id == 79 ||
       logic_id == 93 || logic_id == 115 || logic_id == 117) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CJ(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CJ(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 138 || logic_id == 140 || logic_id == 162 ||
       logic_id == 176 || logic_id == 196 || logic_id == 208) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CK(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CK(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 139 || logic_id == 141 || logic_id == 163 ||
       logic_id == 177 || logic_id == 197 || logic_id == 209) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CL(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CL(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 154 || logic_id == 156 || logic_id == 166 ||
       logic_id == 180 || logic_id == 198 || logic_id == 210) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CM(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CM(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 155 || logic_id == 157 || logic_id == 167 ||
       logic_id == 181 || logic_id == 199 || logic_id == 211) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CN(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CN(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 172 || logic_id == 184 || logic_id == 202 ||
       logic_id == 216 || logic_id == 226 || logic_id == 228) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CO(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CO(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 173 || logic_id == 185 || logic_id == 203 ||
       logic_id == 217 || logic_id == 227 || logic_id == 229) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CP(cTaskContext* ctx) const
+double cTaskLib::Task_Logic3in_CP(cTaskContext& ctx) const
 {
-  const int logic_id = ctx->logic_id;
+  const int logic_id = ctx.GetLogicId();
   if (logic_id == 174 || logic_id == 186 || logic_id == 206 ||
       logic_id == 220 || logic_id == 242 || logic_id == 244) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AA(cTaskContext* ctx) const //(2X)
+double cTaskLib::Task_Math1in_AA(cTaskContext& ctx) const //(2X)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
-    if (test_output == 2 * ctx->input_buffer[i]) return 1.0;
+    if (test_output == 2 * input_buffer[i]) return 1.0;
   }
   return 0.0; 
 }
 
-double cTaskLib::Task_Math1in_AB(cTaskContext* ctx) const //(2X/3)
+double cTaskLib::Task_Math1in_AB(cTaskContext& ctx) const //(2X/3)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == 2 * ctx->input_buffer[i] / 3) return 1.0;
+    if (test_output == 2 * input_buffer[i] / 3) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AC(cTaskContext* ctx) const //(5X/4)
+double cTaskLib::Task_Math1in_AC(cTaskContext& ctx) const //(5X/4)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == 5 * ctx->input_buffer[i] / 4) return 1.0;
+    if (test_output == 5 * input_buffer[i] / 4) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AD(cTaskContext* ctx) const //(X^2)
+double cTaskLib::Task_Math1in_AD(cTaskContext& ctx) const //(X^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i]) return 1.0;
+    if (test_output == input_buffer[i] * input_buffer[i]) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AE(cTaskContext* ctx) const //(X^3)
+double cTaskLib::Task_Math1in_AE(cTaskContext& ctx) const //(X^3)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] * ctx->input_buffer[i])
+    if (test_output == input_buffer[i] * input_buffer[i] * input_buffer[i])
       return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AF(cTaskContext* ctx) const //(sqrt(X)
+double cTaskLib::Task_Math1in_AF(cTaskContext& ctx) const //(sqrt(X)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == (int) sqrt((double) abs(ctx->input_buffer[i]))) return 1.0;
+    if (test_output == (int) sqrt((double) abs(input_buffer[i]))) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AG(cTaskContext* ctx) const //(log(X))
+double cTaskLib::Task_Math1in_AG(cTaskContext& ctx) const //(log(X))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (ctx->input_buffer[i] <= 0) continue;
-    if (test_output == (int) log((double) ctx->input_buffer[i])) return 1.0;
+    if (input_buffer[i] <= 0) continue;
+    if (test_output == (int) log((double) input_buffer[i])) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AH(cTaskContext* ctx) const //(X^2+X^3)
+double cTaskLib::Task_Math1in_AH(cTaskContext& ctx) const //(X^2+X^3)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] + ctx->input_buffer[i] * ctx->input_buffer[i] * ctx->input_buffer[i])
+    if (test_output == input_buffer[i] * input_buffer[i] + input_buffer[i] * input_buffer[i] * input_buffer[i])
       return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AI(cTaskContext* ctx) const // (X^2 + sqrt(X))
+double cTaskLib::Task_Math1in_AI(cTaskContext& ctx) const // (X^2 + sqrt(X))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] + (int) sqrt((double) abs(ctx->input_buffer[i]))) 
+    if (test_output == input_buffer[i] * input_buffer[i] + (int) sqrt((double) abs(input_buffer[i]))) 
       return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AJ(cTaskContext* ctx) const // abs(X)
+double cTaskLib::Task_Math1in_AJ(cTaskContext& ctx) const // abs(X)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == abs(ctx->input_buffer[i])) return 1.0;
+    if (test_output == abs(input_buffer[i])) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AK(cTaskContext* ctx) const //(X-5)
+double cTaskLib::Task_Math1in_AK(cTaskContext& ctx) const //(X-5)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == ctx->input_buffer[i] - 5) return 1.0;
+    if (test_output == input_buffer[i] - 5) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AL(cTaskContext* ctx) const //(-X)
+double cTaskLib::Task_Math1in_AL(cTaskContext& ctx) const //(-X)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == 0 - ctx->input_buffer[i]) return 1.0;
+    if (test_output == 0 - input_buffer[i]) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AM(cTaskContext* ctx) const //(5X)
+double cTaskLib::Task_Math1in_AM(cTaskContext& ctx) const //(5X)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == 5 * ctx->input_buffer[i]) return 1.0;
+    if (test_output == 5 * input_buffer[i]) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AN(cTaskContext* ctx) const //(X/4)
+double cTaskLib::Task_Math1in_AN(cTaskContext& ctx) const //(X/4)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == ctx->input_buffer[i] / 4) return 1.0;
+    if (test_output == input_buffer[i] / 4) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AO(cTaskContext* ctx) const //(X-6)
+double cTaskLib::Task_Math1in_AO(cTaskContext& ctx) const //(X-6)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == ctx->input_buffer[i] - 6) return 1.0;
+    if (test_output == input_buffer[i] - 6) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AP(cTaskContext* ctx) const //(X-7)
+double cTaskLib::Task_Math1in_AP(cTaskContext& ctx) const //(X-7)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == ctx->input_buffer[i] - 7) return 1.0;
+    if (test_output == input_buffer[i] - 7) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AA(cTaskContext* ctx) const //(sqrt(X+Y))
+double cTaskLib::Task_Math2in_AA(cTaskContext& ctx) const //(sqrt(X+Y))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == (int) sqrt((double) abs(ctx->input_buffer[i] + ctx->input_buffer[j])))
+      if (test_output == (int) sqrt((double) abs(input_buffer[i] + input_buffer[j])))
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AB(cTaskContext* ctx) const  //((X+Y)^2)
+double cTaskLib::Task_Math2in_AB(cTaskContext& ctx) const  //((X+Y)^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == (ctx->input_buffer[i] + ctx->input_buffer[j]) * 
-          (ctx->input_buffer[i] + ctx->input_buffer[j])) return 1.0;
+      if (test_output == (input_buffer[i] + input_buffer[j]) * 
+          (input_buffer[i] + input_buffer[j])) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AC(cTaskContext* ctx) const //(X%Y)
+double cTaskLib::Task_Math2in_AC(cTaskContext& ctx) const //(X%Y)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (ctx->input_buffer[j] == 0) continue; // mod by zero
-      if (test_output == ctx->input_buffer[i] % ctx->input_buffer[j]) return 1.0;
+      if (input_buffer[j] == 0) continue; // mod by zero
+      if (test_output == input_buffer[i] % input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AD(cTaskContext* ctx) const //(3X/2+5Y/4)
+double cTaskLib::Task_Math2in_AD(cTaskContext& ctx) const //(3X/2+5Y/4)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == 3 * ctx->input_buffer[i] / 2 + 5 * ctx->input_buffer[j] / 4)
+      if (test_output == 3 * input_buffer[i] / 2 + 5 * input_buffer[j] / 4)
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AE(cTaskContext* ctx) const //(abs(X-5)+abs(Y-6))
+double cTaskLib::Task_Math2in_AE(cTaskContext& ctx) const //(abs(X-5)+abs(Y-6))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == abs(ctx->input_buffer[i] - 5) + abs(ctx->input_buffer[j] - 6))
+      if (test_output == abs(input_buffer[i] - 5) + abs(input_buffer[j] - 6))
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AF(cTaskContext* ctx) const //(XY-X/Y)
+double cTaskLib::Task_Math2in_AF(cTaskContext& ctx) const //(XY-X/Y)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (ctx->input_buffer[j] == 0) continue;
-      if (0-INT_MAX > ctx->input_buffer[i] && ctx->input_buffer[j] == -1) continue;
-      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[j] - 
-          ctx->input_buffer[i] / ctx->input_buffer[j]) return 1.0;
+      if (input_buffer[j] == 0) continue;
+      if (0-INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
+      if (test_output == input_buffer[i] * input_buffer[j] - 
+          input_buffer[i] / input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AG(cTaskContext* ctx) const //((X-Y)^2)
+double cTaskLib::Task_Math2in_AG(cTaskContext& ctx) const //((X-Y)^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == (ctx->input_buffer[i] - ctx->input_buffer[j]) *
-          (ctx->input_buffer[i] - ctx->input_buffer[j])) return 1.0;
+      if (test_output == (input_buffer[i] - input_buffer[j]) *
+          (input_buffer[i] - input_buffer[j])) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AH(cTaskContext* ctx) const //(X^2+Y^2)
+double cTaskLib::Task_Math2in_AH(cTaskContext& ctx) const //(X^2+Y^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] +
-          ctx->input_buffer[j] * ctx->input_buffer[j]) return 1.0;
+      if (test_output == input_buffer[i] * input_buffer[i] +
+          input_buffer[j] * input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AI(cTaskContext* ctx) const //(X^2+Y^3)
+double cTaskLib::Task_Math2in_AI(cTaskContext& ctx) const //(X^2+Y^3)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] + ctx->input_buffer[j] * ctx->input_buffer[j] * ctx->input_buffer[j]) 
+      if (test_output == input_buffer[i] * input_buffer[i] + input_buffer[j] * input_buffer[j] * input_buffer[j]) 
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AJ(cTaskContext* ctx) const //((sqrt(X)+Y)/(X-7))
+double cTaskLib::Task_Math2in_AJ(cTaskContext& ctx) const //((sqrt(X)+Y)/(X-7))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (ctx->input_buffer[i] - 7 == 0) continue;
-      if (test_output == ((int) sqrt((double) abs(ctx->input_buffer[i])) + ctx->input_buffer[j]) / (ctx->input_buffer[i] - 7)) return 1.0;
+      if (input_buffer[i] - 7 == 0) continue;
+      if (test_output == ((int) sqrt((double) abs(input_buffer[i])) + input_buffer[j]) / (input_buffer[i] - 7)) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AK(cTaskContext* ctx) const //(log(|X/Y|))
+double cTaskLib::Task_Math2in_AK(cTaskContext& ctx) const //(log(|X/Y|))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
-      if (i == j || ctx->input_buffer[j] == 0 ) continue;
-      if (0-INT_MAX > ctx->input_buffer[i] && ctx->input_buffer[j] == -1) continue;
-      if (ctx->input_buffer[i] / ctx->input_buffer[j] == 0) continue;
-      if (test_output == (int) log((double) abs(ctx->input_buffer[i] / ctx->input_buffer[j])))
+      if (i == j || input_buffer[j] == 0 ) continue;
+      if (0-INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
+      if (input_buffer[i] / input_buffer[j] == 0) continue;
+      if (test_output == (int) log((double) abs(input_buffer[i] / input_buffer[j])))
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AL(cTaskContext* ctx) const //(log(|X|)/Y)
+double cTaskLib::Task_Math2in_AL(cTaskContext& ctx) const //(log(|X|)/Y)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
-      if (i == j || ctx->input_buffer[j] == 0) continue;
-      if (test_output == (int) log((double) abs(ctx->input_buffer[i])) / ctx->input_buffer[j])
+      if (i == j || input_buffer[j] == 0) continue;
+      if (test_output == (int) log((double) abs(input_buffer[i])) / input_buffer[j])
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AM(cTaskContext* ctx) const //(X/log(|Y|))
+double cTaskLib::Task_Math2in_AM(cTaskContext& ctx) const //(X/log(|Y|))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
-      if (i == j || log((double) abs(ctx->input_buffer[j])) == 0) continue;
-      if (0-INT_MAX > ctx->input_buffer[i] && log((double) abs(ctx->input_buffer[j])) == -1) continue;
-      if (test_output == ctx->input_buffer[i] / (int) log((double) abs(ctx->input_buffer[j])))
+      if (i == j || log((double) abs(input_buffer[j])) == 0) continue;
+      if (0-INT_MAX > input_buffer[i] && log((double) abs(input_buffer[j])) == -1) continue;
+      if (test_output == input_buffer[i] / (int) log((double) abs(input_buffer[j])))
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AN(cTaskContext* ctx) const //(X+Y)
+double cTaskLib::Task_Math2in_AN(cTaskContext& ctx) const //(X+Y)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == ctx->input_buffer[i] + ctx->input_buffer[j])
+      if (test_output == input_buffer[i] + input_buffer[j])
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AO(cTaskContext* ctx) const //(X-Y)
+double cTaskLib::Task_Math2in_AO(cTaskContext& ctx) const //(X-Y)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == ctx->input_buffer[i] - ctx->input_buffer[j])
+      if (test_output == input_buffer[i] - input_buffer[j])
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AP(cTaskContext* ctx) const //(X/Y)
+double cTaskLib::Task_Math2in_AP(cTaskContext& ctx) const //(X/Y)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
-      if (i == j || ctx->input_buffer[j] == 0) continue;
-      if (0 - INT_MAX > ctx->input_buffer[i] && ctx->input_buffer[j] == -1) continue;
-      if (test_output == ctx->input_buffer[i] / ctx->input_buffer[j])
+      if (i == j || input_buffer[j] == 0) continue;
+      if (0 - INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
+      if (test_output == input_buffer[i] / input_buffer[j])
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AQ(cTaskContext* ctx) const //(XY)
+double cTaskLib::Task_Math2in_AQ(cTaskContext& ctx) const //(XY)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[j])
+      if (test_output == input_buffer[i] * input_buffer[j])
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AR(cTaskContext* ctx) const //(sqrt(X)+sqrt(Y))
+double cTaskLib::Task_Math2in_AR(cTaskContext& ctx) const //(sqrt(X)+sqrt(Y))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == (int) sqrt((double) abs(ctx->input_buffer[i])) + (int) sqrt((double) abs(ctx->input_buffer[j])))
+      if (test_output == (int) sqrt((double) abs(input_buffer[i])) + (int) sqrt((double) abs(input_buffer[j])))
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AS(cTaskContext* ctx) const //(X+2Y)
+double cTaskLib::Task_Math2in_AS(cTaskContext& ctx) const //(X+2Y)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == ctx->input_buffer[i] + 2 * ctx->input_buffer[j])
+      if (test_output == input_buffer[i] + 2 * input_buffer[j])
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AT(cTaskContext* ctx) const //(X+3Y)
+double cTaskLib::Task_Math2in_AT(cTaskContext& ctx) const //(X+3Y)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == ctx->input_buffer[i] + 3 * ctx->input_buffer[j])
+      if (test_output == input_buffer[i] + 3 * input_buffer[j])
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AU(cTaskContext* ctx) const //(2X+3Y)
+double cTaskLib::Task_Math2in_AU(cTaskContext& ctx) const //(2X+3Y)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == 2 * ctx->input_buffer[i] + 3 * ctx->input_buffer[j])
+      if (test_output == 2 * input_buffer[i] + 3 * input_buffer[j])
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AV(cTaskContext* ctx) const //(XY^2)
+double cTaskLib::Task_Math2in_AV(cTaskContext& ctx) const //(XY^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[j] * ctx->input_buffer[j])
+      if (test_output == input_buffer[i] * input_buffer[j] * input_buffer[j])
         return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AA(cTaskContext* ctx) const //(X^2+Y^2+Z^2)
+double cTaskLib::Task_Math3in_AA(cTaskContext& ctx) const //(X^2+Y^2+Z^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] + 
-            ctx->input_buffer[j] * ctx->input_buffer[j] + 
-            ctx->input_buffer[k] * ctx->input_buffer[k]) return 1.0;
+        if (test_output == input_buffer[i] * input_buffer[i] + 
+            input_buffer[j] * input_buffer[j] + 
+            input_buffer[k] * input_buffer[k]) return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AB(cTaskContext* ctx) const //(sqrt(X)+sqrt(Y)+sqrt(Z))
+double cTaskLib::Task_Math3in_AB(cTaskContext& ctx) const //(sqrt(X)+sqrt(Y)+sqrt(Z))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (test_output == (int) sqrt((double) abs(ctx->input_buffer[i])) +
-            (int) sqrt((double) abs(ctx->input_buffer[j])) + (int) sqrt((double) abs(ctx->input_buffer[k])))
+        if (test_output == (int) sqrt((double) abs(input_buffer[i])) +
+            (int) sqrt((double) abs(input_buffer[j])) + (int) sqrt((double) abs(input_buffer[k])))
           return 1.0;
       }
     }
@@ -1556,31 +1600,33 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AC(cTaskContext* ctx) const //(X+2Y+3Z)
+double cTaskLib::Task_Math3in_AC(cTaskContext& ctx) const //(X+2Y+3Z)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (test_output == ctx->input_buffer[i] + 2 * ctx->input_buffer[j] +
-            3 * ctx->input_buffer[k]) return 1.0;
+        if (test_output == input_buffer[i] + 2 * input_buffer[j] +
+            3 * input_buffer[k]) return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AD(cTaskContext* ctx) const //(XY^2+Z^3)
+double cTaskLib::Task_Math3in_AD(cTaskContext& ctx) const //(XY^2+Z^3)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (test_output == ctx->input_buffer[i] * ctx->input_buffer[j] * ctx->input_buffer[j] + ctx->input_buffer[k] * ctx->input_buffer[k] * ctx->input_buffer[k])
+        if (test_output == input_buffer[i] * input_buffer[j] * input_buffer[j] + input_buffer[k] * input_buffer[k] * input_buffer[k])
           return 1.0;
       }
     }
@@ -1588,16 +1634,17 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AE(cTaskContext* ctx) const //((X%Y)*Z)
+double cTaskLib::Task_Math3in_AE(cTaskContext& ctx) const //((X%Y)*Z)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (ctx->input_buffer[j] == 0) continue; // mod by zero
-        if (test_output == ctx->input_buffer[i] % ctx->input_buffer[j] * ctx->input_buffer[k])
+        if (input_buffer[j] == 0) continue; // mod by zero
+        if (test_output == input_buffer[i] % input_buffer[j] * input_buffer[k])
           return 1.0;
       }
     }
@@ -1605,17 +1652,18 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AF(cTaskContext* ctx) const //((X+Y)^2+sqrt(Y+Z))
+double cTaskLib::Task_Math3in_AF(cTaskContext& ctx) const //((X+Y)^2+sqrt(Y+Z))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (test_output == (ctx->input_buffer[i] + ctx->input_buffer[j]) *
-            (ctx->input_buffer[i] + ctx->input_buffer[j]) +
-            (int) sqrt((double) abs(ctx->input_buffer[j] + ctx->input_buffer[k])))
+        if (test_output == (input_buffer[i] + input_buffer[j]) *
+            (input_buffer[i] + input_buffer[j]) +
+            (int) sqrt((double) abs(input_buffer[j] + input_buffer[k])))
           return 1.0;
       }
     }
@@ -1623,17 +1671,18 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AG(cTaskContext* ctx) const //((XY)%(YZ))
+double cTaskLib::Task_Math3in_AG(cTaskContext& ctx) const //((XY)%(YZ))
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        int mod_base = ctx->input_buffer[j] * ctx->input_buffer[k];
+        int mod_base = input_buffer[j] * input_buffer[k];
         if (mod_base == 0) continue;
-        if (test_output == (ctx->input_buffer[i] * ctx->input_buffer[j]) %
+        if (test_output == (input_buffer[i] * input_buffer[j]) %
             mod_base) return 1.0;
       }
     }
@@ -1641,15 +1690,16 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AH(cTaskContext* ctx) const //(X+Y+Z)
+double cTaskLib::Task_Math3in_AH(cTaskContext& ctx) const //(X+Y+Z)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (test_output == ctx->input_buffer[i] + ctx->input_buffer[j] + ctx->input_buffer[k])
+        if (test_output == input_buffer[i] + input_buffer[j] + input_buffer[k])
           return 1.0;
       }
     }
@@ -1657,15 +1707,16 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AI(cTaskContext* ctx) const //(-X-Y-Z)
+double cTaskLib::Task_Math3in_AI(cTaskContext& ctx) const //(-X-Y-Z)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (test_output == 0 - ctx->input_buffer[i] - ctx->input_buffer[j] - ctx->input_buffer[k])
+        if (test_output == 0 - input_buffer[i] - input_buffer[j] - input_buffer[k])
           return 1.0;
       }
     }
@@ -1673,15 +1724,16 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AJ(cTaskContext* ctx) const //((X-Y)^2+(Y-Z)^2+(Z-X)^2)
+double cTaskLib::Task_Math3in_AJ(cTaskContext& ctx) const //((X-Y)^2+(Y-Z)^2+(Z-X)^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (test_output == (ctx->input_buffer[i] - ctx->input_buffer[j]) * (ctx->input_buffer[i] - ctx->input_buffer[j]) + (ctx->input_buffer[j] - ctx->input_buffer[k]) * (ctx->input_buffer[j] - ctx->input_buffer[k]) + (ctx->input_buffer[k] - ctx->input_buffer[i]) * (ctx->input_buffer[k] - ctx->input_buffer[i]))
+        if (test_output == (input_buffer[i] - input_buffer[j]) * (input_buffer[i] - input_buffer[j]) + (input_buffer[j] - input_buffer[k]) * (input_buffer[j] - input_buffer[k]) + (input_buffer[k] - input_buffer[i]) * (input_buffer[k] - input_buffer[i]))
           return 1.0;
       }
     }
@@ -1689,15 +1741,16 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AK(cTaskContext* ctx) const //((X+Y)^2+(Y+Z)^2+(Z+X)^2)
+double cTaskLib::Task_Math3in_AK(cTaskContext& ctx) const //((X+Y)^2+(Y+Z)^2+(Z+X)^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;
-        if (test_output == (ctx->input_buffer[i] + ctx->input_buffer[j]) * (ctx->input_buffer[i] + ctx->input_buffer[j]) + (ctx->input_buffer[j] + ctx->input_buffer[k]) * (ctx->input_buffer[j] + ctx->input_buffer[k]) + (ctx->input_buffer[k] + ctx->input_buffer[i]) * (ctx->input_buffer[k] + ctx->input_buffer[i])) 
+        if (test_output == (input_buffer[i] + input_buffer[j]) * (input_buffer[i] + input_buffer[j]) + (input_buffer[j] + input_buffer[k]) * (input_buffer[j] + input_buffer[k]) + (input_buffer[k] + input_buffer[i]) * (input_buffer[k] + input_buffer[i])) 
           return 1.0;
       }
     }
@@ -1705,15 +1758,16 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AL(cTaskContext* ctx) const //((X-Y)^2+(X-Z)^2)
+double cTaskLib::Task_Math3in_AL(cTaskContext& ctx) const //((X-Y)^2+(X-Z)^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;  
-        if (test_output == (ctx->input_buffer[i] - ctx->input_buffer[j]) * (ctx->input_buffer[i] - ctx->input_buffer[j]) + (ctx->input_buffer[i] - ctx->input_buffer[k]) * (ctx->input_buffer[i] - ctx->input_buffer[k]))
+        if (test_output == (input_buffer[i] - input_buffer[j]) * (input_buffer[i] - input_buffer[j]) + (input_buffer[i] - input_buffer[k]) * (input_buffer[i] - input_buffer[k]))
           return 1.0;
       }
     }
@@ -1721,15 +1775,16 @@
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AM(cTaskContext* ctx) const //((X+Y)^2+(Y+Z)^2)
+double cTaskLib::Task_Math3in_AM(cTaskContext& ctx) const //((X+Y)^2+(Y+Z)^2)
 {
-  const int test_output = ctx->output_buffer[0];
-  const int input_size = ctx->input_buffer.GetNumStored();
+  const tBuffer<int>& input_buffer = ctx.GetInputBuffer();
+  const int test_output = ctx.GetOutputBuffer()[0];
+  const int input_size = input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
         if (i == j || j == k || i == k) continue;  
-        if (test_output == (ctx->input_buffer[i] + ctx->input_buffer[j]) * (ctx->input_buffer[i] + ctx->input_buffer[j]) + (ctx->input_buffer[i] + ctx->input_buffer[k]) * (ctx->input_buffer[i] + ctx->input_buffer[k]))
+        if (test_output == (input_buffer[i] + input_buffer[j]) * (input_buffer[i] + input_buffer[j]) + (input_buffer[i] + input_buffer[k]) * (input_buffer[i] + input_buffer[k]))
           return 1.0;
       }
     }
@@ -1737,14 +1792,14 @@
   return 0.0;
 }
 
-double cTaskLib::Task_MatchStr(cTaskContext* ctx) const
+double cTaskLib::Task_MatchStr(cTaskContext& ctx) const
 {
-	tBuffer<int> temp_buf(ctx->output_buffer);
+	tBuffer<int> temp_buf(ctx.GetOutputBuffer());
 	//	if (temp_buf[0] != 357913941) return 0;
 
 	//	temp_buf.Pop(); // pop the signal value off of the buffer
 
-	const cString& string_to_match = ctx->task_entry->GetArguments().GetString(0);
+	const cString& string_to_match = ctx.GetTaskEntry()->GetArguments().GetString(0);
 	int string_index;
 	int num_matched = 0;
 	int test_output;
@@ -1763,8 +1818,8 @@
 	}
 
 	bool used_received = false;
-	if (ctx->received_messages) {
-		tBuffer<int> received(*(ctx->received_messages));
+	if (ctx.GetReceivedMessages()) {
+		tBuffer<int> received(*(ctx.GetReceivedMessages()));
 		for (int i = 0; i < received.GetNumStored(); i++) {
 			test_output = received[i];
 			num_matched = 0;
@@ -1798,12 +1853,12 @@
 }
 
 
-double cTaskLib::Task_MatchNumber(cTaskContext* ctx) const
+double cTaskLib::Task_MatchNumber(cTaskContext& ctx) const
 {
   double quality = 0.0;
-  const cArgContainer& args = ctx->task_entry->GetArguments();
+  const cArgContainer& args = ctx.GetTaskEntry()->GetArguments();
 
-  int diff = abs(args.GetInt(0) - ctx->output_buffer[0]);
+  int diff = abs(args.GetInt(0) - ctx.GetOutputBuffer()[0]);
   int threshold = args.GetInt(1);
     
   if (threshold < 0 || diff <= abs(threshold)) { // Negative threshold == infinite
@@ -1816,11 +1871,11 @@
 }
 
 
-double cTaskLib::Task_CommEcho(cTaskContext* ctx) const
+double cTaskLib::Task_CommEcho(cTaskContext& ctx) const
 {
-  const int test_output = ctx->output_buffer[0];
+  const int test_output = ctx.GetOutputBuffer()[0];
 
-  tConstListIterator<tBuffer<int> > buff_it(ctx->other_input_buffers);  
+  tConstListIterator<tBuffer<int> > buff_it(ctx.GetNeighborhoodInputBuffers());  
   
   while (buff_it.Next() != NULL) {
     const tBuffer<int>& cur_buff = *(buff_it.Get());
@@ -1834,11 +1889,11 @@
 }
 
 
-double cTaskLib::Task_CommNot(cTaskContext* ctx) const
+double cTaskLib::Task_CommNot(cTaskContext& ctx) const
 {
-  const int test_output = ctx->output_buffer[0];
+  const int test_output = ctx.GetOutputBuffer()[0];
   
-  tConstListIterator<tBuffer<int> > buff_it(ctx->other_input_buffers);  
+  tConstListIterator<tBuffer<int> > buff_it(ctx.GetNeighborhoodInputBuffers());  
   
   while (buff_it.Next() != NULL) {
     const tBuffer<int>& cur_buff = *(buff_it.Get());
@@ -1852,14 +1907,14 @@
 }
 
 
-double cTaskLib::Task_NetSend(cTaskContext* ctx) const
+double cTaskLib::Task_NetSend(cTaskContext& ctx) const
 {
-  return 1.0 * ctx->net_completed;
+  return 1.0 * ctx.GetNetCompleted();
 }
 
 
-double cTaskLib::Task_NetReceive(cTaskContext* ctx) const
+double cTaskLib::Task_NetReceive(cTaskContext& ctx) const
 {
-  if (ctx->net_valid) return 1.0;
+  if (ctx.NetIsValid()) return 1.0;
   return 0.0;
 }

Modified: development/source/main/cTaskLib.h
===================================================================
--- development/source/main/cTaskLib.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/main/cTaskLib.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -65,7 +65,7 @@
   const cTaskEntry& GetTask(int id) const { return *(task_array[id]); }
   
   void SetupTests(cTaskContext& ctx) const;
-  inline double TestOutput(cTaskContext* ctx) const { return (this->*(ctx->task_entry->GetTestFun()))(ctx); }
+  inline double TestOutput(cTaskContext& ctx) const { return (this->*(ctx.GetTaskEntry()->GetTestFun()))(ctx); }
 
   bool UseNeighborInput() const { return use_neighbor_input; }
   bool UseNeighborOutput() const { return use_neighbor_output; }
@@ -76,159 +76,159 @@
 
   inline double FractionalReward(unsigned int supplied, unsigned int correct);  
 
-  double Task_Echo(cTaskContext* ctx) const;
-  double Task_Add(cTaskContext* ctx) const;
-  double Task_Sub(cTaskContext* ctx) const;
+  double Task_Echo(cTaskContext& ctx) const;
+  double Task_Add(cTaskContext& ctx) const;
+  double Task_Sub(cTaskContext& ctx) const;
 
   // All 1- and 2-Input Logic Functions
-  double Task_Not(cTaskContext* ctx) const;
-  double Task_Nand(cTaskContext* ctx) const;
-  double Task_And(cTaskContext* ctx) const;
-  double Task_OrNot(cTaskContext* ctx) const;
-  double Task_Or(cTaskContext* ctx) const;
-  double Task_AndNot(cTaskContext* ctx) const;
-  double Task_Nor(cTaskContext* ctx) const;
-  double Task_Xor(cTaskContext* ctx) const;
-  double Task_Equ(cTaskContext* ctx) const;
+  double Task_Not(cTaskContext& ctx) const;
+  double Task_Nand(cTaskContext& ctx) const;
+  double Task_And(cTaskContext& ctx) const;
+  double Task_OrNot(cTaskContext& ctx) const;
+  double Task_Or(cTaskContext& ctx) const;
+  double Task_AndNot(cTaskContext& ctx) const;
+  double Task_Nor(cTaskContext& ctx) const;
+  double Task_Xor(cTaskContext& ctx) const;
+  double Task_Equ(cTaskContext& ctx) const;
 
   // All 3-Input Logic Functions
-  double Task_Logic3in_AA(cTaskContext* ctx) const;
-  double Task_Logic3in_AB(cTaskContext* ctx) const;
-  double Task_Logic3in_AC(cTaskContext* ctx) const;
-  double Task_Logic3in_AD(cTaskContext* ctx) const;
-  double Task_Logic3in_AE(cTaskContext* ctx) const;
-  double Task_Logic3in_AF(cTaskContext* ctx) const;
-  double Task_Logic3in_AG(cTaskContext* ctx) const;
-  double Task_Logic3in_AH(cTaskContext* ctx) const;
-  double Task_Logic3in_AI(cTaskContext* ctx) const;
-  double Task_Logic3in_AJ(cTaskContext* ctx) const;
-  double Task_Logic3in_AK(cTaskContext* ctx) const;
-  double Task_Logic3in_AL(cTaskContext* ctx) const;
-  double Task_Logic3in_AM(cTaskContext* ctx) const;
-  double Task_Logic3in_AN(cTaskContext* ctx) const;
-  double Task_Logic3in_AO(cTaskContext* ctx) const;
-  double Task_Logic3in_AP(cTaskContext* ctx) const;
-  double Task_Logic3in_AQ(cTaskContext* ctx) const;
-  double Task_Logic3in_AR(cTaskContext* ctx) const;
-  double Task_Logic3in_AS(cTaskContext* ctx) const;
-  double Task_Logic3in_AT(cTaskContext* ctx) const;
-  double Task_Logic3in_AU(cTaskContext* ctx) const;
-  double Task_Logic3in_AV(cTaskContext* ctx) const;
-  double Task_Logic3in_AW(cTaskContext* ctx) const;
-  double Task_Logic3in_AX(cTaskContext* ctx) const;
-  double Task_Logic3in_AY(cTaskContext* ctx) const;
-  double Task_Logic3in_AZ(cTaskContext* ctx) const;
-  double Task_Logic3in_BA(cTaskContext* ctx) const;
-  double Task_Logic3in_BB(cTaskContext* ctx) const;
-  double Task_Logic3in_BC(cTaskContext* ctx) const;
-  double Task_Logic3in_BD(cTaskContext* ctx) const;
-  double Task_Logic3in_BE(cTaskContext* ctx) const;
-  double Task_Logic3in_BF(cTaskContext* ctx) const;
-  double Task_Logic3in_BG(cTaskContext* ctx) const;
-  double Task_Logic3in_BH(cTaskContext* ctx) const;
-  double Task_Logic3in_BI(cTaskContext* ctx) const;
-  double Task_Logic3in_BJ(cTaskContext* ctx) const;
-  double Task_Logic3in_BK(cTaskContext* ctx) const;
-  double Task_Logic3in_BL(cTaskContext* ctx) const;
-  double Task_Logic3in_BM(cTaskContext* ctx) const;
-  double Task_Logic3in_BN(cTaskContext* ctx) const;
-  double Task_Logic3in_BO(cTaskContext* ctx) const;
-  double Task_Logic3in_BP(cTaskContext* ctx) const;
-  double Task_Logic3in_BQ(cTaskContext* ctx) const;
-  double Task_Logic3in_BR(cTaskContext* ctx) const;
-  double Task_Logic3in_BS(cTaskContext* ctx) const;
-  double Task_Logic3in_BT(cTaskContext* ctx) const;
-  double Task_Logic3in_BU(cTaskContext* ctx) const;
-  double Task_Logic3in_BV(cTaskContext* ctx) const;
-  double Task_Logic3in_BW(cTaskContext* ctx) const;
-  double Task_Logic3in_BX(cTaskContext* ctx) const;
-  double Task_Logic3in_BY(cTaskContext* ctx) const;
-  double Task_Logic3in_BZ(cTaskContext* ctx) const;
-  double Task_Logic3in_CA(cTaskContext* ctx) const;
-  double Task_Logic3in_CB(cTaskContext* ctx) const;
-  double Task_Logic3in_CC(cTaskContext* ctx) const;
-  double Task_Logic3in_CD(cTaskContext* ctx) const;
-  double Task_Logic3in_CE(cTaskContext* ctx) const;
-  double Task_Logic3in_CF(cTaskContext* ctx) const;
-  double Task_Logic3in_CG(cTaskContext* ctx) const;
-  double Task_Logic3in_CH(cTaskContext* ctx) const;
-  double Task_Logic3in_CI(cTaskContext* ctx) const;
-  double Task_Logic3in_CJ(cTaskContext* ctx) const;
-  double Task_Logic3in_CK(cTaskContext* ctx) const;
-  double Task_Logic3in_CL(cTaskContext* ctx) const;
-  double Task_Logic3in_CM(cTaskContext* ctx) const;
-  double Task_Logic3in_CN(cTaskContext* ctx) const;
-  double Task_Logic3in_CO(cTaskContext* ctx) const;
-  double Task_Logic3in_CP(cTaskContext* ctx) const;
+  double Task_Logic3in_AA(cTaskContext& ctx) const;
+  double Task_Logic3in_AB(cTaskContext& ctx) const;
+  double Task_Logic3in_AC(cTaskContext& ctx) const;
+  double Task_Logic3in_AD(cTaskContext& ctx) const;
+  double Task_Logic3in_AE(cTaskContext& ctx) const;
+  double Task_Logic3in_AF(cTaskContext& ctx) const;
+  double Task_Logic3in_AG(cTaskContext& ctx) const;
+  double Task_Logic3in_AH(cTaskContext& ctx) const;
+  double Task_Logic3in_AI(cTaskContext& ctx) const;
+  double Task_Logic3in_AJ(cTaskContext& ctx) const;
+  double Task_Logic3in_AK(cTaskContext& ctx) const;
+  double Task_Logic3in_AL(cTaskContext& ctx) const;
+  double Task_Logic3in_AM(cTaskContext& ctx) const;
+  double Task_Logic3in_AN(cTaskContext& ctx) const;
+  double Task_Logic3in_AO(cTaskContext& ctx) const;
+  double Task_Logic3in_AP(cTaskContext& ctx) const;
+  double Task_Logic3in_AQ(cTaskContext& ctx) const;
+  double Task_Logic3in_AR(cTaskContext& ctx) const;
+  double Task_Logic3in_AS(cTaskContext& ctx) const;
+  double Task_Logic3in_AT(cTaskContext& ctx) const;
+  double Task_Logic3in_AU(cTaskContext& ctx) const;
+  double Task_Logic3in_AV(cTaskContext& ctx) const;
+  double Task_Logic3in_AW(cTaskContext& ctx) const;
+  double Task_Logic3in_AX(cTaskContext& ctx) const;
+  double Task_Logic3in_AY(cTaskContext& ctx) const;
+  double Task_Logic3in_AZ(cTaskContext& ctx) const;
+  double Task_Logic3in_BA(cTaskContext& ctx) const;
+  double Task_Logic3in_BB(cTaskContext& ctx) const;
+  double Task_Logic3in_BC(cTaskContext& ctx) const;
+  double Task_Logic3in_BD(cTaskContext& ctx) const;
+  double Task_Logic3in_BE(cTaskContext& ctx) const;
+  double Task_Logic3in_BF(cTaskContext& ctx) const;
+  double Task_Logic3in_BG(cTaskContext& ctx) const;
+  double Task_Logic3in_BH(cTaskContext& ctx) const;
+  double Task_Logic3in_BI(cTaskContext& ctx) const;
+  double Task_Logic3in_BJ(cTaskContext& ctx) const;
+  double Task_Logic3in_BK(cTaskContext& ctx) const;
+  double Task_Logic3in_BL(cTaskContext& ctx) const;
+  double Task_Logic3in_BM(cTaskContext& ctx) const;
+  double Task_Logic3in_BN(cTaskContext& ctx) const;
+  double Task_Logic3in_BO(cTaskContext& ctx) const;
+  double Task_Logic3in_BP(cTaskContext& ctx) const;
+  double Task_Logic3in_BQ(cTaskContext& ctx) const;
+  double Task_Logic3in_BR(cTaskContext& ctx) const;
+  double Task_Logic3in_BS(cTaskContext& ctx) const;
+  double Task_Logic3in_BT(cTaskContext& ctx) const;
+  double Task_Logic3in_BU(cTaskContext& ctx) const;
+  double Task_Logic3in_BV(cTaskContext& ctx) const;
+  double Task_Logic3in_BW(cTaskContext& ctx) const;
+  double Task_Logic3in_BX(cTaskContext& ctx) const;
+  double Task_Logic3in_BY(cTaskContext& ctx) const;
+  double Task_Logic3in_BZ(cTaskContext& ctx) const;
+  double Task_Logic3in_CA(cTaskContext& ctx) const;
+  double Task_Logic3in_CB(cTaskContext& ctx) const;
+  double Task_Logic3in_CC(cTaskContext& ctx) const;
+  double Task_Logic3in_CD(cTaskContext& ctx) const;
+  double Task_Logic3in_CE(cTaskContext& ctx) const;
+  double Task_Logic3in_CF(cTaskContext& ctx) const;
+  double Task_Logic3in_CG(cTaskContext& ctx) const;
+  double Task_Logic3in_CH(cTaskContext& ctx) const;
+  double Task_Logic3in_CI(cTaskContext& ctx) const;
+  double Task_Logic3in_CJ(cTaskContext& ctx) const;
+  double Task_Logic3in_CK(cTaskContext& ctx) const;
+  double Task_Logic3in_CL(cTaskContext& ctx) const;
+  double Task_Logic3in_CM(cTaskContext& ctx) const;
+  double Task_Logic3in_CN(cTaskContext& ctx) const;
+  double Task_Logic3in_CO(cTaskContext& ctx) const;
+  double Task_Logic3in_CP(cTaskContext& ctx) const;
 
   // Arbitrary 1-Input Math Tasks
-  double Task_Math1in_AA(cTaskContext* ctx) const;
-  double Task_Math1in_AB(cTaskContext* ctx) const;
-  double Task_Math1in_AC(cTaskContext* ctx) const;
-  double Task_Math1in_AD(cTaskContext* ctx) const;
-  double Task_Math1in_AE(cTaskContext* ctx) const;
-  double Task_Math1in_AF(cTaskContext* ctx) const;
-  double Task_Math1in_AG(cTaskContext* ctx) const;
-  double Task_Math1in_AH(cTaskContext* ctx) const;
-  double Task_Math1in_AI(cTaskContext* ctx) const;
-  double Task_Math1in_AJ(cTaskContext* ctx) const;
-  double Task_Math1in_AK(cTaskContext* ctx) const;
-  double Task_Math1in_AL(cTaskContext* ctx) const;
-  double Task_Math1in_AM(cTaskContext* ctx) const;
-  double Task_Math1in_AN(cTaskContext* ctx) const;
-  double Task_Math1in_AO(cTaskContext* ctx) const;
-  double Task_Math1in_AP(cTaskContext* ctx) const;
+  double Task_Math1in_AA(cTaskContext& ctx) const;
+  double Task_Math1in_AB(cTaskContext& ctx) const;
+  double Task_Math1in_AC(cTaskContext& ctx) const;
+  double Task_Math1in_AD(cTaskContext& ctx) const;
+  double Task_Math1in_AE(cTaskContext& ctx) const;
+  double Task_Math1in_AF(cTaskContext& ctx) const;
+  double Task_Math1in_AG(cTaskContext& ctx) const;
+  double Task_Math1in_AH(cTaskContext& ctx) const;
+  double Task_Math1in_AI(cTaskContext& ctx) const;
+  double Task_Math1in_AJ(cTaskContext& ctx) const;
+  double Task_Math1in_AK(cTaskContext& ctx) const;
+  double Task_Math1in_AL(cTaskContext& ctx) const;
+  double Task_Math1in_AM(cTaskContext& ctx) const;
+  double Task_Math1in_AN(cTaskContext& ctx) const;
+  double Task_Math1in_AO(cTaskContext& ctx) const;
+  double Task_Math1in_AP(cTaskContext& ctx) const;
 
   // Arbitrary 2-Input Math Tasks
-  double Task_Math2in_AA(cTaskContext* ctx) const;
-  double Task_Math2in_AB(cTaskContext* ctx) const;
-  double Task_Math2in_AC(cTaskContext* ctx) const;
-  double Task_Math2in_AD(cTaskContext* ctx) const;
-  double Task_Math2in_AE(cTaskContext* ctx) const;
-  double Task_Math2in_AF(cTaskContext* ctx) const;
-  double Task_Math2in_AG(cTaskContext* ctx) const;
-  double Task_Math2in_AH(cTaskContext* ctx) const;
-  double Task_Math2in_AI(cTaskContext* ctx) const;
-  double Task_Math2in_AJ(cTaskContext* ctx) const;
-  double Task_Math2in_AK(cTaskContext* ctx) const;
-  double Task_Math2in_AL(cTaskContext* ctx) const;
-  double Task_Math2in_AM(cTaskContext* ctx) const;
-  double Task_Math2in_AN(cTaskContext* ctx) const;
-  double Task_Math2in_AO(cTaskContext* ctx) const;
-  double Task_Math2in_AP(cTaskContext* ctx) const;
-  double Task_Math2in_AQ(cTaskContext* ctx) const;
-  double Task_Math2in_AR(cTaskContext* ctx) const;
-  double Task_Math2in_AS(cTaskContext* ctx) const;
-  double Task_Math2in_AT(cTaskContext* ctx) const;
-  double Task_Math2in_AU(cTaskContext* ctx) const;
-  double Task_Math2in_AV(cTaskContext* ctx) const;
+  double Task_Math2in_AA(cTaskContext& ctx) const;
+  double Task_Math2in_AB(cTaskContext& ctx) const;
+  double Task_Math2in_AC(cTaskContext& ctx) const;
+  double Task_Math2in_AD(cTaskContext& ctx) const;
+  double Task_Math2in_AE(cTaskContext& ctx) const;
+  double Task_Math2in_AF(cTaskContext& ctx) const;
+  double Task_Math2in_AG(cTaskContext& ctx) const;
+  double Task_Math2in_AH(cTaskContext& ctx) const;
+  double Task_Math2in_AI(cTaskContext& ctx) const;
+  double Task_Math2in_AJ(cTaskContext& ctx) const;
+  double Task_Math2in_AK(cTaskContext& ctx) const;
+  double Task_Math2in_AL(cTaskContext& ctx) const;
+  double Task_Math2in_AM(cTaskContext& ctx) const;
+  double Task_Math2in_AN(cTaskContext& ctx) const;
+  double Task_Math2in_AO(cTaskContext& ctx) const;
+  double Task_Math2in_AP(cTaskContext& ctx) const;
+  double Task_Math2in_AQ(cTaskContext& ctx) const;
+  double Task_Math2in_AR(cTaskContext& ctx) const;
+  double Task_Math2in_AS(cTaskContext& ctx) const;
+  double Task_Math2in_AT(cTaskContext& ctx) const;
+  double Task_Math2in_AU(cTaskContext& ctx) const;
+  double Task_Math2in_AV(cTaskContext& ctx) const;
 
   // Arbitrary 3-Input Math Tasks
-  double Task_Math3in_AA(cTaskContext* ctx) const;
-  double Task_Math3in_AB(cTaskContext* ctx) const;
-  double Task_Math3in_AC(cTaskContext* ctx) const;
-  double Task_Math3in_AD(cTaskContext* ctx) const;
-  double Task_Math3in_AE(cTaskContext* ctx) const;
-  double Task_Math3in_AF(cTaskContext* ctx) const;
-  double Task_Math3in_AG(cTaskContext* ctx) const;
-  double Task_Math3in_AH(cTaskContext* ctx) const;
-  double Task_Math3in_AI(cTaskContext* ctx) const;
-  double Task_Math3in_AJ(cTaskContext* ctx) const;
-  double Task_Math3in_AK(cTaskContext* ctx) const;
-  double Task_Math3in_AL(cTaskContext* ctx) const;
-  double Task_Math3in_AM(cTaskContext* ctx) const;
+  double Task_Math3in_AA(cTaskContext& ctx) const;
+  double Task_Math3in_AB(cTaskContext& ctx) const;
+  double Task_Math3in_AC(cTaskContext& ctx) const;
+  double Task_Math3in_AD(cTaskContext& ctx) const;
+  double Task_Math3in_AE(cTaskContext& ctx) const;
+  double Task_Math3in_AF(cTaskContext& ctx) const;
+  double Task_Math3in_AG(cTaskContext& ctx) const;
+  double Task_Math3in_AH(cTaskContext& ctx) const;
+  double Task_Math3in_AI(cTaskContext& ctx) const;
+  double Task_Math3in_AJ(cTaskContext& ctx) const;
+  double Task_Math3in_AK(cTaskContext& ctx) const;
+  double Task_Math3in_AL(cTaskContext& ctx) const;
+  double Task_Math3in_AM(cTaskContext& ctx) const;
   
   // Matching Tasks
-  double Task_MatchStr(cTaskContext* ctx) const;
-  double Task_MatchNumber(cTaskContext* ctx) const;
+  double Task_MatchStr(cTaskContext& ctx) const;
+  double Task_MatchNumber(cTaskContext& ctx) const;
 
   // Communication Tasks
-  double Task_CommEcho(cTaskContext* ctx) const;
-  double Task_CommNot(cTaskContext* ctx) const;
+  double Task_CommEcho(cTaskContext& ctx) const;
+  double Task_CommNot(cTaskContext& ctx) const;
   
   // Network Tasks
-  double Task_NetSend(cTaskContext* ctx) const;
-  double Task_NetReceive(cTaskContext* ctx) const;
+  double Task_NetSend(cTaskContext& ctx) const;
+  double Task_NetReceive(cTaskContext& ctx) const;
 };
 
 

Modified: development/source/tools/tBuffer.h
===================================================================
--- development/source/tools/tBuffer.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/tools/tBuffer.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -60,19 +60,20 @@
     data[offset] = in_value;
     total++;
     offset++;
-    while (offset >= data.GetSize()) offset -= data.GetSize();
+    offset %= data.GetSize();
   }
 
-  void Pop(){
+  void Pop()
+  {
 	  total--;
 	  offset--;
-	  while (offset < 0) offset += data.GetSize();
+	  if (offset < 0) offset += data.GetSize();
   }
 
   T operator[](int i) const
   {
     int index = offset - i - 1;
-    while (index < 0)  index += data.GetSize();
+    if (index < 0)  index += data.GetSize();
     return data[index];
   }
 
@@ -81,6 +82,7 @@
   int GetNumStored() const { return (total <= data.GetSize()) ? total : data.GetSize(); }
   int GetNum() const { return total - last_total; }
 
+  
   template<class Archive>
   void serialize(Archive & a, const unsigned int version){
     a.ArkvObj("data", data);

Modified: development/source/tools/tMemTrack.h
===================================================================
--- development/source/tools/tMemTrack.h	2006-12-12 05:25:39 UTC (rev 1139)
+++ development/source/tools/tMemTrack.h	2006-12-13 01:46:56 UTC (rev 1140)
@@ -67,7 +67,9 @@
   tMemTrack(const tMemTrack &){ Instances(1); }
   ~tMemTrack(){ Instances(-1); }
 public:
-  static int Instances(int count = 0){
+  // @DMB - Note: This method is not thread safe.  Instance count may become
+  //              inaccurate during threaded execution.
+  static int Instances(int count = 0) {
     static int s_instances = 0;
     return s_instances += count;
   }




More information about the Avida-cvs mailing list