mirror of
https://github.com/nasa/trick.git
synced 2025-06-22 16:58:57 +00:00
Split test sims and fun sims into separate directories.
Moved more sims into the test directory. refs #191
This commit is contained in:
@ -0,0 +1,39 @@
|
||||
/*
|
||||
PURPOSE:
|
||||
( InputProcessor "Sim object" )
|
||||
PROGRAMMERS:
|
||||
(((Alex Lin) (NASA) (2009)))
|
||||
LIBRARY_DEPENDENCIES:
|
||||
((../src/InputProcessSimObject.cpp))
|
||||
*/
|
||||
|
||||
#ifndef INPUTPROCESSSIMOBJECT_HH
|
||||
#define INPUTPROCESSSIMOBJECT_HH
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "sim_services/SimObject/include/SimObject.hh"
|
||||
|
||||
namespace Trick {
|
||||
|
||||
class InputProcessSimObject : public SimObject {
|
||||
|
||||
public:
|
||||
|
||||
std::string python_call_function ;
|
||||
int return_value ;
|
||||
|
||||
InputProcessSimObject( std::string ) ;
|
||||
|
||||
/* call_function hand coded for jobs to be called by scheduler */
|
||||
virtual int call_function( Trick::JobData * curr_job ) ;
|
||||
virtual double call_function_double( Trick::JobData * curr_job ) ;
|
||||
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,31 @@
|
||||
|
||||
#include <Python.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "InputProcessSimObject/include/InputProcessSimObject.hh"
|
||||
|
||||
Trick::InputProcessSimObject::InputProcessSimObject(std::string in_function) {
|
||||
|
||||
python_call_function = in_function ;
|
||||
return_value = 0 ;
|
||||
|
||||
}
|
||||
|
||||
int Trick::InputProcessSimObject::call_function( Trick::JobData * curr_job ) {
|
||||
|
||||
std::stringstream ss ;
|
||||
|
||||
ss << python_call_function << "(" << curr_job->id << ")" ;
|
||||
PyRun_SimpleString(ss.str().c_str()) ;
|
||||
|
||||
return( return_value ) ;
|
||||
}
|
||||
|
||||
double Trick::InputProcessSimObject::call_function_double( Trick::JobData * curr_job ) {
|
||||
|
||||
(void)curr_job ;
|
||||
return(0.0) ;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user