source: XIOS/dev/branch_openmp/src/object_template.hpp @ 1383

Last change on this file since 1383 was 1334, checked in by yushan, 7 years ago

omp_dev

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 3.6 KB
RevLine 
[591]1#ifndef __XIOS_CObjectTemplate__
2#define __XIOS_CObjectTemplate__
[219]3
[591]4/// XIOS headers ///
5#include "xios_spl.hpp"
[219]6#include "attribute_map.hpp"
7#include "node_enum.hpp"
[300]8#include "buffer_in.hpp"
9#include "event_server.hpp"
10#include "attribute.hpp"
[219]11
[335]12namespace xios
[219]13{
[1331]14  /// ////////////////////// Déclarations ////////////////////// ///
15  template <class T>
16  class CObjectTemplate
17    : public CObject
18    , public virtual CAttributeMap
19  {
[219]20
[1331]21    /// Friend ///
22    friend class CObjectFactory;
[219]23
[1331]24    /// Typedef ///
25    typedef CAttributeMap SuperClassMap;
26    typedef CObject SuperClass;
27    typedef T DerivedType;
[509]28
[1331]29    enum EEventId
30    {
31      EVENT_ID_SEND_ATTRIBUTE=100
32    } ;
[219]33
[1331]34    public :
[219]35
[1331]36      /// Autres ///
37      virtual StdString toString(void) const;
38      virtual void fromString(const StdString & str);
[219]39
[1331]40//      virtual void toBinary  (StdOStream & os) const;
41//      virtual void fromBinary(StdIStream & is);
42      virtual string getName(void) const ;
43      virtual void parse(xml::CXMLNode & node);
[509]44
[1331]45      /// Accesseurs ///
46      ENodeType getType(void) const;
[219]47
[1331]48      /// Test ///
49      virtual bool hasChild(void) const;
[219]50
[1331]51      /// Traitements ///
52      virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0);
[219]53
[1331]54      /// Traitement statique ///
55      static void ClearAllAttributes(void);
56      std::map<int, size_t> getMinimumBufferSizeForAttributes();
57      void sendAttributToServer(const string& id);
58      void sendAttributToServer(CAttribute& attr) ;
59      void sendAllAttributesToServer();
60      static void recvAttributFromClient(CEventServer& event) ;
61      static bool dispatchEvent(CEventServer& event) ;
[219]62
[1331]63      bool isEqual(const string& id, const vector<StdString>& excludedAttrs);
64      bool isEqual(T* obj, const vector<StdString>& excludedAttrs);
[1105]65
[1331]66      /// Accesseur statique ///
67      static std::vector<boost::shared_ptr<DerivedType> > &
68      GetAllVectobject(const StdString & contextId);
[219]69
[1331]70      /// Destructeur ///
71      virtual ~CObjectTemplate(void);
[509]72
[1331]73      static bool has(const string& id) ;
74      static bool has(const string& contextId, const string& id) ;
75      static T* get(const string& id) ;
76      static T* get(const T* ptr) ;
77      static T* get(const string& contextId, const string& id) ;
78      T* get(void) ;
[1334]79      boost::shared_ptr<T> getShared(void) ;
80      static boost::shared_ptr<T> getShared(const T* ptr) ;
[509]81
[1334]82
[1331]83      static T* create(const string& id=string("")) ;
84      static const vector<T*> getAll() ;
85      static const vector<T*> getAll(const string& contextId) ;
[509]86
[1331]87      void generateCInterface(ostream& oss) ;
88      void generateFortran2003Interface(ostream& oss) ;
89      void generateFortranInterface(ostream& oss) ;
[509]90
[1331]91    protected :
[219]92
[1331]93      /// Constructeurs ///
94      CObjectTemplate(void);
95      explicit CObjectTemplate(const StdString & id);
96      CObjectTemplate(const CObjectTemplate<T> & object,
97                      bool withAttrList = true, bool withId = true);
98      CObjectTemplate(const CObjectTemplate<T> * const object); // Not implemented.
[219]99
[1331]100    private :
[219]101
[1331]102      /// Propriétés statiques ///
103      static xios_map<StdString,
104             xios_map<StdString,
105             boost::shared_ptr<DerivedType> > > *AllMapObj_ptr;
106      #pragma omp threadprivate(AllMapObj_ptr)
107      static xios_map<StdString,
108             std::vector<boost::shared_ptr<DerivedType> > > *AllVectObj_ptr;
109      #pragma omp threadprivate(AllVectObj_ptr)
[509]110
[1331]111      static xios_map< StdString, long int > *GenId_ptr ;
112      #pragma omp threadprivate(GenId_ptr)
[219]113
[1331]114  }; // class CObjectTemplate
[335]115} // namespace xios
[219]116
[300]117//#include "object_template_impl.hpp"
118
[591]119#endif // __XIOS_CObjectTemplate__
Note: See TracBrowser for help on using the repository browser.