MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SetGet Class Referenceabstract

#include <SetGet.h>

+ Inheritance diagram for SetGet:
+ Collaboration diagram for SetGet:

Public Member Functions

virtual bool checkOpClass (const OpFunc *op) const =0
 
 SetGet ()
 
virtual ~SetGet ()
 

Static Public Member Functions

static const OpFunccheckSet (const string &field, ObjId &tgt, FuncId &fid)
 
static const vector< double * > * dispatchGet (const ObjId &tgt, FuncId tgtFid, const double *arg, unsigned int size)
 Sends out request for data, and awaits its return. More...
 
static bool strGet (const ObjId &tgt, const string &field, string &ret)
 
static bool strSet (const ObjId &dest, const string &field, const string &val)
 

Detailed Description

Definition at line 50 of file SetGet.h.

Constructor & Destructor Documentation

SetGet::SetGet ( )
inline

Definition at line 53 of file SetGet.h.

54  {;}
virtual SetGet::~SetGet ( )
inlinevirtual

Definition at line 56 of file SetGet.h.

57  {;}

Member Function Documentation

virtual bool SetGet::checkOpClass ( const OpFunc op) const
pure virtual

Implemented in SetGet1< A >, and SetGet0.

const OpFunc * SetGet::checkSet ( const string &  field,
ObjId tgt,
FuncId fid 
)
static

Utility function to check that the target field matches this source type, to look up and pass back the fid, and to return the number of targetEntries. Tgt is passed in as the destination ObjId. May be changed inside, if the function determines that it should be directed to a child Element acting as a Value. Checks arg # and types for a 'set' call. Can be zero to 3 args. Returns # of tgts if good. This is 0 if bad. Passes back found fid.

Definition at line 15 of file SetGet.cpp.

References Neutral::child(), Element::cinfo(), ObjId::dataIndex, ObjId::element(), Id::element(), ObjId::eref(), ObjId::fieldIndex, Cinfo::findFinfo(), DestFinfo::getFid(), DestFinfo::getOpFunc(), ObjId::id, ObjId::isDataHere(), Element::numData(), and Id::path().

Referenced by Field< A >::get(), LookupField< L, A >::get(), Field< A >::getVec(), LookupField< L, A >::getVec(), SetGet0::set(), SetGet1< A >::set(), SetGet2< L, A >::set(), SetGet3< A1, A2, A3 >::set(), SetGet4< A1, A2, A3, A4 >::set(), SetGet5< A1, A2, A3, A4, A5 >::set(), SetGet6< A1, A2, A3, A4, A5, A6 >::set(), SetGet1< A >::setVec(), and SetGet2< L, A >::setVec().

17 {
18  // string field = "set_" + destField;
19  const Finfo* f = tgt.element()->cinfo()->findFinfo( field );
20  if ( !f ) { // Could be a child element? Note that field name will
21  // change from set_<name> to just <name>
22  string f2 = field.substr( 3 );
23  Id child = Neutral::child( tgt.eref(), f2 );
24  if ( child == Id() ) {
25  cout << "Error: SetGet:checkSet:: No field or child named '" <<
26  field << "' was found on\n" << tgt.id.path() << endl;
27  } else {
28  if ( field.substr( 0, 3 ) == "set" )
29  f = child.element()->cinfo()->findFinfo( "setThis" );
30  else if ( field.substr( 0, 3 ) == "get" )
31  f = child.element()->cinfo()->findFinfo( "getThis" );
32  assert( f ); // should always work as Neutral has the field.
33  if ( child.element()->numData() == tgt.element()->numData() ) {
34  tgt = ObjId( child, tgt.dataIndex, tgt.fieldIndex );
35  if ( !tgt.isDataHere() )
36  return 0;
37  } else if ( child.element()->numData() <= 1 ) {
38  tgt = ObjId( child, 0 );
39  if ( !tgt.isDataHere() )
40  return 0;
41  } else {
42  cout << "SetGet::checkSet: child index mismatch\n";
43  return 0;
44  }
45  }
46  }
47 
48  const DestFinfo* df = dynamic_cast< const DestFinfo* >( f );
49  if ( !df )
50  return 0;
51 
52  fid = df->getFid();
53  const OpFunc* func = df->getOpFunc();
54  assert( func );
55  return func;
56 
57  /*
58  // This is the crux of the function: typecheck for the field.
59  // if ( func->checkSet( this ) )
60  if ( checkOpClass( func ) ) {
61  return func;
62  } else {
63  cout << "set::Type mismatch" << oid_ << "." << field << endl;
64  return 0;
65  }
66  */
67 }
unsigned int fieldIndex
Definition: ObjId.h:100
Element * element() const
Synonym for Id::operator()()
Definition: Id.cpp:113
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
Id id
Definition: ObjId.h:98
static Id child(const Eref &e, const string &name)
Definition: Neutral.cpp:665
Definition: ObjId.h:20
bool isDataHere() const
Definition: ObjId.cpp:95
FuncId getFid() const
Definition: DestFinfo.cpp:45
const Cinfo * cinfo() const
Definition: Element.cpp:66
virtual unsigned int numData() const =0
Returns number of data entries across all nodes.
const OpFunc * getOpFunc() const
Definition: DestFinfo.cpp:40
Element * element() const
Definition: ObjId.cpp:124
Eref eref() const
Definition: ObjId.cpp:66
Definition: Id.h:17
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
unsigned int dataIndex
Definition: ObjId.h:99
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static const vector< double* >* SetGet::dispatchGet ( const ObjId tgt,
FuncId  tgtFid,
const double *  arg,
unsigned int  size 
)
static

Sends out request for data, and awaits its return.

bool SetGet::strGet ( const ObjId tgt,
const string &  field,
string &  ret 
)
static

Blocking 'get' call, returning into a string. There is a matching 'get<T> call, returning appropriate type.

Definition at line 72 of file SetGet.cpp.

References Element::cinfo(), ObjId::element(), ObjId::eref(), Cinfo::findFinfo(), Element::getName(), Shell::myNode(), and Finfo::strGet().

Referenced by testStrGet(), and wildcardFieldComparison().

73 {
74  const Finfo* f = tgt.element()->cinfo()->findFinfo( field );
75  if ( !f ) {
76  cout << Shell::myNode() << ": Error: SetGet::strGet: Field " <<
77  field << " not found on Element " << tgt.element()->getName() <<
78  endl;
79  return 0;
80  }
81  return f->strGet( tgt.eref(), field, ret );
82 }
virtual bool strGet(const Eref &tgt, const string &field, string &returnValue) const =0
const Cinfo * cinfo() const
Definition: Element.cpp:66
Element * element() const
Definition: ObjId.cpp:124
Eref eref() const
Definition: ObjId.cpp:66
static unsigned int myNode()
const string & getName() const
Definition: Element.cpp:56
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SetGet::strSet ( const ObjId dest,
const string &  field,
const string &  val 
)
static

Blocking 'set' call, using automatic string conversion There is a matching blocking set call with typed arguments.

Definition at line 84 of file SetGet.cpp.

References Element::cinfo(), ObjId::element(), ObjId::eref(), Cinfo::findFinfo(), Element::getName(), Shell::myNode(), and Finfo::strSet().

Referenced by testStrSet().

85 {
86  const Finfo* f = tgt.element()->cinfo()->findFinfo( field );
87  if ( !f ) {
88  cout << Shell::myNode() << ": Error: SetGet::strSet: Field " <<
89  field << " not found on Element " << tgt.element()->getName() <<
90  endl;
91  return 0;
92  }
93  return f->strSet( tgt.eref(), field, v );
94 }
virtual bool strSet(const Eref &tgt, const string &field, const string &arg) const =0
static unsigned int myNode()
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following files: