27 #include <rtt/rtt-config.h> 30 #define ORO_MEMORY_POOL 44 #ifdef ORO_BUILD_LOGGING 46 # warning "Logging needs rtalloc!" 54 namespace po = boost::program_options;
56 int main(
int argc,
char** argv)
59 std::vector<std::string> scriptFiles;
60 std::string name(
"Deployer");
61 bool requireNameService =
false;
62 bool deploymentOnlyChecked =
false;
65 po::options_description taoOptions(
"Additional options after a '--' are passed through to TAO");
68 po::options_description otherOptions;
70 #ifdef ORO_BUILD_RTALLOC 71 OCL::memorySize rtallocMemorySize = ORO_DEFAULT_RTALLOC_SIZE;
72 po::options_description rtallocOptions = OCL::deployerRtallocOptions(rtallocMemorySize);
73 otherOptions.add(rtallocOptions);
74 OCL::TLSFMemoryPool memoryPool;
77 #if defined(ORO_BUILD_LOGGING) && defined(OROSEM_LOG4CPP_LOGGING) 79 std::string rttLog4cppConfigFile;
80 po::options_description rttLog4cppOptions = OCL::deployerRttLog4cppOptions(rttLog4cppConfigFile);
81 otherOptions.add(rttLog4cppOptions);
85 otherOptions.add(taoOptions);
91 while(!found && optIndex<argc)
93 found = (0 == strcmp(
"--", argv[optIndex]));
94 if(!found) optIndex++;
98 argv[optIndex] = argv[0];
104 siteFile, scriptFiles, name, requireNameService, deploymentOnlyChecked,
119 #if defined(ORO_BUILD_LOGGING) && defined(OROSEM_LOG4CPP_LOGGING) 120 if (!OCL::deployerConfigureRttLog4cppCategory(rttLog4cppConfigFile))
126 #ifdef ORO_BUILD_RTALLOC 127 if (!memoryPool.initialize(rtallocMemorySize.size))
131 #endif // ORO_BUILD_RTALLOC 133 #ifdef ORO_BUILD_LOGGING 144 if (0 ==
__os_init(argc - optIndex, &argv[optIndex]))
146 #ifdef ORO_BUILD_LOGGING 147 log(
Info) <<
"OCL factory set for real-time logging" <<
endlog();
175 for (std::vector<std::string>::const_iterator iter=scriptFiles.begin();
176 iter!=scriptFiles.end() && result;
179 if ( !(*iter).empty() )
181 if ( (*iter).rfind(
".xml", std::string::npos) == (*iter).length() - 4 ||
182 (*iter).rfind(
".cpf", std::string::npos) == (*iter).length() - 4) {
183 if ( deploymentOnlyChecked ) {
185 bool configureOk =
true;
187 if (!dc.
kickStart2( (*iter),
false, loadOk, configureOk, startOk )) {
190 log(
Error) <<
"Failed to load file: '"<< (*iter) <<
"'." <<
endlog();
191 }
else if (!configureOk) {
192 log(
Error) <<
"Failed to configure file: '"<< (*iter) <<
"'." <<
endlog();
198 result = dc.
kickStart( (*iter) ) && result;
203 if ( (*iter).rfind(
".ops", std::string::npos) == (*iter).length() - 4 ||
204 (*iter).rfind(
".osd", std::string::npos) == (*iter).length() - 4 ||
205 (*iter).rfind(
".lua", std::string::npos) == (*iter).length() - 4) {
206 result = dc.
runScript( (*iter) ) && result;
210 log(
Error) <<
"Unknown extension of file: '"<< (*iter) <<
"'. Must be xml, cpf for XML files or, ops, osd or lua for script files."<<
endlog();
213 rc = (result ? 0 : -1);
216 if ( !deploymentOnlyChecked && !vm.count(
"daemon") ) {
217 if (isatty(fileno(stdin))) {
233 }
catch( CORBA::Exception &e ) {
246 std::cerr <<
"Unable to start Orocos" << std::endl;
250 #ifdef ORO_BUILD_LOGGING 255 #ifdef ORO_BUILD_RTALLOC 256 memoryPool.shutdown();
void loop()
Call this method from ORO_main() to process keyboard input and thus startup the TaskBrowser.
bool kickStart2(const std::string &configurationfile, const bool doStart, bool &loadOk, bool &configureOk, bool &startOk)
This component allows a text client to browse the peers of a peer RTT::TaskContext and execute comman...
int __os_init(int argc, char **argv)
virtual void deleteAllCategories()
static void set_category_factory(creator_function_t creator_function)
static std::ostream & nl(std::ostream &__os)
#define CORBA_EXCEPTION_INFO(x)
int deployerParseCmdLine(int argc, char **argv, std::string &siteFile, std::vector< std::string > &scriptFiles, std::string &name, bool &requireNameService, bool &deploymentOnlyChecked, int &minNumberCPU, po::variables_map &vm, po::options_description *otherOptions)
static RTT_CORBA_API bool InitOrb(int argc, char *argv[], Seconds orb_timeout=0)
static TaskContextServer * Create(TaskContext *tc, bool use_naming=true, bool require_name_service=false)
bool kickStart(const std::string &file_name)
static log4cpp::Category * createOCLCategory(const std::string &name, log4cpp::Category *parent, log4cpp::Priority::Value priority)
int main(int argc, char **argv)
static HierarchyMaintainer & getDefaultMaintainer()
void shutdownDeployment()
bool runScript(const std::string &file_name)
static void ShutdownOrb(bool wait_for_completion=true)
int enforceMinNumberCPU(const int minNumberCPU)
static Logger::LogFunction endlog()