Diana  0.8.3
CapeTypes.hpp
00001 /* -----------------------------------------------------------------------------
00002  *  Diana process modelling, simulation and analysis software
00003  *  Copyright (c) 2005, Michael Krasnyk
00004  *  All rights reserved.
00005  *
00006  *  This file is a part of Diana process modelling, simulation and analysis software
00007  *
00008  *  Diana is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License as published
00010  *  by the Free Software Foundation (see accompanying file LICENSE)
00011  * -----------------------------------------------------------------------------
00012  *  $Id: CapeTypes.hpp 8160 2009-03-16 18:36:30Z miha $
00013  * -----------------------------------------------------------------------------
00014  *  Description:
00015  */
00016 
00017 #ifndef CAPE_TYPES_HPP
00018 
00019 #define CAPE_TYPES_HPP
00020 
00021 #include <iostream>
00022 #include <string>
00023 #include <vector>
00024 
00025 namespace Common{
00026 
00032   namespace Types{
00033 
00034 #ifndef SWIG
00035 
00038     enum CapeType{
00039       ctCapeNone = 0,     
00040       ctCapeLong,         
00041       ctCapeShort,        
00042       ctCapeDouble,       
00043       ctCapeFloat,        
00044 
00045       ctCapeBoolean,      
00046       ctCapeChar,         
00047       ctCapeString,       
00048       ctCapeArrayString,  
00049       ctCapeDate,         
00050 
00051       ctCapeURL,          
00052       ctCapePointer,      
00053       ctDianaArray,       
00054       ctDianaSparseArray, 
00055     };
00056 #endif
00057 
00058     // elementary type definitions
00059 
00060     typedef long           CapeLong;       
00061     typedef short          CapeShort;      
00062 
00063     typedef double         CapeDouble;     
00064     typedef float          CapeFloat;      
00065       // We define it not as bool, because std::vector is something strange
00066       // with bitwise storage and masks
00067       // we are better off with skalar types 
00068       //typedef bool           CapeBoolean;    ///< Cape Open boolean type
00069     typedef unsigned char  CapeBoolean;    
00070 
00071     typedef char           CapeChar;       
00072     typedef std::string    CapeString;     
00073     typedef CapeString     CapeDate;       
00074     typedef CapeString     CapeURL;        
00075 
00076     typedef void*          CapePointer;    
00077 
00078     // sequence definitions
00079     typedef std::vector<CapeLong>      CapeArrayLong;       
00080     typedef std::vector<CapeShort>     CapeArrayShort;      
00081     typedef std::vector<CapeDouble>    CapeArrayDouble;     
00082     typedef std::vector<CapeFloat>     CapeArrayFloat;      
00083     typedef std::vector<CapeBoolean>   CapeArrayBoolean;    
00084     typedef std::vector<CapeChar>      CapeArrayChar;       
00085     typedef std::vector<CapeString>    CapeArrayString;     
00086     typedef std::vector<CapeDate>      CapeArrayDate;       
00087     typedef std::vector<CapeURL>       CapeArrayURL;        
00088     typedef std::vector<CapePointer>   CapeArrayPointer;    
00089 
00093     enum CapeValidationStatus{
00094       CAPE_NOT_VALIDATED, 
00096       CAPE_INVALID,       
00097       CAPE_VALID          
00098     };
00099 
00100     typedef std::vector<CapeValidationStatus> CapeArrayValidationStatus;  
00101 
00102     // Definition of Undefined values
00103     const CapeLong    CapeLongUNDEFINED   = 1<<31;      
00104     const CapeShort   CapeShortUNDEFINED  = 1<<15;      
00105 
00106     const CapeDouble  CapeDoubleUNDEFINED = -4.9E-324;  
00107     const CapeFloat   CapeFloatUNDEFINED  = -1.4E-45;   
00108 
00109     const CapeChar    CapeCharUNDEFINED   = '\0';       
00110     const CapeString  CapeStringUNDEFINED = CapeString("");         
00111     const CapeDate    CapeDateUNDEFINED   = CapeString("");         
00112     const CapeURL     CapeURLUNDEFINED    = CapeString("");         
00113   }
00114 }
00115 
00116 #endif // CAPE_TYPES_HPP