本文整理汇总了C++中OutputPort类的典型用法代码示例。如果您正苦于以下问题:C++ OutputPort类的具体用法?C++ OutputPort怎么用?C++ OutputPort使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OutputPort类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gInvRotorderOp_Update
// Update =====================================================
CStatus gInvRotorderOp_Update( CRef& in_ctxt )
{
OperatorContext ctxt( in_ctxt );
// Inputs --------------------------------------------------------------
long iRotorder = ctxt.GetParameterValue(L"Rotorder");
long iOut = 0;
if(iRotorder == 0)
iOut = 5;
else if (iRotorder == 1)
iOut = 3;
else if (iRotorder == 2)
iOut = 4;
else if (iRotorder == 3)
iOut = 1;
else if (iRotorder == 4)
iOut = 2;
else if (iRotorder == 5)
iOut = 0;
OutputPort Out = ctxt.GetOutputPort();
Out.PutValue(iOut);
return CStatus::OK;
}
示例2: sn_inverseRotorder_op_Update
// Update =====================================================
CStatus sn_inverseRotorder_op_Update( CRef& in_ctxt )
{
OperatorContext ctxt( in_ctxt );
LONG rotorder = ctxt.GetParameterValue(L"rotorder");
LONG out_ro = 0;
if(rotorder == 0)
out_ro = 5;
else if (rotorder == 1)
out_ro = 3;
else if (rotorder == 2)
out_ro = 4;
else if (rotorder == 3)
out_ro = 1;
else if (rotorder == 4)
out_ro = 2;
else if (rotorder == 5)
out_ro = 0;
OutputPort Out = ctxt.GetOutputPort();
Out.PutValue(out_ro);
return CStatus::OK;
}
示例3: GetSource
wxString
InputPort::GetType() const
{
OutputPort *output = GetSource();
if (output != NULL)
{
return output->GetType();
}
return wxT("?");
}
示例4: outputPort
OutputPort* NodeInspector::outputPort(const Datum* d) const
{
for (auto row : rows)
for (auto a : row->childItems())
{
OutputPort* p = dynamic_cast<OutputPort*>(a);
if (p && p->getDatum() == d)
return p;
}
return NULL;
}
示例5: disconnect
virtual void disconnect(bool forward)
{
// Call the base class first
base::ChannelElement<T>::disconnect(forward);
OutputPort<T>* port = this->port;
if (port && !forward)
{
this->port = 0;
port->removeConnection( cid );
}
}
示例6: createConnection
static bool createConnection(OutputPort<T>& output_port, base::InputPortInterface& input_port, ConnPolicy const& policy)
{
if ( !output_port.isLocal() ) {
log(Error) << "Need a local OutputPort to create connections." <<endlog();
return false;
}
InputPort<T>* input_p = dynamic_cast<InputPort<T>*>(&input_port);
// This is the input channel element of the output half
base::ChannelElementBase::shared_ptr output_half = 0;
if (input_port.isLocal() && policy.transport == 0)
{
// Local connection
if (!input_p)
{
log(Error) << "Port " << input_port.getName() << " is not compatible with " << output_port.getName() << endlog();
return false;
}
// local ports, create buffer here.
output_half = buildBufferedChannelOutput<T>(*input_p, output_port.getPortID(), policy, output_port.getLastWrittenValue());
}
else
{
// if the input is not local, this is a pure remote connection,
// if the input *is* local, the user requested to use a different transport
// than plain memory, rare case, but we accept it. The unit tests use this for example
// to test the OOB transports.
if ( !input_port.isLocal() ) {
output_half = createRemoteConnection( output_port, input_port, policy);
} else
output_half = createOutOfBandConnection<T>( output_port, *input_p, policy);
}
if (!output_half)
return false;
// Since output is local, buildChannelInput is local as well.
// This this the input channel element of the whole connection
base::ChannelElementBase::shared_ptr channel_input =
buildChannelInput<T>(output_port, input_port.getPortID(), output_half);
return createAndCheckConnection(output_port, input_port, channel_input, policy );
}
示例7: writeJointPositionsToPort
void ArmBridgeRosOrocos::writeJointPositionsToPort(brics_actuator::JointPositions brics_joint_positions, std_msgs::Float64MultiArray& orocos_data_array, OutputPort<std_msgs::Float64MultiArray>& output_port)
{
for (size_t i = 0; i < brics_joint_positions.positions.size(); i++)
{
std::cout << brics_joint_positions.positions[i].value << " ";
orocos_data_array.data[i] = brics_joint_positions.positions[i].value;
}
output_port.write(orocos_data_array);
}
示例8: lua_upvalueindex
int
InputPort::LuaGetSource(lua_State *L)
{
ShaderObject *obj = *(ShaderObject **)lua_touserdata(L, lua_upvalueindex(1));
InputPort *input = dynamic_cast<InputPort *>(obj);
OutputPort *source = input->GetSource();
if (source != NULL)
{
source->PushLua(L);
}
else
{
lua_newtable(L);
lua_pushcfunction(L, ::LuaUID);
lua_setfield(L, -2, "uid");
lua_pushcfunction(L, ::LuaGetType);
lua_setfield(L, -2, "get_type");
}
return 1;
}
示例9: testPortBufferConnection
void CorbaTest::testPortBufferConnection()
{
// This test assumes that there is a buffer connection mo => mi of size 3
// Check if connection succeeded both ways:
BOOST_CHECK( mo->connected() );
BOOST_CHECK( mi->connected() );
double value = 0;
// Check if no-data works
BOOST_CHECK_EQUAL( mi->read(value), NoData );
// Check if writing works
ASSERT_PORT_SIGNALLING(mo->write(1.0), mi);
ASSERT_PORT_SIGNALLING(mo->write(2.0), mi);
ASSERT_PORT_SIGNALLING(mo->write(3.0), mi);
ASSERT_PORT_SIGNALLING(mo->write(4.0), 0);
BOOST_CHECK( mi->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
BOOST_CHECK( mi->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
BOOST_CHECK( mi->read(value) );
BOOST_CHECK_EQUAL( 3.0, value );
BOOST_CHECK_EQUAL( mi->read(value), OldData );
}
示例10: testPortBufferConnection
void CorbaMQueueIPCTest::testPortBufferConnection()
{
// This test assumes that there is a buffer connection mw1 => server => mr1 of size 3
// Check if connection succeeded both ways:
BOOST_CHECK( mw1->connected() );
BOOST_CHECK( mr1->connected() );
double value = 0;
// Check if no-data works
BOOST_CHECK( !mr1->read(value) );
// Check if writing works
ASSERT_PORT_SIGNALLING(mw1->write(1.0), mr1);
ASSERT_PORT_SIGNALLING(mw1->write(2.0), mr1);
ASSERT_PORT_SIGNALLING(mw1->write(3.0), mr1);
// it will be emptied too fast by mqueue.
//ASSERT_PORT_SIGNALLING(mw1->write(4.0), 0);
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 3.0, value );
BOOST_CHECK_EQUAL( mr1->read(value), OldData );
}
示例11: testPortBufferConnection
void CorbaMQueueIPCTest::testPortBufferConnection()
{
// This test assumes that there is a buffer connection mw1 => server => mr1 of size 3
// Check if connection succeeded both ways:
BOOST_CHECK( mw1->connected() );
BOOST_CHECK( mr1->connected() );
double value = 0;
// Check if no-data works
BOOST_CHECK( !mr1->read(value) );
// Check if writing works
ASSERT_PORT_SIGNALLING(mw1->write(1.0), mr1);
ASSERT_PORT_SIGNALLING(mw1->write(2.0), mr1);
ASSERT_PORT_SIGNALLING(mw1->write(3.0), mr1);
// There are two connections between mw1 and mr1. We first flush one of the
// two, and then the second one (normal multi-writer single-reader
// behaviour)
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 3.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 1.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 2.0, value );
BOOST_CHECK( mr1->read(value) );
BOOST_CHECK_EQUAL( 3.0, value );
BOOST_CHECK_EQUAL( mr1->read(value), OldData );
}
示例12: updateHook
void updateHook() {
dummyInPort.read(dataVar);
dummyOutPort.write(dataVar);
dataInPort.read(dataVar);
dataOutPort.write(dataVar);
//log(Info) << "Worker relaying data!" << endlog();
}
示例13: updateHook
void updateHook() {
cwport.write(i);
swport.write(i);
iwport.write(i);
fwport.write(i);
dwport.write( std::vector<double>(10,i) );
++i;
}
示例14: TestTaskContext
TestTaskContext(std::string name)
: TaskContext(name),
hello("Hello", "The hello thing", "World"),
cwport("cw_port", 'a'),
swport("sw_port", 1),
iwport("iw_port", 0),
fwport("fw_port", 0.0),
dwport("dw_port"),
crport("cr_port"),
srport("sr_port"),
irport("ir_port"),
frport("fr_port"),
drport("dr_port"), i(0)
{
this->properties()->addProperty( hello );
this->ports()->addPort( cwport );
this->ports()->addPort( swport );
this->ports()->addPort( iwport );
this->ports()->addPort( fwport );
this->ports()->addPort( dwport );
this->ports()->addPort( crport );
this->ports()->addPort( srport );
this->ports()->addPort( irport );
this->ports()->addPort( frport );
this->ports()->addPort( drport );
// write initial value.
std::vector<double> init(10, 5.4528);
dwport.write( init );
}
示例15: updateHook
void updateHook() {
double input_sample;
if ( input.read(input_sample) ) {
current += this->engine()->getActivity()->getPeriod()*input_sample /inertia.value();
}
output.write( current );
}