#ifndef __XIOS_CScalar__ #define __XIOS_CScalar__ /// XIOS headers /// #include "xios_spl.hpp" #include "declare_group.hpp" #include "declare_ref_func.hpp" #include "group_template.hpp" #include "array_new.hpp" #include "attribute_enum.hpp" #include "attribute_enum_impl.hpp" #include "attribute_array.hpp" #include "transformation.hpp" #include "transformation_enum.hpp" namespace xios { /// ////////////////////// Déclarations ////////////////////// /// class CScalarGroup; class CScalarAttributes; class CScalar; ///-------------------------------------------------------------- // Declare/Define CVarAttribute BEGIN_DECLARE_ATTRIBUTE_MAP(CScalar) #include "scalar_attribute.conf" END_DECLARE_ATTRIBUTE_MAP(CScalar) ///-------------------------------------------------------------- class CScalar : public CObjectTemplate , public CScalarAttributes { /// typedef /// typedef CObjectTemplate SuperClass; typedef CScalarAttributes SuperClassAttribute; friend class CScalarGroup; public : typedef CScalarAttributes RelAttributes; typedef CScalarGroup RelGroup; typedef CTransformation::TransformationMapTypes TransMapTypes; /// Constructeurs /// CScalar(void); explicit CScalar(const StdString & id); CScalar(const CScalar & var); // Not implemented yet. CScalar(const CScalar * const var); // Not implemented yet. /// Destructeur /// virtual ~CScalar(void); public : /// Accesseurs statiques /// static StdString GetName(void); static StdString GetDefName(void); static ENodeType GetType(void); public: static CScalar* createScalar(); public: void checkAttributes(void); bool checkAttributes_done_ = false ; void addRelFile(const StdString& filename); bool IsWritten(const StdString& filename) const; void checkAttributesOnClient(); virtual void parse(xml::CXMLNode & node); public: void sendScalarToFileServer(CContextClient* client) ; private: std::set sendScalarToFileServer_done_ ; public: void sendScalarToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) ; private: std::set sendScalarToCouplerOut_done_ ; public: void makeAliasForCoupling(const string& fieldId, int posInGrid) ; public: bool hasTransformation(); void solveInheritanceTransformation(); TransMapTypes getAllTransformations(); void duplicateTransformation(CScalar*); CTransformation* addTransformation(ETranformationType transType, const StdString& id=""); bool isEqual(CScalar* scalar); private: /** Clients that have to send a scalar. There can be multiple clients in case of secondary server, otherwise only one client. */ std::list clients; std::set clientsSet; public: void setContextClient(CContextClient* contextClient) ; private: std::set relFiles; TransMapTypes transformationMap_; void setTransformations(const TransMapTypes&); private: static bool initializeTransformationMap(std::map& m); static std::map transformationMapList_; static bool dummyTransformationMapList_; /** define if the scalar is completed or not ie all attributes have been received before in case of grid reading from file or coupling */ private: /** define if the scalar is completed or not ie all attributes have been received before in case of grid reading from file or coupling */ bool isCompleted_=true ; public: /*! \brief Check if a scalar is completed Before make any scalar processing, we must be sure that all scalar informations have been sent, for exemple when reading a grid in a file or when grid elements are sent by an other context (coupling). So all direct reference of the scalar (scalar_ref) must be also completed \return true if scalar and scalar reference are completed */ bool isCompleted(void) { if (hasDirectScalarReference()) if (!getDirectScalarReference()->isCompleted()) return false; else return isCompleted_ ; } void setCompleted(void) { isCompleted_=true ; } void unsetCompleted(void) { isCompleted_=false ; } private: DECLARE_REF_FUNC(Scalar,scalar) }; // class CVar ///-------------------------------------------------------------- // Declare/Define CScalarGroup and CScalarDefinition DECLARE_GROUP(CScalar); } // namespace xios #endif // __XIOS_CScalar__