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


C++ Pool类代码示例

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


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

示例1: Java_org_voltdb_jni_ExecutionEngine_nativeUpdateHashinator

/*
 * Class:     org_voltdb_jni_ExecutionEngine
 * Method:    nativeUpdateHashinator
 * Signature: (JI)I
 */
SHAREDLIB_JNIEXPORT void JNICALL Java_org_voltdb_jni_ExecutionEngine_nativeUpdateHashinator(JNIEnv *env, jobject obj, jlong engine_ptr)
{
    VOLT_DEBUG("nativeUpdateHashinator in C++ called");
    VoltDBEngine *engine = castToEngine(engine_ptr);
    assert(engine);
    Topend *topend = static_cast<JNITopend*>(engine->getTopend())->updateJNIEnv(env);
    try {
        updateJNILogProxy(engine); //JNIEnv pointer can change between calls, must be updated
        NValueArray& params = engine->getParameterContainer();
        Pool *stringPool = engine->getStringPool();
        deserializeParameterSet(engine->getParameterBuffer(), engine->getParameterBufferCapacity(), params, engine->getStringPool());
        HashinatorType hashinatorType = static_cast<HashinatorType>(voltdb::ValuePeeker::peekAsInteger(params[0]));
        const char *configValue = static_cast<const char*>(voltdb::ValuePeeker::peekObjectValue(params[1]));
        engine->updateHashinator(hashinatorType, configValue);
        stringPool->purge();
    } catch (const FatalException &e) {
        topend->crashVoltDB(e);
    }
}
开发者ID:algking,项目名称:voltdb,代码行数:24,代码来源:voltdbjni.cpp

示例2: PostProcess

// Add missing descriptors which are not computed yet, but will be for the
// final release or during the 1.x cycle. However, the schema need to be
// complete before that, so just put default values for these.
// Also make sure that some descriptors that might have fucked up come out nice.
void PostProcess(Pool& pool, const Pool& options, const string& nspace) {
  if (options.value<Real>("rhythm.compute") != 0) {
    string rhythmspace = "rhythm.";
    if (!nspace.empty()) rhythmspace = nspace + ".rhythm.";
    const vector<string>& descNames = pool.descriptorNames();
    if (find(descNames.begin(), descNames.end(), rhythmspace + "bpm_confidence") == descNames.end())
      pool.set(rhythmspace + "bpm_confidence", 0.0);
    if (find(descNames.begin(), descNames.end(), rhythmspace + "perceptual_tempo") == descNames.end())
      pool.set(rhythmspace + "perceptual_tempo", "unknown");
    if (find(descNames.begin(), descNames.end(), rhythmspace + "beats_loudness") == descNames.end())
      pool.add(rhythmspace + "beats_loudness", Real(0.0));
    if (find(descNames.begin(), descNames.end(), rhythmspace + "beats_loudness_band_ratio") == descNames.end())
      pool.add(rhythmspace + "beats_loudness_band_Ratio", vector<Real>());
    //if (find(descNames.begin(), descNames.end(), rhythmspace + "rubato_start") == descNames.end())
    //  pool.set(rhythmspace + "rubato_start", vector<Real>(0));
    //if (find(descNames.begin(), descNames.end(), rhythmspace + "rubato_stop") == descNames.end())
    //  pool.set(rhythmspace + "rubato_stop", vector<Real>(0));
  }
}
开发者ID:AnasGhrab,项目名称:essentia,代码行数:23,代码来源:streaming_extractorpostprocess.cpp

示例3: computeMidLevel

void computeMidLevel(const string& audioFilename, Real startTime, Real endTime, Pool& pool, const Pool& options, const string& nspace) {

  /*************************************************************************
   *    3rd pass: HPCP & beats loudness (depend on some descriptors that   *
   *              have been computed during the 2nd pass)                  *
   *************************************************************************/
  Real replayGain = 0;
  Real analysisSampleRate = options.value<Real>("analysisSampleRate");

  const vector<string>& desc = pool.descriptorNames();
  if (find(desc.begin(), desc.end(), "replayGain") != desc.end()) {
    replayGain = pool.value<Real>("metadata.audio_properties.replay_gain");
  }
  string downmix = "mix";
  try {
    downmix = pool.value<string>("metadata.audio_properties.downmix");
  }
  catch (const EssentiaException&) {
    throw EssentiaException("StreamingExtractor::computeLowLevel, could not determine downmix type");
  }

  streaming::AlgorithmFactory& factory = streaming::AlgorithmFactory::instance();

  Algorithm* audio_3 = factory.create("EqloudLoader",
                                               "filename", audioFilename,
                                               "sampleRate", analysisSampleRate,
                                               "startTime", startTime,
                                               "endTime", endTime,
                                               "replayGain", replayGain,
                                               "downmix", downmix);


  SourceBase& audioSource_2 = audio_3->output("audio");

  // Compute Tonal descriptors (needed TuningFrequency before)
  TonalDescriptors(audioSource_2, pool, options, nspace);


  // Compute the loudness at the beats position (needed beats position)
  string rhythmspace = "rhythm.";
  if (!nspace.empty()) rhythmspace = nspace + ".rhythm.";
  vector<Real> ticks = pool.value<vector<Real> >(rhythmspace + "beats_position");

  Algorithm* beatsLoudness = factory.create("BeatsLoudness",
                                                     "sampleRate", analysisSampleRate,
                                                     "beats", ticks);

  connect(audioSource_2, beatsLoudness->input("signal"));
  connect(beatsLoudness->output("loudness"), pool, rhythmspace + "beats_loudness");
  connect(beatsLoudness->output("loudnessBandRatio"), pool, rhythmspace + "beats_loudness_band_ratio");

  cout << "Process step 3: Mid Level" << endl;
  Network network(audio_3);
  network.run();
}
开发者ID:AnasGhrab,项目名称:essentia,代码行数:55,代码来源:streaming_extractor_short_sounds.cpp

示例4: SVN_JNI_NULL_PTR_EX

void SVNAdmin::deltify(const char *path, Revision &revStart, Revision &revEnd)
{
  Pool requestPool;
  SVN_JNI_NULL_PTR_EX(path, "path", );
  path = svn_path_internal_style(path, requestPool.pool());
  svn_repos_t *repos;
  svn_fs_t *fs;
  svn_revnum_t start = SVN_INVALID_REVNUM, end = SVN_INVALID_REVNUM;
  svn_revnum_t youngest, revision;
  Pool revisionPool;

  SVN_JNI_ERR(svn_repos_open(&repos, path, requestPool.pool()), );
  fs = svn_repos_fs (repos);
  SVN_JNI_ERR(svn_fs_youngest_rev(&youngest, fs, requestPool.pool()), );

  if (revStart.revision()->kind == svn_opt_revision_number)
    /* ### We only handle revision numbers right now, not dates. */
    start = revStart.revision()->value.number;
  else if (revStart.revision()->kind == svn_opt_revision_head)
    start = youngest;
  else
    start = SVN_INVALID_REVNUM;

  if (revEnd.revision()->kind == svn_opt_revision_number)
    end = revEnd.revision()->value.number;
  else if (revEnd.revision()->kind == svn_opt_revision_head)
    end = youngest;
  else
    end = SVN_INVALID_REVNUM;

  /* Fill in implied revisions if necessary. */
  if (start == SVN_INVALID_REVNUM)
    start = youngest;
  if (end == SVN_INVALID_REVNUM)
    end = start;

  if (start > end)
    {
      SVN_JNI_ERR(svn_error_create
                  (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
                   _("First revision cannot be higher than second")), );
    }
开发者ID:matthewdpklanier,项目名称:alien-svn,代码行数:42,代码来源:SVNAdmin.cpp

示例5:

  void
  Path::init(const char * path)
  {
    Pool pool;

    m_pathIsUrl = false;

    if (path == 0)
      m_path = "";
    else
    {
      const char * int_path =
        svn_path_internal_style(path, pool.pool());

      m_path = int_path;

      if (svn::Url::isValid(int_path))
        m_pathIsUrl = true;
    }
  }
开发者ID:Jopie64,项目名称:GitSvn2,代码行数:20,代码来源:path.cpp

示例6: Java_org_voltdb_jni_ExecutionEngine_nativeHashinate

/*
 * Class:     org_voltdb_jni_ExecutionEngine
 * Method:    nativeHashinate
 * Signature: (JI)I
 */
SHAREDLIB_JNIEXPORT jint JNICALL Java_org_voltdb_jni_ExecutionEngine_nativeHashinate(JNIEnv *env, jobject obj, jlong engine_ptr, jint partitionCount)
{
    VOLT_DEBUG("nativeHashinate in C++ called");
    VoltDBEngine *engine = castToEngine(engine_ptr);
    assert(engine);
    try {
        updateJNILogProxy(engine); //JNIEnv pointer can change between calls, must be updated
        NValueArray& params = engine->getParameterContainer();
        Pool *stringPool = engine->getStringPool();
        deserializeParameterSet(engine->getParameterBuffer(), engine->getParameterBufferCapacity(), params, engine->getStringPool());
        int retval =
            voltdb::TheHashinator::hashinate(params[0], partitionCount);
        stringPool->purge();
        return retval;
    } catch (FatalException e) {
        std::cout << "HASHINATE ERROR: " << e.m_reason << std::endl;
        return org_voltdb_jni_ExecutionEngine_ERRORCODE_ERROR;
    }
    return org_voltdb_jni_ExecutionEngine_ERRORCODE_ERROR;
}
开发者ID:DimensionSoftware,项目名称:voltdb,代码行数:25,代码来源:voltdbjni.cpp

示例7: TRACE_POINT

OXT_FORCE_INLINE void
Group::onSessionInitiateFailure(Process *process, Session *session) {
	boost::container::vector<Callback> actions;

	TRACE_POINT();
	// Standard resource management boilerplate stuff...
	Pool *pool = getPool();
	boost::unique_lock<boost::mutex> lock(pool->syncher);
	assert(process->isAlive());
	assert(isAlive() || getLifeStatus() == SHUTTING_DOWN);

	UPDATE_TRACE_POINT();
	P_DEBUG("Could not initiate a session with process " <<
		process->inspect() << ", detaching from pool if possible");
	if (!pool->detachProcessUnlocked(process->shared_from_this(), actions)) {
		P_DEBUG("Process was already detached");
	}
	pool->fullVerifyInvariants();
	lock.unlock();
	runAllActions(actions);
}
开发者ID:godentarek,项目名称:passenger,代码行数:21,代码来源:Implementation.cpp

示例8: typeid

void EntityManager::Dump()
{
	Logger::Info("============================");
	Logger::Info("EntityManager dump");
	Logger::Info("============================");
	Logger::Info("Pools:");
	Logger::Info("============================");
	
	Map<const char *, Pool *>::iterator poolIterator;
	for(poolIterator = pools.begin(); poolIterator != pools.end(); ++poolIterator)
	{
		const char * poolName = poolIterator->first;
		Pool * pool = poolIterator->second;
		Logger::Info("Pool \"%s\" of type %s", poolName, typeid(*pool).name());
		Logger::Info("----------------------------");
		
		while(pool)
		{
			int32 count = pool->GetCount();
			int32 maxCount = pool->GetMaxCount();
			Logger::Info("    subpool of family %lld (%d elements, %d maxCount, %d bytes)", pool->GetEntityFamily()->family.GetBit(), count, maxCount, maxCount*pool->typeSizeof);
			for(int32 i = 0; i < count; ++i)
			{
				pool->DumpElement(i);
			}

			pool = pool->GetNext();
			Logger::Info("    ----------------------------");
		}
	}
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:31,代码来源:EntityManager.cpp

示例9: bytePoolFree

 void bytePoolFree( eBytePool bytePool, u8* data )
 {
     switch( bytePool )
     {
         case eBytePool0:
         {
             break;
         }
         case eBytePool32:
         {
             _bytePool32.Delete( ( Bx32* )data );
             break;
         }
         case eBytePool128:
         {
             _bytePool128.Delete( ( Bx128* )data );
             break;
         }
         case eBytePool512:
         {
             _bytePool512.Delete( ( Bx512* )data );
             break;
         }
         case eBytePool2048:
         {
             _bytePool2048.Delete( ( Bx2048* )data );
             break;
         }
         case eBytePool8192:
         {
             _bytePool8192.Delete( ( Bx8192* )data );
             break;
         }
         case eBytePool16384:
         {
             _bytePool16384.Delete( ( Bx16384* )data );
             break;
         }
         case eBytePool32768:
         {
             _bytePool32768.Delete( ( Bx32768* )data );
             break;
         }
         case eBytePool65534:
         {
             _bytePool65534.Delete( ( Bx65534* )data );
             break;
         }
     }
 }
开发者ID:abirdsall,项目名称:apps,代码行数:50,代码来源:coreArray.cpp

示例10: PostProcess

// Add missing descriptors which are not computed yet, but will be for the
// final release or during the 1.x cycle. However, the schema need to be
// complete before that, so just put default values for these.
// Also make sure that some descriptors that might have fucked up come out nice.
void PostProcess(Pool& pool, const string& nspace) {
  string rhythmspace = "rhythm.";
  if (!nspace.empty()) rhythmspace = nspace + ".rhythm.";
  pool.set(rhythmspace + "bpm_confidence", 0.0);
  pool.set(rhythmspace + "perceptual_tempo", "unknown");

  try {
    pool.value<vector<Real> >(rhythmspace + "beats_loudness");
  }
  catch (EssentiaException&) {
    pool.set(rhythmspace + "beats_loudness", 0.0);
    pool.set(rhythmspace + "beats_loudness_bass", 0.0);
  }

  try {
    pool.value<vector<Real> >(rhythmspace + "rubato_start");
  }
  catch (EssentiaException&) {
    pool.set(rhythmspace + "rubato_start", vector<Real>(0));
  }

  try {
    pool.value<vector<Real> >(rhythmspace + "rubato_stop");
  }
  catch (EssentiaException&) {
    pool.set(rhythmspace + "rubato_stop", vector<Real>(0));
  }

  // PCA analysis of spectral contrast output:
  PCA(pool, nspace);
}
开发者ID:AnasGhrab,项目名称:essentia,代码行数:35,代码来源:streaming_extractorutils.cpp

示例11:

Pool * EntityManager::CreatePool(const char * dataName, int32 maxSize)
{
	Pool * pool = 0;

    Map<const char *, Pool *>::iterator poolsIt = poolAllocators.find(dataName);
    if (poolsIt != poolAllocators.end())
    {
        Pool * newPool = poolsIt->second->CreateCopy(maxSize);

        Pool * prevPool = 0;
        Map<const char *, Pool*>::iterator find = pools.find(dataName);
        if(pools.end() != find)
        {
            prevPool = find->second;
        }
        newPool->SetNext(prevPool);
        pools[dataName] = newPool;
		pool = newPool;
    }
	
	return pool;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:22,代码来源:EntityManager.cpp

示例12: insertTuple

bool StreamedTable::insertTuple(TableTuple &source)
{
    size_t mark = 0;
    if (m_wrapper) {
        mark = m_wrapper->appendTuple(m_executorContext->m_lastCommittedTxnId,
                                      m_executorContext->currentTxnId(),
                                      m_sequenceNo++,
                                      m_executorContext->currentTxnTimestamp(),
                                      source,
                                      TupleStreamWrapper::INSERT);
        m_tupleCount++;
        m_usedTupleCount++;

        UndoQuantum *uq = m_executorContext->getCurrentUndoQuantum();
        Pool *pool = uq->getDataPool();
        StreamedTableUndoAction *ua =
          new (pool->allocate(sizeof(StreamedTableUndoAction)))
          StreamedTableUndoAction(this, mark);
        uq->registerUndoAction(ua);
    }
    return true;
}
开发者ID:Eonblast,项目名称:voltdb,代码行数:22,代码来源:streamedtable.cpp

示例13: PoolFix

Res PoolFix(Pool pool, ScanState ss, Seg seg, Addr *refIO)
{
  AVERT_CRITICAL(Pool, pool);
  AVERT_CRITICAL(ScanState, ss);
  AVERT_CRITICAL(Seg, seg);
  AVER_CRITICAL(pool == SegPool(seg));
  AVER_CRITICAL(refIO != NULL);

  /* Should only be fixing references to white segments. */
  AVER_CRITICAL(TraceSetInter(SegWhite(seg), ss->traces) != TraceSetEMPTY);

  return pool->fix(pool, ss, seg, refIO);
}
开发者ID:bhanug,项目名称:mps,代码行数:13,代码来源:pool.c

示例14: LevelAverage

void LevelAverage(Pool& pool, const string& nspace) {

  // namespace:
  string llspace = "lowlevel.";
  if (!nspace.empty()) llspace = nspace + ".lowlevel.";

  vector<Real> levelArray = pool.value<vector<Real> >(llspace + "loudness");
  pool.remove(llspace + "loudness");

  // Maximum dynamic
  Real EPSILON = 10e-5;
  Real maxValue = levelArray[argmax(levelArray)];
  if (maxValue <= EPSILON) {
    maxValue = EPSILON;
  }

  // Normalization to the maximum
  Real THRESHOLD = 0.0001; // this corresponds to -80dB
  for (uint i=0; i<levelArray.size(); i++) {
    levelArray[i] /= maxValue;
    if (levelArray[i] <= THRESHOLD) {
      levelArray[i] = THRESHOLD;
    }
  }

  // Average Level
  Real levelAverage = 10*log10(mean(levelArray));

  // Re-scaling and range-control
  // This yields in numbers between
  // 0 for signals with  large dynamic variace and thus low dynamic average
  // 1 for signal with little dynamic range and thus
  // a dynamic average close to the maximum
  Real x1 = -5.0;
  Real x2 = -2.0;
  Real levelAverageSqueezed = squeezeRange(levelAverage, x1, x2);
  pool.set(llspace + "average_loudness", levelAverageSqueezed);
}
开发者ID:AnasGhrab,项目名称:essentia,代码行数:38,代码来源:streaming_extractorutils.cpp

示例15: TEST

TEST(move, DISABLED_there_should_be_only_one_owner)
{
    class Resource {
    public:
        Resource(std::string id)
            : id(std::move(id))
        {}

        std::string id;
    };

    class Pool {
    public:
        Pool()
            : resources{ {Resource{"one"}, Resource{"two"}} }
        {}
        size_t size() const {
            return resources.size();
        }
        
        Resource borrow() {
            return Resource{ "?" };
        }
        
        void return_(Resource) {}

        bool contains(const std::string &id) const
        {
            return std::any_of(begin(resources), end(resources),
                [&](const auto &resource) { return resource.id == id; });
        }
    private:
        std::vector<Resource> resources;
    };


    Pool pool;
    auto r1 = pool.borrow();
    EXPECT_EQ("one", r1.id);
    EXPECT_EQ(1u, pool.size());
    EXPECT_FALSE(pool.contains("one"));
    EXPECT_TRUE(pool.contains("two"));

    pool.return_(r1);
    EXPECT_EQ(2u, pool.size());
    EXPECT_TRUE(pool.contains("one")); 
    EXPECT_TRUE(pool.contains("two"));
}
开发者ID:xtofl,项目名称:cpp11training,代码行数:48,代码来源:moveable_objects.cpp


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