| E-Cell Simulation Environment Version 3.1.100 User's Manual (Draft: Dec. 18, 2003) | ||
|---|---|---|
| Prev | Chapter 6. Creating New Object Classes | Next |
To define a new Process class,
at least fire() and
initialize() methods must be defined.
VariableReference, VariableReferenceVector
Example 6-2. SimpleProcess.cpp
#include "libecs.hpp"
#include "Process.hpp"
#include "PropertySlotMaker.hpp"
5
USE_LIBECS;
LIBECS_DM_CLASS( SimpleProcess, Process )
{
10
public:
LIBECS_DM_OBJECT( SimpleFluxProcess, Process )
{
15 PROPERTYSLOT_SET_GET( Real, k );
}
SimpleProcess()
:
20 k( 0.0 )
{
; // do nothing
}
25 SIMPLE_SET_GET_METHOD( Real, k );
virtual void initialize()
{
Process::initialize();
30 S0 = getVariableReference( "S0" );
}
virtual void fire()
{
35 setFlux( k * S0.getConcentration() );
}
protected:
40 Real k;
VariableReference S0;
};
LIBECS_DM_INIT( SimpleProcess, Process );
45