XTA: API Reference for C++ language

Config.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2018, Christian Ferrari <tiian@users.sourceforge.net>
3  * All rights reserved.
4  *
5  * This file is part of LIXA.
6  *
7  * LIXA is free software: you can redistribute this file and/or modify
8  * it under the terms of the GNU Lesser General Public License version 2.1 as
9  * published by the Free Software Foundation.
10  *
11  * LIXA is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with LIXA. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 
22 /* set module trace flag */
23 #ifdef LIXA_TRACE_MODULE
24 # undef LIXA_TRACE_MODULE
25 #endif /* LIXA_TRACE_MODULE */
26 #define LIXA_TRACE_MODULE LIXA_TRACE_MOD_XTA
27 
28 
29 
30 #include "Exception.hpp"
31 #include "Config.hpp"
32 
33 
34 
35 namespace xta {
36 
38  {
39  this->config = NULL;
40  };
41 
42  Config::Config(xta_config_t *config)
43  {
44  if (NULL == config)
45  throw Exception(LIXA_RC_NULL_OBJECT, "xta::Config::Config");
46  this->config = config;
47  };
48 
50  {
51  /* this->tx is just a reference to an object created/destroyed by
52  TransactionManager */
53  this->config = NULL;
54  };
55 
57  {
58  if (NULL == config)
59  throw Exception(LIXA_RC_NULL_OBJECT,
60  "Config::getConnectionTimeout");
61  else
62  return xta_config_get_connection_timeout(config);
63  }
64 
66  {
67  if (NULL == config)
68  throw Exception(LIXA_RC_NULL_OBJECT,
69  "Config::setConnectionTimeout");
70  else {
71  int rc;
72  if (LIXA_RC_OK != (rc = xta_config_set_connection_timeout(
73  config, value)))
74  throw Exception(rc, "xta_config_set_connection_timeout");
75  }
76  }
77 }
int getConnectionTimeout()
Definition: Config.cpp:56
xta_config_t * config
Definition: Config.hpp:67
void setConnectionTimeout(int value)
Definition: Config.cpp:65
Config(void)
Definition: Config.cpp:37

Copyright © 2009-2019, Christian Ferrari tiian@users.sourceforge.net http://www.tiian.org/