示例#1
0
文件: page.cpp 项目: JIM-DB/Server
        bool Page::deleteObj(long long headerpos)
        {
            //reading the Page
            tasking::RWLockGuard<> lock(m_rwLock, tasking::WRITE);
            auto l_header = reinterpret_cast<HeaderMetaData*>(static_cast<char*>(m_header) + headerpos);
            auto l_oid = l_header->getOID();
            //start delete by calculating the start position and passing the hash of the obj name
            deleteObj(l_header->getObjektType(), static_cast<char*>(m_body) + l_header->getPos());

            //now its delete put the freetype ptr to the start
            //of the "prepared" deleted object
            auto l_free = m_free;
            while (l_free->getNext() == 0)
                l_free = reinterpret_cast<FreeType*>(reinterpret_cast<char*>(l_free) + l_free->getNext());
            // now l_Free is the last element;
            l_free->setNext(dist(l_free, static_cast<char*>(m_body) + l_header->getPos()));

            // Delete header
            l_free = m_headerFree;
            while (l_free->getNext() == 0)
                l_free = reinterpret_cast<FreeType*>(reinterpret_cast<char*>(l_free) + l_free->getNext());

            //now we have the last free element of the header
            //insert free type with the right size
            auto l_deletedHeader = new(l_header) FreeType(sizeof(HeaderMetaData));
            //set the freeType pointer to it
            l_free->setNext(dist(l_free, l_deletedHeader));

            //delete the obj of the idx
            index::ObjectIndex::getInstance().erase(l_oid);
            //do NOT delete the Meta! it is way faster to
            //insert with meta then without so keep the data
            return true;
        }
示例#2
0
文件: set.c 项目: jiajw0426/easyscada
SET
setXIntersect(SET A,SET B)
{
    SET set;
    void *e;

    if (! (A->cmp && B->cmp) )
	return NULL;		/* Both need a compare function */

    /* Create new set */
    if (! (set = setNew(A->cmp,A->ed,A->ord)))
	{ XLOG(set); return NULL; }

    /* Add elements of A only */
    for (e = setFirst(A); e; e = setNext(A))
	if (!setContains(B,e))
	    setAdd(set,e);

    /* Add elements of B only */
    for (e = setFirst(B); e; e = setNext(B))
	if (!setContains(A,e))
	    setAdd(set,e);

    return set;
}
 void setNext(TreeLinkNode *node, int depth, vector<TreeLinkNode*> &nexts) {
     if (node == nullptr) return;
     while ((int)nexts.size() <= depth) nexts.push_back(nullptr);
     node->next = nexts[depth];
     nexts[depth] = node;
     setNext(node->right, depth + 1, nexts);
     setNext(node->left, depth + 1, nexts);
 }
示例#4
0
// updateData
// update data
void CWayPoint::updateData( CSerializable* pObj )
{
	pObj->nextRecord();
	
	CZone* pZone = (CZone*) getParent();

	// next waypoint
	long id = pObj->readLong();	
	CGameObject *p = pZone->searchObject( id );

	if ( id != -1 && p )
	{		
		if ( p && p->getObjectType() == CGameObject::WaypointObject )
		{
			((CWayPoint*)p)->setBack( this );
			setNext( (CWayPoint*)p );
		}
	}
	else
	{
		if ( m_next )
			m_next->setBack( NULL );
		setNext(NULL);
	}

	// prev waypoint
	id = pObj->readLong();
	p = pZone->searchObject( id );

	if ( id != -1 && p )
	{
		if ( p && p->getObjectType() == CGameObject::WaypointObject )
		{
			((CWayPoint*)p)->setNext( this );
			setBack( (CWayPoint*)p );
		}
	}
	else
	{
		if ( m_back )
			m_back->setNext( NULL );
		setBack(NULL);
	}

	// wait time
	m_timeWait = pObj->readLong();

	CGameObject::updateData( pObj );
}
示例#5
0
  /*
  * \bug fel  om vi flyttas till att vara första barn..
  */
  void CellCursor::moveBefore(Cell *current)
  {
    // 2006-04-27 AF,
    cursorIsMoved();

    removeFromCurrentPosition();

    //Remove all widgets from currents parent.
    current->parentCell()->removeCellWidgets();

    //Move to new position.
    if(current->hasParentCell())
    {
      setParentCell(current->parentCell());
      if(!current->hasPrevious())
        current->parentCell()->setChild(this);
      else
        current->previous()->setNext(this);

    }
    else
      throw runtime_error("Could not insert before root");

    setPrevious(current->previous());
    current->setPrevious(this);
    setNext(current);

    //Insert widgets to parents layout.
    parentCell()->addCellWidgets();

    // TMP EMIT
    emit changedPosition();
    //      emit positionChanged(x(), y(), 5, 5);
  }
示例#6
0
void MqttBridge::received(const QMQTT::Message &message){
    //Now we have to pass on the different command to the DBUS command
    //That will be done by emitting signals, as we have no
    //knowlege of the dBus class, We will try to have a clean interface

    qDebug()<<"Message Topic and payload "<<message.topic() << message.payload();
    if      (message.topic()==mediaPlayCommand) emit setPlay();
    else if (message.topic()==mediaNextCommand) emit setNext();
    else if (message.topic()==mediaPrevCommand) emit setPrevious();
    else if (message.topic()==mediaVolumeCommand) {
        double volume = message.payload().toDouble()/100;
        emit setVolume(volume);
        }
    else if (message.topic()==mediaPlayIdCommand) {
     QDBusObjectPath _path;
     _path.setPath(message.payload());
     emit setPlayId(_path);
    }
    else if (message.topic()==mediaPlayPauseCommand) emit setPlayPause();
    else if (message.topic()==mediaRepeatCommand){
        if (message.payload()=="0") emit setLoop("None");
        else emit setLoop("Playlist");
    }
    else if (message.topic()==mediaMixCommand){
     if (message.payload()=="0") emit setShuffle(false);
     else emit setShuffle(true);
    }



}
示例#7
0
void StreamRender::setUrl(const QString url){

    StreamPlay *streamplay= new StreamPlay;
    connect(this, SIGNAL(next()),streamplay, SLOT(setNext()));
    connect(this, SIGNAL(stop()),streamplay, SLOT(setStop()));

    connect(streamplay, SIGNAL(Finish()),this, SLOT(StreamFree()));



    streamplay->isFaderSolapar(FundirSolapar);
    streamplay->isFaderStop(FundirParar);
    streamplay->setFaderSec(Fundir);
    streamplay->setDevice(Device);
    streamplay->setUrl(url);

    stream = streamplay->stream;


     StreamMath *streammath = new StreamMath(stream);
     segundos = streammath->Duracion();
     Slider->setMaximum(segundos);
     delete streammath;
     Timer->start(Render);




}
示例#8
0
 void initialize(int32_t valueNumber, Relationship *rel, StoreRelationship *storeRel)
    {
    _valueNumber = valueNumber;
    relationships.setFirst(rel);
    storeRelationships.setFirst(storeRel);
    setNext(NULL);
    }
示例#9
0
void Simulation::onKeyDownEvent(SDL_Keysym key)
{
    switch (key.sym)
    {
        case SDLK_ESCAPE:
            setNext(MENU);
        break;

        case SDLK_RETURN:
            if (!gameRunning)
                setNext(RESULTS);
        break;

        default: break;
    }
}
示例#10
0
size_t ReadsLayout::reverseComplement(size_t index) {
    
    if (getNext(index) != 0) {
        cout << "size_t ReadsLayout::reverseComplement(size_t index) problem\n";
        sendBugReportPlease(cerr);
    }

    unsigned int reversePos = getPosition(index) + 1;
    size_t pTmp;
    size_t previous;

    do {
        setDirection(index, !getDirection(index));
        setPosition(index, reversePos - getPosition(index));
        //swap links
        pTmp = getNext(index);
        setNext(index, getPrevious(index));
        setPrevious(index, pTmp);
        previous = index;
        index = getNext(index);

    } while (index != 0);

    return previous;
}
示例#11
0
int sis_final_context(int context)
{
	int i;

	for(i=0; i<MAX_CONTEXT; i++)
	  if(global_ppriv[i].used && (global_ppriv[i].context == context))
	    break;
          
	if(i < MAX_CONTEXT){
	  set_t *set;
	  unsigned int item;
	  int retval;
	  
  	  DRM_DEBUG("find socket %d, context = %d\n", i, context);

	  /* Video Memory */
	  set = global_ppriv[i].sets[0];
	  retval = setFirst(set, &item);
	  while(retval){
   	    DRM_DEBUG("free video memory 0x%x\n", item);
            sis_free(item);
	    retval = setNext(set, &item);
	  }
	  setDestroy(set);

	  /* AGP Memory */
	  set = global_ppriv[i].sets[1];
	  retval = setFirst(set, &item);
	  while(retval){
   	    DRM_DEBUG("free agp memory 0x%x\n", item);
	    mmFreeMem((PMemBlock)item);
	    retval = setNext(set, &item);
	  }
	  setDestroy(set);
	  
	  global_ppriv[i].used = 0;	  
        }

	/* turn-off auto-flip */
	/* TODO */
#if defined(SIS_STEREO)
	flip_final();
#endif
	
	return 1;
}
示例#12
0
int sis_final_context(struct drm_device *dev, int context)
{
	int i;

	for (i = 0; i < MAX_CONTEXT; i++) {
		if (global_ppriv[i].used &&
		    (global_ppriv[i].context == context))
			break;
	}

	if (i < MAX_CONTEXT) {
		set_t *set;
		ITEM_TYPE item;
		int retval;

		DRM_DEBUG("find socket %d, context = %d\n", i, context);

		/* Video Memory */
		set = global_ppriv[i].sets[0];
		retval = setFirst(set, &item);
		while (retval) {
			DRM_DEBUG("free video memory 0x%lx\n", item);
#if defined(__linux__) && defined(CONFIG_FB_SIS)
			sis_free(item);
#else
			mmFreeMem((PMemBlock) item);
#endif
			retval = setNext(set, &item);
		}
		setDestroy(set);

		/* AGP Memory */
		set = global_ppriv[i].sets[1];
		retval = setFirst(set, &item);
		while (retval) {
			DRM_DEBUG("free agp memory 0x%lx\n", item);
			mmFreeMem((PMemBlock) item);
			retval = setNext(set, &item);
		}
		setDestroy(set);

		global_ppriv[i].used = 0;
	}

	return 1;
}
示例#13
0
void LevelManager::GameInToMainLayer()
{
	setNext(false);
	ResManager::getManager()->removeAllArmatureInfo();
	LoadingLayer* layer = new LoadingLayer(Intent_GameIn2Main);
	CCDirector::sharedDirector()->getRunningScene()->addChild(layer,1000);
	layer->release();
}
示例#14
0
void LevelManager::SectionToGameIn()
{
	setNext(false);
	LoadingLayer* layer = new LoadingLayer(Intent_Section2GameIn,m_iLastSeasonId);
	CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
	pScene->addChild(layer);
	layer->release();
}
示例#15
0
IOBooksInfo::IOBooksInfo() {
    setCardNumber("");
    setCode("");
    setODate("");
    setIDate("");
    setNext(NULL);
    setPrev(NULL);
}
示例#16
0
void JabberBrowser::showSearch()
{
	if (m_search){
		QTimer::singleShot(0, m_search, SLOT(setNext()));
		m_search->exec();
		delete m_search;
		m_search = NULL;
	}
}
示例#17
0
void JabberBrowser::showReg()
{
	if (m_reg){
		QTimer::singleShot(0, m_reg, SLOT(setNext()));
		m_reg->exec();
		delete m_reg;
		m_reg = NULL;
	}
}
示例#18
0
QFAppScriptRunnable *QFAppScriptRunnable::then(QJSValue condition,QJSValue script)
{
    QFAppScriptRunnable* runnable = new QFAppScriptRunnable(this);
    runnable->setEngine(m_engine.data());
    runnable->setCondition(condition);
    runnable->setScript(script);
    setNext(runnable);
    return runnable;
}
示例#19
0
文件: set.c 项目: jiajw0426/easyscada
SET
setUnion1(SET s1,SET s2)
{
    SET set;
    void *e;

    set = setNew(s1->cmp,s1->ed,s1->ord);

    if (!set)
	{ XLOG(set); return NULL; }

    for (e = setFirst(s1); e; e = setNext(s1))
	setAdd(set,e);	/* Blind copy of s1 */

    for (e = setFirst(s2); e; e = setNext(s2))
	setAdd(set,e);	/* Call setAdd() to weed out duplicates */

    return set;
}
示例#20
0
void JabberBrowser::showConfig()
{
    if (m_config){
        m_config->initTitle();
        QTimer::singleShot(0, m_config, SLOT(setNext()));
        m_config->exec();
        delete m_config;
        m_config = NULL;
    }
}
/*! 
   Inserts pL into the containment hierarchy after 'this'.
   This is actually a general linked list insertion routine.
*/
void fl_ContainerLayout::_insertIntoList(fl_ContainerLayout * pL)
{
	fl_ContainerLayout * pNext = getNext();
	setNext(pL);

	pL->setPrev(this);
	pL->setNext(pNext);

	if(pNext)
		pNext->setPrev(pL);
}
示例#22
0
文件: set.c 项目: jiajw0426/easyscada
SET
setUnion(SET set1,SET set2)
{
    void *e;

    /* Add all elements of set2 onto set1 */
    for (e = setFirst(set2); e; e = setNext(set2))
	setAdd(set1,e);
 
    return set1;
}
示例#23
0
void LevelManager::GameInToSectionLayer()
{
	setNext(false);
	ResManager::getManager()->removeAllArmatureInfo();
	CCScene* pScene = Starseneui::scene();
	Starseneui* pLayer = (Starseneui*)pScene->getChildByTag(Starseneui_tag);
	pLayer->Goxiaogk(Smalllayer_tag);

	CCTransitionFade* pTran = CCTransitionFade::create(0.5f, pScene, ccWHITE);
	CCDirector::sharedDirector()->replaceScene(pTran);
}
示例#24
0
/* add_freelist the free block pointer to appropriate segregated free list */
void add_freelist (void *bp){
    int index = getlist_index(GET_SIZE(HDRP(bp)));
    setNext(bp, free_listp[index]);
    setPrev(bp, NULL);  

    if (free_listp[index] != NULL)
            setPrev(free_listp[index], bp); 
          
    free_listp[index] = bp;

    return;
}
示例#25
0
/*delete_freelist Remove the allocated block pointer from its assigned segregated free list */
void delete_freelist (void *bp){
    int index = getlist_index(GET_SIZE(HDRP(bp)));
    if (getPrev(bp) != NULL)
        setNext(getPrev(bp),getNext(bp));

    else 
	free_listp[index] = getNext(bp);

    if (getNext(bp) != NULL)
        setPrev(getNext(bp), getPrev(bp));

    return;
}
示例#26
0
Node* reverse(Node* root){
    /*BEGIN SOLUTION*/
    Node* prev = NULL;
    while(root != NULL){
        Node* temp = getNext(root);
        setNext(root, prev);
        prev = root;
        root = temp;
    }
    return prev;
    /*END SOLUTION*/
    /*STUB: return root; */
}
示例#27
0
void IRInstruction::convertToJmp() {
  assert(isControlFlow());
  assert(IMPLIES(block(), &block()->back() == this));
  m_op = Jmp;
  m_typeParam.clear();
  m_numSrcs = 0;
  m_numDsts = 0;
  m_srcs = nullptr;
  m_dst = nullptr;
  m_extra = nullptr;
  // Instructions in the simplifier don't have blocks yet.
  setNext(nullptr);
}
示例#28
0
	bool xMemoryPool::growMemoryArray(void)
	{
#ifdef _DEBUG
		std::string str("Growing memory pool: [" + getDebugName() + ":" + ToStr((unsigned long)m_chunkSize) + "] = " + ToStr((unsigned long)m_memArraySize + 1) + "\n");
		::OutputDebugStringA(str.c_str());  // the logger is not initialized during many of the initial memory pool growths, so let's just use the OS version
#endif

											// allocate a new array
		size_t allocationSize = sizeof(unsigned char*) * (m_memArraySize + 1);
		unsigned char** ppNewMemArray = (unsigned char**)malloc(allocationSize);

		// make sure the allocation succeeded
		if (!ppNewMemArray)
			return false;

		// copy any existing memory pointers over
		for (unsigned int i = 0; i < m_memArraySize; ++i)
		{
			ppNewMemArray[i] = m_ppRawMemoryArray[i];
		}

		// allocate a new block of memory
		ppNewMemArray[m_memArraySize] = allocateNewMemoryBlock();  // indexing m_memArraySize here is safe because we haven't incremented it yet to reflect the new size	

																   // attach the block to the end of the current memory list
		if (m_pHead)
		{
			unsigned char* pCurr = m_pHead;
			unsigned char* pNext = getNext(m_pHead);
			while (pNext)
			{
				pCurr = pNext;
				pNext = getNext(pNext);
			}
			setNext(pCurr, ppNewMemArray[m_memArraySize]);
		}
		else
		{
			m_pHead = ppNewMemArray[m_memArraySize];
		}

		// destroy the old memory array
		if (m_ppRawMemoryArray)
			free(m_ppRawMemoryArray);

		// assign the new memory array and increment the size count
		m_ppRawMemoryArray = ppNewMemArray;
		++m_memArraySize;

		return true;
	}
示例#29
0
Node* cut(Node* root, int i){
    /*BEGIN SOLUTION*/
    if (i == 0){
        return root;
    }
    for(int j = i-1; j > 0; j--){
        root = getNext(root);
    }
    Node* tail = getNext(root);
    setNext(root, NULL);
    return tail;
    /*END SOLUTION*/
    /*STUB: return root; */
}
/*!
  Destruct container
  \note The Containers in vector of the container are not
        destructed. They are owned by the logical hierarchy (i.e.,
		the fl_Container classes like fl_BlockLayout), not the physical
        hierarchy.
 */
fp_TOCContainer::~fp_TOCContainer()
{
	clearCons();
	deleteBrokenTOCs(false);
	UT_DEBUGMSG(("SEVIOR: deleting TOC %p \n",this));
//
// For debugging...
//
	setContainer(NULL);
	setPrev(NULL);
	setNext(NULL);
	m_pMasterTOC = NULL;

}