#include #include DEFUN_DLD (tbcInit, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} address@hidden =} tbcInit (\ @var{layout}, @var{classpath})\n\ @deftypefnx {Loadable Function} address@hidden =} tbcInit (\ @var{layout}, @var{classpath}, @var{dump})\n\ @deftypefnx {Loadable Function} address@hidden =} tbcInit (\ @var{layout}, @var{classpath}, @var{dump}, @var{hostname})\n\ Initialize the underlying libraries and prepare the system for controlling\ the testbed defined in @var{layout}. This call need only be done once. \ However, subsequent calls should not cause problems. The return boolean \ indicates whether or not the call succeed successfully (true) or \ not (false).\n\n\ @table @var\n\ @item layout\nAn XML file describing the layout of the testbed one\ wishes to control.\ @item classpath\nNeeds to point to all directories and @sc{jar} files that \ are needed to parse the XML and communicate with the testbed. At a minimum \ that usually means testbed.jar.\ @item dump\nA boolean to indicate whether or not to display a whole bunch \ of diagnostics. It is not recommended that a user use this because it will \ force a lot of messages to come to the screen and will flood the user with \ all kinds of details that the probably do not care about.\ @item hostname\nIn worse case senerios the underlying libraries cannot \ self detect the hostname. When this occurs, the library needs to be force \ fed the host name. Normally, this should never be done.\ @end table\n\n\ @end deftypefn\n\ @seealso{tbcAppend, tbcCollect, tbcExecute, tbcFlush, tbcMonitor}") { bool allGood = true, dump = false, hasHN = false, success = false; std::string hostname; octave_value_list result; if (args.length() < 2 || args.length() > 4 || nargout > 1) print_usage ("tbcInit"); else { if (args(0).is_string()) { const char *xmlfile = args(0).all_strings()[0].c_str(); if (args(1).is_string()) { const char *classpath = args(1).all_strings()[0].c_str(); if (args.length() > 2) { if (args(2).is_bool_type()) { dump = args(2).bool_value(); if (args.length() > 3) { if (args(3).is_string()) { std::cerr << "You had better know what you are " << "doing. Forcing a hostname is very " << "very dangerous." << std::endl; hostname = args(3).all_strings()[0]; hasHN = true; } } } else { gripe_wrong_type_arg ("tbcInit -- argument 3", args(2)); allGood = false; } } if (allGood) { success = commandInterface::initialize (xmlfile, classpath, (hasHN ? hostname.c_str() : NULL), dump); } } else gripe_wrong_type_arg ("tbcInit -- argument 2", args(1)); } else gripe_wrong_type_arg ("tbcInit -- argument 1", args(0)); } result(0) = success; return result; }