本文整理汇总了C++中SimpleVector类的典型用法代码示例。如果您正苦于以下问题:C++ SimpleVector类的具体用法?C++ SimpleVector怎么用?C++ SimpleVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findAddressIndex
void LocalAddressReceiver::removeReceiveAddress( char *inAddress ) {
mReceiveAddressLock->lock();
int index = findAddressIndex( inAddress );
if( index != -1 ) {
delete [] *( mAddressVector->getElement( index ) );
mAddressVector->deleteElement( index );
SimpleVector<char *> *currentMessageQueue
= *( mMessageQueueVector->getElement( index ) );
SimpleVector<char *> *currentFromAddressQueue
= *( mFromAddressQueueVector->getElement( index ) );
int numInQueue = currentMessageQueue->size();
for( int j=0; j<numInQueue; j++ ) {
delete [] *( currentMessageQueue->getElement( j ) );
delete [] *( currentFromAddressQueue->getElement( j ) );
}
delete currentMessageQueue;
delete currentFromAddressQueue;
mMessageQueueVector->deleteElement( index );
mFromAddressQueueVector->deleteElement( index );
}
mReceiveAddressLock->unlock();
}
示例2: testSimpleVectorDataAccess
void testSimpleVectorDataAccess() {
SimpleVector v = createSimpleVector(3);
BOOST_CHECK( v.getElement(0) == 0 );
BOOST_CHECK( v.getElement(1) == 1 );
BOOST_CHECK( v.getElement(2) == 2 );
}
示例3:
const char *TranslationManager::translate( char *inTranslationKey ) {
char *translatedString = NULL;
SimpleVector<char *> *keys =
mStaticMembers.mTranslationKeys;
SimpleVector<char *> *naturalLanguageStrings =
mStaticMembers.mNaturalLanguageStrings;
if( keys != NULL ) {
int numKeys = keys->size();
for( int i=0; i<numKeys && translatedString == NULL; i++ ) {
if( strcmp( inTranslationKey, *( keys->getElement( i ) ) ) == 0 ) {
// keys match
translatedString =
*( naturalLanguageStrings->getElement( i ) );
}
}
}
if( translatedString == NULL ) {
translatedString = inTranslationKey;
}
return translatedString;
}
示例4: SYS_fasl_sharp_left_paren
// ### fasl-sharp-left-paren stream sub-char numarg => value
Value SYS_fasl_sharp_left_paren(Value streamarg, Value subchar, Value numarg)
{
Thread * thread = current_thread();
if (thread->symbol_value(S_read_suppress) != NIL)
{
stream_read_list(streamarg, true, thread, FASL_READTABLE);
return NIL;
}
if (numarg != NIL && thread->symbol_value(S_backquote_count) == FIXNUM_ZERO)
return stream_read_vector(streamarg, check_index(numarg), thread, FASL_READTABLE);
Value list = stream_read_list(streamarg, true, thread, FASL_READTABLE);
if (thread->symbol_value(S_backquote_count) == FIXNUM_ZERO)
{
if (numarg != NIL)
{
INDEX len = check_index(numarg);
SimpleVector * vector = new_simple_vector(len);
for (INDEX i = 0; i < len; i++)
{
vector->inline_xaset(i, car(list));
if (cdr(list) != NIL)
list = xcdr(list);
}
return make_value(vector);
}
return make_value(new_simple_vector(list));
}
return make_cons(thread->symbol_value(S_backquote_vector_flag), list);
}
示例5: findSolHelp
bool SolverClass::findSolHelp(SimpleVector<Rectangle> &hand, int index)
{
Rectangle insertRect;
hand.getValueAt(index, insertRect);
if(findUnused(index, rectangleData))
{
if(drawRectangle(index))
{
findSolHelp(rectangleData, index + 1);
}
remove(index);
findSolHelp(rectangleData , index);
}
else if(index == hand.getSize())
{
return true;
}
else
{
cout << "NO SOLUTION" << endl;
return false;
}
return true;
}
示例6: printf
LocalAddressReceiver::~LocalAddressReceiver() {
mReceiveAddressLock->lock();
int numAddresses = mAddressVector->size();
int i;
for( i=0; i<numAddresses; i++ ) {
delete [] *( mAddressVector->getElement( i ) );
SimpleVector<char *> *currentMessageQueue
= *( mMessageQueueVector->getElement( i ) );
SimpleVector<char *> *currentFromAddressQueue
= *( mFromAddressQueueVector->getElement( i ) );
int numInQueue = currentMessageQueue->size();
for( int j=0; j<numInQueue; j++ ) {
delete [] *( currentMessageQueue->getElement( j ) );
delete [] *( currentFromAddressQueue->getElement( j ) );
}
delete currentMessageQueue;
delete currentFromAddressQueue;
}
delete mAddressVector;
delete mMessageQueueVector;
delete mFromAddressQueueVector;
mReceiveAddressLock->unlock();
if (!mHandlerLock->tryLockForWrite(2000))
{
//FIXME : if no lock obtaine after 2 seconds : what to do ?
printf("strange, lock for write in ~LocalAddressReceiver not obtained!!!\n");
}
int numHandlers = mMessageHandlerVector->size();
for( i=0; i<numHandlers; i++ ) {
MessageHandlerWrapper *wrapper =
*( mMessageHandlerVector->getElement( i ) );
delete wrapper;
}
delete mMessageHandlerVector;
numHandlers = mGlobalMessageHandlerVector->size();
for( i=0; i<numHandlers; i++ ) {
MessageHandlerWrapper *wrapper =
*( mGlobalMessageHandlerVector->getElement( i ) );
delete wrapper;
}
delete mGlobalMessageHandlerVector;
mHandlerLock->unlock();
delete mHandlerLock;
delete mReceiveAddressLock;
}
示例7: testSimpleVectorMultiply
void testSimpleVectorMultiply() {
SimpleVector v = createSimpleVector(3);
// [0,1,2] * 3 = [0,3,6]
v.multiply(3);
BOOST_CHECK( v.getElement(0) == 0 );
BOOST_CHECK( v.getElement(1) == 3 );
BOOST_CHECK( v.getElement(2) == 6 );
}
示例8: DataSetWriter
using namespace tecplot::___3933; namespace tecplot { namespace teciompi { DataSetWriterMPI::DataSetWriterMPI( ___37* ___36, ___3501 vars, ___3501 ___4671, ___1844 const& maxIJKSubzoneSize, ___2090::ItemOffset_t maxFESubzoneSize, MPI_Comm communicator, int mainProcess, int localProcess, bool flushToDisk ) : DataSetWriter(___36, vars, ___4671, maxIJKSubzoneSize, maxFESubzoneSize, flushToDisk) , m_communicator(communicator) , m_mainProcess(mainProcess) , m_localProcess(localProcess) {} DataSetWriterMPI::~DataSetWriterMPI() {} ___372 DataSetWriterMPI::writeDataSet( FileWriterInterface& szpltFile, ___1392& szpltZoneHeaderFileLocs) { REQUIRE(szpltFile.___2041()); if (!___2337->___896()) return ___4226; ___372 ___2039 = ___4226;
#if defined _WIN32 && _MSC_FULL_VER < 190022816
unsigned int oldOutputFormat = _set_output_format(_TWO_DIGIT_EXPONENT);
#endif
try { ZoneWriterFactoryMPI ___4710(___2680, *___2337, m_communicator, m_mainProcess); boost::unordered_map<___4636, boost::shared_ptr<___4709> > zoneWriterMap; boost::unordered_map<___4636, ___1393> zoneFileLocMap; if (m_localProcess == m_mainProcess) { ___1393 fileLoc = szpltFile.fileLoc(); MPICommunicator communicator(m_communicator); m_zoneIter->reset(); ___4636 const ___341 = m_zoneIter->baseItem(); while (___2039 && m_zoneIter->hasNext()) { ___4636 const ___904 = m_zoneIter->next(); ___4636 const fileZone = ___904 - ___341; if (!___2337->___4638(___904 + 1)) continue; uint64_t zoneFileSize; if (___2337->zoneIsPartitioned(___904 + 1) || ___2337->zoneGetOwnerProcess(___904 + 1) == m_localProcess) { zoneFileLocMap[fileZone] = fileLoc; std::vector<___372> ___4564; ___372 ___4499; getZoneSharing(___4564, ___4499, ___904, ___341, szpltFile.___844()); zoneWriterMap[fileZone] = ___4710.___4708(*m_varIter, ___904, ___341, ___4564, ___4499); zoneFileSize = zoneWriterMap[fileZone]->zoneFileSize(szpltFile.___2002() == ___4226); } else { int zoneOwner = ___2337->zoneGetOwnerProcess(___904 + 1); communicator.sendScalar(fileLoc, zoneOwner, TecioMPI::ZONE_FILE_LOC); communicator.receiveScalar(zoneFileSize, zoneOwner, TecioMPI::ZONE_FILE_SIZE); } fileLoc += zoneFileSize; } } else { MPINonBlockingCommunicationCollection communicationCollection(m_communicator); m_zoneIter->reset(); ___4636 const ___341 = m_zoneIter->baseItem(); while (___2039 && m_zoneIter->hasNext()) { ___4636 const ___904 = m_zoneIter->next(); ___4636 const fileZone = ___904 - ___341; if (!___2337->___4638(___904 + 1)) continue; if (___2337->zoneIsPartitioned(___904 + 1) || ___2337->zoneGetOwnerProcess(___904 + 1) == m_localProcess) { std::vector<___372> ___4564; ___372 ___4499; getZoneSharing(___4564, ___4499, ___904, ___341, szpltFile.___844()); zoneWriterMap[fileZone] = ___4710.___4708(*m_varIter, ___904, ___341, ___4564, ___4499); uint64_t zoneSize = zoneWriterMap[fileZone]->zoneFileSize(szpltFile.___2002() == ___4226); if (!___2337->zoneIsPartitioned(___904 + 1)) { communicationCollection.sendScalarCopy(zoneSize, m_mainProcess, TecioMPI::ZONE_FILE_SIZE); communicationCollection.receiveScalar(zoneFileLocMap[fileZone], m_mainProcess, TecioMPI::ZONE_FILE_LOC); } } } communicationCollection.___4446(); } m_zoneIter->reset(); ___4636 const ___341 = m_zoneIter->baseItem(); while (___2039 && m_zoneIter->hasNext()) { ___4636 const ___904 = m_zoneIter->next(); ___4636 const fileZone = ___904 - ___341; if (!___2337->___4638(___904 + 1)) continue; if (___2337->zoneIsPartitioned(___904 + 1) || ___2337->zoneGetOwnerProcess(___904 + 1) == m_localProcess) { ___2039 = zoneWriterMap[fileZone]->writeZone(szpltFile, zoneFileLocMap[fileZone]); if (m_localProcess == m_mainProcess) { szpltZoneHeaderFileLocs[fileZone] = zoneWriterMap[fileZone]->getZoneHeaderFilePosition(); m_varIter->reset(); ___4352 const baseVar = m_varIter->baseItem(); while (m_varIter->hasNext()) { ___4352 const datasetVar = m_varIter->next(); ___4352 const fileVar = datasetVar - baseVar; m_zoneVarMetadata->m_vzMinMaxes[fileVar][fileZone] = zoneWriterMap[fileZone]->varMinMax(datasetVar); } } else if (!___2337->zoneIsPartitioned(___904 + 1)) { MPINonBlockingCommunicationCollection communicationCollection(m_communicator); ___1393 headerFileLoc = zoneWriterMap[fileZone]->getZoneHeaderFilePosition(); communicationCollection.sendScalarCopy(headerFileLoc, m_mainProcess, TecioMPI::HEADER_FILE_LOC); std::vector<double> minValues; std::vector<double> maxValues; m_varIter->reset(); while (m_varIter->hasNext()) { ___4352 const ___4336 = m_varIter->next(); ___2479 varMinMax = zoneWriterMap[fileZone]->varMinMax(___4336); minValues.push_back(varMinMax.minValue()); maxValues.push_back(varMinMax.maxValue()); } communicationCollection.sendVectorCopy(minValues, m_mainProcess, TecioMPI::VAR_MIN_VALUES_SIZE, TecioMPI::VAR_MIN_VALUES_VEC); communicationCollection.sendVectorCopy(maxValues, m_mainProcess, TecioMPI::VAR_MAX_VALUES_SIZE, TecioMPI::VAR_MAX_VALUES_VEC); communicationCollection.___4446(); } } else if (m_localProcess == m_mainProcess) { int zoneOwner = ___2337->zoneGetOwnerProcess(___904 + 1); MPICommunicator communicator(m_communicator); communicator.receiveScalar(szpltZoneHeaderFileLocs[fileZone], zoneOwner, TecioMPI::HEADER_FILE_LOC); SimpleVector<double> minValues; SimpleVector<double> maxValues; communicator.receiveVector(minValues, zoneOwner, TecioMPI::VAR_MIN_VALUES_SIZE, TecioMPI::VAR_MIN_VALUES_VEC); communicator.receiveVector(maxValues, zoneOwner, TecioMPI::VAR_MAX_VALUES_SIZE, TecioMPI::VAR_MAX_VALUES_VEC);
___478(minValues.size() == m_varIter->___2812()); ___478(maxValues.size() == m_varIter->___2812()); m_varIter->reset(); ___4352 const baseVar = m_varIter->baseItem(); while (m_varIter->hasNext()) { ___4352 const fileVar = m_varIter->next() - baseVar; m_zoneVarMetadata->m_vzMinMaxes[fileVar][fileZone] = ___2479(minValues[fileVar], maxValues[fileVar]); } } if (szpltFile.___844() == ___845) ___2680.remove(___904); } if (!___2039) { ___2680.clear(); } } catch(std::exception const& e) { ___2039 = ___1186(e.what()); }
#if defined _WIN32
_set_output_format(oldOutputFormat);
#endif
return ___2039; } }}
示例9: setSetting
void SettingsManager::setSetting( const char *inSettingName,
const char *inSettingValue ) {
SimpleVector<char *> *settingsVector = new SimpleVector<char *>( 1 );
settingsVector->push_back( (char *)inSettingValue );
setSetting( inSettingName, settingsVector );
delete settingsVector;
}
示例10: testSimpleVectorClone
void testSimpleVectorClone() {
SimpleVector v = createSimpleVector(3);
Vector* c = v.clone();
v.setElement(0, 7);
v.setElement(1, 7);
v.setElement(2, 7);
BOOST_CHECK( c->getElement(0) == 0 );
BOOST_CHECK( c->getElement(1) == 1 );
BOOST_CHECK( c->getElement(2) == 2 );
}
示例11: dumpRhs
void sLinsysRoot::dumpRhs(int proc, const char* nameToken, SimpleVector& rhs)
{
int n = rhs.length();
char szNumber[30];
string strBuffer="";
int iter = g_iterNumber;
if(iter!=0 && iter!=2 && iter!=20 && iter!=25 && iter!=55) return;
char ipmPhase[4];
if(g_iterNumber-iter>0) strcpy(ipmPhase, "co");
else strcpy(ipmPhase, "pr");
char szFilename[256];
sprintf(szFilename, "%s_%s_%d__%d.mat", nameToken,ipmPhase, n, iter);
for(int i=0; i<n; i++) {
sprintf(szNumber, "%22.16f ", rhs[i]);
strBuffer += szNumber;
}
FILE* file = fopen(szFilename, "w");
assert(file);
fwrite(strBuffer.c_str(), 1, strBuffer.length(), file);
fclose(file);
}
示例12: findUnused
bool SolverClass::findUnused(int index, SimpleVector<Rectangle> &hand)
{
Rectangle temp;
int rectCount;
for(rectCount = 0; rectCount < hand.getSize(); rectCount++)
{
hand.getValueAt(rectCount, temp);
if(!temp.isUsed())
{
index = rectCount;
return true;
}
}
return false;
}
示例13: assert
void sLinsys::addTermToSchurResidual(sData* prob,
SimpleVector& res,
SimpleVector& x)
{
assert(gOuterSolve<3 );
SparseGenMatrix& A = prob->getLocalA();
SparseGenMatrix& C = prob->getLocalC();
SparseGenMatrix& R = prob->getLocalCrossHessian();
int nxP, aux;
A.getSize(aux,nxP); assert(aux==locmy);
C.getSize(aux,nxP); assert(aux==locmz);
R.getSize(aux,nxP); assert(aux==locnx);
assert(nxP==x.length());
int N=locnx+locmy+locmz;
SimpleVector y(N);
//y.setToZero();
R.mult( 0.0,&y[0],1, 1.0,&x[0],1);
A.mult( 0.0,&y[locnx],1, 1.0,&x[0],1);
C.mult( 0.0,&y[locnx+locmy],1, 1.0,&x[0],1);
//cout << "4 - y norm:" << y.twonorm() << endl;
//printf("%g %g %g %g\n", y[locnx+locmy+0], y[locnx+locmy+1], y[locnx+locmy+2], y[locnx+locmy+3]);
solver->solve(y);
R.transMult(1.0,&res[0],1, 1.0,&y[0],1);
A.transMult(1.0,&res[0],1, 1.0,&y[locnx],1);
C.transMult(1.0,&res[0],1, 1.0,&y[locnx+locmy],1);
}
示例14: markEmotionsLive
void markEmotionsLive() {
for( int i=0; i<emotions.size(); i++ ) {
Emotion *e = emotions.getElement( i );
if( e->eyeEmot > 0 ) {
addBaseObjectToLiveObjectSet( e->eyeEmot );
}
if( e->mouthEmot > 0 ) {
addBaseObjectToLiveObjectSet( e->mouthEmot );
}
if( e->otherEmot > 0 ) {
addBaseObjectToLiveObjectSet( e->otherEmot );
}
if( e->faceEmot > 0 ) {
addBaseObjectToLiveObjectSet( e->faceEmot );
}
if( e->bodyEmot > 0 ) {
addBaseObjectToLiveObjectSet( e->bodyEmot );
}
if( e->headEmot > 0 ) {
addBaseObjectToLiveObjectSet( e->headEmot );
}
}
}
示例15:
static toolRecord *getToolRecord( int inObjectID ) {
if( getToolInRange( inObjectID ) ) {
return tools.getElement( idToIndexMap[inObjectID] );
}
else {
return tools.getElement( 0 );
}
}