source: XIOS/trunk/src/interface/c/iccontext.cpp @ 591

Last change on this file since 591 was 591, checked in by rlacroix, 9 years ago

Remove leftovers from the XMLIO age.

  • 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
  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1/* ************************************************************************** *
2 *      Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
3 * ************************************************************************** */
4
5#include <boost/multi_array.hpp>
6#include <boost/shared_ptr.hpp>
7
8#include "xios.hpp"
9
10#include "attribute_template.hpp"
11#include "object_template.hpp"
12#include "group_template.hpp"
13
14#include "calendar_type.hpp"
15
16#include "icutil.hpp"
17#include "timer.hpp"
18#include "context.hpp"
19
20extern "C"
21{
22// /////////////////////////////// Définitions ////////////////////////////// //
23
24   // ----------------------- Redéfinition de types ----------------------------
25
26   typedef enum { D360 = 0 , ALLLEAP, NOLEAP, JULIAN, GREGORIAN } XCalendarType ;
27
28   typedef xios::CContext * XContextPtr;
29
30   // ------------------------ Création des handle -----------------------------
31
32   void cxios_context_handle_create (XContextPtr * _ret, const char * _id, int _id_len)
33   {
34      std::string id;
35      if (!cstr2string(_id, _id_len, id)) return;
36      CTimer::get("XIOS").resume() ;
37
38      std::vector<xios::CContext*> def_vector =
39            xios::CContext::getRoot()->getChildList();
40
41      for (std::size_t i = 0; i < def_vector.size(); i++)
42      {
43          if (def_vector[i]->getId().compare(id) == 0)
44          {
45            *_ret = def_vector[i];
46             CTimer::get("XIOS").suspend() ;
47            return;
48          }
49      }
50       CTimer::get("XIOS").suspend() ;
51       ERROR("void cxios_context_handle_create (XContextPtr * _ret, const char * _id, int _id_len)",
52             << "Context "<<id<<"  unknown");
53      // Lever une exeception ici
54   }
55
56   // ------------------------ Changements de contextes ------------------------
57
58   void cxios_context_get_current(XContextPtr* context)
59   {
60      CTimer::get("XIOS").resume();
61      *context = CContext::getCurrent();
62      CTimer::get("XIOS").suspend();
63   }
64
65   void cxios_context_set_current(XContextPtr context, bool withswap)
66   {
67      CTimer::get("XIOS").resume() ;
68      CContext::setCurrent(context->getId());
69      CTimer::get("XIOS").suspend() ;
70   }
71
72   // -------------------- Vérification des identifiants -----------------------
73
74   void cxios_context_valid_id (bool * _ret, const char * _id, int _id_len)
75   {
76      std::string id;
77      if (!cstr2string(_id, _id_len, id)) return;
78
79      CTimer::get("XIOS").resume();
80      std::vector<xios::CContext*> def_vector =
81            xios::CContext::getRoot()->getChildList();
82
83      *_ret = false;
84      for (std::size_t i = 0; i < def_vector.size(); i++)
85      {
86        if (def_vector[i]->getId().compare(id) == 0)
87        {
88          *_ret = true;
89          break;
90        }
91      }
92      CTimer::get("XIOS").suspend();
93   }
94} // extern "C"
Note: See TracBrowser for help on using the repository browser.