-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathOpFuncBase.cpp
71 lines (63 loc) · 1.67 KB
/
OpFuncBase.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**********************************************************************
** This program is part of 'MOOSE', the
** Messaging Object Oriented Simulation Environment.
** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS
** It is made available under the terms of the
** GNU Lesser General Public License version 2.1
** See the file COPYING.LIB for the full notice.
**********************************************************************/
#include "header.h"
#include "HopFunc.h"
const unsigned char MooseSendHop = 0;
const unsigned char MooseSetHop = 1;
const unsigned char MooseSetVecHop = 2;
const unsigned char MooseGetHop = 4;
const unsigned char MooseGetVecHop = 5;
const unsigned char MooseReturnHop = 8;
const unsigned char MooseTestHop = 255;
vector< OpFunc* >& OpFunc::ops()
{
static vector< OpFunc* > op;
return op;
}
OpFunc::OpFunc()
{
opIndex_ = ops().size();
ops().push_back( this );
}
const OpFunc* OpFunc0Base::makeHopFunc( HopIndex hopIndex ) const
{
return new HopFunc0( hopIndex );
}
void OpFunc0Base::opBuffer( const Eref& e, double* buf ) const
{
op( e );
}
const OpFunc* OpFunc::lookop( unsigned int opIndex )
{
assert ( opIndex < ops().size() );
return ops()[ opIndex ];
}
// Static function
unsigned int OpFunc::rebuildOpIndex()
{
for( vector< OpFunc* >::iterator
i = ops().begin(); i != ops().end(); ++i ) {
(*i)->opIndex_ = ~0U;
}
return ops().size();
}
bool OpFunc::setIndex( unsigned int i ) // Should only be called by Cinfo.
{
if( opIndex_ == ~0U ) {
opIndex_ = i;
ops()[i] = this;
return true;
}
/*
cout << " OpFunc " << rttiType() <<
" already setup. (old,new) index = (" <<
opIndex_ << ", " << i << " )\n";
*/
return false;
}