MCPcopy Create free account
hub / github.com/apache/trafficserver / create

Function create

include/tscore/Extendible.h:643–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641// allocate and initialize an extendible data structure
642template <typename Derived_t, typename... Args>
643Derived_t *
644create(Args &&...args)
645{
646 // don't instantiate until all Fields are finalized.
647 ink_assert(ext::details::areFieldsFinalized());
648
649 // calculate the memory needed for the class and all Extendible blocks
650 const size_t type_size = ext::sizeOf<Derived_t>();
651
652 // alloc one block of memory
653 Derived_t *ptr = static_cast<Derived_t *>(ats_memalign(alignof(Derived_t), type_size));
654
655 // construct (recursively super-to-sub class)
656 new (ptr) Derived_t(std::forward(args)...);
657
658 // define extendible blocks start offsets (recursively super-to-sub class)
659 details::initRecurseSuper(*ptr, uintptr_t(ptr) + sizeof(Derived_t));
660 return ptr;
661}
662
663/////////////////////////
664// ExtDebugFormat - print a ascii chart of memory layout of a class

Callers 15

testRunStartingMethod · 0.85
testRunStartingMethod · 0.85
testRunStartingMethod · 0.85
testRunStartingMethod · 0.85
recvfrom_reMethod · 0.85
sendmsg_reMethod · 0.85
udp_echo_serverFunction · 0.85
testRunStartingMethod · 0.85
testRunStartingMethod · 0.85
testRunStartingMethod · 0.85
mainFunction · 0.85
testRunStartingMethod · 0.85

Calls 3

ats_memalignFunction · 0.85
forwardFunction · 0.85
initRecurseSuperFunction · 0.85

Tested by 15

testRunStartingMethod · 0.68
testRunStartingMethod · 0.68
udp_echo_serverFunction · 0.68
testRunStartingMethod · 0.68
testRunStartingMethod · 0.68
testRunStartingMethod · 0.68
mainFunction · 0.68
testRunStartingMethod · 0.68
testFunction · 0.68
testRunStartingMethod · 0.68
testRunStartingMethod · 0.68
testRunStartingMethod · 0.68