MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Conv< T > Class Template Reference

#include <Conv.h>

+ Collaboration diagram for Conv< T >:

Static Public Member Functions

static const T & buf2val (double **buf)
 
static string rttiType ()
 
static unsigned int size (const T &val)
 
static void str2val (T &val, const string &s)
 
static void val2buf (const T &val, double **buf)
 
static void val2str (string &s, const T &val)
 

Detailed Description

template<class T>
class Conv< T >

Definition at line 30 of file Conv.h.

Member Function Documentation

template<class T>
static const T& Conv< T >::buf2val ( double **  buf)
inlinestatic

Definition at line 44 of file Conv.h.

References Conv< T >::size().

Referenced by GetHopFunc< A >::op(), OpFunc2Base< A1, A2 >::opBuffer(), OpFunc3Base< A1, A2, A3 >::opBuffer(), OpFunc4Base< A1, A2, A3, A4 >::opBuffer(), OpFunc5Base< A1, A2, A3, A4, A5 >::opBuffer(), OpFunc6Base< A1, A2, A3, A4, A5, A6 >::opBuffer(), SrcFinfo2< T1, T2 >::sendBuffer(), SrcFinfo3< T1, T2, T3 >::sendBuffer(), SrcFinfo4< T1, T2, T3, T4 >::sendBuffer(), SrcFinfo5< T1, T2, T3, T4, T5 >::sendBuffer(), SrcFinfo6< T1, T2, T3, T4, T5, T6 >::sendBuffer(), testConvVector(), and testConvVectorOfVectors().

44  {
45  const T* ret = reinterpret_cast< const T* >( *buf );
46  *buf += size( *ret );
47  return *ret;
48  }
static unsigned int size(const T &val)
Definition: Conv.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T>
static string Conv< T >::rttiType ( )
inlinestatic

Definition at line 82 of file Conv.h.

References name.

Referenced by ElementValueFinfo< T, F >::rttiType(), LookupElementValueFinfo< T, L, F >::rttiType(), ValueFinfo< T, F >::rttiType(), LookupValueFinfo< T, L, F >::rttiType(), ReadOnlyElementValueFinfo< T, F >::rttiType(), ReadOnlyLookupElementValueFinfo< T, L, F >::rttiType(), ReadOnlyValueFinfo< T, F >::rttiType(), ReadOnlyLookupValueFinfo< T, L, F >::rttiType(), OpFunc1Base< ProcPtr >::rttiType(), FieldElementFinfo< T, F >::rttiType(), OpFunc2Base< A1, A2 >::rttiType(), SrcFinfo1< T >::rttiType(), OpFunc3Base< A1, A2, A3 >::rttiType(), OpFunc4Base< A1, A2, A3, A4 >::rttiType(), OpFunc5Base< A1, A2, A3, A4, A5 >::rttiType(), SrcFinfo2< T1, T2 >::rttiType(), OpFunc6Base< A1, A2, A3, A4, A5, A6 >::rttiType(), SrcFinfo3< T1, T2, T3 >::rttiType(), SrcFinfo4< T1, T2, T3, T4 >::rttiType(), LookupGetOpFuncBase< L, A >::rttiType(), SrcFinfo5< T1, T2, T3, T4, T5 >::rttiType(), SrcFinfo6< T1, T2, T3, T4, T5, T6 >::rttiType(), Conv< vector< vector< T > > >::rttiType(), and Conv< vector< T > >::rttiType().

82  {
83  if ( typeid( T ) == typeid( char ))
84  return "char";
85  if ( typeid( T ) == typeid( int ) )
86  return "int";
87  if ( typeid( T ) == typeid( short ) )
88  return "short";
89  if ( typeid( T ) == typeid( long ) )
90  return "long";
91  if ( typeid( T ) == typeid( unsigned int ) )
92  return "unsigned int";
93  if ( typeid( T ) == typeid( unsigned long ) )
94  return "unsigned long";
95  if ( typeid( T ) == typeid( float ) )
96  return "float";
97  if ( typeid( T ) == typeid( double ) )
98  return "double";
99  if ( typeid( T ) == typeid( Id ) )
100  return "Id";
101  if ( typeid( T ) == typeid( ObjId ) )
102  return "ObjId";
103  return typeid( T ).name(); // this is not portable but may be more useful than "bad"
104  }
Definition: ObjId.h:20
static char name[]
Definition: mfield.cpp:401
Definition: Id.h:17

+ Here is the caller graph for this function:

template<class T>
static unsigned int Conv< T >::size ( const T &  val)
inlinestatic

Size, in units of sizeof(double). So a double would be 1, something with 1 chars would be 1 as well, but something with 9 chars would be 2.

Definition at line 38 of file Conv.h.

Referenced by Conv< T >::buf2val(), Conv< string >::buf2val(), GetOpFuncBase< A >::opBuffer(), Conv< vector< vector< T > > >::size(), Conv< vector< T > >::size(), testConvVector(), testConvVectorOfVectors(), Conv< T >::val2buf(), and Conv< string >::val2buf().

39  {
40  return 1 + ( sizeof( T ) - 1 ) / sizeof( double );
41  }

+ Here is the caller graph for this function:

template<class T>
static void Conv< T >::str2val ( T &  val,
const string &  s 
)
inlinestatic

Default conversion from string just puts the string into the char* pointer.

Definition at line 65 of file Conv.h.

Referenced by LookupField< L, A >::innerStrGet(), SetGet1< A >::innerStrSet(), Field< A >::innerStrSet(), SetGet2< L, A >::innerStrSet(), LookupField< L, A >::innerStrSet(), SetGet3< A1, A2, A3 >::innerStrSet(), SetGet4< A1, A2, A3, A4 >::innerStrSet(), SetGet5< A1, A2, A3, A4, A5 >::innerStrSet(), and SetGet6< A1, A2, A3, A4, A5, A6 >::innerStrSet().

65  {
66  istringstream is( s );
67  is >> val;
68  }

+ Here is the caller graph for this function:

template<class T>
static void Conv< T >::val2buf ( const T &  val,
double **  buf 
)
inlinestatic

Converts data contents into double* buf. Buf must be allocated ahead of time. Returns size of value. Needs to be specialized for variable size and pointer-containing types T.

Definition at line 56 of file Conv.h.

References Conv< T >::size().

Referenced by HopFunc1< A >::op(), HopFunc2< A1, A2 >::op(), HopFunc3< A1, A2, A3 >::op(), HopFunc4< A1, A2, A3, A4 >::op(), HopFunc5< A1, A2, A3, A4, A5 >::op(), HopFunc6< A1, A2, A3, A4, A5, A6 >::op(), GetOpFuncBase< A >::opBuffer(), testConvVector(), testConvVectorOfVectors(), Conv< vector< vector< T > > >::val2buf(), and Conv< vector< T > >::val2buf().

56  {
57  *reinterpret_cast< T* >( *buf ) = val;
58  *buf += size( val );
59  }
static unsigned int size(const T &val)
Definition: Conv.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T>
static void Conv< T >::val2str ( string &  s,
const T &  val 
)
inlinestatic

Default conversion into string just puts the char* representation into the string. Arguably a bad way to do it.

Definition at line 74 of file Conv.h.

Referenced by Field< A >::innerStrGet(), and LookupField< L, A >::innerStrGet().

74  {
75  stringstream ss;
76  ss << val;
77  s = ss.str();
78  // ostringstream os( s );
79  // os << val;
80  }

+ Here is the caller graph for this function:


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