Field3D

#include <FieldMappingIO.h>

Inheritance diagram for NullFieldMappingIO:
FieldMappingIO RefBase

Public Types

typedef NullFieldMappingIO class_type
 
typedef boost::intrusive_ptr< NullFieldMappingIOPtr
 
- Public Types inherited from FieldMappingIO
typedef FieldMappingIO class_type
 
typedef boost::intrusive_ptr< FieldMappingIOPtr
 
- Public Types inherited from RefBase
typedef boost::intrusive_ptr< RefBasePtr
 
typedef boost::weak_ptr< RefBaseWeakPtr
 

Public Member Functions

virtual std::string className () const
 Returns the class name. More...
 
 NullFieldMappingIO ()
 Ctor. More...
 
virtual FieldMapping::Ptr read (const OgIGroup &mappingGroup)
 Reads the field mapping and tries to create a NullFieldMapping object from it. More...
 
virtual FieldMapping::Ptr read (hid_t mappingGroup)
 Reads the field mapping and tries to create a NullFieldMapping object from it. More...
 
virtual bool write (hid_t mappingGroup, FieldMapping::Ptr mapping)
 Writes the given field mapping to disk. More...
 
virtual bool write (OgOGroup &mappingGroup, FieldMapping::Ptr mapping)
 Writes the given field mapping to disk. More...
 
- Public Member Functions inherited from FieldMappingIO
 FieldMappingIO ()
 Ctor. More...
 
virtual ~FieldMappingIO ()
 Dtor. More...
 
- Public Member Functions inherited from RefBase
void ref () const
 Used by boost::intrusive_pointer. More...
 
size_t refcnt ()
 Used by boost::intrusive_pointer. More...
 
void unref () const
 Used by boost::intrusive_pointer. More...
 
WeakPtr weakPtr () const
 
 RefBase ()
 
 RefBase (const RefBase &)
 Copy constructor. More...
 
RefBaseoperator= (const RefBase &)
 Assignment operator. More...
 
virtual ~RefBase ()
 Destructor. More...
 
virtual bool checkRTTI (const char *typenameStr)=0
 This function is only implemented by concrete classes and triggers the actual RTTI check through matchRTTI();. More...
 
bool matchRTTI (const char *typenameStr)
 Performs a check to see if the given typename string matches this class' This needs to be implemented in -all- subclasses, even abstract ones. More...
 

Static Public Member Functions

static FieldMappingIO::Ptr create ()
 
static const char * staticClassType ()
 
- Static Public Member Functions inherited from FieldMappingIO
static const char * staticClassType ()
 RTTI replacement. More...
 
- Static Public Member Functions inherited from RefBase
static const char * staticClassType ()
 

Public Attributes

 DEFINE_FIELD_RTTI_CONCRETE_CLASS
 
- Public Attributes inherited from FieldMappingIO
 DEFINE_FIELD_RTTI_ABSTRACT_CLASS
 

Private Types

typedef FieldMappingIO base
 Convenience typedef for referring to base class. More...
 

Detailed Description

Handles IO for a NullFieldMapping object

Definition at line 138 of file FieldMappingIO.h.

Member Typedef Documentation

◆ Ptr

typedef boost::intrusive_ptr<NullFieldMappingIO> NullFieldMappingIO::Ptr

Definition at line 145 of file FieldMappingIO.h.

◆ class_type

◆ base

Convenience typedef for referring to base class.

Definition at line 195 of file FieldMappingIO.h.

Constructor & Destructor Documentation

◆ NullFieldMappingIO()

NullFieldMappingIO::NullFieldMappingIO ( )
inline

Ctor.

Definition at line 160 of file FieldMappingIO.h.

161  : FieldMappingIO()
162  { }

Member Function Documentation

◆ staticClassType()

static const char* NullFieldMappingIO::staticClassType ( )
inlinestatic

Definition at line 152 of file FieldMappingIO.h.

153  {
154  return "NullFieldMappingIO";
155  }

◆ create()

static FieldMappingIO::Ptr NullFieldMappingIO::create ( )
inlinestatic

Definition at line 164 of file FieldMappingIO.h.

165  { return Ptr(new NullFieldMappingIO); }

Referenced by initIO().

◆ read() [1/2]

FieldMapping::Ptr NullFieldMappingIO::read ( hid_t  mappingGroup)
virtual

Reads the field mapping and tries to create a NullFieldMapping object from it.

Returns
Null if no object was read

Implements FieldMappingIO.

Definition at line 88 of file FieldMappingIO.cpp.

89 {
90  string nfmData;
91  if (!readAttribute(mappingGroup, k_nullMappingDataName, nfmData)) {
92  Msg::print(Msg::SevWarning, "Couldn't read attribute " + k_nullMappingDataName);
93  return NullFieldMapping::Ptr();
94  }
96 }

References Msg::print(), Hdf5Util::readAttribute(), and Msg::SevWarning.

◆ read() [2/2]

FieldMapping::Ptr NullFieldMappingIO::read ( const OgIGroup &  mappingGroup)
virtual

Reads the field mapping and tries to create a NullFieldMapping object from it.

Returns
Null if no object was read

Implements FieldMappingIO.

Definition at line 101 of file FieldMappingIO.cpp.

102 {
103  OgIAttribute<string> data =
104  mappingGroup.findAttribute<string>(k_nullMappingDataName);
105  if (!data.isValid()) {
106  Msg::print(Msg::SevWarning, "Couldn't read attribute " +
107  k_nullMappingDataName);
108  return NullFieldMapping::Ptr();
109  }
111 }

References Msg::print(), and Msg::SevWarning.

◆ write() [1/2]

bool NullFieldMappingIO::write ( hid_t  mappingGroup,
FieldMapping::Ptr  mapping 
)
virtual

Writes the given field mapping to disk.

Returns
true if successful, otherwise false

Implements FieldMappingIO.

Definition at line 116 of file FieldMappingIO.cpp.

117 {
118  string nfmAttrData("NullFieldMapping has no data");
119  if (!writeAttribute(mappingGroup, k_nullMappingDataName, nfmAttrData)) {
120  Msg::print(Msg::SevWarning, "Couldn't add attribute " + k_nullMappingDataName);
121  return false;
122  }
123  return true;
124 }

References Msg::print(), Msg::SevWarning, and Hdf5Util::writeAttribute().

◆ write() [2/2]

bool NullFieldMappingIO::write ( OgOGroup &  mappingGroup,
FieldMapping::Ptr  mapping 
)
virtual

Writes the given field mapping to disk.

Returns
true if successful, otherwise false

Implements FieldMappingIO.

Definition at line 129 of file FieldMappingIO.cpp.

130 {
131  string nfmAttrData("NullFieldMapping has no data");
132  OgOAttribute<string> data(mappingGroup, k_nullMappingDataName, nfmAttrData);
133  return true;
134 }

◆ className()

std::string NullFieldMappingIO::className ( ) const
virtual

Returns the class name.

Implements FieldMappingIO.

Definition at line 138 of file FieldMappingIO.cpp.

139 {
140  return k_nullMappingName;
141 }

References FIELD3D_NAMESPACE_OPEN::k_nullMappingName().

Member Data Documentation

◆ DEFINE_FIELD_RTTI_CONCRETE_CLASS

NullFieldMappingIO::DEFINE_FIELD_RTTI_CONCRETE_CLASS

Definition at line 150 of file FieldMappingIO.h.


The documentation for this class was generated from the following files:
Hdf5Util::writeAttribute
FIELD3D_API bool writeAttribute(hid_t location, const std::string &attrName, const std::string &value)
Writes a string attribute.
Msg::SevWarning
Definition: Log.h:68
NullFieldMapping::Ptr
boost::intrusive_ptr< NullFieldMapping > Ptr
Convenience typedef.
Definition: FieldMapping.h:243
OgIAttribute
Definition: OgawaFwd.h:62
NullFieldMapping
Trivial class, world space is equal to local space, i.e. the field is contained in the unit cube [0....
Definition: FieldMapping.h:236
OgOAttribute
Definition: OgawaFwd.h:64
FIELD3D_NAMESPACE_OPEN::k_nullMappingName
const string k_nullMappingName("NullFieldMapping")
FieldMappingIO::FieldMappingIO
FieldMappingIO()
Ctor.
Definition: FieldMappingIO.h:87
NullFieldMappingIO
Definition: FieldMappingIO.h:138
Hdf5Util::readAttribute
FIELD3D_API bool readAttribute(hid_t location, const std::string &attrName, std::string &value)
Reads a string attribute.
Msg::print
FIELD3D_API void print(Severity severity, const std::string &message)
Sends the string to the assigned output, prefixing the message with the severity.
Definition: Log.cpp:70
NullFieldMappingIO::Ptr
boost::intrusive_ptr< NullFieldMappingIO > Ptr
Definition: FieldMappingIO.h:145