Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::ReaderWriterSet::Handler Class Reference

#include <ReaderWriterSet.hpp>

+ Collaboration diagram for moab::ReaderWriterSet::Handler:

Public Member Functions

 Handler (reader_factory_t read_f, writer_factory_t write_f, const char *name, const char *desc, const char *const *ext, int num_ext)
 
const std::string & name () const
 
const std::string & description () const
 
void get_extensions (std::vector< std::string > &list_out) const
 
bool have_reader () const
 
bool have_writer () const
 
ReaderIfacemake_reader (Interface *iface) const
 
WriterIfacemake_writer (Interface *iface) const
 
bool reads_extension (const char *ext) const
 
bool writes_extension (const char *ext) const
 
bool operator== (const char *name) const
 

Private Attributes

reader_factory_t mReader
 
writer_factory_t mWriter
 
std::string mName
 
std::string mDescription
 
std::vector< std::string > mExtensions
 

Friends

class ReaderWriterSet
 

Detailed Description

Definition at line 103 of file ReaderWriterSet.hpp.

Constructor & Destructor Documentation

◆ Handler()

moab::ReaderWriterSet::Handler::Handler ( reader_factory_t  read_f,
writer_factory_t  write_f,
const char *  name,
const char *  desc,
const char *const *  ext,
int  num_ext 
)

Definition at line 233 of file ReaderWriterSet.cpp.

239  : mReader( read_f ), mWriter( write_f ), mName( nm ), mDescription( desc ), mExtensions( num_ext )
240 {
241  for( int i = 0; i < num_ext; ++i )
242  mExtensions[i] = ext[i];
243 }

References mExtensions.

Member Function Documentation

◆ description()

const std::string& moab::ReaderWriterSet::Handler::description ( ) const
inline

Definition at line 120 of file ReaderWriterSet.hpp.

121  {
122  return mDescription;
123  }

References mDescription.

◆ get_extensions()

void moab::ReaderWriterSet::Handler::get_extensions ( std::vector< std::string > &  list_out) const
inline

Definition at line 124 of file ReaderWriterSet.hpp.

125  {
126  list_out = mExtensions;
127  }

References mExtensions.

◆ have_reader()

bool moab::ReaderWriterSet::Handler::have_reader ( ) const
inline

Definition at line 129 of file ReaderWriterSet.hpp.

130  {
131  return NULL != mReader;
132  }

References mReader.

Referenced by make_reader().

◆ have_writer()

bool moab::ReaderWriterSet::Handler::have_writer ( ) const
inline

Definition at line 133 of file ReaderWriterSet.hpp.

134  {
135  return NULL != mWriter;
136  }

References mWriter.

Referenced by make_writer().

◆ make_reader()

ReaderIface* moab::ReaderWriterSet::Handler::make_reader ( Interface iface) const
inline

Definition at line 138 of file ReaderWriterSet.hpp.

139  {
140  return have_reader() ? mReader( iface ) : NULL;
141  }

References have_reader(), iface, and mReader.

◆ make_writer()

WriterIface* moab::ReaderWriterSet::Handler::make_writer ( Interface iface) const
inline

Definition at line 143 of file ReaderWriterSet.hpp.

144  {
145  return have_writer() ? mWriter( iface ) : NULL;
146  }

References have_writer(), iface, and mWriter.

◆ name()

const std::string& moab::ReaderWriterSet::Handler::name ( ) const
inline

Definition at line 116 of file ReaderWriterSet.hpp.

117  {
118  return mName;
119  }

References mName.

◆ operator==()

bool moab::ReaderWriterSet::Handler::operator== ( const char *  name) const

Definition at line 310 of file ReaderWriterSet.cpp.

311 {
312  // do case-insensitive comparison
313  std::string::const_iterator siter = mName.begin();
314  for( ; *nm; ++nm, ++siter )
315  if( siter == mName.end() || tolower( *nm ) != tolower( *siter ) ) return false;
316  return *nm == '\0';
317 }

◆ reads_extension()

bool moab::ReaderWriterSet::Handler::reads_extension ( const char *  ext) const

Definition at line 277 of file ReaderWriterSet.cpp.

278 {
279  if( !have_reader() ) return false;
280 
281  std::vector< std::string >::const_iterator siter;
282  for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
283  if( !( *siter ).compare( ext ) )
284  return true;
285  else if( 0 == strcasecmp( siter->c_str(), ext ) )
286  return true;
287 
288  return false;
289 }

◆ writes_extension()

bool moab::ReaderWriterSet::Handler::writes_extension ( const char *  ext) const

Definition at line 291 of file ReaderWriterSet.cpp.

292 {
293  if( !have_writer() ) return false;
294 
295  std::vector< std::string >::const_iterator siter;
296  for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
297  if( !( *siter ).compare( ext ) )
298  return true;
299  else if( 0 == strcasecmp( siter->c_str(), ext ) )
300  return true;
301 
302  return false;
303 }

Friends And Related Function Documentation

◆ ReaderWriterSet

friend class ReaderWriterSet
friend

Definition at line 106 of file ReaderWriterSet.hpp.

Member Data Documentation

◆ mDescription

std::string moab::ReaderWriterSet::Handler::mDescription
private

Definition at line 157 of file ReaderWriterSet.hpp.

Referenced by description().

◆ mExtensions

std::vector< std::string > moab::ReaderWriterSet::Handler::mExtensions
private

Definition at line 158 of file ReaderWriterSet.hpp.

Referenced by get_extensions(), and Handler().

◆ mName

std::string moab::ReaderWriterSet::Handler::mName
private

Definition at line 157 of file ReaderWriterSet.hpp.

Referenced by name().

◆ mReader

reader_factory_t moab::ReaderWriterSet::Handler::mReader
private

Definition at line 154 of file ReaderWriterSet.hpp.

Referenced by have_reader(), and make_reader().

◆ mWriter

writer_factory_t moab::ReaderWriterSet::Handler::mWriter
private

Definition at line 155 of file ReaderWriterSet.hpp.

Referenced by have_writer(), and make_writer().


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