本文整理汇总了C++中Child类的典型用法代码示例。如果您正苦于以下问题:C++ Child类的具体用法?C++ Child怎么用?C++ Child使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Child类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Child child;
child.MyFunc(1);
return 0;
}
示例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();
}
}
示例3: main
int main() {
Child child;
child.out(3);
return 0;
}
示例4: testVirtual
void testVirtual() {
Child x;
x.m_child = 42;
// Don't crash when inlining and devirtualizing.
x.interface();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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}}
}
示例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;
}
示例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();
}
}
示例12: main
int main() {
Student o;
o.LocalPrintThis();
o.ForcedPrintThis();
Child* pX = &o;
pX->PrintThis();
return err;
}
示例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();
}
}
示例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;
}
示例15: AddEntry
void SourceMatchController::IncrementMessageCount(Child &aChild)
{
if (aChild.GetIndirectMessageCount() == 0)
{
AddEntry(aChild);
}
aChild.IncrementIndirectMessageCount();
}