Page MenuHomec4science

factory_multiscale.hh
No OneTemporary

File Metadata

Created
Tue, May 13, 02:42

factory_multiscale.hh

/**
* @file factory_multiscale.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Wed Dec 04 12:14:29 2013
*
* @brief This is the central factory for all the objects created through the parser
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __LIBMULTISCALE_FACTORY_MULTISCALE_HH__
#define __LIBMULTISCALE_FACTORY_MULTISCALE_HH__
/* -------------------------------------------------------------------------- */
#include "domain_interface.hh"
#include "domain_multiscale.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template <typename T,typename IT>
class FactoryMultiScale : public T, public IDManager<T,IT> {
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
typedef std::string ID;
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
protected:
FactoryMultiScale(UInt Dim);
// virtual ~FactoryMultiScale();
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public:
//! public function that create an factory from a reference code
void createObject(std::stringstream & line);
//! call init onto all factorys stored
void init();
//! action
void action();
//! routines which truly creates a new object connected to obj parameter
template <typename Obj> void create(Obj & obj);
//! parse a config line
UInt parseLine(std::stringstream & line,ActionType atype);
//! request the singleton
static IT * getManager(UInt dim);
static IT & getManager();
public:
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
protected:
//! dimension for all the built objects
UInt dim;
std::string obj_id_being_created;
std::string obj_type_being_created;
ActionType obj_kind_being_created;
};
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_FACTORY_MULTISCALE_HH__ */

Event Timeline