本文整理汇总了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();
}