Skip to content
Snippets Groups Projects
Method.h 1.88 KiB
Newer Older
/*
 * Method.h
 *
 *  Created on: Dec 16, 2016
 *      Author: wfg
 */

#ifndef METHOD_H_
#define METHOD_H_

/// \cond EXCLUDE_FROM_DOXYGEN
#include <vector>
#include <string>
wfg's avatar
wfg committed
#include <map>
wfg's avatar
wfg committed
#include "functions/adiosFunctions.h"

namespace adios
{

/**
 * Serves as metadata to define an engine
 */
wfg's avatar
wfg committed
class Method
wfg's avatar
wfg committed
    const std::string m_Type; ///< Method type
wfg's avatar
wfg committed
    const bool m_DebugMode = false; ///< true: on, throws exceptions and do additional checks, false: off, faster, but unsafe
wfg's avatar
wfg committed
    std::map<std::string, std::string> m_Parameters; ///< method parameters
    std::vector< std::map<std::string, std::string> > m_TransportParameters; ///< each is a separate Transport containing their own parameters
wfg's avatar
wfg committed
     * Constructor
     * @param type must be an engine type
wfg's avatar
wfg committed
     */
wfg's avatar
wfg committed
    Method( const std::string type, const bool debugMode = false );
wfg's avatar
wfg committed

    ~Method( );

wfg's avatar
wfg committed
    /**
     * Sets parameters for the method in "parameter=value" format
     * @param args list of parameters with format "parameter1=value1", ..., "parameterN=valueN"
     */
wfg's avatar
wfg committed
    template< class ...Args>
wfg's avatar
wfg committed
    void SetParameters( Args... args )
        std::vector<std::string> parameters = { args... };
wfg's avatar
wfg committed
        m_Parameters = BuildParametersMap( parameters, m_DebugMode );
wfg's avatar
wfg committed
    /**
     * Adds a transport and its parameters for the method
     * @param type must be a supported transport type under /include/transport
     * @param args list of parameters for a transport with format "parameter1=value1", ..., "parameterN=valueN"
     */
wfg's avatar
wfg committed
    template< class ...Args>
    void AddTransport( const std::string type, Args... args )
        std::vector<std::string> parameters = { args... };
        AddTransportParameters( type, parameters );
wfg's avatar
wfg committed

wfg's avatar
wfg committed
private:

    void AddTransportParameters( const std::string type, const std::vector<std::string>& parameters );
};


} //end namespace


#endif /* METHOD_H_ */