{-- TerraHS - Interface between TerraLib and Haskell (c) Sergio Costa (INPE) - Setembro, 2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License 2.1 as published by the Free Software Foundation (http://www.opensource.org/licenses/gpl-license.php) --} {-- --} module Algebras.Base.Model --( --) where import TerraHS.TerraLib import TerraHS.Misc.Databases import TerraHS.TerraLib.TeDatabase import Algebras.Base -- class ModelConvert m where toGeoObjects :: m -> [TeGeoObject] fromGeoObjects :: [TeGeoObject] -> m type Parameter = String class (ModelConvert m) => ModelPersistence m where -- operations saveModel :: TeDatabasePtr -> Parameter -> m -> IO Bool loadModel :: TeDatabasePtr -> Parameter -> IO m -- axioms saveModel db p m = (store db p (toGeoObjects m) ) loadModel db p = ( (retrieve db p)::(IO [TeGeoObject]) ) >>= ( \go -> return (fromGeoObjects go) )