27 #include <rtt/rtt-config.h> 30 #define ORO_MEMORY_POOL 37 #ifndef RTT_SCRIPT_PROGRAM 38 #define USE_TASKBROWSER 41 #ifdef USE_TASKBROWSER 49 #ifdef ORO_BUILD_LOGGING 51 # warning "Logging needs rtalloc!" 58 namespace po = boost::program_options;
60 int main(
int argc,
char** argv)
63 std::vector<std::string> scriptFiles;
64 std::string name(
"Deployer");
65 bool requireNameService =
false;
66 bool deploymentOnlyChecked =
false;
69 po::options_description otherOptions;
71 #ifdef ORO_BUILD_RTALLOC 72 OCL::memorySize rtallocMemorySize = ORO_DEFAULT_RTALLOC_SIZE;
73 po::options_description rtallocOptions = OCL::deployerRtallocOptions(rtallocMemorySize);
74 otherOptions.add(rtallocOptions);
75 OCL::TLSFMemoryPool memoryPool;
78 #if defined(ORO_BUILD_LOGGING) && defined(OROSEM_LOG4CPP_LOGGING) 80 std::string rttLog4cppConfigFile;
81 po::options_description rttLog4cppOptions = OCL::deployerRttLog4cppOptions(rttLog4cppConfigFile);
82 otherOptions.add(rttLog4cppOptions);
89 while(!found && optIndex<argc)
91 found = (0 == strcmp(
"--", argv[optIndex]));
92 if(!found) optIndex++;
96 argv[optIndex] = argv[0];
102 siteFile, scriptFiles, name, requireNameService, deploymentOnlyChecked,
117 #if defined(ORO_BUILD_LOGGING) && defined(OROSEM_LOG4CPP_LOGGING) 118 if (!OCL::deployerConfigureRttLog4cppCategory(rttLog4cppConfigFile))
124 #ifdef ORO_BUILD_RTALLOC 125 if (!memoryPool.initialize(rtallocMemorySize.size))
129 #endif // ORO_BUILD_RTALLOC 131 #ifdef ORO_BUILD_LOGGING 142 if (0 ==
__os_init(argc - optIndex, &argv[optIndex]))
144 #ifdef ORO_BUILD_LOGGING 145 log(
Info) <<
"OCL factory set for real-time logging" <<
endlog();
159 for (std::vector<std::string>::const_iterator iter=scriptFiles.begin();
160 iter!=scriptFiles.end() && result;
163 if ( !(*iter).empty() )
165 if ( (*iter).rfind(
".xml", std::string::npos) == (*iter).length() - 4 ||
166 (*iter).rfind(
".cpf", std::string::npos) == (*iter).length() - 4) {
167 if ( deploymentOnlyChecked ) {
169 bool configureOk =
true;
171 if (!dc.
kickStart2( (*iter),
false, loadOk, configureOk, startOk )) {
174 log(
Error) <<
"Failed to load file: '"<< (*iter) <<
"'." <<
endlog();
175 }
else if (!configureOk) {
176 log(
Error) <<
"Failed to configure file: '"<< (*iter) <<
"'." <<
endlog();
182 result = dc.
kickStart( (*iter) ) && result;
187 if ( (*iter).rfind(
".ops", std::string::npos) == (*iter).length() - 4 ||
188 (*iter).rfind(
".osd", std::string::npos) == (*iter).length() - 4 ||
189 (*iter).rfind(
".lua", std::string::npos) == (*iter).length() - 4) {
190 result = dc.
runScript( (*iter) ) && result;
194 log(
Error) <<
"Unknown extension of file: '"<< (*iter) <<
"'. Must be xml, cpf for XML files or, ops, osd or lua for script files."<<
endlog();
197 rc = (result ? 0 : -1);
199 #ifdef USE_TASKBROWSER 201 if ( !deploymentOnlyChecked && !vm.count(
"daemon") ) {
202 if (isatty(fileno(stdin))) {
219 std::cerr <<
"Unable to start Orocos" << std::endl;
223 #ifdef ORO_BUILD_LOGGING 228 #ifdef ORO_BUILD_RTALLOC 229 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)
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)
bool kickStart(const std::string &file_name)
static log4cpp::Category * createOCLCategory(const std::string &name, log4cpp::Category *parent, log4cpp::Priority::Value priority)
static HierarchyMaintainer & getDefaultMaintainer()
void shutdownDeployment()
bool runScript(const std::string &file_name)
int main(int argc, char **argv)
int enforceMinNumberCPU(const int minNumberCPU)
static Logger::LogFunction endlog()