コード例 #1
0
ファイル: connection.cpp プロジェクト: KarlHegbloom/texmacs
string
connection_start (string name, string session, bool again) {
  // cout << "Start " << name << ", " << session << "\n";
  if (!connection_declared (name))
    return "Error: connection " * name * " has not been declared";

  connection con= connection (name * "-" * session);
  if (is_nil (con)) {
    if (DEBUG_VERBOSE)
      debug_io << "Starting session '" << session << "'\n";
    tree t= connection_info (name, session);
    if (is_tuple (t, "pipe", 1)) {
      tm_link ln= make_pipe_link (t[1]->label);
      con= tm_new<connection_rep> (name, session, ln);
    }
#ifndef QTTEXMACS
    else if (is_tuple (t, "socket", 2)) {
      tm_link ln= make_socket_link (t[1]->label, as_int (t[2]->label));
      con= tm_new<connection_rep> (name, session, ln);
    }
#endif
    else if (is_tuple (t, "dynlink", 3)) {
      tm_link ln=
	make_dynamic_link (t[1]->label, t[2]->label, t[3]->label, session);
      con= tm_new<connection_rep> (name, session, ln);
    }
  }

  return con->start (again);
}
コード例 #2
0
ファイル: session.cpp プロジェクト: skyformat99/arg3db
            void session::open()
            {
                if (db_ != nullptr) {
                    return;
                }

                MYSQL *conn = mysql_init(nullptr);

                if (conn == nullptr) {
                    throw database_exception("out of memory connecting to mysql");
                }

                auto info = connection_info();

                int port = 3306;

                try {
                    if (!info.port.empty()) {
                        port = std::stoi(info.port);
                    }
                } catch (const std::exception &e) {
                    mysql_close(conn);
                    throw database_exception("unable to parse port " + info.port);
                }

                if (mysql_real_connect(conn, info.host.c_str(), info.user.c_str(), info.password.c_str(), info.path.c_str(), port, nullptr, 0) ==
                    nullptr) {
                    mysql_close(conn);
                    throw database_exception("No connection could be made to the database");
                }

                db_ = shared_ptr<MYSQL>(conn, helper::close_db());
            }
コード例 #3
0
ファイル: session.cpp プロジェクト: skyformat99/arg3db
            void session::open(int flags)
            {
                if (db_ != nullptr) {
                    return;
                }

                sqlite3 *conn = nullptr;

                if (sqlite3_open_v2(connection_info().path.c_str(), &conn, flags, nullptr) != SQLITE_OK) {
                    throw database_exception(last_error());
                }

                db_ = shared_ptr<sqlite3>(conn, helper::close_db());
            }
コード例 #4
0
ファイル: main.cpp プロジェクト: chuck1/Diffusion2D
int main(int ac, char** av) {
	
	if(ac != 2) {
		std::cout << "usage: " << av[0] << " <run number>" << std::endl;
		return 1;
	}

	// thomas's data
	size_t run_index = atoi(av[1]);
	real T_in_pipe[]  = {152.9, 203.6, 415.1};
	real T_in_head[]  = {203.5, 291.8, 487.8};
	real T_in_flux[]  = {227.7, 315.7, 504.7};
	real T_out_flux[] = {244.6, 346.9, 522.5};
	real T_out_head[] = {250.8, 355.7, 538.0};
	real T_out_pipe[] = {229.3, 332.6, 512.8};

	real* T_ym = new real[3];

	const char* prob_names[] = {"opt2_run1","opt2_run2","opt2_run3"};
	
	// convert to kelvin
	for(size_t i = 0; i < 3; ++i) {
		T_in_pipe[i]  += 273.15;
		T_in_head[i]  += 273.15;
		T_in_flux[i]  += 273.15;
		T_out_flux[i] += 273.15;
		T_out_head[i] += 273.15;
		T_out_pipe[i] += 273.15;

		T_ym[i] = (T_in_flux[i] + T_out_flux[i]) * 0.5;
	}

	// solve

	// dimensions
	real w_total = 	6.00e-2;
	real w_irrad = 	2.00e-2;
	real pipe = 	6.35e-3;

	real l_total = 	4.00e-2;
	real l_irrad = 	2.00e-2;

	// calculations
	real l_1 = (l_total - l_irrad) / 2.0;
	real l_3 = l_irrad - pipe * 2.0;

	real w_ends = (w_total - w_irrad) / 2.0;
	real w_1 = (w_ends - pipe) / 2.0;


	// lists
	auto xd = math::make_array_1<real,1>({0, w_1, pipe, w_1, w_irrad, w_1, pipe, w_1});

	auto yd = math::make_array_1<real,1>({0, 1e-2, 5e-2});

	auto zd = math::make_array_1<real,1>({0, l_1, pipe, l_3*0.5, l_3*0.5, pipe, l_1});

	real nom_size = 5e-4;

	auto nx = xd->sub({1},{-1})->divide(nom_size)->ceil<size_t>();
	auto ny = yd->sub({1},{-1})->divide(nom_size)->ceil<size_t>();
	auto nz = zd->sub({1},{-1})->divide(nom_size)->ceil<size_t>();

	auto x = xd->cumsum();
	auto y = yd->cumsum();
	auto z = zd->cumsum();

	coor_type X({x,y,z});

	cell_count_type n({nx,ny,nz});

	//=================================================================

	real s = 1.0e10;


	//nx = [10, 10, 10, 50, 10, 10, 10];
	//ny = [50, 50];
	//nz = [10, 10, 30, 10, 10];

	// the default boundary for solve source is const = 1.0
	auto const_bou(std::make_shared<boundary_single>(1.0));

	auto T_bou_i(std::make_shared<boundary_single>(T_in_pipe[run_index]));
	auto T_bou_o(std::make_shared<boundary_single>(T_out_pipe[run_index]));

	patch_v_bou_vec_type v_bou_s_def({
			{{const_bou},{const_bou}},
			{{const_bou},{const_bou}}
			});



	patch_v_bou_vec_type v_bou_T_i({
			{{T_bou_i},{T_bou_i}},
			{{T_bou_i},{T_bou_i}}
			});

	patch_v_bou_vec_type v_bou_T_o({
			{{T_bou_o},{T_bou_o}},
			{{T_bou_o},{T_bou_o}}
			});

	patch_v_bou_type v_bou_def({{"s",v_bou_s_def}});



	patch_v_bou_type v_bou_i({{"s",v_bou_s_def},{"T",v_bou_T_i}});
	patch_v_bou_type v_bou_o({{"s",v_bou_s_def},{"T",v_bou_T_o}});


	// create patch groups;

	point pt_xz(
			x->get(0),
			(y->get(0) + y->get(1)) / 2.0,
			(z->get(2) + z->get(3)) / 2.0);

	point pt_ym(
			(x->get(2) + x->get(5)) / 2.0,
			0.0,
			z->get(3));

	point pt_h_in(
			(x->get(3) + x->get(4)) / 2.0,
			y->get(1),
			(z->get(1) + z->get(2)) / 2.0);

	point pt_h_out(
			(x->get(3) + x->get(4)) / 2.0,
			y->get(1),
			(z->get(4) + z->get(5)) / 2.0);

	point pt_in(
			x->get(2),
			(y->get(1) + y->get(2)) / 2.0,
			(z->get(1) + z->get(2)) / 2.0);

	point pt_out(
			x->get(5),
			(y->get(1) + y->get(2)) / 2.0,
			(z->get(4) + z->get(5)) / 2.0);

	//==============================================================

	auto prob = std::make_shared<Prob>(prob_names[run_index], X, n, 2E4, 2E4);

	prob->create_equation("T", 10.0, 1.5, 1.5);
	prob->create_equation("s", 10.0, 1.5, 1.5);

	auto g_xyz		= prob->create_patch_group("xyz",		{{"T",0.0},		{"s",2.0}}, {{"T",0.0},{"s",s}}, pt_xz);
	auto g_h_in		= prob->create_patch_group("h_in",		{{"T",0.0},		{"s",2.0}}, {{"T",0.0},{"s",s}}, pt_h_in);
	auto g_h_out		= prob->create_patch_group("h_out",		{{"T",0.0},		{"s",2.0}}, {{"T",0.0},{"s",s}}, pt_h_out);
	auto g_in		= prob->create_patch_group("in",		{{"T",0.0},		{"s",2.0}}, {{"T",0.0},{"s",s}}, pt_in);
	auto g_out		= prob->create_patch_group("out",		{{"T",0.0},		{"s",2.0}}, {{"T",0.0},{"s",s}}, pt_out);
	auto g_ym		= prob->create_patch_group("out",		{{"T",T_ym[run_index]},	{"s",2.0}}, {{"T",0.0},{"s",s}}, pt_ym);

	// create patches

	auto p_in_xm	= g_in->create_patch("p_in_xm",		-1,	{1},		{1,2},	{1,2},		v_bou_i);
	auto p_in_xp	= g_in->create_patch("p_in_xp",		1,	{2},		{1,2},	{1,2},		v_bou_i);
	auto p_in_zm	= g_in->create_patch("p_in_zm",		-3,	{1,2},		{1,2},	{1},		v_bou_i);
	auto p_in_zp	= g_in->create_patch("p_in_zp",		3,	{1,2},		{1,2},	{2},		v_bou_i);

	auto p_out_xm	= g_out->create_patch("p_out_xm",	-1,	{5},		{1,2},	{4,5},		v_bou_o);
	auto p_out_xp	= g_out->create_patch("p_out_xp",	1,	{6},		{1,2},	{4,5},		v_bou_o);
	auto p_out_zm	= g_out->create_patch("p_out_zm",	-3,	{5,6},		{1,2},	{4},		v_bou_o);
	auto p_out_zp	= g_out->create_patch("p_out_zp",	3,	{5,6},		{1,2},	{5},		v_bou_o);


	// ym
	auto p_ym_0_0	= g_ym->create_patch("p_ym_0_0",	-2,	{0,1,2,3},	{0},	{0,1},		v_bou_def);
	auto p_ym_0_1	= g_ym->create_patch("p_ym_0_1",	-2,	{0,1,2,3},	{0},	{1,2,3,4,5},	v_bou_def);
	auto p_ym_0_2	= g_ym->create_patch("p_ym_0_2",	-2,	{0,1,2,3},	{0},	{5,6},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},	"s":{{1.0,1.0},{1.0,1.0}}});

	auto p_ym_1_0	= g_ym->create_patch("p_ym_1_0",	-2,	{3,4},		{0},	{0,1},		v_bou_def);
	auto p_ym_1_1	= g_ym->create_patch("p_ym_1_1",	-2,	{3,4},		{0},	{1,2,3,4,5},	v_bou_def);
	auto p_ym_1_2	= g_ym->create_patch("p_ym_1_2",	-2,	{3,4},		{0},	{5,6},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,T_irr_zp}},"s":{{1.0,1.0},{1.0,1.0}}});

	auto p_ym_2_0	= g_ym->create_patch("p_ym_2_0",	-2,	{4,5,6,7},	{0},	{0,1},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},	"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_ym_2_1	= g_ym->create_patch("p_ym_2_1",	-2,	{4,5,6,7},	{0},	{1,2,3,4,5},	v_bou_def);// = {"T":{{0.0,T_irr_xp},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_ym_2_2	= g_ym->create_patch("p_ym_2_2",	-2,	{4,5,6,7},	{0},	{5,6},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},	"s":{{1.0,1.0},{1.0,1.0}}});

	// yp
	auto p_yp_0_0	= g_in->create_patch("p_yp_0_0",	2,	{0,1,2,3},	{1},	{0,1},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});

	auto p_yp_0_1_0	= g_in->create_patch("p_yp_0_1_0",	2,	{0,1},		{1},	{1,2,3},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_yp_0_1_1	= g_in->create_patch("p_yp_0_1_1",	2,	{1,2},		{1},	{2,3},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_yp_0_1_2	= g_in->create_patch("p_yp_0_1_2",	2,	{2,3},		{1},	{1,2,3},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});

	auto p_yp_0_2	= g_h_out->create_patch("p_yp_0_2",	2,	{0,1,2,3},	{1},	{3,4,5},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_yp_0_3	= g_h_out->create_patch("p_yp_0_3",	2,	{0,1,2,3},	{1},	{5,6},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});

	auto p_yp_1_0	= g_h_in->create_patch("p_yp_1_0",	2,	{3,4},		{1},	{0,1},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_yp_1_1	= g_h_in->create_patch("p_yp_1_1",	2,	{3,4},		{1},	{1,2,3},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_yp_1_2	= g_h_out->create_patch("p_yp_1_2",	2,	{3,4},		{1},	{3,4,5},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_yp_1_3	= g_h_out->create_patch("p_yp_1_3",	2,	{3,4},		{1},	{5,6},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});

	auto p_yp_2_0	= g_h_in->create_patch("p_yp_2_0",	2,	{4,5,6,7},	{1},	{0,1},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_yp_2_1	= g_h_in->create_patch("p_yp_2_1",	2,	{4,5,6,7},	{1},	{1,2,3},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});

	auto p_yp_2_2_0	= g_out->create_patch("p_yp_2_2_0",	2,	{4,5},		{1},	{3,4,5},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_yp_2_2_1	= g_out->create_patch("p_yp_2_2_1",	2,	{5,6},		{1},	{3,4},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_yp_2_2_2	= g_out->create_patch("p_yp_2_2_2",	2,	{6,7},		{1},	{3,4,5},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});

	auto p_yp_2_3	= g_out->create_patch("p_yp_2_3",	2,	{4,5,6,7},	{1},	{5,6},		v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});

	// xp
	auto p_xm	= g_xyz->create_patch("p_xm",		-1,	{0},			{0,1},		{0,1,2,3,4,5,6},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_xp	= g_xyz->create_patch("p_xp",		1,	{7},			{0,1},		{0,1,2,3,4,5,6},	v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});

	auto p_zm	= g_xyz->create_patch("p_zm",		-3,	{0,1,2,3,4,5,6,7},	{0,1},		{0},			v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});
	auto p_zp	= g_xyz->create_patch("p_zp",		3,	{0,1,2,3,4,5,6,7},	{0,1},		{6},			v_bou_def);// = {"T":{{0.0,0.0},{0.0,0.0}},"s":{{1.0,1.0},{1.0,1.0}}});


	// stitching

	// in xm
	stitch(p_in_xm,		p_in_zm);
	stitch(p_in_xm,		p_in_zp);
	stitch(p_in_xm,		p_yp_0_1_0);

	// in xp
	stitch(p_in_xp,		p_in_zm);
	stitch(p_in_xp,		p_in_zp);
	stitch(p_in_xp,		p_yp_0_1_2);

	// in z
	stitch(p_in_zm,		p_yp_0_0);
	stitch(p_in_zp,		p_yp_0_1_1);

	// out xm
	stitch(p_out_xm,	p_out_zm);
	stitch(p_out_xm,	p_out_zp);
	stitch(p_out_xm,	p_yp_2_2_0);

	// out xp
	stitch(p_out_xp,	p_out_zm);
	stitch(p_out_xp,	p_out_zp);
	stitch(p_out_xp,	p_yp_2_2_2);

	// out z
	stitch(p_out_zp,	p_yp_2_3);
	stitch(p_out_zm,	p_yp_2_2_1);



	// xm
	stitch(p_xm,p_ym_0_0);
	stitch(p_xm,p_ym_0_1);
	stitch(p_xm,p_ym_0_2);

	stitch(p_xm,p_yp_0_0);
	stitch(p_xm,p_yp_0_1_0);
	stitch(p_xm,p_yp_0_2);
	stitch(p_xm,p_yp_0_3);

	stitch(p_xm,p_zm);
	stitch(p_xm,p_zp);

	// xp
	stitch(p_xp,p_ym_2_0);
	stitch(p_xp,p_ym_2_1);;
	stitch(p_xp,p_ym_2_2);

	stitch(p_xp,p_yp_2_0);
	stitch(p_xp,p_yp_2_1);
	stitch(p_xp,p_yp_2_2_2);
	stitch(p_xp,p_yp_2_3);

	stitch(p_xp,p_zm);
	stitch(p_xp,p_zp);

	//zm;
	stitch(p_zm,p_ym_0_0);
	stitch(p_zm,p_ym_1_0);
	stitch(p_zm,p_ym_2_0);

	stitch(p_zm,p_yp_0_0);
	stitch(p_zm,p_yp_1_0);
	stitch(p_zm,p_yp_2_0);

	// zp;
	stitch(p_zp,p_ym_0_2);
	stitch(p_zp,p_ym_1_2);
	stitch(p_zp,p_ym_2_2);

	stitch(p_zp,p_yp_0_3);
	stitch(p_zp,p_yp_1_3);
	stitch(p_zp,p_yp_2_3);

	// yp
	// row 0
	stitch(p_yp_0_0,	p_yp_1_0);
	stitch(p_yp_0_0,	p_yp_0_1_0);
	stitch(p_yp_0_0,	p_yp_0_1_2);

	stitch(p_yp_1_0,	p_yp_1_1);
	stitch(p_yp_1_0,	p_yp_2_0);

	stitch(p_yp_2_0,	p_yp_2_1);

	// row 1
	stitch(p_yp_0_1_0,	p_yp_0_1_1);
	stitch(p_yp_0_1_0,	p_yp_0_2);

	stitch(p_yp_0_1_1,	p_yp_0_1_2);
	stitch(p_yp_0_1_1,	p_yp_0_2);

	stitch(p_yp_0_1_2,	p_yp_1_1);
	stitch(p_yp_0_1_2,	p_yp_0_2);

	stitch(p_yp_1_1,	p_yp_2_1);
	stitch(p_yp_1_1,	p_yp_1_2);

	stitch(p_yp_2_1,	p_yp_2_2_0);
	stitch(p_yp_2_1,	p_yp_2_2_1);
	stitch(p_yp_2_1,	p_yp_2_2_2);


	// row 2
	stitch(p_yp_0_2,	p_yp_1_2);
	stitch(p_yp_0_2,	p_yp_0_3);

	stitch(p_yp_1_2,	p_yp_2_2_0);
	stitch(p_yp_1_2,	p_yp_1_3);

	stitch(p_yp_2_2_0,	p_yp_2_2_1);
	stitch(p_yp_2_2_0,	p_yp_2_3);

	stitch(p_yp_2_2_1,	p_yp_2_2_2);

	stitch(p_yp_2_2_2,	p_yp_2_3);

	// row 3
	stitch(p_yp_0_3,	p_yp_1_3);

	stitch(p_yp_1_3,	p_yp_2_3);

	// ym;
	stitch(p_ym_0_0,	p_ym_0_1);
	stitch(p_ym_0_0,	p_ym_1_0);

	stitch(p_ym_1_0,	p_ym_1_1);
	stitch(p_ym_1_0,	p_ym_2_0);
	
	stitch(p_ym_2_0,	p_ym_2_1);

	stitch(p_ym_0_1,	p_ym_1_1);
	stitch(p_ym_0_1,	p_ym_0_2);

	stitch(p_ym_1_1,	p_ym_2_1);
	stitch(p_ym_1_1,	p_ym_1_2);

	stitch(p_ym_2_1,	p_ym_2_2);

	stitch(p_ym_0_2,	p_ym_1_2);

	stitch(p_ym_1_2,	p_ym_2_2);


	for(auto g : prob->patch_groups_) {
		g->get_value_of_interest_residual("T");
	}	

	// solve;

	prob->connection_info();

	solve_with_source(prob);
	//solve_source(prob);
	//solve_temp(prob);

	prob->value_stats("T");

};
コード例 #5
0
ファイル: PublisherImpl.cpp プロジェクト: svn2github/OpenDDS
DDS::ReturnCode_t
PublisherImpl::writer_enabled(
  OpenDDS::DCPS::DataWriterRemote_ptr remote_writer,
  DDS::DataWriter_ptr    local_writer,
  const char*              topic_name,
  //BuiltinTopicKey_t topic_key
  RepoId                   topic_id)
{
  PublisherDataWriterInfo* info = new PublisherDataWriterInfo;
  info->remote_writer_objref_ = remote_writer;
  info->local_writer_objref_ = local_writer;
  info->local_writer_impl_ =
    dynamic_cast<DataWriterImpl*>(local_writer);

  info->topic_id_      = topic_id;
  // all other info memebers default in constructor

  /// Load the publication into the repository and get the
  /// publication_id_ in return.
  try {
    DDS::DataWriterQos qos;
    info->local_writer_objref_->get_qos(qos);

    OpenDDS::DCPS::TransportInterfaceInfo trans_conf_info =
      connection_info();
    trans_conf_info.publication_transport_priority = qos.transport_priority.value;

    DCPSInfo_var repo = TheServiceParticipant->get_repository(this->domain_id_);
    info->publication_id_ =
      repo->add_publication(
        this->domain_id_, // Loaded during Publisher
        // construction
        this->participant_->get_id(),   // Loaded during Publisher construction.
        info->topic_id_, // Loaded during DataWriter construction.
        info->remote_writer_objref_,
        qos,
        trans_conf_info ,   // Obtained during setup.
        this->qos_);

    if (info->publication_id_ == GUID_UNKNOWN) {
      ACE_ERROR((LM_ERROR,
                 ACE_TEXT("(%P|%t) ERROR: PublisherImpl::writer_enabled, ")
                 ACE_TEXT("add_publication returned invalid id. \n")));
      return DDS::RETCODE_ERROR;
    }

    info->local_writer_impl_->set_publication_id(info->publication_id_);

    OpenDDS::DCPS::TransportImpl_rch impl = this->get_transport_impl();

    if (impl.is_nil()) {
      ACE_ERROR((LM_ERROR,
                 ACE_TEXT("(%P|%t) ERROR: ")
                 ACE_TEXT("PublisherImpl::writer_enabled, ")
                 ACE_TEXT("the publisher has not been attached to ")
                 ACE_TEXT("the TransportImpl.\n")));
      return DDS::RETCODE_ERROR;
    }

    // Register the DataWriterImpl object with the TransportImpl.
    else if (impl->register_publication(info->publication_id_,
                                        info->local_writer_impl_) == -1) {
      RepoIdConverter converter(info->publication_id_);
      ACE_ERROR((LM_ERROR,
                 ACE_TEXT("(%P|%t) ERROR: ")
                 ACE_TEXT("PublisherImpl::writer_enabled: ")
                 ACE_TEXT("failed to register datawriter %C with ")
                 ACE_TEXT("TransportImpl.\n"),
                 std::string(converter).c_str()));
      return DDS::RETCODE_ERROR;
    }

  } catch (const CORBA::SystemException& sysex) {
    sysex._tao_print_exception(
      "ERROR: System Exception"
      " in PublisherImpl::writer_enabled");
    return DDS::RETCODE_ERROR;

  } catch (const CORBA::UserException& userex) {
    userex._tao_print_exception(
      "ERROR:  Exception"
      " in PublisherImpl::writer_enabled");
    return DDS::RETCODE_ERROR;
  }

  {
    ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex,
                     guard,
                     this->pi_lock_,
                     DDS::RETCODE_ERROR);
    DataWriterMap::iterator it =
      datawriter_map_.insert(DataWriterMap::value_type(topic_name, info));

    if (it == datawriter_map_.end()) {
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("(%P|%t) ERROR: ")
                        ACE_TEXT("PublisherImpl::writer_enabled, ")
                        ACE_TEXT("insert datawriter(topic_name=%C) ")
                        ACE_TEXT("failed.\n"),
                        topic_name),
                       DDS::RETCODE_ERROR);
    }

    std::pair<PublicationMap::iterator, bool> pair =
      publication_map_.insert(
        PublicationMap::value_type(info->publication_id_, info));

    if (pair.second == false) {
      RepoIdConverter converter(info->publication_id_);
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("(%P|%t) ERROR: ")
                        ACE_TEXT("PublisherImpl::writer_enabled: ")
                        ACE_TEXT("insert publication %C failed.\n"),
                        std::string(converter).c_str()), DDS::RETCODE_ERROR);
    }

    // Increase ref count when the servant is added to the
    // datawriter/publication map.
    info->local_writer_impl_->_add_ref();
  }

  return DDS::RETCODE_OK;
}
コード例 #6
0
ファイル: session.cpp プロジェクト: skyformat99/arg3db
 void session::query_schema(const std::string &tablename, std::vector<column_definition> &columns)
 {
     return impl_->query_schema(connection_info().path, tablename, columns);
 }