Last change
on this file since 501 was
501,
checked in by ymipsl, 10 years ago
|
Add licence copyright to all file ond directory src using the command :
svn propset -R copyright -F header_licence src
XIOS is now officialy under CeCILL licence
YM
|
-
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:
1.2 KB
|
Rev | Line | |
---|
[458] | 1 | #ifndef __XIOS_SIMPLE_NODE_EXPR_HPP__ |
---|
| 2 | #define __XIOS_SIMPLE_NODE_EXPR_HPP__ |
---|
| 3 | |
---|
| 4 | #include<string> |
---|
| 5 | #include<vector> |
---|
| 6 | |
---|
| 7 | class CSimpleNodeExpr |
---|
| 8 | { |
---|
| 9 | public : |
---|
| 10 | |
---|
| 11 | enum ENodeType |
---|
| 12 | { |
---|
| 13 | scalarDouble, scalarVariable, opScalar, opScalarScalar, |
---|
| 14 | fieldInstant, fieldAverage, opFieldScalar, opScalarField, opFieldField, opField |
---|
| 15 | } ; |
---|
| 16 | |
---|
| 17 | CSimpleNodeExpr(ENodeType nodeType, const std::string* str) : nodeType(nodeType) |
---|
| 18 | { |
---|
| 19 | id=*str ; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | CSimpleNodeExpr(ENodeType nodeType, const char* str) : nodeType(nodeType) |
---|
| 23 | { |
---|
| 24 | id=std::string(str) ; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | void addChild(CSimpleNodeExpr* child) |
---|
| 28 | { |
---|
| 29 | children.push_back(child) ; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | std::string print(void) |
---|
| 33 | { |
---|
| 34 | if (nodeType==scalarDouble) return id ; |
---|
| 35 | else if (nodeType==scalarVariable) return "$"+id ; |
---|
| 36 | else if (nodeType==fieldInstant) return id ; |
---|
| 37 | else if (nodeType==fieldAverage) return "@"+id ; |
---|
| 38 | else if (nodeType==opScalar || nodeType==opField) return id+"("+children[0]->print()+")" ; |
---|
| 39 | else return "("+children[0]->print()+id+children[1]->print()+")" ; |
---|
| 40 | } |
---|
| 41 | ~CSimpleNodeExpr() |
---|
| 42 | { |
---|
| 43 | for(std::vector<CSimpleNodeExpr*>::iterator it=children.begin();it!=children.end();++it) delete *it ; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | ENodeType nodeType ; |
---|
| 47 | std::string id ; |
---|
| 48 | |
---|
| 49 | std::vector<CSimpleNodeExpr*> children ; |
---|
| 50 | } ; |
---|
| 51 | |
---|
| 52 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.