Beispiel #1
0
inline ConstStringS _Find_CodePage_From_Charset(const ConstStringS& strCharset) throw()
{
	ConstArray<_Charset_CP> c_arr(g_charset_cp_map::GetAddress(), g_charset_cp_map::GetCount());
	auto iter(c_arr.GetBegin());
	for( ; iter != c_arr.GetEnd(); iter.MoveNext() ) {
		const _Charset_CP& cc = iter.get_Value();
		if( ConstStringCompareTrait<ConstStringS>::IsEQ(strCharset, ConstStringS(cc.m_charset.m_first, cc.m_charset.m_size)) ) {
			return ConstStringS(cc.m_codepage.m_first, cc.m_codepage.m_size);
		}
	}
	return ConstStringS();
}
Beispiel #2
0
inline ConstStringS _Find_ShortString_From_LCID(uint uLCID, uint& uIndex) throw()
{
	ConstArray<_LCID_ShortString> c_arr(g_lcid_short_string_map::GetAddress(), g_lcid_short_string_map::GetCount());
	auto iter(c_arr.GetBegin());
	for( ; iter != c_arr.GetEnd(); iter.MoveNext() ) {
		const _LCID_ShortString& ls = iter.get_Value();
		if( ls.m_lcid == uLCID ) {
			uIndex = ls.m_uIndex;
			return ConstStringS(ls.m_short_string.m_first, ls.m_short_string.m_size);
		}
	}
	return ConstStringS();
}
Beispiel #3
0
inline uint _Find_LCID_From_ShortString(const ConstStringS& strShortString, uint& uIndex) throw()
{
	ConstArray<_LCID_ShortString> c_arr(g_lcid_short_string_map::GetAddress(), g_lcid_short_string_map::GetCount());
	auto iter(c_arr.GetBegin());
	for( ; iter != c_arr.GetEnd(); iter.MoveNext() ) {
		const _LCID_ShortString& ls = iter.get_Value();
		if( ConstStringCompareTrait<ConstStringS>::IsEQ(strShortString, ConstStringS(ls.m_short_string.m_first, ls.m_short_string.m_size)) ) {
			uIndex = ls.m_uIndex;
			return ls.m_lcid;
		}
	}
	return 0;
}
Beispiel #4
0
void BcastObject()
{
   ROOT::Mpi::TEnvironment env(gApplication->Argc(), gApplication->Argv());
   ROOT::Mpi::TIntraCommunicator world;
   MpiInitTest(world, 2, ROOT::Mpi::GreaterIqual);
   Int_t root = 0;

   if (world.Rank() == root) {
      /**********
       * Matrix *
       **********/
      TMatrixD d_mat(2, 2);
      d_mat[0][0] = 0.1;
      d_mat[0][1] = 0.2;
      d_mat[1][0] = 0.3;
      d_mat[1][1] = 0.4;

      TMatrixF f_mat(2, 2);
      f_mat[0][0] = 0.01;
      f_mat[0][1] = 0.02;
      f_mat[1][0] = 0.03;
      f_mat[1][1] = 0.04;

      TMatrixDSparse sd_mat(2, 2);
      sd_mat[0][0] = 1.00001;

      /**********
       * TSring *
       **********/
      TString t_str = "hola";
      TStringLong tl_str = "123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890\n";
      tl_str += "123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890\n";
      tl_str += "123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890\n";
      /**********
       * TArray *
       **********/
      TArrayC c_arr(4);
      c_arr[0] = 'R';
      c_arr[1] = 'O';
      c_arr[2] = 'O';
      c_arr[3] = 'T';

      TArrayD d_arr(3);
      d_arr[0] = 1.1;
      d_arr[1] = 2.2;
      d_arr[2] = 3.3;

      TArrayF f_arr(3);
      f_arr[0] = 0.1;
      f_arr[1] = 0.2;
      f_arr[2] = 0.3;

      TArrayI i_arr(3);
      i_arr[0] = 1;
      i_arr[1] = 2;
      i_arr[2] = 3;




      world.BcastSendObject(d_mat, root);
      world.BcastSendObject(f_mat, root);
      world.BcastSendObject(sd_mat, root);
      world.BcastSendObject(t_str, root);
      world.BcastSendObject(tl_str, root);
      world.BcastSendObject(c_arr, root);
      world.BcastSendObject(d_arr, root);
      world.BcastSendObject(f_arr, root);
      world.BcastSendObject(i_arr, root);

   }


   /**********
    * Matrix *
    **********/
   TMatrixD d_mat(2, 2);
   TMatrixF f_mat(2, 2);
   TMatrixDSparse sd_mat(2, 2);

   TMatrixD d_mat_required(2, 2);
   d_mat_required[0][0] = 0.1;
   d_mat_required[0][1] = 0.2;
   d_mat_required[1][0] = 0.3;
   d_mat_required[1][1] = 0.4;

   TMatrixF f_mat_required(2, 2);
   f_mat_required[0][0] = 0.01;
   f_mat_required[0][1] = 0.02;
   f_mat_required[1][0] = 0.03;
   f_mat_required[1][1] = 0.04;

   TMatrixDSparse sd_mat_required(2, 2);
   sd_mat_required[0][0] = 1.00001;

   /**********
   * TSring *
   **********/
   TString t_str;
   TStringLong tl_str;
   TStringLong tl_str_required = "123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890\n";
   tl_str_required += "123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890\n";
   tl_str_required += "123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890\n";

   /**********
    * TArray *
    **********/
   TArrayC c_arr(4);
   TArrayD d_arr(3);
   TArrayF f_arr(3);
   TArrayI i_arr(3);

   TArrayC c_arr_required(4);
   c_arr_required[0] = 'R';
   c_arr_required[1] = 'O';
   c_arr_required[2] = 'O';
   c_arr_required[3] = 'T';

   TArrayD d_arr_required(3);
   d_arr_required[0] = 1.1;
   d_arr_required[1] = 2.2;
   d_arr_required[2] = 3.3;

   TArrayF f_arr_required(3);
   f_arr_required[0] = 0.1;
   f_arr_required[1] = 0.2;
   f_arr_required[2] = 0.3;

   TArrayI i_arr_required(3);
   i_arr_required[0] = 1;
   i_arr_required[1] = 2;
   i_arr_required[2] = 3;



   world.BcastRecvObject(d_mat, root);
   CompareTMatrixTest(d_mat, d_mat_required,__LINE__ ,world.Rank(), "Bcast Send/Recv Object MatrixD");

   world.BcastRecvObject(f_mat, root);
   CompareTMatrixTest(f_mat, f_mat_required,__LINE__ ,world.Rank(), "Bcast Send/Recv Object MatrixF");

   world.BcastRecvObject(sd_mat, root);
   CompareTMatrixTest(sd_mat, sd_mat_required,__LINE__, world.Rank(), "Bcast Send/Recv Object MatrixDSparse");

   world.BcastRecvObject(t_str, root);
   CompareTest(t_str, "hola",__LINE__, world.Rank(), "Bcast Send/Recv Object TString");

   world.BcastRecvObject(tl_str, root);
   CompareTest(tl_str, tl_str_required,__LINE__, world.Rank(), "Bcast Send/Recv Object TStringLong");

   world.BcastRecvObject(c_arr, root);
   CompareTArrayTest(c_arr, c_arr_required,__LINE__, world.Rank(), "Bcast Send/Recv Object TArrayC");

   world.BcastRecvObject(d_arr, root);
   CompareTArrayTest(d_arr, d_arr_required,__LINE__, world.Rank(), "Bcast Send/Recv Object TArrayD");

   world.BcastRecvObject(f_arr, root);
   CompareTArrayTest(f_arr, f_arr_required,__LINE__, world.Rank(), "Bcast Send/Recv Object TArrayF");

   world.BcastRecvObject(i_arr, root);
   CompareTArrayTest(i_arr, i_arr_required,__LINE__, world.Rank(), "Bcast Send/Recv Object TArrayI");
}