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


C++ Child类代码示例

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


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

示例1: main

int main()
{
  Child child;
  child.MyFunc(1);

  return 0;
}
开发者ID:Halkilor,项目名称:testowe,代码行数:7,代码来源:Overload2.cpp

示例2: GetNetif

void ChildSupervisor::SendMessage(Child &aChild)
{
    ThreadNetif &netif = GetNetif();
    Message *message = NULL;
    otError error = OT_ERROR_NONE;
    uint8_t childIndex;

    VerifyOrExit(aChild.GetIndirectMessageCount() == 0);

    message = netif.GetInstance().mMessagePool.New(Message::kTypeSupervision, sizeof(uint8_t));
    VerifyOrExit(message != NULL);

    // Supervision message is an empty payload 15.4 data frame.
    // The child index is stored here in the message content to allow
    // the destination of the message to be later retrieved using
    // `ChildSupervisor::GetDestination(message)`.

    childIndex = netif.GetMle().GetChildIndex(aChild);
    SuccessOrExit(error = message->Append(&childIndex, sizeof(childIndex)));

    SuccessOrExit(error = netif.SendMessage(*message));
    message = NULL;

    otLogInfoMle(GetInstance(), "Sending supervision message to child 0x%04x", aChild.GetRloc16());

exit:

    if (message != NULL)
    {
        message->Free();
    }
}
开发者ID:NCTU-ivan,项目名称:embarc_osp,代码行数:32,代码来源:child_supervision.cpp

示例3: main

int main() {
	Child child;

	child.out(3);

	return 0;
}
开发者ID:gamepattisiere,项目名称:laboratory,代码行数:7,代码来源:ViratualFunctionArgumentName.cpp

示例4: testVirtual

  void testVirtual() {
    Child x;
    x.m_child = 42;

    // Don't crash when inlining and devirtualizing.
    x.interface();
  }
开发者ID:qiqi6988,项目名称:ioc-clang,代码行数:7,代码来源:inline.cpp

示例5: dynamic_cast_test

int dynamic_cast_test (ACE_DLL &dll)
{
  Child child;
  child.test();

  Parent *parent = &child;

  void * foo = dll.symbol (ACE_TEXT ("dynamic_cast_test"));

  // Cast the void* to long first.
  ptrdiff_t tmp = reinterpret_cast<ptrdiff_t> (foo);
  PFN pfnAcquire = reinterpret_cast<PFN> (tmp);
  if (pfnAcquire == 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%p\n"),
                       dll.error ()),
                      -1);

  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("before %@ %@\n"),
              &child,  dynamic_cast<Child*> (parent)));

  if (pfnAcquire (&child) == -1)
    ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("dynamic_cast failed.\n")), -1);

  return 0;
}
开发者ID:CCJY,项目名称:ACE,代码行数:26,代码来源:DLL_Test.cpp

示例6: VerifyOrExit

void ChildSupervisor::HandleTimer(void)
{
    Child * child;
    uint8_t numChildren;

    VerifyOrExit(mSupervisionInterval != 0);

    child = GetNetif().GetMle().GetChildren(&numChildren);

    for (uint8_t i = 0; i < numChildren; i++, child++)
    {
        if (!child->IsStateValidOrRestoring())
        {
            continue;
        }

        child->IncrementSecondsSinceLastSupervision();

        if ((child->GetSecondsSinceLastSupervision() >= mSupervisionInterval) && (child->IsRxOnWhenIdle() == false))
        {
            SendMessage(*child);
        }
    }

    mTimer.Start(kOneSecond);

exit:
    return;
}
开发者ID:itavero,项目名称:openthread,代码行数:29,代码来源:child_supervision.cpp

示例7: main

int main() {
  int a = 10;
  int* p = new int(1000);
  int& ref = a;

  std::cout << "Values of a p and ref: " << a << " " << *p << " " << ref << "\n";

  // Modify ref, check if a changed.
  ++ref;
  std::cout << "a and ref: " << a << " " << ref << "\n";

  // Implicit subclass to parent class pointer conversion
  Parent* parentP = new Child();
  parentP->print();
  Child* childP = static_cast<Child*>(parentP);
  childP->print();
  Parent* parentP1 = new Parent();
  parentP1->print();

  Child child = Child();
  parentP = &child;
  (*parentP).print();
  parentP = parentP1;
  parentP->print();
  child.print();
  
  return 0;
}
开发者ID:AnthonyChuah,项目名称:CPPscripts,代码行数:28,代码来源:t1.cpp

示例8: main

int main(){
    Child child;
    cout << child.foo() << endl;
    
    int arr[] = {10,20,30,40,50,60};
    int *ptr1 = arr;
    ++*ptr1;
    int *ptr2 = arr+5;
    cout << "--> "<<*ptr1 << endl;
    cout << "--> "<<(char*)ptr2  - (char*)ptr1 << endl;

    f(&i,&j);
    cout << i <<" "<< j << endl;
    test(arr);
    int size= (int)sizeof(arr)/sizeof(arr[0]);
    cout << "Size here: " << sizeof(arr[0]) << endl;
    //x = (char *)a;
    ///cout <<"here " << x << endl;
//    Tiger tiger;
//    Animal animal;
//    animal.print();
//    animal.vPrint();
//    tiger.print();
//    tiger.vPrint();
//    Animal *a = &animal;
//    a->print();
//    a->vPrint();
//    a = &tiger;
//    a->print();
//    a->vPrint();
    return 0;
}
开发者ID:chrisbangun,项目名称:Cplusplus,代码行数:32,代码来源:main.cpp

示例9: test

void test(Data data) {
  Child *wrapper = reinterpret_cast<Child*>(data);
  // Don't crash when upcasting here.
  // We don't actually know if 'data' is a Child.
  wrapper->set();
  clang_analyzer_eval(wrapper->x == 42); // expected-warning{{TRUE}}
}
开发者ID:8l,项目名称:emscripten-fastcomp-clang,代码行数:7,代码来源:reinterpret-cast.cpp

示例10: otPlatRadioAddSrcMatchShortEntry

otError SourceMatchController::AddAddress(const Child &aChild)
{
    otError error = OT_ERROR_NONE;

    if (aChild.IsIndirectSourceMatchShort())
    {
        error = otPlatRadioAddSrcMatchShortEntry(&GetInstance(), aChild.GetRloc16());

        otLogDebgMac(GetInstance(), "SrcAddrMatch - Adding short addr: 0x%04x -- %s (%d)", aChild.GetRloc16(),
                     otThreadErrorToString(error), error);
    }
    else
    {
        otExtAddress addr;

        for (uint8_t i = 0; i < sizeof(addr); i++)
        {
            addr.m8[i] = aChild.GetExtAddress().m8[sizeof(addr) - 1 - i];
        }

        error = otPlatRadioAddSrcMatchExtEntry(&GetInstance(), &addr);

        otLogDebgMac(GetInstance(), "SrcAddrMatch - Adding addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x -- %s (%d)",
                     addr.m8[7], addr.m8[6], addr.m8[5], addr.m8[4], addr.m8[3], addr.m8[2], addr.m8[1], addr.m8[0],
                     otThreadErrorToString(error), error);
    }

    return error;
}
开发者ID:nodish,项目名称:openthread,代码行数:29,代码来源:src_match_controller.cpp

示例11: VerifyOrExit

void ChildSupervisor::SendMessage(Child &aChild)
{
    Message *message = NULL;
    uint8_t  childIndex;

    VerifyOrExit(aChild.GetIndirectMessageCount() == 0);

    message = Get<MessagePool>().New(Message::kTypeSupervision, sizeof(uint8_t));
    VerifyOrExit(message != NULL);

    // Supervision message is an empty payload 15.4 data frame.
    // The child index is stored here in the message content to allow
    // the destination of the message to be later retrieved using
    // `ChildSupervisor::GetDestination(message)`.

    childIndex = Get<ChildTable>().GetChildIndex(aChild);
    SuccessOrExit(message->Append(&childIndex, sizeof(childIndex)));

    SuccessOrExit(Get<ThreadNetif>().SendMessage(*message));
    message = NULL;

    otLogInfoUtil("Sending supervision message to child 0x%04x", aChild.GetRloc16());

exit:

    if (message != NULL)
    {
        message->Free();
    }
}
开发者ID:abtink,项目名称:openthread,代码行数:30,代码来源:child_supervision.cpp

示例12: main

int main() {
  Student  o;
  o.LocalPrintThis();
  o.ForcedPrintThis();
  Child* pX = &o;
  pX->PrintThis();
  return err;
}
开发者ID:Freeaqingme,项目名称:OpenBSD,代码行数:8,代码来源:p5571.C

示例13: printChildren

/*
 * This function prints the names of all the children in the family.
 *
 * @attribute: Child *children - head pointer to linked list of children
 */
void Wife::printChildren()
{
  Child *child = children;
  
  while(child != NULL){
    child->print();
    child = child->getSibling();
  }
}
开发者ID:ipkCoder,项目名称:cs211,代码行数:14,代码来源:Wife.cpp

示例14: setFirstFreeChild

Bool testlist::Child::pushFreeChild(const Child & child)  {
    if( !child.isExists())
        return false;
    child.setNextChildFreeChild(getFirstFreeChild());
    setFirstFreeChild(child);
    setNumFreeChilds(getNumFreeChilds() + 1);
    child.setupFreeChildHandler();
    return true;
}
开发者ID:ivandzen,项目名称:HSDB,代码行数:9,代码来源:testlist.cpp

示例15: AddEntry

void SourceMatchController::IncrementMessageCount(Child &aChild)
{
    if (aChild.GetIndirectMessageCount() == 0)
    {
        AddEntry(aChild);
    }

    aChild.IncrementIndirectMessageCount();
}
开发者ID:nodish,项目名称:openthread,代码行数:9,代码来源:src_match_controller.cpp


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