New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
attribute.cpp in vendors/XIOS/current/src – NEMO

source: vendors/XIOS/current/src/attribute.cpp @ 3408

Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1#include "attribute.hpp"
2#include "base_type.hpp"
3
4namespace xios
5{
6      /// ////////////////////// Définitions ////////////////////// ///
7      CAttribute::CAttribute(const StdString & id)
8         : CObject(id), CBaseType()
9         , value()
10      { /* Ne rien faire de plus */ }
11
12      CAttribute::CAttribute(const CAttribute & attribut)
13         : CObject(attribut.getId()),CBaseType()
14      { 
15         this->value = attribut.getAnyValue(); 
16      }
17     
18      CAttribute::~CAttribute(void)
19      { /* Ne rien faire de plus */ }
20     
21      ///--------------------------------------------------------------
22
23      const boost::any & CAttribute::getAnyValue(void) const
24      { 
25         return (this->value); 
26      }
27
28
29      void CAttribute::setAnyValue(const boost::any & value)
30      { 
31         this->value = value; 
32      }
33     
34      void CAttribute::clear(void)
35      {
36         this->value = boost::any(); 
37      }
38
39      //---------------------------------------------------------------
40
41      bool CAttribute::isEmpty(void) const
42      { 
43         return (this->value.empty()); 
44      }
45
46      const StdString & CAttribute::getName(void) const
47      { 
48         return (this->getId()); 
49      }
50     
51
52      ///--------------------------------------------------------------
53
54     
55      CMessage& operator<<(CMessage& msg,CAttribute& type)
56      {
57        msg.push(type) ;
58        return msg ;
59      }
60
61     CMessage& operator<<(CMessage& msg, const CAttribute&  type)
62     {
63       msg.push(*type.duplicate()) ;
64       return msg ;
65     }
66 
67      CBufferOut& operator<<(CBufferOut& buffer, CAttribute&  type)
68     {
69   
70       if (!type.toBuffer(buffer)) ERROR("CBufferOut& operator<<(CBufferOut& buffer, CAttribute&  type)",
71                                           <<"Buffer remain size is to low for size type") ;
72      return buffer ;
73     }
74     
75     CBufferIn& operator>>(CBufferIn& buffer, CAttribute&  type)
76     {
77   
78       if (!type.fromBuffer(buffer)) ERROR("CBufferInt& operator>>(CBufferIn& buffer, CAttribute&  type)",
79                                           <<"Buffer remain size is to low for size type") ;
80       return buffer ;
81     }
82
83} // namespace xios
Note: See TracBrowser for help on using the repository browser.