コード例 #1
0
ファイル: ObjController.cpp プロジェクト: ptrv/SaM-Designer
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
0
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;
}
コード例 #3
0
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));
}
コード例 #4
0
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 );

}
コード例 #5
0
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;
}
コード例 #6
0
ファイル: goqml.cpp プロジェクト: chai2010/qml
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());
}
コード例 #7
0
ファイル: socket_client.cpp プロジェクト: xzben/openSocket
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;
}
コード例 #8
0
ファイル: Select.cpp プロジェクト: Ahmkel/Flowchart-Creator
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();
}
コード例 #9
0
ファイル: Connector.cpp プロジェクト: ChowZenki/dboserver
	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());
				}
			}

		}
	}
コード例 #10
0
ファイル: tcp.cpp プロジェクト: jack833/dk
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);
}
コード例 #11
0
ファイル: channel.c プロジェクト: Cpppro/acquaman
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;
}
コード例 #12
0
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);
}
コード例 #13
0
ファイル: Connector.cpp プロジェクト: Terrabits/RsaToolbox
/*!
 * \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());
}
コード例 #14
0
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;
}
コード例 #15
0
void kdrive::connector::raiseError(Connector& connector, const Exception& exception)
{
	const int errorCode = exception.code() ? exception.code() : ConnectorErrorCodes::ConnectorError;

	connector.setLastErrorCode(errorCode);
	connector.setLastErrorMessage(exception.displayText());
	connector.routeEvent(ConnectorEvents::Error);
	exception.rethrow();
}
コード例 #16
0
bool CircuitICNDocument::joinConnectors( ECNode *node )
{
	// We don't want to destroy the node if it has a parent
	if ( node->parentItem() ) return false;

	node->removeNullConnectors();

	// an electronic node can be removed if it has exactly 2 connectors connected to it

	int conCount = node->getAllConnectors().count();
	if ( conCount != 2 ) return false;

	Connector *con1, *con2;
	ECNode *startNode = NULL;
    ECNode *endNode = NULL;
	QPointList conPoints;

	con1 = node->connectorList().at(0).data();
	con2 = node->connectorList().at(1).data();

	if ( con1 == con2 ) return false;

	// we don't know on which end of the connectors is our node, so we must check both ends
	// HACK // TODO // dynamic_cast used, because Connector doesn't know about ECNode, only Node
	if( con1->startNode() == node )
		startNode = dynamic_cast<ECNode*> ( con1->endNode() );
	else	startNode = dynamic_cast<ECNode*> ( con1->startNode() );

	if( con2->startNode() == node )
		endNode = dynamic_cast<ECNode*> ( con2->endNode() );
	else	endNode = dynamic_cast<ECNode*> ( con2->startNode() );

	conPoints = con1->connectorPoints(false) + con2->connectorPoints(false);
	
	if( !startNode || !endNode ) return false;

	Connector *newCon = endNode->createConnector(startNode);

	if(!newCon) return false;

	startNode->addConnector(newCon);
	newCon->setRoutePoints( conPoints, con1->usesManualPoints() || con2->usesManualPoints() );

	// Avoid flicker: update draw lists now
	con1->updateConnectorPoints(false);
	con2->updateConnectorPoints(false);
	newCon->updateDrawList();

	node->removeNode();
	con1->removeConnector();
	con2->removeConnector();
	
	return true;
}
コード例 #17
0
void ConnectorFactoryTest::dispose_removes_points()
{
  Connector *connector = new Connector(Point(42, 57));
  RelativePosition pp(Point(0, 0));

  connector->addPoint(&pp);

  ConnectorFactory::dispose(connector);

  CPPUNIT_ASSERT(&connector->getPosition() != pp.getAnchor());
}
コード例 #18
0
ファイル: SimpleServer.cpp プロジェクト: LeeBn/Navigation
void main_connect()
{
	ACE_INET_Addr addr(PORT_NO, "192.168.0.56");
	Connector myconnector;
	My_Svc_Handler *my_svc_handler = new My_Svc_Handler;
	myconnector.connect(my_svc_handler, addr);
	while(1)
		Reactor::instance()->handle_events();

	return;
}
コード例 #19
0
ファイル: transfns.c プロジェクト: LambdaCalculus379/SLS-1.02
void TF_2Port::Evaluate (Path* path) {
    Transfer();

    for (int i = 0; i < Outputs(); ++i) {
        if (ChangedOutput(i)) {
            StateVar* output = GetOutput(i);
            Connector* conn = GetBinding(output);
            conn->Transmit(path);
        }
    }
}
コード例 #20
0
ファイル: canvasview.cpp プロジェクト: SiteView/NNMQT
void CanvasView::flowThreChanged(int iSpeed, int iIndex)
{
    QList<CanvasItem *> canvas_items = canvas()->items();
    for (int i = 0; i < canvas_items.size(); ++i)
    {
        Connector *conn = dynamic_cast<Connector *>(canvas_items.at(i));
        if (conn)
        {
            conn->setFlowThreshold(iSpeed, iIndex);
        }
    }
}
コード例 #21
0
ファイル: kmsprint.cpp プロジェクト: tomba/kmsxx
static string format_connector(Connector& c)
{
	string str;

	str = sformat("Connector %u (%u) %s",
		      c.idx(), c.id(), c.fullname().c_str());

	if (c.connected())
		str += " (connected)";

	return str;
}
コード例 #22
0
ファイル: main.cpp プロジェクト: livefantom/uos-base
int main()
{

    signal(SIGPIPE, SIG_IGN);
    signal(SIGINT,  sigExit);
    signal(SIGTERM, sigExit);
    signal(SIGUSR1, sigSend);

	PfAuth* auth = PfAuth::singleton();
	auth->initialize("./pfauth.ini");
	Connector* conn = auth->createConn();
	int i = 0;
	uint64_t last_send = 0;
	uint64_t now = 0;
	int ret;

	while( !g_stop )
	{
		AuthMsg msg;
		msg.user_id = "31504325";
		msg.user_name = "zhy770129";
		msg.time = "1260247189";
		msg.flag = "be6fe47bdda836b8cebb27e869e67f7c";
		msg.game_id = 707;
		msg.cmd_id = 0x10003801;

		SysTimeValue::getTickCount(&now);
		if ( now - last_send > 400 && g_send )
		{
			SysTimeValue::getTickCount(&last_send);
			ret = conn->sendRequest(msg, i);
			if (ret == 1)
			{
				printf("[request sent] seq = %d\n", i);
				++i;
			}
		}

		AuthMsg msg1;
		uint32_t seq = 0;
		ret = conn->recvResponse(msg1, &seq);
		if (ret == 1)
		{
			printf("[response received] seq=%d, retcode=%d, state=%d\n", seq, msg1.retcode, msg1.state);
		}
		usleep(10);

	}// end of while.
	auth->releaseConn(conn);
	auth->release();

    return 0;
}
コード例 #23
0
ファイル: ERModel.cpp プロジェクト: jasons8021/POSD_ERDiagram
//	刪除Connector
void ERModel::deleteConnection( Component* delComponent )
{
	Connector* delConnector = static_cast<Connector*>(delComponent);
	Component* sourceNode = searchComponent(delConnector->getSourceNodeID());
	Component* destinationNode = searchComponent(delConnector->getDestinationNodeID());

	sourceNode->deleteConnectedComponent(delConnector->getDestinationNodeID());
	destinationNode->deleteConnectedComponent(delConnector->getSourceNodeID());

	deleteTableSet(delComponent->getID(), _components, PARAMETER_COMPONENTSTABLE);
	deleteTableSet(delComponent->getID(), _connections, PARAMETER_CONNECTIONSTABLE);
}
コード例 #24
0
ファイル: layer.hpp プロジェクト: mupimenov/ga4nn
 void connect_back(const layer::ptr &l_back, Connector connector) {
   for (size_t i = 0; i < m_neuron.size(); ++i) {
     const neuron::ptr &n_front = m_neuron[i];
     for (size_t j = 0; j < l_back->neuron_count(); ++j) {
       neuron::ptr n_back = l_back->get_neuron(j);
       if (connector.valid_connection(j, i))
         m_connection.push_back(connection::ptr(
             new connection(n_front->create_link(n_back,
                             connector.weight(),
                             connector.constant()), n_front)));
     }
   }
 }
コード例 #25
0
void DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
    if (line != 0 && myMode == InsertLine)
    {
        QList<QGraphicsItem *> startItems = items(line->line().p1());
        if (startItems.count() && startItems.first() == line)
            startItems.removeFirst();
        QList<QGraphicsItem *> endItems = items(line->line().p2());
        if (endItems.count() && endItems.first() == line)
            endItems.removeFirst();

        removeItem(line);
        delete line;

        if (startItems.count() > 0 && endItems.count() > 0 &&
                startItems.first()->type() == Connector::Type &&
                endItems.first()->type() == Connector::Type &&
                startItems.first() != endItems.first())
        {
            Connector *startItem =
                    qgraphicsitem_cast<Connector *>(startItems.first());
            Connector *endItem =
                    qgraphicsitem_cast<Connector *>(endItems.first());
            QDomNode arrowXml =  createArrowXml(startItem,endItem);
            Arrow *arrow = new Arrow(startItem, endItem,arrowXml);

            arrowList.append(arrow);
            arrow->setColor(myLineColor);
            startItem->addArrow(arrow);
            endItem->addArrow(arrow);
            arrow->setZValue(-1000.0);
            addItem(arrow);
            arrow->updatePosition();

        }
    }

    line = 0;
    QGraphicsScene::mouseReleaseEvent(mouseEvent);
    if(myMode == MoveItem)
    {
        DiagramItem* item =(DiagramItem*)itemAt(mouseEvent->scenePos());
        if(item == 0)
            return;
        if(item->type() == DiagramItem::Type)
            {
                item->updatePoz();
                ((DiagramWindow*)parent())->updateXml();
            }
    }
}
コード例 #26
0
void FPNode::setVisible( bool yes )
{
	if ( isVisible() == yes ) return;
	
	KtlQCanvasPolygon::setVisible(yes);
	
	const FlowConnectorList::iterator inputEnd = m_inFlowConnList.end();
	for ( FlowConnectorList::iterator it = m_inFlowConnList.begin(); it != inputEnd; ++it )
	{
		Connector *connector = *it;
		if ( connector )
		{
			if ( isVisible() )
				connector->setVisible ( true );
			else
			{
				Node *node = connector->startNode();
				connector->setVisible ( node && node->isVisible() );
			}
		}
	}
	
	Connector *connector = m_outputConnector; 
	if ( connector )
	{
		if ( isVisible() )
			connector->setVisible ( true );
		else
		{
			Node *node = connector->endNode();
			connector->setVisible ( node && node->isVisible() );
		}
	}
}
コード例 #27
0
void DetailedView::extshape_Clicked(ExtensionShape *cs)
{    
    if(cs->node_type == 2){
        for(int i=0;i<cs->linkedClass->subclasses.size();i++){
            OwlClass * tmp = cs->linkedClass->subclasses[i];
            if(!dclasses.contains(tmp)){
                this->addShapeWithExt(tmp);

                Connector * c = new Connector();
                c->initWithConnection(tmp->shape,cs->linkedClass->shape);
                c->setDirected(true);
                c->setRoutingType(Connector::orthogonal);
                m_canvas->addItem(c);

                dclasses.append(tmp);
                dedges.append(c);

                tmp->classesconnectors<<c;
                cs->linkedClass->classesconnectors<<c;

                subexts.removeAll(cs);
            }
        }
    }

    if(cs->node_type ==1){
        for(int i=0;i<cs->linkedClass->superclasses.size();i++){
            OwlClass * tmp = cs->linkedClass->superclasses[i];
            if(!dclasses.contains(tmp)){
                this->addShapeWithExt(tmp);

                Connector * c = new Connector();
                c->initWithConnection(cs->linkedClass->shape,tmp->shape);
                c->setDirected(true);
                c->setRoutingType(Connector::orthogonal);
                m_canvas->addItem(c);

                dclasses.append(tmp);
                dedges.append(c);

                tmp->classesconnectors<<c;
                cs->linkedClass->classesconnectors<<c;

                superexts.removeAll(cs);
            }
        }
      }


    m_canvas->removeItem(cs->edge);
    m_canvas->removeItem(cs);
    dedges.removeAll(cs->edge);
    cs->linkedClass->classesconnectors.removeAll(cs->edge);

    delete cs->edge;
    delete cs;

    this->m_canvas->fully_restart_graph_layout();

}
コード例 #28
0
Connector* V4L1_ConnectorManager::findByIndex(const ListType& l, int index)
{
	// Find a Connector by its unique index.
	Connector	*res = 0;

	// iterate the list	
	for(ListType::const_iterator it = l.begin(); it != l.end(); it++) {
		res = *it;
		if(res->getIndex() == index)
			return res;
	} 
	
	return 0;
}
コード例 #29
0
bool FPNode::isConnected( Node *node, NodeList *checkedNodes )
{
	if ( this == node )
		return true;

	bool firstNode = !checkedNodes;
	if (firstNode)
		checkedNodes = new NodeList();

	else if ( checkedNodes->contains(this) )
		return false;

	checkedNodes->append(this);

	const FlowConnectorList::const_iterator inputEnd = m_inFlowConnList.end();
	for ( FlowConnectorList::const_iterator it = m_inFlowConnList.begin(); it != inputEnd; ++it )
	{
		Connector *connector = *it;
		if (connector) {
			Node *startNode = connector->startNode();
			if ( startNode && startNode->isConnected( node, checkedNodes ) ) {
				if (firstNode) {
					delete checkedNodes;
				}
				return true;
			}
		}	
	}
	
	Connector *connector = m_outputConnector;
	if ( connector )
	{
		Node *endNode = connector->endNode();
		if ( endNode && endNode->isConnected ( node, checkedNodes ) )
		{
			if ( firstNode )
			{
				delete checkedNodes;
			}
			return true;
		}
	}


	if (firstNode) {
		delete checkedNodes;
	}

	return false;
}
コード例 #30
-1
ファイル: connector.hpp プロジェクト: Ilceren/cpp-driver
  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;
    }
  }