当前位置: 首页>>代码示例>>C++>>正文


C++ Constant::ready方法代码示例

本文整理汇总了C++中Constant::ready方法的典型用法代码示例。如果您正苦于以下问题:C++ Constant::ready方法的具体用法?C++ Constant::ready怎么用?C++ Constant::ready使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Constant的用法示例。


在下文中一共展示了Constant::ready方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HelloWorld

        /**
         * This example sets the interface up in the Constructor
         * of the component.
         */
        HelloWorld(std::string name)
            : TaskContext(name),
              // Name, description, value
              property("the_property", "the_property Description", "Hello World"),
              // Name, value
              attribute("the_attribute", "Hello World"),
              // Name, value
              constant("the_constant", "Hello World"),
              // Name, initial value
              dataport("the_data_port","World"),
              // Name, buffer size, initial value
              bufferport("the_buffer_port",13, "World"),
              // Name, function pointer, object
              method("the_method", &HelloWorld::mymethod, this),
              // Name, command function pointer, completion condition function pointer, object
              command("the_command", &HelloWorld::mycommand, &HelloWorld::mycomplete, this),
              // Name
              event("the_event"),

              // Create the activity which runs the task's engine:
              // 0: Priority
              // 0.01: Period (100Hz)
              // engine(): is being executed.
              act(0, 0.01, this->engine() )
        {
            // Set log level more verbose than default,
            // such that we can see output :
            if ( log().getLogLevel() < Logger::Info ) {
                log().setLogLevel( Logger::Info );
                log(Info) << "HelloWorld manually raises LogLevel to 'Info' (5). See also file 'orocos.log'."<<endlog();
            }

            // Check if all initialisation was ok:
            assert( property.ready() );
            assert( attribute.ready() );
            assert( constant.ready() );
            assert( method.ready() );
            assert( command.ready() );
            assert( event.ready() );

            // Now add it to the interface:
            this->properties()->addProperty(&property);

            this->attributes()->addAttribute(&attribute);
            this->attributes()->addConstant(&constant);

            this->ports()->addPort(&dataport);
            this->ports()->addPort(&bufferport);

            this->methods()->addMethod(&method, "'the_method' Description");

            this->commands()->addCommand(&command, "'the_command' Description",
                                         "the_arg", "Use 'World' as argument to make the command succeed.");

            this->events()->addEvent(&event, "'the_event' Description",
                                     "the_data", "The data of this event.");

            // Adding an asynchronous callback:
            h = this->events()->setupConnection("the_event").callback(this, &HelloWorld::mycallback, this->engine()->events() ).handle();
            h.connect();

            log(Info) << "**** Starting the 'Hello' component ****" <<endlog();
            // Start the component's activity:
            this->start();
        }
开发者ID:ptroja,项目名称:orocos-ocl,代码行数:69,代码来源:HelloWorld.cpp


注:本文中的Constant::ready方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。