本文整理汇总了C++中Connector类的典型用法代码示例。如果您正苦于以下问题:C++ Connector类的具体用法?C++ Connector怎么用?C++ Connector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Connector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddAudioConnectionAction
Connector* ObjController::addConnector(ObjectsHolder* holder,
BaseObjectComponent* objComp,
ObjectComponent* audioOutComp,
ValueTree source,
int index,
bool undoable)
{
if(undoable)
{
AddAudioConnectionAction* action = new AddAudioConnectionAction(
this, objComp, source, audioOutComp, holder);
owner.getUndoManager().perform(action, "Add new audio connection");
return connections[action->indexAdded];
}
else
{
Connector* conn = new Connector(*this, objComp, audioOutComp);
ValueTree sources = conn->getTargetObject()->getData().getChildWithName(Ids::sources);
if(! sources.getChildWithProperty(Ids::value, source[Ids::value]).isValid())
sources.addChild(source, -1, nullptr);
connections.insert(index, conn);
holder->addAndMakeVisible(conn);
conn->update();
conn->toBack();
return conn;
}
return nullptr;
}
示例2: enable_CA
int
enable_CA()
{
Channel *chan;
Connector *conp;
if( processFlag == 0 )
processFlag = epicsMutexCreate();
epicsMutexLock( processFlag);
startupFlag = 0;
for( chan=reProcessList; chan; chan = chan->next_proc)
{
chan->reprocess = 0;
/*
* update the data values
*/
for( conp=chan->first_connector; conp ; conp=conp->next_chan)
{
if( conp->newState)
(*conp->newState)(conp);
DEBUGP printf("Calling function %p\n", conp->update);
if( conp->update)
conp->update(conp);
}
}
epicsMutexUnlock(processFlag);
return 0;
}
示例3: getEcNodeWithID
Connector *CircuitICNDocument::createConnector( const QString &startNodeId, const QString &endNodeId, QPointList *pointList )
{
ECNode *startNode = getEcNodeWithID(startNodeId);
ECNode *endNode = getEcNodeWithID(endNodeId);
if ( !startNode || !endNode ) {
kDebug() << "Either/both the connector start node and end node could not be found" << endl;
return 0L;
}
if ( !canConnect( startNode, endNode ) ) return 0l;
Connector *connector = endNode->createConnector(startNode);
if (!connector) {
kError() << k_funcinfo << "End node did not create the connector" << endl;
return 0l;
}
startNode->addConnector(connector);
flushDeleteList(); // Delete any connectors that might have been removed by the nodes
// Set the route to the manual created one if the user created such a route
if(pointList) connector->setRoutePoints(*pointList,true);
// FIXME WTF is going on here? Redundant/meaningless code?
// ConnectorList connectorList;
// connectorList.append(connector);
setModified(true);
requestRerouteInvalidatedConnectors();
return connector;
}
示例4: Connector
void test_Connector::isNotType() {
Connector connector = Connector();
Connector same = Connector();
Connector different(N_50_OHM_CONNECTOR, MALE_GENDER);
QVERIFY(connector.isNotType(same) == false);
QVERIFY(connector.isNotType(different));
}
示例5: x
void JunctionFlowNode::drawShape ( QPainter &p )
{
const int _x = ( int ) x();
const int _y = ( int ) y();
if ( !m_inFlowConnList.isEmpty() )
{
const FlowConnectorList::iterator end = m_inFlowConnList.end();
for ( FlowConnectorList::iterator it = m_inFlowConnList.begin(); it != end; ++ it )
{
Connector * connector = *it;
if ( !connector )
continue;
// Work out the direction of the connector
const QPointList points = connector->connectorPoints ( false );
const int count = points.size();
if ( count < 2 )
continue;
QPoint end_0 = points[count-1];
QPoint end_1 = points[count-2];
Q3PointArray pa;
if ( end_0.x() < end_1.x() )
{
pa = arrowPoints ( 180 );
pa.translate ( 4, 0 );
}
else if ( end_0.x() > end_1.x() )
{
pa = arrowPoints ( 0 );
pa.translate ( -4, 0 );
}
else if ( end_0.y() < end_1.y() )
{
pa = arrowPoints ( 270 );
pa.translate ( 0, 4 );
}
else if ( end_0.y() > end_1.y() )
{
pa = arrowPoints ( 90 );
pa.translate ( 0, -4 );
}
else continue;
pa.translate ( _x, _y );
p.setPen ( connector->isSelected() ? m_selectedColor : Qt::black );
p.drawPolygon ( pa );
}
return;
}
if ( m_dir == 0 ) p.drawLine ( _x, _y, _x-8, _y );
else if ( m_dir == 90 ) p.drawLine ( _x, _y, _x, _y-8 );
else if ( m_dir == 180 ) p.drawLine ( _x, _y, _x+8, _y );
else if ( m_dir == 270 ) p.drawLine ( _x, _y, _x, _y+8 );
}
示例6: extractConnector
static Connector extractConnector(DOMDocument * domDocument, DOMTreeWalker * domTreeWalker) {
Connector connector;
DOMNode * node = domTreeWalker->getCurrentNode();
while (node) {
if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "SrcAddress") == 0) {
XMLNodeFilter * nodeFilter = new XMLNodeFilter();
DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
PortAddress portAddress = extractPortAddress(domDocument, d);
connector.setSrcAddress(portAddress);
d->release();
delete nodeFilter;
}
if (XMLString::compareString(XMLString::transcode(node->getNodeName()), "DstAddress") == 0) {
XMLNodeFilter * nodeFilter = new XMLNodeFilter();
DOMTreeWalker * d = domDocument->createTreeWalker(node, DOMNodeFilter::SHOW_ALL, nodeFilter, true);
PortAddress portAddress = extractPortAddress(domDocument, d);
connector.setDstAddress(portAddress);
d->release();
delete nodeFilter;
}
node = domTreeWalker->nextNode();
}
return connector;
}
示例7: qsignal
error *objectConnect(QObject_ *object, const char *signal, int signalLen, QQmlEngine_ *engine, void *func, int argsLen)
{
QObject *qobject = reinterpret_cast<QObject *>(object);
QQmlEngine *qengine = reinterpret_cast<QQmlEngine *>(engine);
QByteArray qsignal(signal, signalLen);
const QMetaObject *meta = qobject->metaObject();
// Walk backwards so descendants have priority.
for (int i = meta->methodCount()-1; i >= 0; i--) {
QMetaMethod method = meta->method(i);
if (method.methodType() == QMetaMethod::Signal) {
QByteArray name = method.name();
if (name.length() == signalLen && qstrncmp(name.constData(), signal, signalLen) == 0) {
if (method.parameterCount() < argsLen) {
// TODO Might continue looking to see if a different signal has the same name and enough arguments.
return errorf("signal \"%s\" has too few parameters for provided function", name.constData());
}
Connector *connector = Connector::New(qobject, method, qengine, func, argsLen);
const QMetaObject *connmeta = connector->metaObject();
QObject::connect(qobject, method, connector, connmeta->method(connmeta->methodOffset()));
return 0;
}
}
}
// Cannot use constData here as the byte array is not null-terminated.
return errorf("object does not expose a \"%s\" signal", qsignal.data());
}
示例8: main
USING_NAMESPACE
int main()
{
Stream stream;
Connector connector;
if( connector.connect(stream, InterAddress(6000, "127.0.0.1"), TimeValue(1)) )
{
char ip[20]; int32 port;
stream.getLocalAddress(ip, port);
printf("local addr:[%s][%d]\n", ip, port);
char buf[100] = "hello world!";
if( SOCKET_ERROR != stream.send(buf, strlen(buf)) )
printf("send successed!\n");
char recvbuf[100];
memset(recvbuf, 0, sizeof(recvbuf));
if (SOCKET_ERROR != stream.recv(recvbuf, 100))
printf("recv: %s", recvbuf);
}
else
{
printf("Connector failed!!");
}
getchar();
return 0;
}
示例9: Execute
void Select::Execute()
{
Input *pIn = pManager->GetInput();
Output *pOut = pManager->GetOutput();
Statement *SelectedStatement;
Connector* SelectedConnector;
int Type;
SelectedStatement = pManager->GetStatement(this->Position, Type);
SelectedConnector = pManager->GetConnector(this->Position);
if (SelectedStatement != NULL || SelectedConnector != NULL)
{
if (SelectedStatement)
{
SelectedStatement->SetSelected(!SelectedStatement->IsSelected());
pManager->UpdateSelectedStatements(SelectedStatement);
}
else
{
SelectedConnector->SetSelected(!SelectedConnector->IsSelected());
pManager->UpdateSelectedConnectors(SelectedConnector);
}
}
if (pManager->GetSelectedStatements().size() == 1)
pManager->GetOutput()->PrintMessage(pManager->GetSelectedStatements().front()->GetComment());
else
pManager->GetOutput()->PrintMessage("");
pManager->UpdateInterface();
}
示例10: Run
void Run()
{
Connector* pConnector = (Connector*)GetArg();
while (IsRunnable())
{
if (TRUE == InterlockedCompareExchange((LONG*)& pConnector->_IsConnected, TRUE, TRUE))
{
Wait(pConnector->_ProcessTime);
}
else
{
Logger::Log("%s Connector Try Connect\n", GetName());
int rc = pConnector->DoConnect();
if (0 != rc)
{
Logger::Log("%s Connector Connect Fail :%d\n", GetName(), rc);
Wait(pConnector->_RetryTime);
}
else
{
Logger::Log("%s Connector Connect Success\n", GetName());
}
}
}
}
示例11: GetSystemInfo
void TCPServer::run()
{
_run = true;
HANDLE hCompletion = this->_iocp;
SYSTEM_INFO info;
GetSystemInfo(&info);
_dispatcherCount = info.dwNumberOfProcessors * 2;
_dispatcher = new HANDLE[_dispatcherCount];
for (int i = 0; i < _dispatcherCount; i++)
{
_dispatcher[i] = ::CreateThread(NULL, 0, DispatchThread, (LPVOID)this, 0, 0);
}
//----------------------
// Accept the connection.
while (_run)
{
SOCKADDR_IN saRemote;
int nRemoteLen = sizeof(saRemote);
SOCKET client = accept(this->_server, (sockaddr *)&saRemote, &nRemoteLen);
if (client == INVALID_SOCKET)
{
printError(L"accept socket");
continue;
}
Connector *pPerHandle = new Connector(saRemote, nRemoteLen, client);
::CreateIoCompletionPort((HANDLE)client, hCompletion, (ULONG_PTR)pPerHandle, 0);
pPerHandle->postRead();
}
// No longer need server socket
closesocket(this->_server);
}
示例12: connect
static void connect(uv_tcp_t* handle, const Address& address, void* data,
Callback cb) {
Connector* connector = new Connector(address, data, cb);
int rc = 0;
#if UV_VERSION_MAJOR == 0
if (address.family() == AF_INET) {
rc = uv_tcp_connect(&connector->req_, handle, *address.addr_in(),
on_connect);
} else {
rc = uv_tcp_connect6(&connector->req_, handle, *address.addr_in6(),
on_connect);
}
#else
rc = uv_tcp_connect(&connector->req_, handle, address.addr(),
on_connect);
#endif
if (rc != 0) {
connector->status_ = -1;
connector->cb_(connector);
delete connector;
}
}
示例13: open
int Server_Connection::open(void *acceptor_or_connector)
{
typedef Connector<Server_Connection, ACE_SOCK_CONNECTOR> Connector;
Connector *connector = static_cast<Connector*>(acceptor_or_connector);
m_holder = connector->holder();
return Connection::open(acceptor_or_connector);
}
示例14: isType
/*!
* \brief Performs a connector type comparison with \c other
*
* Returns true if \c this and \c other are the same
* connector type. For user-defined connector types, the
* string representing the type are compared.
*
* \note User-defined types are case-sensitive.
*
* \param other Connector to compare
* \return Result of connector type comparison
* \sa isNotType()
*/
bool Connector::isType(const Connector &other) const {
if (isNotCustomType())
return(type() == other.type());
else if (other.isNotCustomType())
return(false);
else
return(customType() == other.customType());
}
示例15: connector
Sender *
Invocation_Thread::create_connection (void)
{
int result = 0;
// Connector for creating new connections.
Connector connector (this->thread_manager_,
this->reactor_,
this->nested_upcalls_);
// <server_handle> is a global variable. It will be used later by
// the Close_Socket_Thread.
result =
connector.connect (client_handle,
server_handle,
this->run_receiver_thread_);
ACE_TEST_ASSERT (result == 0);
ACE_UNUSED_ARG (result);
// Create a new sender.
Sender *sender =
new Sender (client_handle,
this->connection_cache_);
// Register it with the cache.
this->connection_cache_.add_connection (sender);
//
// There might be a race condition here. The sender has been added
// to the cache and is potentially available to other threads
// accessing the cache. Therefore, the other thread may use this
// sender and potentially close the sender before it even gets
// registered with the Reactor.
//
// This is resolved by marking the connection as busy when it is
// first added to the cache. And only once the thread creating the
// connection is done with it, it is marked a available in the
// cache.
//
// This order of registration is important.
//
// Register the handle with the Reactor.
result =
this->reactor_.register_handler (client_handle,
sender,
ACE_Event_Handler::READ_MASK);
#if 0
ACE_TEST_ASSERT (result == 0);
ACE_UNUSED_ARG (result);
#else
if (result != 0)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) create_connection h %d, %p\n"),
client_handle,
ACE_TEXT ("register_handler")));
#endif
return sender;
}