Ignore:
Timestamp:
Apr 10, 2007, 5:57:02 PM (18 years ago)
Author:
ansari
Message:

Ajout classe ThSafeOp (thsafeop.h) pour rendre NDataBlock<T> (et SegDataBlock) thread-safe, ajout methode DataTypeInfo::getTypeId() , implementation ThSafeOp ds ndatablock.cc (.h), Reza 10/04/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/datatype.cc

    r2884 r3208  
    1414{
    1515}
    16 #if defined(__SGICC__) || defined(__IBMCPP__)
    17 template <class T>
    18 string DataTypeInfo<T>::getTypeName()
    19 {
    20   if (typeid(T) == typeid(uint_1)) return("uint_1");
    21   else if (typeid(T) == typeid(uint_2)) return("uint_2");
    22   else if (typeid(T) == typeid(int_2)) return("int_2");
    23   else if (typeid(T) == typeid(int_4)) return("int_4");
    24   else if (typeid(T) == typeid(int_8)) return("int_8");
    25   else if (typeid(T) == typeid(uint_4)) return("uint_4");
    26   else if (typeid(T) == typeid(uint_8)) return("uint_8");
    27   else if (typeid(T) == typeid(r_4)) return("r_4");
    28   else if (typeid(T) == typeid(r_8)) return("r_8");
    29   else if (typeid(T) == typeid(complex<r_4>)) return(" complex<r_4> ");
    30   else if (typeid(T) == typeid(complex<r_8>)) return(" complex<r_8> ");
    31   else return("???unknowntype???");
    32 }
    33 #else
     16//! Return the type name of T, as a string, (Example: T=uint_8 --> "uint_8")
    3417template <class T>
    3518string DataTypeInfo<T>::getTypeName() { return("???unknowntype???"); }
     
    3720string DataTypeInfo<uint_1>::getTypeName() { return("uint_1"); }
    3821DECL_TEMP_SPEC
     22string DataTypeInfo<int_1>::getTypeName() { return("int_1"); }
     23DECL_TEMP_SPEC
    3924string DataTypeInfo<uint_2>::getTypeName() { return("uint_2"); }
    4025DECL_TEMP_SPEC
    4126string DataTypeInfo<int_2>::getTypeName() { return("int_2"); }
    4227DECL_TEMP_SPEC
     28string DataTypeInfo<uint_4>::getTypeName() { return("uint_4"); }
     29DECL_TEMP_SPEC
    4330string DataTypeInfo<int_4>::getTypeName() { return("int_4"); }
    4431DECL_TEMP_SPEC
     32string DataTypeInfo<uint_8>::getTypeName() { return("uint_8"); }
     33DECL_TEMP_SPEC
    4534string DataTypeInfo<int_8>::getTypeName() { return("int_8"); }
    46 DECL_TEMP_SPEC
    47 string DataTypeInfo<uint_4>::getTypeName() { return("uint_4"); }
    48 DECL_TEMP_SPEC
    49 string DataTypeInfo<uint_8>::getTypeName() { return("uint_8"); }
    5035DECL_TEMP_SPEC
    5136string DataTypeInfo<r_4>::getTypeName() { return("r_4"); }
     
    5641DECL_TEMP_SPEC
    5742string DataTypeInfo< complex<r_8> >::getTypeName() { return(" complex<r_8> "); }
    58 #endif
     43
     44/*!
     45  \ brief Return an identifier associated to T
     46  uint_1 -> 1  , int_1 -> 2
     47  uint_2 -> 3  , int_2 -> 4
     48  uint_4 -> 5  , int_4 -> 6
     49  uint_8 -> 7  , int_8 -> 8
     50  r_4    -> 9  , r_8   -> 10
     51  complex<r_4> -> 11 , complex<r_8> -> 12
     52*/
     53template <class T>
     54int DataTypeInfo<T>::getTypeId() { return(0); }
     55DECL_TEMP_SPEC
     56int DataTypeInfo<uint_1>::getTypeId() { return(1); }
     57DECL_TEMP_SPEC
     58int DataTypeInfo<int_1>::getTypeId() { return(2); }
     59DECL_TEMP_SPEC
     60int DataTypeInfo<uint_2>::getTypeId() { return(3); }
     61DECL_TEMP_SPEC
     62int DataTypeInfo<int_2>::getTypeId() { return(4); }
     63DECL_TEMP_SPEC
     64int DataTypeInfo<uint_4>::getTypeId() { return(5); }
     65DECL_TEMP_SPEC
     66int DataTypeInfo<int_4>::getTypeId() { return(6); }
     67DECL_TEMP_SPEC
     68int DataTypeInfo<uint_8>::getTypeId() { return(7); }
     69DECL_TEMP_SPEC
     70int DataTypeInfo<int_8>::getTypeId() { return(8); }
     71DECL_TEMP_SPEC
     72int DataTypeInfo<r_4>::getTypeId() { return(9); }
     73DECL_TEMP_SPEC
     74int DataTypeInfo<r_8>::getTypeId() { return(10); }
     75DECL_TEMP_SPEC
     76int DataTypeInfo< complex<r_4> >::getTypeId() { return(11); }
     77DECL_TEMP_SPEC
     78int DataTypeInfo< complex<r_8> >::getTypeId() { return(12); }
     79
    5980
    6081
     
    115136#ifdef __CXX_PRAGMA_TEMPLATES__
    116137#pragma define_template DataTypeInfo<uint_1>
     138#pragma define_template DataTypeInfo<int_1>
    117139#pragma define_template DataTypeInfo<uint_2>
    118140#pragma define_template DataTypeInfo<int_2>
     
    130152namespace SOPHYA {
    131153template class DataTypeInfo<uint_1>;
     154template class DataTypeInfo<int_1>;
    132155template class DataTypeInfo<uint_2>;
    133156template class DataTypeInfo<int_2>;
Note: See TracChangeset for help on using the changeset viewer.