Diana  0.8.3
DianaBasic.hpp
00001 /* -----------------------------------------------------------------------------
00002  *  Diana process modelling, simulation and analysis software
00003  *  Copyright (c) 2005, Michael Krasnyk
00004  *  All rights reserved.
00005  *
00006  *  This file is a part of Diana process modelling, simulation and analysis software
00007  *
00008  *  Diana is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License as published
00010  *  by the Free Software Foundation (see accompanying file LICENSE)
00011  * -----------------------------------------------------------------------------
00012  *  $Id: DianaBasic.hpp 8160 2009-03-16 18:36:30Z miha $
00013  * -----------------------------------------------------------------------------
00014  *  Description:
00015  */
00016 
00017 #ifndef DIANA_BASIC_H
00018 #define DIANA_BASIC_H
00019 
00020 #include <vector>
00021 #include <map>
00022 #include <list>
00023 
00024 #include <CapeOpen.hpp>
00025 
00032 namespace Diana{
00033 
00037   class DianaCollection : public Common::Collection::ICapeCollection {
00038   private:
00039       Common::Types::CapeBoolean owning; 
00040   public:
00041       DianaCollection(Common::Types::CapeBoolean owning=true):ICapeCollection(),owning(owning){};
00042     virtual ~DianaCollection();
00043 
00044       Common::Types::CapeBoolean getOwning() const;
00045 
00046       void setOwning(const Common::Types::CapeBoolean _owning);
00047 
00049     const Common::Types::CapeString& GetComponentName() const
00050       throw (Common::Error::ECapeUnknown);
00051 
00054     void SetComponentName(const Common::Types::CapeString& _name)
00055       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00056 
00058     const Common::Types::CapeString& GetComponentDescription() const
00059       throw (Common::Error::ECapeUnknown);
00060 
00063     void SetComponentDescription(const Common::Types::CapeString& _description)
00064                                 throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00065 
00067     Common::Types::CapeLong Count() const  
00068       throw (Common::Error::ECapeUnknown, Common::Error::ECapeFailedInitialisation);
00069       
00073     Common::Identification::ICapeIdentification* ItemByIndex(Common::Types::CapeLong index) const
00074       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument,
00075              Common::Error::ECapeFailedInitialisation, Common::Error::ECapeOutOfBounds);
00076 
00077 
00083     Common::Identification::ICapeIdentification* ItemByName(const Common::Types::CapeString& name) const
00084       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument,
00085              Common::Error::ECapeFailedInitialisation, Common::Error::ECapeOutOfBounds);
00086 
00088     void Add(Common::Identification::ICapeIdentification* item,
00089              const Common::Types::CapeString& alias=Common::Types::CapeStringUNDEFINED)
00090       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00091 
00093     void AddIndexed(Common::Identification::ICapeIdentification* item,
00094                     const Common::Types::CapeString& alias=Common::Types::CapeStringUNDEFINED)
00095       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00096 
00102       void AddArray(Common::Identification::ICapeIdentification* item,
00103                     const std::vector<Common::Identification::ICapeIdentification*>& skalItems,
00104                     const Common::Types::CapeString& alias=Common::Types::CapeStringUNDEFINED)
00105           throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00106 
00111     Common::Identification::ICapeIdentification* 
00112     GetArray(Common::Types::CapeLong index)
00113       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00114       
00115                 
00117     Common::Types::CapeLong ItemIndexByName(const Common::Types::CapeString& name) const
00118       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00119 
00120   protected:
00121     Common::Types::CapeString   strCollName;              
00122     Common::Types::CapeString   strCollDescription;       
00123     
00125     Common::Types::CapeLong mapNameToPosition(const Common::Types::CapeString& name) const;
00127     Common::Identification::ICapeIdentification* getItemFromPool(Common::Types::CapeLong pos) const
00128       throw (Common::Error::ECapeUnknown, Common::Error::ECapeOutOfBounds);
00130     void addStringMapping(const Common::Types::CapeString& name, const Common::Types::CapeString& alias,
00131                           Common::Types::CapeLong pos)
00132       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument);
00134     typedef std::vector<Common::Identification::ICapeIdentification*> vecident;
00136     typedef std::vector<Common::Types::CapeLong> vecindices;
00138     typedef std::map<std::string, Common::Types::CapeLong> mapindices;
00139                 
00140     vecident   vecItemsPool;     
00141     vecindices vecItems;         
00142     vecindices arrayItems;       
00143     mapindices mapItems;         
00144     mapindices mapItemsIndexed;  
00146   };
00147 };
00148 
00149 #endif // DIANA_BASIC_H