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


C++ ensureSize函数代码示例

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


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

示例1: putTweetRetweet1VertexValueIfAbsent

TweetRetweet1VertexValueEntry* putTweetRetweet1VertexValueIfAbsent(TweetRetweet1VertexValueMap* tweetRetweet1VertexValueMap, int& tweetTweetIdRetweet1RetweetTweetId ) {
	int h = 31;
	hashCode(h, tweetTweetIdRetweet1RetweetTweetId ); 
	h = h & (tweetRetweet1VertexValueMap->capacity - 1);
	TweetRetweet1VertexValueEntry* candidate = tweetRetweet1VertexValueMap->tweetRetweet1VertexValueEntryArray[h];
	TweetRetweet1VertexValueEntry* lastP = NULL;
	while(candidate) {
		if(
		  candidate->tweetTweetIdRetweet1RetweetTweetId == (tweetTweetIdRetweet1RetweetTweetId)
	      ) {
			return candidate;
		} else {
			lastP = candidate;
			candidate = candidate->next;
		}
	}
	TweetRetweet1VertexValueEntry* p = new TweetRetweet1VertexValueEntry;
	p->tweetTweetIdRetweet1RetweetTweetId = tweetTweetIdRetweet1RetweetTweetId;
	if(lastP)
		lastP->next = p;
	else
		tweetRetweet1VertexValueMap->tweetRetweet1VertexValueEntryArray[h] = p;
	tweetRetweet1VertexValueMap->size++;
	ensureSize(tweetRetweet1VertexValueMap);
	return p;
}
开发者ID:gauravsaxena81,项目名称:GraphIVM,代码行数:26,代码来源:TweetRetweet1VertexValueMapManager.cpp

示例2: putFollower4TweetVertexValueIfAbsent

//%4 - vertex value attributes
Follower4TweetVertexValueEntry* putFollower4TweetVertexValueIfAbsent(Follower4TweetVertexValueMap* follower4TweetVertexValueMap, int& follower4IdTweetUserId ) {
	int h = 31;
	//%1 - vertex value attribute values
	hashCode(h, follower4IdTweetUserId ); 
	h = h & (follower4TweetVertexValueMap->capacity - 1);
	Follower4TweetVertexValueEntry* candidate = follower4TweetVertexValueMap->follower4TweetVertexValueEntryArray[h];
	Follower4TweetVertexValueEntry* lastP = candidate;
	while(candidate) {
		if(
		  candidate->follower4IdTweetUserId == (follower4IdTweetUserId)
	      ) {
			return candidate;
		} else {
			lastP = candidate;
			candidate = candidate->next;
		}
	}
	Follower4TweetVertexValueEntry* p = new Follower4TweetVertexValueEntry;
	p->follower4IdTweetUserId = follower4IdTweetUserId;
	if(lastP)
		lastP->next = p;
	else
		follower4TweetVertexValueMap->follower4TweetVertexValueEntryArray[h] = p;
	follower4TweetVertexValueMap->size++;
	ensureSize(follower4TweetVertexValueMap);
	return p;
}
开发者ID:gauravsaxena81,项目名称:GraphIVM,代码行数:28,代码来源:Follower4TweetVertexValueMapManager.cpp

示例3: putRetweet3Retweet4VertexValueIfAbsent

Retweet3Retweet4VertexValueEntry* putRetweet3Retweet4VertexValueIfAbsent(Retweet3Retweet4VertexValueMap* retweet3Retweet4VertexValueMap, int& r3TweetIdR4RetweetTweetId ) {
	int h = 31;
	hashCode(h, r3TweetIdR4RetweetTweetId ); 
	h = h & (retweet3Retweet4VertexValueMap->capacity - 1);
	Retweet3Retweet4VertexValueEntry* candidate = retweet3Retweet4VertexValueMap->retweet3Retweet4VertexValueEntryArray[h];
	Retweet3Retweet4VertexValueEntry* lastP = candidate;
	while(candidate) {
		if(
		  candidate->r3TweetIdR4RetweetTweetId == (r3TweetIdR4RetweetTweetId)
	      ) {
			return candidate;
		} else {
			lastP = candidate;
			candidate = candidate->next;
		}
	}
	Retweet3Retweet4VertexValueEntry* p = new Retweet3Retweet4VertexValueEntry;
	p->r3TweetIdR4RetweetTweetId = r3TweetIdR4RetweetTweetId;
	if(lastP)
		lastP->next = p;
	else
		retweet3Retweet4VertexValueMap->retweet3Retweet4VertexValueEntryArray[h] = p;
	retweet3Retweet4VertexValueMap->size++;
	ensureSize(retweet3Retweet4VertexValueMap);
	return p;
}
开发者ID:gauravsaxena81,项目名称:GraphIVM,代码行数:26,代码来源:Retweet3Retweet4VertexValueMapManager.cpp

示例4: putRetweet1JoinTupleIfAbsent

Retweet1JoinTupleEntry* putRetweet1JoinTupleIfAbsent(Retweet1JoinTupleMap* retweet1JoinTupleMap, int& r1TweetIdR2RetweetTweetId, Retweet1Retweet2VertexValueMap* retweet1Retweet2VertexValueMap ) {
    int h = 31;
    hashCode(h, r1TweetIdR2RetweetTweetId ); 
    h = h & (retweet1JoinTupleMap->capacity - 1);
    Retweet1JoinTupleEntry* candidate = retweet1JoinTupleMap->retweet1JoinTupleEntryArray[h];
    Retweet1JoinTupleEntry* lastP = candidate;
    while(candidate) {
        if(
                candidate->retweet1Retweet2VertexValue->r1TweetIdR2RetweetTweetId == r1TweetIdR2RetweetTweetId
        ) {
            return candidate;
        } else {
            lastP = candidate;
            candidate = candidate->next;
        }
    }
    Retweet1JoinTupleEntry* p = new Retweet1JoinTupleEntry;
    if(!lastP)
        retweet1JoinTupleMap->retweet1JoinTupleEntryArray[h] = p;
    else
        lastP->next = p;
    retweet1JoinTupleMap->size++;
    ensureSize(retweet1JoinTupleMap, r1TweetIdR2RetweetTweetId );
    addToVertexValues(r1TweetIdR2RetweetTweetId , p, retweet1Retweet2VertexValueMap);
    return p;
}
开发者ID:gauravsaxena81,项目名称:GraphIVM,代码行数:26,代码来源:Retweet1JoinTupleMapManager.cpp

示例5: putUserTweetVertexValueIfAbsent

UserTweetVertexValueEntry* putUserTweetVertexValueIfAbsent(UserTweetVertexValueMap* userTweetVertexValueMap, int& userIdTweetUserId ) {
	int h = 31;
	hashCode(h, userIdTweetUserId ); 
	h = h & (userTweetVertexValueMap->capacity - 1);
	UserTweetVertexValueEntry* candidate = userTweetVertexValueMap->userTweetVertexValueEntryArray[h];
	UserTweetVertexValueEntry* lastP = NULL;
	while(candidate) {
		if(
		  candidate->userIdTweetUserId == (userIdTweetUserId)
	      ) {
			return candidate;
		} else {
			lastP = candidate;
			candidate = candidate->next;
		}
	}
	UserTweetVertexValueEntry* p = new UserTweetVertexValueEntry;
	p->userIdTweetUserId = userIdTweetUserId;
	if(lastP)
		lastP->next = p;
	else
		userTweetVertexValueMap->userTweetVertexValueEntryArray[h] = p;
	userTweetVertexValueMap->size++;
	ensureSize(userTweetVertexValueMap);
	return p;
}
开发者ID:gauravsaxena81,项目名称:GraphIVM,代码行数:26,代码来源:UserTweetVertexValueMapManager.cpp

示例6: sync

		/* Sum contributions from all threads, save to _force&_torque.
		 * Locks globalMutex, since one thread modifies common data (_force&_torque).
		 * Must be called before get* methods are used. Exception is thrown otherwise, since data are not consistent. */
		inline void sync(){
			for(int i=0; i<nThreads; i++){
				if (_maxId[i] > 0) { synced = false;}
			}
			if(synced) return;
			boost::mutex::scoped_lock lock(globalMutex);
			if(synced) return; // if synced meanwhile
			
			for(int i=0; i<nThreads; i++){
				if (_maxId[i] > 0) { ensureSize(_maxId[i],i);}
			}
			
			syncSizesOfContainers();

			for(long id=0; id<(long)size; id++){
				Vector3r sumF(Vector3r::Zero()), sumT(Vector3r::Zero());
				for(int thread=0; thread<nThreads; thread++){ sumF+=_forceData[thread][id]; sumT+=_torqueData[thread][id];}
				_force[id]=sumF; _torque[id]=sumT;
				if (permForceUsed) {_force[id]+=_permForce[id]; _torque[id]+=_permTorque[id];}
			}
			if(moveRotUsed){
				for(long id=0; id<(long)size; id++){
					Vector3r sumM(Vector3r::Zero()), sumR(Vector3r::Zero());
					for(int thread=0; thread<nThreads; thread++){ sumM+=_moveData[thread][id]; sumR+=_rotData[thread][id];}
					_move[id]=sumM; _rot[id]=sumR;
				}
			}
			synced=true; syncCount++;
		}
开发者ID:NauticalMile64,项目名称:trunk,代码行数:32,代码来源:ForceContainer.hpp

示例7: putTweetProjectedTuple

//%3 - projected attributes
TweetProjectedTupleEntry* putTweetProjectedTuple(TweetProjectedTupleMap* tweetProjectedTupleMap, int& tweetId ) {
	int h = 31;
	hashCode(h, tweetId ); 
	h = h & (tweetProjectedTupleMap->capacity - 1);
	TweetProjectedTupleEntry* candidate = tweetProjectedTupleMap->tweetProjectedTupleEntryArray[h];
	TweetProjectedTupleEntry* lastP = NULL;
	while(candidate) {
		if(
		  //%1 - projected attributes
				candidate->tweetId == (tweetId)
		) {
			candidate->count++;
			return candidate;
		} else {
			lastP = candidate;
			candidate = candidate->next;
		}
	}
	TweetProjectedTupleEntry* p = new TweetProjectedTupleEntry;
	//%1 - projected attributes
	p->tweetId = tweetId;
	if(!lastP)
		tweetProjectedTupleMap->tweetProjectedTupleEntryArray[h] = p;
	else
		lastP->next = p;
	tweetProjectedTupleMap->size++;
	ensureSize(tweetProjectedTupleMap);
	return p;
}
开发者ID:gauravsaxena81,项目名称:GraphIVM,代码行数:30,代码来源:TweetProjectedTupleMapManager.cpp

示例8: ensureSize

prettyTable& prettyTable::addTitle(std::string title) {
    colRowTitles_++;
    maxColRowTitles_ = std::max(maxColRowTitles_, colRowTitles_);
    ensureSize();
    rowTitles_[rowRowTitles_][colRowTitles_] = title;

    return *this;
}
开发者ID:paulkoerbitz,项目名称:uncert,代码行数:8,代码来源:prettytable.cpp

示例9: getTorqueSingle

		const Vector3r getTorqueSingle(Body::id_t id){ 
			ensureSize(id); 
			if (permForceUsed) {
				return _torque[id] + _permTorque[id];
			} else {
				return _torque[id];
			}
		}
开发者ID:NauticalMile64,项目名称:trunk,代码行数:8,代码来源:ForceContainer.hpp

示例10: ensureSize

void IOBuffer::storeDoubleLE(double data) {
	ensureSize(8);
	rx_uint64 val = 0;
	memcpy(&val, &data, 8);
	val = ToLE64(data);
	memcpy(buffer+published, &val, 8);
	published += 8;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:8,代码来源:IOBuffer.cpp

示例11: storeBytes

bool IOBuffer::storeBytes(const char* someData, const rx_uint32 numBytes) {
	if(!ensureSize(numBytes)) {
		return false;
	}
	memcpy(buffer+published, someData, numBytes);
	published += numBytes;
	return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:8,代码来源:IOBuffer.cpp

示例12: databases

Tablespace::Tablespace(ConfigParser& cfg, IndexType defaultTablespaceSize)
        : databases(defaultTablespaceSize), cfg(cfg) {
    ensureSize(defaultTablespaceSize);
    //Use malloc here to allow usage of realloc
    //Initialize all pointers to zero
    for (size_t i = 0; i < databases.size(); i++) {
        databases[i] = nullptr;
    }
}
开发者ID:QuantScientist3,项目名称:YakDB,代码行数:9,代码来源:Tablespace.cpp

示例13: pushBump

			void pushBump(element_type const & entry)
			{
				if ( expect_false(full()) )
				{
					ensureSize(std::max(2*f,static_cast<size_t>(1)));
					assert ( ! full() );
				}
				push(entry);
			}
开发者ID:gt1,项目名称:libmaus2,代码行数:9,代码来源:FiniteSizeHeap.hpp

示例14: append

static void append(buffer_t* buf, char* str)
{
    int needed;
    int len;

    len = strlen(str);
    needed = buf->pos + len + 1;
    ensureSize(buf, needed);
    strcpy(buf->block + buf->pos, str);
    buf->pos += len;
}
开发者ID:kmizu,项目名称:spnuts,代码行数:11,代码来源:pnuts.c

示例15: write

    void write (const MinMaxValue* const values, const int startIndex, const int numValues)
    {
        resetPeak();

        if (startIndex + numValues > data.size())
            ensureSize (startIndex + numValues);

        MinMaxValue* const dest = getData (startIndex);

        for (int i = 0; i < numValues; ++i)
            dest[i] = values[i];
    }
开发者ID:Krewn,项目名称:LIOS,代码行数:12,代码来源:juce_AudioThumbnail.cpp


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