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


C++ Method函数代码示例

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


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

示例1: TEST_DEFINE_TEST

TEST_DEFINE_TEST(TestCtx, ObjectTests)
{
    auto t = Module.GetRootObject<test::IObjectTests>("GetTests");
    if (!t)
    {
        TEST_REPORT_ERROR("ObjectTests not implemented!");
        return;
    }

    auto some_obj = t->ReturnNewObject();
    TEST_THROWS_NOTHING(some_obj->Method());

    TEST_EQUALS((bool)t->ReturnNull(), false);
    TEST_EQUALS(t->CheckNotNull(nullptr), false);
    TEST_EQUALS(t->CheckNotNull(some_obj), true);

    TEST_EQUALS((bool)t->CallbackReturn(Ctx.MakeComponent<test::IObjectTestsCallbackReturn, ObjectTestsCallback>(some_obj)), true);
    auto cb = Ctx.MakeComponent<test::IObjectTestsCallbackReturn, ObjectTestsCallback>(nullptr);
    TEST_EQUALS((bool)t->CallbackReturn(cb), false);
    TEST_EQUALS(t->CallbackParam(joint::Cast<test::IObjectTestsCallbackParam>(cb), nullptr), false);
    TEST_EQUALS(t->CallbackParam(joint::Cast<test::IObjectTestsCallbackParam>(cb), some_obj), true);

    auto o_impl = Ctx.MakeComponentWrapper<SomeObject>();
    auto o = Ctx.MakeComponentProxy<test::ISomeObject>(o_impl);

    TEST_THROWS_NOTHING(t->InvokeObjectMethod(o));
    TEST_EQUALS(o_impl->GetInvokationsCount(), 1);

    auto o2 = t->ReturnSameObject(o);
    o2->Method();
    TEST_EQUALS(o_impl->GetInvokationsCount(), 2);
}
开发者ID:koplyarov,项目名称:joint,代码行数:32,代码来源:ObjectTests.hpp

示例2: Info

int LibvlcCamera::PrimeCapture() {
  Info("Priming capture from %s", mPath.c_str());

  StringVector opVect = split(Options(), ",");

  // Set transport method as specified by method field, rtpUni is default
  if ( Method() == "rtpMulti" )
    opVect.push_back("--rtsp-mcast");
  else if ( Method() == "rtpRtsp" )
    opVect.push_back("--rtsp-tcp");
  else if ( Method() == "rtpRtspHttp" )
    opVect.push_back("--rtsp-http");

  opVect.push_back("--no-audio");

  if ( opVect.size() > 0 ) {
    mOptArgV = new char*[opVect.size()];
    Debug(2, "Number of Options: %d",opVect.size());
    for (size_t i=0; i< opVect.size(); i++) {
      opVect[i] = trimSpaces(opVect[i]);
      mOptArgV[i] = (char *)opVect[i].c_str();
      Debug(2, "set option %d to '%s'", i,  opVect[i].c_str());
    }
  }

  mLibvlcInstance = libvlc_new(opVect.size(), (const char* const*)mOptArgV);
  if ( mLibvlcInstance == NULL ) {
    Error("Unable to create libvlc instance due to: %s", libvlc_errmsg());
    return -1;
  }

  mLibvlcMedia = libvlc_media_new_location(mLibvlcInstance, mPath.c_str());
  if ( mLibvlcMedia == NULL ) {
    Error("Unable to open input %s due to: %s", mPath.c_str(), libvlc_errmsg());
    return -1;
  }

  mLibvlcMediaPlayer = libvlc_media_player_new_from_media(mLibvlcMedia);
  if ( mLibvlcMediaPlayer == NULL ) {
    Error("Unable to create player for %s due to: %s", mPath.c_str(), libvlc_errmsg());
    return -1;
  }

  libvlc_video_set_format(mLibvlcMediaPlayer, mTargetChroma.c_str(), width, height, width * mBpp);
  libvlc_video_set_callbacks(mLibvlcMediaPlayer, &LibvlcLockBuffer, &LibvlcUnlockBuffer, NULL, &mLibvlcData);

  mLibvlcData.bufferSize = width * height * mBpp;
  // Libvlc wants 32 byte alignment for images (should in theory do this for all image lines)
  mLibvlcData.buffer = (uint8_t*)zm_mallocaligned(64, mLibvlcData.bufferSize);
  mLibvlcData.prevBuffer = (uint8_t*)zm_mallocaligned(64, mLibvlcData.bufferSize);
  
  mLibvlcData.newImage.setValueImmediate(false);

  libvlc_media_player_play(mLibvlcMediaPlayer);

  return 0;
}
开发者ID:abishai,项目名称:ZoneMinder,代码行数:57,代码来源:zm_libvlc_camera.cpp

示例3: Method

QList<QList<card> > Method::PickOptimalSeqSingles()
{
    QList<QList<QList<card> > > seqRecord;
    QList<QList<card> > seqInherited;
    Method(m_player, m_cards).PickSeqSingles(seqRecord, seqInherited, m_cards);
    if (seqRecord.isEmpty())
    {
        return QList<QList<card> >();
    }

    QMap<int, int> seqMarks;
    for (int i = 0; i < seqRecord.size(); i++)
    {
        QList<card> backupCards = m_cards;
        QList<QList<card> > seqArray = seqRecord[i];
        for(int l=0;l<seqArray.size();l++)
        {
            for(int j=0;j<seqArray[l].size();j++)
            {
                backupCards.removeOne(seqArray[l][j]);
            }
        }

        QList<QList<card> > singleArray = Method(m_player, backupCards).FindCardsByCount(1);

        QList<card> cardList;
        for (int j = 0; j < singleArray.size(); j++)
        {
            for(int i=0;i<singleArray[j].size();i++)
                cardList<<singleArray[j][i];

        }

        int mark = 0;
        for (int j = 0; j < cardList.size(); j++)
        {
            mark += cardList[j].point + 15;
        }
        seqMarks.insert(i, mark);
    }

    int index = 0;
    int compMark = 1000000;
    QMap<int, int>::ConstIterator it = seqMarks.constBegin();
    for (; it != seqMarks.constEnd(); it++)
    {
        if (it.value() < compMark)
        {
            compMark = it.value();
            index = it.key();
        }
    }

    return seqRecord[index];
}
开发者ID:seem-sky,项目名称:doudizhu,代码行数:55,代码来源:method.cpp

示例4: Method

unsigned int Method(int N, int M)
{
	if(N==M) return 1;
	if(M==0) return 1;//if(M==1) return N
	if(matrix[N][M]>0)
	{
		return matrix[N][M];
	}
	matrix[N][M]=Method(N-1, M) + Method(N-1, M-1);
	return matrix[N][M];
}
开发者ID:HaochenLiu,项目名称:OnlineJudge,代码行数:11,代码来源:2234443_AC_0MS_80K.cpp

示例5: establish_root_environment

int establish_root_environment(void) {
    spawn_env(NULL, Primordial_Grid(GC_SKIPREG));
    rootEnvironment=Car(env);
    rootBacros=Grid();
    unknownSymbolError=Err(Cons(String("Unknown symbol"), NULL));
    Set(rootEnvironment, "nil", NULL);
    Set(rootEnvironment, "true", Atom("true"));
    Set(rootEnvironment, "add", Routine(&dirty_sum));
    Set(rootEnvironment, "+", Get(rootEnvironment, "add"));
    Set(rootEnvironment, "subtract", Routine(&dirty_sub));
    Set(rootEnvironment, "-", Get(rootEnvironment, "subtract"));
    Set(rootEnvironment, "if", Method(&funky_if));
    Set(rootEnvironment, "&ver", String("Funky Lisp Draft 3"));
    Set(rootEnvironment, "set!", Routine(&funky_set));
    Set(rootEnvironment, "print_", Routine(&funky_print));
    Set(rootEnvironment, "list", Routine(&funky_list));
    Set(rootEnvironment, "pair", Routine(&funky_pair));
    Set(rootEnvironment, "grid", Routine(&funky_grid));
    Set(rootEnvironment, "get", Routine(&funky_grid_get));
    Set(rootEnvironment, "quote", Method(&funky_quote));
    Set(rootEnvironment, "apply", Routine(&apply));
    Set(rootEnvironment, "mac", Method(&funky_macro));
    Set(rootEnvironment, "def", Method(&funky_def));
    Set(rootEnvironment, "head", Routine(&funky_head));
    Set(rootEnvironment, "rest_", Routine(&funky_rest));
    Set(rootEnvironment, "last", Routine(&funky_last));
    Set(rootEnvironment, "err", Routine(&funky_err));
    Set(rootEnvironment, "dump", Routine(&funky_dump));
    Set(rootEnvironment, "&bacros", rootBacros);
    Set(rootEnvironment, ">", Routine(&funky_greater_than));
    Set(rootEnvironment, "<", Routine(&funky_less_than));
    Set(rootEnvironment, "=", Routine(&funky_equivalent));
    Set(rootEnvironment, "not", Routine(&funky_not_operator));
    Set(rootEnvironment, "eval", Method(&funky_evaluator));
    Set(rootEnvironment, "true?", Routine(&funky_truthy));
    Set(rootEnvironment, "false?", Routine(&funky_nilly));
    Set(rootEnvironment, "lambda?", Routine(&funky_callable));
    Set(rootEnvironment, "atom?", Routine(&funky_is_atom));
    Set(rootEnvironment, "gen?", Routine(&funky_is_gen));
    Set(rootEnvironment, "len", Routine(&funky_length));
    Set(rootEnvironment, "gen", Routine(&funky_gen));
    Set(rootEnvironment, "cons", Routine(&funky_cons));
    Set(rootEnvironment, "append", Routine(&funky_append));
    Set(rootEnvironment, "error?", Routine(&funky_is_error));
    Set(rootEnvironment, "grid?", Routine(&funky_is_grid));
    Set(rootEnvironment, "txt-concatenate_", Routine(&funky_make_txt));
    Set(rootEnvironment, "type", Routine(&funky_type_symbol));
    Set(rootEnvironment, UNKNOWN_HANDLER, Atom(UNKNOWN_LIT));
    establish_bacros(rootBacros);
    return new_env();
}
开发者ID:gregghz,项目名称:funky,代码行数:51,代码来源:funky_env.c

示例6: switch

static thing_th *dup_cell(thing_th *thing) {
    switch(th_kind(thing)) {
        case number_k:
            return Number(sym(thing));
        case string_k:
            return String(sym(thing));
        case atom_k:
            return Atom(sym(thing));
        case cons_k:
            return Cons(Car(thing), Cdr(thing));
        case error_k:
            return Err(Cdr(thing));
        case procedure_k:
            return Proc(Car(thing), Cdr(thing));
        case macro_k:
            return Mac(Car(thing), Cdr(thing));
        case gen_k:
            return Gen(Car(thing), Cdr(thing));
        case routine_k:
            return Routine(call_rt(thing));
        case method_k:
            return Method(call_rt(thing));
        case grid_k:
            return duplicate_grid(thing);
        case null_k:
            return NULL;
    }
}
开发者ID:gregghz,项目名称:funky,代码行数:28,代码来源:funky_data.c

示例7: Trip_File

File_Group::File_Group (void)
{
    Trip_File (NULL);
    Time_File (NULL);
    Trip_Factor (NULL);
    Script_File (NULL);

    Purpose (0);
    Mode (0);
    Method (0);
    Duration (0);
    Type (0);
    SubType (0);
    Org_Wt (0);
    Des_Wt (0);
    Dist_Wt (true);
    Speed (0);
    Time_Field (0);
    Scaling_Factor (1.0);

    period = NULL;
    time_equiv = NULL;
    program = NULL;
    header = NULL;
}
开发者ID:kravitz,项目名称:transims4,代码行数:25,代码来源:File_Group.cpp

示例8: ChunkFinish

void ChunkFinish(Chunk chunk)
{
  Arena arena;

  AVERT(Chunk, chunk);

  AVER(BTIsResRange(chunk->allocTable, 0, chunk->pages));
  arena = ChunkArena(chunk);

  if (arena->hasFreeLand)
    ArenaFreeLandDelete(arena,
                        PageIndexBase(chunk, chunk->allocBase),
                        chunk->limit);

  ArenaChunkRemoved(arena, chunk);

  chunk->sig = SigInvalid;

  TreeFinish(&chunk->chunkTree);
  RingRemove(&chunk->arenaRing);

  /* Finish all other fields before class finish, because they might be */
  /* unmapped there. */
  Method(Arena, arena, chunkFinish)(chunk);
}
开发者ID:clojit,项目名称:rust-mps-obj,代码行数:25,代码来源:tract.c

示例9: PoolAlloc

Res PoolAlloc(Addr *pReturn, Pool pool, Size size)
{
  Res res;

  AVER(pReturn != NULL);
  AVERT(Pool, pool);
  AVER(size > 0);

  res = Method(Pool, pool, alloc)(pReturn, pool, size);
  if (res != ResOK)
    return res;
  /* Make sure that the allocated address was in the pool's memory. */
  /* .hasaddr.critical: The PoolHasAddr check is expensive, and in */
  /* allocation-bound programs this is on the critical path. */
  AVER_CRITICAL(PoolHasAddr(pool, *pReturn));
  /* All allocations should be aligned to the pool's alignment */
  AVER_CRITICAL(AddrIsAligned(*pReturn, pool->alignment));

  /* All PoolAllocs should advance the allocation clock, so we count */
  /* it all in the fillMutatorSize field. */
  ArenaGlobals(PoolArena(pool))->fillMutatorSize += size;

  EVENT3(PoolAlloc, pool, *pReturn, size);

  return ResOK;
}
开发者ID:bhanug,项目名称:mps,代码行数:26,代码来源:pool.c

示例10: Method

Method Wren::method( 
    const std::string& mod,
    const std::string& var,
    const std::string& sig
) {
    return Method( vm_, wrenGetMethod( vm_, mod.c_str(), var.c_str(), sig.c_str() ) );
}
开发者ID:gusa1120,项目名称:wrenly,代码行数:7,代码来源:Wrenly.cpp

示例11: Method

int SuperClass::Method()
{
    Method();
    AbstractVirtualMethod(y);
    int LocalVariable;
    return y;
}
开发者ID:choenig,项目名称:qt-creator,代码行数:7,代码来源:cursor.cpp

示例12: PoolBlacken

void PoolBlacken(Pool pool, TraceSet traceSet, Seg seg)
{
  AVERT(Pool, pool);
  AVERT(TraceSet, traceSet);
  AVERT(Seg, seg);
  AVER(SegPool(seg) == pool);
  Method(Pool, pool, blacken)(pool, traceSet, seg);
}
开发者ID:bhanug,项目名称:mps,代码行数:8,代码来源:pool.c

示例13: Run

 void Run()
 {
     int total = 0;
     for (int i=0; i<1e8; i++)
     {
         total += Method(i);
     }
 }
开发者ID:getshameer,项目名称:Chaste,代码行数:8,代码来源:TestStaticPolymorphism.hpp

示例14: PoolFreeWalk

void PoolFreeWalk(Pool pool, FreeBlockVisitor f, void *p)
{
  AVERT(Pool, pool);
  AVER(FUNCHECK(f));
  /* p is arbitrary, hence can't be checked. */

  Method(Pool, pool, freewalk)(pool, f, p);
}
开发者ID:bhanug,项目名称:mps,代码行数:8,代码来源:pool.c

示例15: PoolTraceEnd

void PoolTraceEnd(Pool pool, Trace trace)
{
  AVERT(Pool, pool);
  AVERT(Trace, trace);
  AVER(pool->arena == trace->arena);

  Method(Pool, pool, traceEnd)(pool, trace);
}
开发者ID:bhanug,项目名称:mps,代码行数:8,代码来源:pool.c


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