MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Finfo.cpp
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 #include <typeinfo>
11 #include "header.h"
12 
13 Finfo::Finfo( const string& name, const string& doc )
14  : name_( name ), doc_( doc )
15 {
16  ;
17 }
18 
20 // MOOSE class functions
22 
24 {
26  "fieldName",
27  "Name of field handled by Finfo",
29  );
30 
32  "docs",
33  "Documentation for Finfo",
35  );
36 
38  "type",
39  "RTTI type info for this Finfo",
41  );
42 
44  "src",
45  "Subsidiary SrcFinfos. Useful for SharedFinfos",
47  );
49  "dest",
50  "Subsidiary DestFinfos. Useful for SharedFinfos",
52  );
53 
54 
55  static Finfo* finfoFinfos[] =
56  {
57  &fieldName, // ReadOnlyValue
58  &docs, // ReadOnlyValue
59  &type, // ReadOnlyValue
60  &src, // ReadOnlyValue
61  &dest, // ReadOnlyValue
62  };
63 
64  static Dinfo< Finfo* > dinfo;
65  static Cinfo finfoCinfo (
66  "Finfo",
68  finfoFinfos,
69  sizeof( finfoFinfos ) / sizeof( Finfo* ),
70  &dinfo
71  );
72 
73  return &finfoCinfo;
74 }
75 
76 static const Cinfo* finfoCinfo = Finfo::initCinfo();
77 
79 
80 const string& Finfo::name( ) const
81 {
82  return name_;
83 }
84 
85 const string& Finfo::docs( ) const
86 {
87  return doc_;
88 }
89 
91 // Needed to access as a MOOSE field. Note that the Finfo is stored as a ptr
92 string FinfoWrapper::getName( ) const
93 {
94  return f_->name();
95 }
96 
97 string FinfoWrapper::docs( ) const
98 {
99  return f_->docs();
100 }
101 
102 
103 string FinfoWrapper::type( ) const
104 {
105  return f_->rttiType();
106 }
107 
108 vector< string > FinfoWrapper::src( ) const
109 {
110  return f_->innerSrc();
111 }
112 
113 vector< string > FinfoWrapper::dest( ) const
114 {
115  return f_->innerDest();
116 }
117 
118 
119 // Default virtual functions.
120 string Finfo::rttiType() const
121 {
122  return typeid( *this ).name();
123 }
124 
125 vector< string > Finfo::innerSrc() const
126 {
127  static vector< string > ret;
128  return ret;
129 }
130 
131 vector< string > Finfo::innerDest() const
132 {
133  static vector< string > ret;
134  return ret;
135 }
string getName() const
Definition: Finfo.cpp:92
Definition: Dinfo.h:60
virtual string rttiType() const
Definition: Finfo.cpp:120
const string & name() const
Definition: Finfo.cpp:80
string name_
Definition: Finfo.h:146
vector< string > dest() const
Definition: Finfo.cpp:113
vector< string > src() const
Definition: Finfo.cpp:108
const string & docs() const
Returns documentation string.
Definition: Finfo.cpp:85
static const Cinfo * initCinfo()
Definition: Finfo.cpp:23
string docs() const
Definition: Finfo.cpp:97
const Finfo * f_
Definition: Finfo.h:177
static const Cinfo * finfoCinfo
Definition: Finfo.cpp:76
string doc_
Definition: Finfo.h:147
static char name[]
Definition: mfield.cpp:401
string type() const
Definition: Finfo.cpp:103
Finfo(const string &name, const string &doc)
Definition: Finfo.cpp:13
virtual vector< string > innerSrc() const
Definition: Finfo.cpp:125
virtual vector< string > innerDest() const
Definition: Finfo.cpp:131
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
Definition: Cinfo.h:18
Definition: Finfo.h:12