本文整理汇总了C++中DataList类的典型用法代码示例。如果您正苦于以下问题:C++ DataList类的具体用法?C++ DataList怎么用?C++ DataList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void
FreezeScript::AssignVisitor::visitSequence(const SequenceDataPtr& dest)
{
Slice::TypePtr type = dest->getType();
SequenceDataPtr src = SequenceDataPtr::dynamicCast(_src);
if(src && isCompatible(type, src->getType()))
{
DataList& srcElements = src->getElements();
DataList destElements;
Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(type);
assert(seqType);
Slice::TypePtr elemType = seqType->type();
string typeName = typeToString(type);
for(DataList::const_iterator p = srcElements.begin(); p != srcElements.end(); ++p)
{
DataPtr element = _factory->create(elemType, false);
Destroyer<DataPtr> elementDestroyer(element);
AssignVisitor v(*p, _factory, _errorReporter, _convert, typeName + " element");
element->visit(v);
destElements.push_back(element);
elementDestroyer.release();
}
DataList& l = dest->getElements();
l.swap(destElements);
}
else
{
typeMismatchError(type, _src->getType());
}
}
示例2: sendSumwz
void ParallelInfo::sendSumwz(const DataList &toSend)
{
int P_Tag = 0;
// P_Info points to the info struct for the neigbor under consideration
ParallelInfo *P_Info;
#if defined(TIMING_MODE)
long long start, elapsed;
start = rdtsc();
#endif
P_Info = &P_Nodes[0];
// send sumwz to the root node
for (unsigned int i = 0; i < toSend.size(); i++)
P_Info->P_sumwz[i] = toSend.at(i);
#if defined(RNG_BUCKET)
P_RandComm->Send(&P_Info->P_sumwz[0], totalNumNrns, MPI_DOUBLE,
P_ROOT_NODE_NUM, P_Tag, MPI_COMM_WORLD);
#else
MPI_Send(&P_Info->P_sumwz[0], totalNumNrns, MPI_DOUBLE, P_ROOT_NODE_NUM,
P_Tag, MPI_COMM_WORLD);
#endif
#if defined(TIMING_MODE)
elapsed = rdtsc() - start;
Output::Out() << MSG << "Elapsed nonroot_snd time = "
<< elapsed * 1.0 / TICKS_PER_SEC << " seconds" << endl;
#endif
}
示例3: rcvNrnWij
DataList ParallelInfo::rcvNrnWij(const UIVector &nrnNodeConn, const int nrn, const UIVector &Shuffle, const UIVector &FanInCon, const DendriticSynapse * const * const inMatrix)
{
int P_Tag = 0;
MPI_Status P_Status;
// the wmatrix data!!! (receive one row of wmatrix)
DataList toReturn;
#if !defined(PARENT_CHLD)
//Root node needs to account for its own data
const unsigned int shuffRow = Shuffle.at(nrn);
const DendriticSynapse * const dendriticTree = inMatrix[shuffRow];
for (unsigned int c = 0; c < FanInCon[shuffRow]; ++c)
toReturn.push_back( dendriticTree[c].getWeight() );
#endif
//Now get data from all other nodes
for (unsigned int nodeNum = 1; nodeNum < P_NumNodes; nodeNum++) {
int NumConPerNode = nrnNodeConn.at(nodeNum);
float *tmp_win = new float[NumConPerNode];
MPI_Recv(&tmp_win[0], NumConPerNode, MPI_FLOAT, nodeNum, P_Tag,
MPI_COMM_WORLD, &P_Status);
for (int i = 0; i < NumConPerNode; i++)
toReturn.push_back(tmp_win[i]);
delete[] tmp_win;
}
return toReturn;
}
示例4: PRDF_TRAC
void ScrDB::Expect(TARGETING::TargetHandle_t i_ptargetHandle,
BitString & bs,
uint64_t registerId)
{
PRDF_TRAC( "ScrDB::Expect() huid: %X, addr: %016X, data: %08X %08X",
getHuid(i_ptargetHandle), registerId,
bs.getFieldJustify(0,32), bs.getFieldJustify(32,32) );
SimScrDataSet eValues;
DataList data;
// parse all data given
data.push_back(bs.getFieldJustify(0,32));
data.push_back(bs.getFieldJustify(32,32));
eValues.AddData(data);
// PRDF_TRAC("get a copy");
PreScrMap scrMap = eChipset[i_ptargetHandle]; // create/get copy of map
// PRDF_TRAC("update register value");
scrMap[registerId] = eValues; // Add entree
// PRDF_TRAC("update the master");
eChipset[i_ptargetHandle] = scrMap; // copy it back
//PRDF_EXIT( "ScrDB::Expect()" );
}
示例5: read_u30_list
static void read_u30_list(DataList<uint32_t>& list, uint32_t val_count, const uint8_t*& pos)
{
list.ensureCapacity(val_count);
while (val_count--)
{
list.add(AvmCore::readU32(pos));
}
}
示例6: ParseFile
DataList ParseFile(QString const& fileName)
{
DataList dataList;
QFileInfo info(fileName);
if (info.exists()) {
try {
// First, check for a QChem input/output file. For input files
// OB returns an empty molecule, for output files the charge and
// multiplicity don't seem to be parsed correctly.
if (fileName.endsWith(".in", Qt::CaseInsensitive) ||
fileName.endsWith(".inp", Qt::CaseInsensitive) ||
fileName.endsWith(".qcin", Qt::CaseInsensitive) ||
fileName.endsWith(".qcinp", Qt::CaseInsensitive) ||
fileName.endsWith(".out", Qt::CaseInsensitive) ||
fileName.endsWith(".qcout", Qt::CaseInsensitive) ) {
QChem qchemParser;
dataList += qchemParser.parseFile(fileName);
}
// Second, check for external charges, which are not recognized by Open
// Babel. Check the ExternalChargesParser.h file for a description of
// the external charges format.
if (dataList.isEmpty()) {
ExternalCharges chargeParser;
dataList += chargeParser.parseFile(fileName);
}
// Now let Open Babel have a crack.
OpenBabel obParser;
dataList += obParser.parseFile(fileName);
// OB will pull the geometry from a FChk file, but not the MO
// information so we must pass this information explicitly.
if (fileName.endsWith(".fchk", Qt::CaseInsensitive)) {
FormattedCheckpoint fchkParser;
dataList += fchkParser.parseFile(fileName);
}
// Finally, if we have found anything we append the file as well.
if (!dataList.isEmpty()) {
Layer::Files* files(new Layer::Files());
files->appendLayer(new Layer::File(fileName));
dataList.append(files);
}
} catch (IOError& ioerr) {
if (Base::s_displayErrors) QMsgBox::warning(0, "IQmol", ioerr.what());
} catch (std::exception& e) {
if (Base::s_displayErrors) QMsgBox::warning(0, "IQmol", e.what());
}
}
return dataList;
}
示例7: Parent
bool Node::IsChildOf(DataList* what) const
{
DataList* current = Parent();
while (current) {
if (current == what)
return true;
current = current->Parent();
}
return false;
}
示例8: while
void Auth2Certificate::AppendDataList( const DataList &theDataList )
{
Auth2Certificate::DataListCIter anIter = theDataList.begin();
while( anIter != theDataList.end() )
{
CertificateDataBlock *aBlock = (*anIter)->Duplicate();
mDataList.push_back( aBlock );
++anIter;
}
}
示例9: convolve
static DataList convolve(const DataList &f1, const DataList &f2,
const float dt = 1.0f) {
const unsigned int f1size = f1.size();
const unsigned int f2size = f2.size();
DataList toReturn = DataList(f1size + f2size - 1, 0);
for (unsigned int i = 0; i < f1size; ++i) {
for (unsigned int j = 0; j < f2size; ++j) {
toReturn[i+j] += f1[i] * f2[j] * dt;
}
}
return toReturn;
}
示例10: assert
void
FreezeScript::TransformVisitor::visitSequence(const SequenceDataPtr& dest)
{
Slice::TypePtr type = dest->getType();
if(_info->doDefaultTransform(type))
{
SequenceDataPtr s = SequenceDataPtr::dynamicCast(_src);
if(s && isCompatible(type, _src->getType()))
{
DataList& srcElements = s->getElements();
DataList destElements;
Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(type);
assert(seqType);
Slice::TypePtr elemType = seqType->type();
string typeName = typeToString(type);
for(DataList::const_iterator p = srcElements.begin(); p != srcElements.end(); ++p)
{
DataPtr element = _info->getDataFactory()->create(elemType, false);
Destroyer<DataPtr> elementDestroyer(element);
try
{
TransformVisitor v(*p, _info, typeName + " element");
element->visit(v);
destElements.push_back(element);
elementDestroyer.release();
}
catch(const ClassNotFoundException& ex)
{
//
// If transformation of the sequence element fails because a class
// could not be found, then we invoke purgeObjects() to determine
// whether we should ignore the situation (and remove the element
// from the sequence) or raise the exception again.
//
if(!_info->purgeObjects())
{
throw;
}
warning("purging element of sequence " + typeToString(type) +
" due to missing class type " + ex.id);
}
}
DataList& l = dest->getElements();
l.swap(destElements);
}
else
{
typeMismatchError(type, _src->getType());
}
}
_info->executeCustomTransform(dest, _src);
}
示例11: getChunk
//=============================================================================
// METHOD: SPELLipcDataChunk::
//=============================================================================
SPELLipcDataChunk::DataList SPELLipcDataChunk::getChunk( const std::string& id, unsigned int num )
{
DataList chunk;
DataMap::iterator it = m_chunks.find(id);
if (it != m_chunks.end())
{
ListOfDataList* chunks = it->second;
if (num<chunks->size())
{
DataList* list = (*chunks)[num];
DataList::iterator lit;
for( lit = list->begin(); lit != list->end(); lit++)
{
chunk.push_back( (*lit) );
}
}
}
return chunk;
}
示例12: fillDataLists
void fillDataLists(const vector<FrameEnhanced> &frames,
DataList& redChannels, DataList& greenChannels, DataList& blueChannels)
{
assert(frames.size() == redChannels.size());
assert(frames.size() == greenChannels.size());
assert(frames.size() == blueChannels.size());
// build temporary data structure
for ( size_t exp = 0; exp < frames.size(); ++exp )
{
Channel* red;
Channel* green;
Channel* blue;
frames[exp].frame()->getXYZChannels(red, green, blue);
redChannels[exp] = red->data();
greenChannels[exp] = green->data();
blueChannels[exp] = blue->data();
}
}
示例13: Read
void ScrDB::Read(TARGETING::TargetHandle_t i_ptargetHandle,
BitString & bs,
uint64_t registerId)
{
//PRDF_DENTER( "ScrDB::Read() huid: 0x%X, addr: 0x%016X",
// getHuid(i_ptargetHandle), registerId );
DataList data;
unsigned int dataWordSize = bs.getBitLen()/32;
dataWordSize += (bs.getBitLen() % 32) ? 1 : 0;
// if the register has a predetermined value than get it
if(pChipset.find(i_ptargetHandle) != pChipset.end())
{
PreScrMap pscrmap = pChipset[i_ptargetHandle];
if(pscrmap.find(registerId) != pscrmap.end()) // we must have a predetermined value
{
SimScrDataSet pValues = pscrmap[registerId];
data = pValues.GetData(); // get next set of values
// pValues has changed - copy it back
pscrmap[registerId] = pValues;
pChipset[i_ptargetHandle] = pscrmap;
}
}
if(data.size() == 0) // use the last value written to this reg
{
// get a copy of the scrMap for this chip - if one does not exist it will be created
ScrMap scrMap = chipset[i_ptargetHandle];
// get a copy of the data for this address from the scrMap for this chip
// if data structure does not exist, it will be created, but will be empty
data = scrMap[registerId];
if(data.size() == 0) // This is the first time this register has been accessed
{
while(data.size() < dataWordSize) data.push_back(0); // zero fill
scrMap[registerId] = data;
chipset[i_ptargetHandle] = scrMap; // update the persistent copy of the scrMap
}
}
if(0 != data.size())
{
for(unsigned int i = 0; i < data.size(); ++i)
{
bs.setFieldJustify((i*32), 32, data[i]);
}
PRDF_TRAC( "ScrDB::Read() huid: %X, addr: %016X, data: %08X %08X",
getHuid(i_ptargetHandle), registerId, data[0],
2 == data.size() ? data[1] : 0 );
}
//PRDF_DEXIT( "ScrDB::Read()" );
}
示例14: m
//=============================================================================
// METHOD: SPELLipcDataChunk::
//=============================================================================
int SPELLipcDataChunk::startChunks( const std::string& id, const DataList& data )
{
SPELLmonitor m(m_lock);
if (data.size()<=m_chunkSize) return 0;
ListOfDataList* chunks = new ListOfDataList();
DataList::const_iterator it;
DataList::const_iterator end = data.end();
unsigned int lineCount = 0;
DataList* chunk = new DataList();
for( it = data.begin(); it != end; it++)
{
chunk->push_back( (*it) );
lineCount++;
if (lineCount==m_chunkSize)
{
chunks->push_back( chunk );
chunk = new DataList();
lineCount = 0;
}
}
// Add the last partial chunk if any
if (chunk->size()>0)
{
chunks->push_back( chunk );
}
m_chunks[id] = chunks;
int totalChunks = chunks->size();
return totalChunks;
}
示例15: Base
Combo::Combo(Layer::Molecule* molecule, DataList const& frames, int const interpolationFrames,
double const speed) : Base(1.0, speed, Ramp), m_molecule(molecule), m_frames(frames),
m_bounce(false), m_loop(false), m_interpolationFrames(interpolationFrames),
m_currentIndex(-1)
{
m_referenceFrames = 1 + (frames.size()-1)/(m_interpolationFrames+1);
int nCycles(m_bounce ? 2*m_referenceFrames-1 : m_referenceFrames-1);
setCycles(nCycles);
DataList::iterator iter;
for (iter = m_frames.begin(); iter != m_frames.end(); ++iter) {
(*iter)->m_surface->setCheckState(Qt::Unchecked);
}
setCurrentIndex(0);
}