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


C++ Pipe类代码示例

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


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

示例1: SshKeyPasswordRetriever

bool SshEncryptionFacility::createAuthenticationKeyFromPKCS8(const QByteArray &privKeyFileContents,
    QList<BigInt> &pubKeyParams, QList<BigInt> &allKeyParams, QString &error)
{
    try {
        Pipe pipe;
        pipe.process_msg(convertByteArray(privKeyFileContents), privKeyFileContents.size());
        Private_Key * const key = PKCS8::load_key(pipe, m_rng, SshKeyPasswordRetriever());
        if (DSA_PrivateKey * const dsaKey = dynamic_cast<DSA_PrivateKey *>(key)) {
            m_authKeyAlgoName = SshCapabilities::PubKeyDss;
            m_authKey.reset(dsaKey);
            pubKeyParams << dsaKey->group_p() << dsaKey->group_q()
                         << dsaKey->group_g() << dsaKey->get_y();
            allKeyParams << pubKeyParams << dsaKey->get_x();
        } else if (RSA_PrivateKey * const rsaKey = dynamic_cast<RSA_PrivateKey *>(key)) {
            m_authKeyAlgoName = SshCapabilities::PubKeyRsa;
            m_authKey.reset(rsaKey);
            pubKeyParams << rsaKey->get_e() << rsaKey->get_n();
            allKeyParams << pubKeyParams << rsaKey->get_p() << rsaKey->get_q()
                         << rsaKey->get_d();
        } else {
            qWarning("%s: Unexpected code flow, expected success or exception.", Q_FUNC_INFO);
            return false;
        }
    } catch (const Botan::Exception &ex) {
        error = QLatin1String(ex.what());
        return false;
    } catch (const Botan::Decoding_Error &ex) {
        error = QLatin1String(ex.what());
        return false;
    }

    return true;
}
开发者ID:bitzhuwei,项目名称:OVITO_sureface,代码行数:33,代码来源:sshcryptofacility.cpp

示例2: getResource

void ComposerEngine::playWaveForAnim(uint16 id, uint16 priority, bool bufferingOnly) {
	if (_audioStream && _audioStream->numQueuedStreams() != 0) {
		if (_currSoundPriority < priority)
			return;
		if (_currSoundPriority > priority) {
			_mixer->stopAll();
			_audioStream = NULL;
		}
	}
	Common::SeekableReadStream *stream = NULL;
	if (!bufferingOnly && hasResource(ID_WAVE, id)) {
		stream = getResource(ID_WAVE, id);
	} else {
		for (Common::List<Pipe *>::iterator k = _pipes.begin(); k != _pipes.end(); k++) {
			Pipe *pipe = *k;
			if (!pipe->hasResource(ID_WAVE, id))
				continue;
			stream = pipe->getResource(ID_WAVE, id, true);
			break;
		}
	}
	if (!stream)
		return;
	// FIXME: non-pipe buffers have fixed wav header (data at +44, size at +40)
	byte *buffer = (byte *)malloc(stream->size());
	stream->read(buffer, stream->size());
	if (!_audioStream)
		_audioStream = Audio::makeQueuingAudioStream(22050, false);
	_audioStream->queueBuffer(buffer, stream->size(), DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
	_currSoundPriority = priority;
	delete stream;
	if (!_mixer->isSoundHandleActive(_soundHandle))
		_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _audioStream);
}
开发者ID:chrisws,项目名称:scummvm,代码行数:34,代码来源:graphics.cpp

示例3: test_pipeEvent_given_pipe_with_AND_and_OR_module_data_should_register_event_for_all_pipe_data

void test_pipeEvent_given_pipe_with_AND_and_OR_module_data_should_register_event_for_all_pipe_data(void)
{
    Module *AND, *OR;
    ModuleAndPin *andData, *orData;
    Pipe *pipe;
    Node *andRootNode, *orNode;
    int inputType = QUAD_2_INPUT;

    AND = createdAndModule(inputType);
    OR = createdOrModule(inputType);
    pipe = createdPipeModule();
    pipe->stateToFire = HIGH;
    andData = createdModuleAndPin(AND, (AND->pin[0]).pinNumber);
    orData = createdModuleAndPin(OR, (OR->pin[1]).pinNumber);

    andRootNode = createdNewPipeDataNode(andData);
    orNode = createdNewPipeDataNode(orData);
    setNode(andRootNode, orNode, NULL, 'b');
    pipe->data = andRootNode;

    registerEvent_Expect(orData, NULL, ONE_NANO_SEC + OR_PROPAGATION_DELAY);
    registerEvent_Expect(andData, NULL, ONE_NANO_SEC + AND_PROPAGATION_DELAY);

    pipe->event((void *)pipe, (void *)pipe->data, ONE_NANO_SEC);

    TEST_ASSERT_EQUAL(HIGH, (AND->pin[0]).state);
    TEST_ASSERT_EQUAL(HIGH, (OR->pin[1]).state);

    destroyModule(OR);
    destroyModule(AND);
    destroyPipeData(pipe);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:32,代码来源:test_DigitalSignalModule.c

示例4: test_pipeEvent_given_pipe_with_AND_module_data_should_register_event_for_pipe_data

void test_pipeEvent_given_pipe_with_AND_module_data_should_register_event_for_pipe_data(void)
{
    Module *AND;
    ModuleAndPin *pipeData;
    Pipe *pipe;
    Node *newNode;
    int inputType = QUAD_2_INPUT;

    AND = createdAndModule(inputType);
    pipe = createdPipeModule();
    pipe->stateToFire = HIGH;
    pipeData = createdModuleAndPin(AND, (AND->pin[0]).pinNumber);

    newNode = createdNewPipeDataNode(pipeData);
    pipe->data = newNode;

    registerEvent_Expect(pipeData, NULL, ONE_NANO_SEC + AND_PROPAGATION_DELAY);

    pipe->event((void *)pipe, (void *)pipe->data, ONE_NANO_SEC);

    TEST_ASSERT_EQUAL(HIGH, (AND->pin[0]).state);

    destroyModule(AND);
    destroyPipeData(pipe);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:25,代码来源:test_DigitalSignalModule.c

示例5: addToMaterialBalanceStreamsUpstream

//-----------------------------------------------------------------------------------------------
// adds the rates from the well to the direct upstream connections
//-----------------------------------------------------------------------------------------------
void DecoupledModel::addToMaterialBalanceStreamsUpstream(ProductionWell *w)
{

    // looping through the pipes connected to the well
    for(int i = 0; i < w->numberOfPipeConnections(); ++i)
    {

        Pipe *p = w->pipeConnection(i)->pipe();     // pointer to the pipe


        // finding the flow fraction from this well to the pipe
        double frac = w->pipeConnection(i)->variable()->value();

        // calculating the rate from this well to the pipe vs. time
        for(int j = 0; j < w->numberOfStreams(); ++j)
        {
            Stream s = *w->stream(j) * frac;

            // finding the material balance constraint that corresponds to this pipe and time
            MaterialBalanceConstraint *mbc = find(p->stream(j));

            // adding the rate contribution from this well to what is allready in the mbc
            mbc->setStream(s + mbc->stream());

        }

    }

}
开发者ID:iocenter,项目名称:ResOpt,代码行数:32,代码来源:decoupledmodel.cpp

示例6: initializePipelineProcessors

    void initializePipelineProcessors()
    {
        const Window* sharedWindow = static_cast< const Window* >(
                                         _window->getSharedContextWindow( ));

        // share upload processors for windows which also share the GL context
        if( sharedWindow && sharedWindow != _window )
        {
            _glContext = sharedWindow->_impl->_glContext;
            _dashProcessor = sharedWindow->_impl->_dashProcessor;
            _textureUploader = sharedWindow->_impl->_textureUploader;
            _dataUploader = sharedWindow->_impl->_dataUploader;
            return;
        }

        // First one in group: setup
        Node* node = static_cast< Node* >( _window->getNode( ));
        DashTree& dashTree = node->getDashTree();
        _dashProcessor->setDashContext( dashTree.createContext( ));
        _dataUploader.reset( new DataUploadProcessor( dashTree, _glContext,
                                                      node->getTextureDataCache( )));

        Config* config = static_cast< Config* >( _window->getConfig( ));
        Pipe* pipe = static_cast< Pipe* >( _window->getPipe( ));

        _textureUploader.reset(
            new EqTextureUploadProcessor( *config, dashTree, _glContext,
                                          node->getTextureDataCache(),
                                          pipe->getFrameData()->getVRParameters( )));
    }
开发者ID:rdumusc,项目名称:Livre,代码行数:30,代码来源:Window.cpp

示例7: getPipe

void Window::addTasks( const uint32_t tasks )
{
    Pipe* pipe = getPipe();
    EQASSERT( pipe );
    setTasks( getTasks() | tasks );
    pipe->addTasks( tasks );
}
开发者ID:cstalder,项目名称:Equalizer,代码行数:7,代码来源:window.cpp

示例8: main

int main(int argc, const char* argv[])
{
	if (argc == 4) {
		port = atoi(argv[1]);
		ipaddr = argv[2];
		bindaddr = argv[3];
	}

	ev::loop_ref loop = ev::default_loop(0);

	InetServer server(loop);
	server.open(IPAddress(bindaddr), port);
	if (!server.isOpen()) {
		perror("server.open()");
		return 1;
	}

	pthread_t client_thread;
	int rv = pthread_create(&client_thread, NULL, client_run, NULL);
	if (rv < 0) {
		perror("pthread_create");
		return 1;
	}

	pthread_t proxy_thread;
	for (int i = 0; i < 2; ++i) {
		Socket* cs = server.acceptOne();
		if (!cs) {
			perror("accept");
			return 1;
		}

		if (i == 0) {
			// first client gets proxied
			pthread_create(&proxy_thread, NULL, proxy_run, cs);
		} else {
			// second client gets dumped to terminal (partly reading into buf, remaining data via pipe)
			Buffer buf;
			cs->read(buf, 39);
			write(STDOUT_FILENO, buf.data(), buf.size());

			Pipe pipe;
			for (;;) {
				if (cs->read(&pipe, 1024) > 0) {
					pipe.read(STDOUT_FILENO, pipe.size());
				} else {
					break;
				}
			}
			// TODO: cs->read(chunkedBuffer, Stream::MOVE);
			delete cs;
		}
	}

	pthread_join(client_thread, NULL);
	pthread_join(proxy_thread, NULL);

	return 0;
}
开发者ID:christianparpart,项目名称:libxio,代码行数:59,代码来源:network-splicing.cpp

示例9: getPipe

void View::notifyAttach()
{
    eq::View::notifyAttach();
    Pipe* pipe = getPipe();

    if (pipe) // render client view
        setUserData(pipe->getRenderer()->createViewData(*this));
}
开发者ID:Eyescale,项目名称:Equalizer,代码行数:8,代码来源:view.cpp

示例10: encode

/*
* Return a BER encoded X.509 object
*/
SecureVector<byte> EAC_Signed_Object::BER_encode() const
   {
   Pipe ber;
   ber.start_msg();
   encode(ber, RAW_BER);
   ber.end_msg();
   return ber.read_all();
   }
开发者ID:BenjaminSchiborr,项目名称:safe,代码行数:11,代码来源:signed_obj.cpp

示例11: PEM_encode

/*
* Return a PEM encoded X.509 object
*/
std::string EAC_Signed_Object::PEM_encode() const
   {
   Pipe pem;
   pem.start_msg();
   encode(pem, PEM);
   pem.end_msg();
   return pem.read_all_as_string();
   }
开发者ID:BenjaminSchiborr,项目名称:safe,代码行数:11,代码来源:signed_obj.cpp

示例12: getPipe

void View::notifyAttach()
{
    eq::View::notifyAttach();
    Pipe* pipe = getPipe();

    if( pipe ) // render client view
        setUserData( pipe->getRenderer()->createViewData( ));
    else // application view
        setUserData( getConfig()->getApplication()->createViewData( ));
}
开发者ID:aoighost,项目名称:Equalizer,代码行数:10,代码来源:view.cpp

示例13: create_pipe

void tester_util::redirect(const ProcessPointer &from, const int from_fd,
                           const ProcessPointer &to, const int to_fd) {
  try {
    const Pipe pipe = create_pipe();
    from->setStream(from_fd, pipe.writeEnd());
    to->setStream(to_fd, pipe.readEnd());
  } catch (std::exception &) {
    BOOST_THROW_EXCEPTION(redirect_error() << bunsan::enable_nested_current());
  }
}
开发者ID:bacsorg,项目名称:system_single,代码行数:10,代码来源:tester_util.cpp

示例14: endpointLocker

status_t
OHCI::_SubmitTransfer(Transfer *transfer)
{
	Pipe *pipe = transfer->TransferPipe();
	bool directionIn = (pipe->Direction() == Pipe::In);

	ohci_general_td *firstDescriptor = NULL;
	ohci_general_td *lastDescriptor = NULL;
	status_t result = _CreateDescriptorChain(&firstDescriptor, &lastDescriptor,
		directionIn ? OHCI_TD_DIRECTION_PID_IN : OHCI_TD_DIRECTION_PID_OUT,
		transfer->VectorLength());

	if (result < B_OK)
		return result;

	// Apply data toggle to the first descriptor (the others will use the carry)
	firstDescriptor->flags &= ~OHCI_TD_TOGGLE_CARRY;
	firstDescriptor->flags |= pipe->DataToggle() ? OHCI_TD_TOGGLE_1
		: OHCI_TD_TOGGLE_0;

	// Set the last descriptor to generate an interrupt
	lastDescriptor->flags &= ~OHCI_TD_INTERRUPT_MASK;
	lastDescriptor->flags |=
		OHCI_TD_SET_DELAY_INTERRUPT(OHCI_TD_INTERRUPT_IMMEDIATE);

	if (!directionIn) {
		_WriteDescriptorChain(firstDescriptor, transfer->Vector(),
			transfer->VectorCount());
	}

	// Add to the transfer list
	ohci_endpoint_descriptor *endpoint
		= (ohci_endpoint_descriptor *)pipe->ControllerCookie();

	MutexLocker endpointLocker(endpoint->lock);
	result = _AddPendingTransfer(transfer, endpoint, firstDescriptor,
		firstDescriptor, lastDescriptor, directionIn);
	if (result < B_OK) {
		TRACE_ERROR("failed to add pending transfer\n");
		_FreeDescriptorChain(firstDescriptor);
		return result;
	}

	// Add the descriptor chain to the endpoint
	_SwitchEndpointTail(endpoint, firstDescriptor, lastDescriptor);
	endpointLocker.Unlock();

	endpoint->flags &= ~OHCI_ENDPOINT_SKIP;
	if (pipe->Type() & USB_OBJECT_BULK_PIPE) {
		// Tell the controller to process the bulk list
		_WriteReg(OHCI_COMMAND_STATUS, OHCI_BULK_LIST_FILLED);
	}

	return B_OK;
}
开发者ID:mmanley,项目名称:Antares,代码行数:55,代码来源:ohci.cpp

示例15: EQASSERT

void Display::discoverLocal( Config* config )
{
    Node* node = config->findAppNode();
    EQASSERT( node );
    if( !node )
        return;

    const Pipes& pipes = node->getPipes();
    EQASSERT( !pipes.empty( ));
    if( pipes.empty( ))
        return;

    Pipe* pipe = pipes.front();
    Window* window = new Window( pipe );
    window->setViewport( Viewport( .25f, .2f, .5f, .5f ));
    window->setName( pipe->getName() + " window" );
    window->setIAttribute( Window::IATTR_PLANES_STENCIL, 1 );

    Channel* channel = new Channel( window );
    channel->setName( pipe->getName() + " channel" );
    Observer* observer = new Observer( config );

    const PixelViewport& pvp = pipe->getPixelViewport();
    Wall wall;
    if( pvp.isValid( ))
        wall.resizeHorizontalToAR( float( pvp.w ) / float( pvp.h ));

    Canvas* canvas = new Canvas( config );
    canvas->setWall( wall );

    Segment* segment = new Segment( canvas );
    segment->setChannel( channel );

    Strings names;
    names.push_back( EQ_SERVER_CONFIG_LAYOUT_2D_DYNAMIC  );
    names.push_back( EQ_SERVER_CONFIG_LAYOUT_SIMPLE );
    names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_DS );
    names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_STATIC );
    names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_DYNAMIC );
    names.push_back( EQ_SERVER_CONFIG_LAYOUT_2D_STATIC );

    for( StringsCIter i = names.begin(); i != names.end(); ++i )
    {
        Layout* layout = new Layout( config );
        layout->setName( *i );

        View* view = new View( layout );
        view->setObserver( observer );
        view->setWall( wall );

        canvas->addLayout( layout );
    }

    config->activateCanvas( canvas );
}
开发者ID:oliver-e,项目名称:Equalizer,代码行数:55,代码来源:display.cpp


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