MOAB: Mesh Oriented datABase  (version 5.2.1)
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 97 of file ReaderWriterSet.hpp.


Constructor & Destructor Documentation

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 239 of file ReaderWriterSet.cpp.

References mExtensions.

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

Member Function Documentation

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

Definition at line 110 of file ReaderWriterSet.hpp.

References mDescription.

        {
            return mDescription;
        }
void moab::ReaderWriterSet::Handler::get_extensions ( std::vector< std::string > &  list_out) const [inline]

Definition at line 114 of file ReaderWriterSet.hpp.

References mExtensions.

        {
            list_out = mExtensions;
        }

Definition at line 119 of file ReaderWriterSet.hpp.

References mReader.

Referenced by make_reader().

        {
            return NULL != mReader;
        }

Definition at line 123 of file ReaderWriterSet.hpp.

References mWriter.

Referenced by make_writer().

        {
            return NULL != mWriter;
        }
ReaderIface* moab::ReaderWriterSet::Handler::make_reader ( Interface *  iface) const [inline]

Definition at line 128 of file ReaderWriterSet.hpp.

References have_reader(), and mReader.

        {
            return have_reader() ? mReader( iface ) : NULL;
        }
WriterIface* moab::ReaderWriterSet::Handler::make_writer ( Interface *  iface) const [inline]

Definition at line 133 of file ReaderWriterSet.hpp.

References have_writer(), and mWriter.

        {
            return have_writer() ? mWriter( iface ) : NULL;
        }
const std::string& moab::ReaderWriterSet::Handler::name ( ) const [inline]

Definition at line 106 of file ReaderWriterSet.hpp.

References mName.

        {
            return mName;
        }
bool moab::ReaderWriterSet::Handler::operator== ( const char *  name) const

Definition at line 311 of file ReaderWriterSet.cpp.

{
    // do case-insensitive comparison
    std::string::const_iterator siter = mName.begin();
    for( ; *nm; ++nm, ++siter )
        if( siter == mName.end() || tolower( *nm ) != tolower( *siter ) ) return false;
    return *nm == '\0';
}
bool moab::ReaderWriterSet::Handler::reads_extension ( const char *  ext) const

Definition at line 278 of file ReaderWriterSet.cpp.

{
    if( !have_reader() ) return false;

    std::vector< std::string >::const_iterator siter;
    for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
        if( !( *siter ).compare( ext ) )
            return true;
        else if( 0 == strcasecmp( siter->c_str(), ext ) )
            return true;

    return false;
}
bool moab::ReaderWriterSet::Handler::writes_extension ( const char *  ext) const

Definition at line 292 of file ReaderWriterSet.cpp.

{
    if( !have_writer() ) return false;

    std::vector< std::string >::const_iterator siter;
    for( siter = mExtensions.begin(); siter != mExtensions.end(); ++siter )
        if( !( *siter ).compare( ext ) )
            return true;
        else if( 0 == strcasecmp( siter->c_str(), ext ) )
            return true;

    return false;
}

Friends And Related Function Documentation

friend class ReaderWriterSet [friend]

Definition at line 100 of file ReaderWriterSet.hpp.


Member Data Documentation

Definition at line 147 of file ReaderWriterSet.hpp.

Referenced by description().

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

Definition at line 148 of file ReaderWriterSet.hpp.

Referenced by get_extensions(), and Handler().

Definition at line 147 of file ReaderWriterSet.hpp.

Referenced by name().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines