Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

hyp.type.h

Go to the documentation of this file.
00001 /*
00002 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00003  Hyperion Pattern.
00004  Hyperion Pattern is a part of the Hyperion Project.
00005 ----------------------------------------------------------
00006  Copyright (c) 2001 Pierre Rebours.
00007 
00008  This library is free software; you can redistribute it and/or
00009  modify it under the terms of the GNU Lesser General Public
00010  License as published by the Free Software Foundation; either
00011  version 2.1 of the License, or (at your option) any later version.
00012 
00013  This library is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  
00017  See hyp.license.txt file for more information about the license.
00018  
00019  Web: http://lagrandeporte.multimania.com/hyperion
00020  Email: pierre_rebours@yahoo.com
00021 ----------------------------------------------------------
00022  CVS
00023  $Log$
00024 
00025  Creation 14/03/01 PR
00026 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00027 */
00028 
00029 #ifndef _hyp_type_h_
00030 #define _hyp_type_h_
00031 
00032 #include"hyp.def.h"
00033 #include"hyp.ker.def.h"
00034 
00035 hyp_NAMESPACE_BEGIN_HYP
00036 
00042 
00047 
00048 typedef int t_label;
00049 typedef unsigned int t_size;
00050 
00051 typedef unsigned short int t_ushort;
00052 typedef unsigned char t_uchar;
00053 typedef unsigned long int t_ulong;
00054 typedef unsigned int t_uint;
00056  
00063 #define hyp_USE_DOUBLE 1
00064 
00065 #ifdef hyp_USE_DOUBLE
00066         typedef double t_real;
00067 #else 
00068         typedef float t_real;
00069 #endif
00070 
00071 
00072 
00078 class CFlag
00079 {       
00080 public:
00081         typedef t_uint t_flag;
00082         
00083         explicit CFlag(const t_size& Pos) { m_Flag = (0x00000001<<Pos) ; }
00084         CFlag() : m_Flag(0) {};
00085 
00086         inline operator t_flag() const {
00087                 return GetFlag();
00088         }
00089         inline t_flag GetFlag(void) const {
00090                 return m_Flag;
00091         }
00092 
00093         inline void SetFlag(const t_flag& Flag) {
00094                 m_Flag|=Flag;
00095         }       
00096         inline bool HaveFlag(const t_flag& Flag) const {
00097                 return (Flag & m_Flag) ==0 ? false : true;
00098         }
00099 
00100 private:
00101         t_flag m_Flag;
00102 };
00103 
00104 
00109 
00115 template<class T>
00116 class TArray :
00117 #ifdef hyp_USE_VALARRAY
00118 public std::valarray<T>
00119 #else
00120 public std::vector<T>
00121 #endif
00122 {
00123 public:
00129         explicit TArray(t_size Capacity,const T& Data=T()) {
00130                 resize(Capacity,Data);
00131         }
00132 
00137         void reset(const T& Data) {
00138                 for(int i=0;size();i++) (*this)[i]=Data;
00139         }
00140 
00145         void show(std::ostream& Stream) {
00146                 stream<<"TArray : "<<this<<" - Size : "<<size()<<"\n";
00147                 for(int i=0;i<size();i++) {
00148                         Stream<<"N° : "<<i<<" - "<<at(i)<<"\n";
00149                 }
00150         }
00151 };
00152 
00153 typedef TArray<t_real> t_real_array;
00154 typedef TArray<bool> t_mask_array;
00155 typedef TArray<t_label> t_label_array;
00156 
00157 typedef std::vector<t_label> t_label_enum;
00159 
00160 
00165 typedef signed __int64 t_int64;
00166 hyp_ker_DLL t_int64 GetInt64(t_uint High,t_uint Low);
00167 hyp_ker_DLL t_uint GetHighInt64(t_int64);
00168 hyp_ker_DLL t_uint GetLowInt64(t_int64);
00169 hyp_ker_DLL std::ostream& operator<<(std::ostream&,const t_int64&);
00171 
00172 
00173 
00174 hyp_NAMESPACE_END_HYP
00175 
00176 #endif

Top of Page
written by Pierre Rebours © 2000-2001. Terms of Use.