/* PROC.hpp - key abstraction: data-processing assets Copyright (C) Lumiera.org 2008, Hermann Vosseler This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /** @file proc.hpp ** Data processing Plugins and Codecs can be treated as a specific Kind of Asset. ** For the different Kinds of Assets, we use sub-interfaces inheriting ** from the general Asset interface. To be able to get asset::Proc instances ** directly from the AssetManager, we define a specialisation of the Asset ID. ** ** @see asset.hpp for explanation ** @see ProcFactory creating concrete asset::Proc instances ** */ #ifndef ASSET_PROC_H #define ASSET_PROC_H #include "pre_a.hpp" #include "proc/asset.hpp" #include "lib/factory.hpp" #include "lib/streamtype.hpp" namespace asset { class Proc; class ProcFactory; typedef P PProc; template<> class ID : public ID { public: ID (size_t id); ID (const Proc&); }; /** * key abstraction: data processing asset * @todo just a stub, have to figure out what a asset::Proc is */ class Proc : public Asset { public: static ProcFactory create; virtual const ID& getID() const ///< @return ID of kind Proc { return static_cast& > (Asset::getID()); } typedef lumiera::StreamType::ImplFacade::DataBuffer Buff; typedef Buff* PBuff; typedef void (ProcFunc) (PBuff); /** resolve any plugin and configuration info * to yield the actual media data processing function. * @return a function ready to be invoked; either the * "real thing" or a suitable placeholder. * @throw lumiera::error::Fatal if unable to provide * any usable function or placeholder. This case * can be considered exceptional and justifies a * subsystem failure. */ virtual ProcFunc* resolveProcessor() const =0; protected: Proc (const Asset::Ident& idi) : Asset(idi) {} //////////////TODO friend class ProcFactory; }; // definition of ID ctors is possible now, // after providing full definition of class Proc inline ID::ID(size_t id) : ID (id) {}; inline ID::ID(const Proc& proc) : ID (proc.getID()) {}; /** * Factory specialised for creating Processor Asset objects. */ class ProcFactory : public lib::Factory { public: typedef P PType; PType operator() (Asset::Ident& key); ////////////TODO define actual operation }; } // namespace asset #endif