MOOSE - Multiscale Object Oriented Simulation Environment
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
ProcOpFunc.h
Go to the documentation of this file.
1
/**********************************************************************
2
** This program is part of 'MOOSE', the
3
** Messaging Object Oriented Simulation Environment.
4
** Copyright (C) 2003-2009 Upinder S. Bhalla. and NCBS
5
** It is made available under the terms of the
6
** GNU Lesser General Public License version 2.1
7
** See the file COPYING.LIB for the full notice.
8
**********************************************************************/
9
10
#ifndef _PROC_OPFUNC_H
11
#define _PROC_OPFUNC_H
12
18
/*
19
class ProcOpFuncBase: public OpFunc
20
{
21
public:
22
// This key extra function does Process calls.
23
virtual void proc( char* obj, const Eref& e, ProcPtr p ) const = 0;
24
private:
25
};
26
27
template< class T > class ProcOpFunc: public ProcOpFuncBase
28
{
29
public:
30
ProcOpFunc( void ( T::*func )( const Eref& e, ProcPtr ) )
31
: func_( func )
32
{;}
33
34
bool checkFinfo( const Finfo* s ) const {
35
return dynamic_cast< const SrcFinfo1< ProcPtr >* >( s );
36
}
37
38
bool checkSet( const SetGet* s ) const {
39
return dynamic_cast< const SetGet1< ProcPtr >* >( s );
40
}
41
42
bool strSet( const Eref& tgt,
43
const string& field, const string& arg ) const {
44
ProcInfo p;
45
stringstream ss( arg );
46
double dt = 1;
47
ss >> dt;
48
if ( dt <= 0 )
49
dt = 1;
50
p.dt = dt;
51
return SetGet1< ProcPtr >::set( tgt.objId(), field, &p );
52
}
53
54
void op( const Eref& e, const double* buf ) const {
55
Conv< ProcPtr > arg1( buf );
56
(reinterpret_cast< T* >( e.data() )->*func_)( e, *arg1 ) ;
57
}
58
59
60
// This key extra function does Process calls.
61
void proc( char* obj, const Eref& e, ProcPtr p ) const {
62
( reinterpret_cast< T* >( obj )->*func_)( e, p );
63
}
64
65
string rttiType() const {
66
return "void";
67
}
68
69
private:
70
void ( T::*func_ )( const Eref& e, ProcPtr );
71
};
72
*/
73
template
<
class
T >
class
ProcOpFunc
:
public
EpFunc1
< T, ProcPtr >
74
{
75
public
:
76
ProcOpFunc
(
void
( T::*func )(
const
Eref
& e,
ProcPtr
) )
77
:
EpFunc1
< T,
ProcPtr
>( func )
78
{;}
79
80
string
rttiType
()
const
{
81
return
"const ProcInfo*"
;
82
}
83
};
84
85
#endif //_PROC_OPFUNC_H
EpFunc1
Definition:
EpFunc.h:64
ProcOpFunc::rttiType
string rttiType() const
Definition:
ProcOpFunc.h:80
ProcInfo
Definition:
ProcInfo.h:12
Eref
Definition:
Eref.h:26
ProcOpFunc::ProcOpFunc
ProcOpFunc(void(T::*func)(const Eref &e, ProcPtr))
Definition:
ProcOpFunc.h:76
ProcOpFunc
Definition:
ProcOpFunc.h:73
moose-core
basecode
ProcOpFunc.h
Generated on Tue Sep 4 2018 09:05:31 for MOOSE - Multiscale Object Oriented Simulation Environment by
1.8.6