本文整理汇总了C++中clone函数的典型用法代码示例。如果您正苦于以下问题:C++ clone函数的具体用法?C++ clone怎么用?C++ clone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clone函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: clone
void IMUMessage::clone(const IMUMessage& x) {
clone(*(x.m_msg));
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:3,代码来源:cpp_imu.cpp
示例2: main
int main(int argc, char **argv)
{
char *path_info, *cp, *username, *filename, *extra, *program;
struct passwd *pw;
openlog("safeperl", LOG_PID, LOG_USER);
/*
* The format of an URL passed to us should be
* .../cgi-bin/safeperl/username/filename/...
* The file we then look for is ~username/cgi/bin/filename
* (unless CGI_PREFIX has been defined as something else).
* Since this program is safeperl, the stuff from /username
* onwards gets passed to us in PATH_INFO.
*/
path_info = getenv("PATH_INFO");
if (!path_info)
die("PATH_INFO not set");
if (path_info[0] != '/')
die(usage);
/* Parse the username */
username = path_info + 1;
cp = strchr(username, '/');
if (!cp)
die(usage);
username = unescape(clone(username, cp - username));
/* Parse the filename */
filename = cp + 1;
cp = strchr(filename, '/');
if (!cp)
{
filename = unescape(clone(filename, strlen(filename)));
extra = env_info;
}
else
{
filename = unescape(clone(filename, cp - filename));
/* Parse the remaining stuff */
extra = clone(env_info, strlen(env_info) + strlen(cp + 1));
strcat(extra, cp + 1); /* guaranteed room */
}
if (strchr(filename, '/'))
die("safeperl filename may not have escaped slashes embedded");
/* Put the altered PATH_INFO into the environment */
if (putenv(extra))
die("Failed to alter PATH_INFO in environment");
/* Get and check the username requested */
pw = getpwnam(username);
if (!pw || pw->pw_uid < MIN_USER_UID || pw->pw_uid > MAX_USER_UID)
die("No such username");
/* Make room for string /homedirectory/public_html/cgi-bin/filename */
program = clone(pw->pw_dir,
strlen(pw->pw_dir) + strlen(CGI_PREFIX)+ strlen(filename));
strcat(program, CGI_PREFIX); /* guaranteed room */
strcat(program, filename); /* guaranteed room */
syslog(LOG_INFO, "Running cgiperl %s as user %s", program, pw->pw_name);
closelog();
/* Now become the user */
if (setgid(pw->pw_gid) < 0)
die("setgid failed");
if (initgroups(pw->pw_name, pw->pw_gid))
die("initgroups failed");
if (setuid(pw->pw_uid) < 0)
die("setuid failed");
if (chdir(pw->pw_dir) < 0)
die("failed to chdir to home directory");
/* Ensure low resource limits */
limit(RLIMIT_CPU, CPU_LIMIT);
limit(RLIMIT_DATA, DATA_LIMIT);
limit(RLIMIT_CORE, CORE_LIMIT);
limit(RLIMIT_RSS, RSS_LIMIT);
(void) setpriority(PRIO_PROCESS, 0, CGI_NICE);
/*
* Off we go. We do not make any attempt to close file
* descriptors or do similar clean-up stuff. Looking after
* that is the responsibility of cgiperl.
*/
execl(CGIPERL_PATH, CGIPERL_PATH, program, (char *) 0);
die("Failed to execl cgiperl");
/* NOTREACHED */
}
开发者ID:gitpan,项目名称:safecgiperl,代码行数:91,代码来源:safeperl.c
示例3: processEvent
//.........这里部分代码省略.........
} else {
throw std::runtime_error("Collection 'mcparticles' should be present");
}
//std::cout << "Fetching collection 'refs'" << std::endl;
auto& refs = store.get<ExampleReferencingTypeCollection>("refs");
if(refs.isValid()){
auto ref = refs[0];
for (auto j = ref.Clusters_begin(), end = ref.Clusters_end(); j!=end; ++j){
for (auto i = j->Hits_begin(), end = j->Hits_end(); i!=end; ++i){
//std::cout << " Referenced object has an energy of " << i->energy() << std::endl;
glob++;
}
}
} else {
throw std::runtime_error("Collection 'refs' should be present");
}
//std::cout << "Fetching collection 'OneRelation'" << std::endl;
auto& rels = store.get<ExampleWithOneRelationCollection>("OneRelation");
if(rels.isValid()) {
//std::cout << "Referenced object has an energy of " << (*rels)[0].cluster().energy() << std::endl;
glob++;
} else {
throw std::runtime_error("Collection 'OneRelation' should be present");
}
// std::cout << "Fetching collection 'WithVectorMember'" << std::endl;
auto& vecs = store.get<ExampleWithVectorMemberCollection>("WithVectorMember");
if(vecs.isValid()) {
std::cout << vecs.size() << std::endl;
for( auto item : vecs )
for (auto c = item.count_begin(), end = item.count_end(); c!=end; ++c){
std::cout << " Counter value " << (*c) << std::endl;
glob++;
}
} else {
throw std::runtime_error("Collection 'WithVectorMember' should be present");
}
auto& comps = store.get<ExampleWithComponentCollection>("Component");
if (comps.isValid()) {
auto comp = comps[0];
int a = comp.component().data.x + comp.component().data.z;
}
auto& arrays = store.get<ExampleWithArrayCollection>("arrays");
if (arrays.isValid() && arrays.size() != 0) {
auto array = arrays[0];
if (array.myArray(1) != eventNum) {
throw std::runtime_error("Array not properly set.");
}
if (array.arrayStruct().data.p.at(2) != 2*eventNum) {
throw std::runtime_error("Array not properly set.");
}
if (array.structArray(0).x != eventNum) {
throw std::runtime_error("Array of struct not properly set.");
}
} else {
throw std::runtime_error("Collection 'arrays' should be present");
}
auto& nmspaces = store.get<ex::ExampleWithARelationCollection>("WithNamespaceRelation");
auto& copies = store.get<ex::ExampleWithARelationCollection>("WithNamespaceRelationCopy");
auto& cpytest = store.create<ex::ExampleWithARelationCollection>("TestConstCopy");
if (nmspaces.isValid() && copies.isValid()) {
for (int j = 0; j < nmspaces.size(); j++) {
auto nmsp = nmspaces[j];
auto cpy = copies[j];
cpytest.push_back(nmsp.clone());
if (nmsp.ref().isAvailable()) {
if (nmsp.ref().data().x != cpy.ref().data().x || nmsp.ref().data().y != cpy.ref().data().y) {
throw std::runtime_error("Copied item has differing data in OneToOne referenced item.");
}
// check direct accessors of POD sub members
if (nmsp.ref().x() != cpy.ref().x()) {
throw std::runtime_error("Getting wrong values when using direct accessors for sub members.");
}
if (nmsp.number() != cpy.number()) {
throw std::runtime_error("Copied item has differing member.");
}
if (!(nmsp.ref().getObjectID() == cpy.ref().getObjectID())) {
throw std::runtime_error("Copied item has wrong OneToOne references.");
}
}
auto cpy_it = cpy.refs_begin();
for (auto it = nmsp.refs_begin(); it != nmsp.refs_end(); ++it, ++cpy_it) {
if (it->data().x != cpy_it->data().x || it->data().y != cpy_it->data().y) {
throw std::runtime_error("Copied item has differing data in OneToMany referenced item.");
}
if (!(it->getObjectID() == cpy_it->getObjectID())) {
throw std::runtime_error("Copied item has wrong OneToMany references.");
}
}
}
} else {
throw std::runtime_error("Collection 'WithNamespaceRelation' and 'WithNamespaceRelationCopy' should be present");
}
}
开发者ID:hegner,项目名称:podio,代码行数:101,代码来源:read-one.cpp
示例4: pthread_create
int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
void* (*start_routine)(void*), void* arg) {
ErrnoRestorer errno_restorer;
// Inform the rest of the C library that at least one thread was created.
__isthreaded = 1;
pthread_internal_t* thread = __create_thread_struct();
if (thread == NULL) {
return EAGAIN;
}
if (attr == NULL) {
pthread_attr_init(&thread->attr);
} else {
thread->attr = *attr;
attr = NULL; // Prevent misuse below.
}
// Make sure the stack size and guard size are multiples of PAGE_SIZE.
thread->attr.stack_size = BIONIC_ALIGN(thread->attr.stack_size, PAGE_SIZE);
thread->attr.guard_size = BIONIC_ALIGN(thread->attr.guard_size, PAGE_SIZE);
if (thread->attr.stack_base == NULL) {
// The caller didn't provide a stack, so allocate one.
thread->attr.stack_base = __create_thread_stack(thread);
if (thread->attr.stack_base == NULL) {
__free_thread_struct(thread);
return EAGAIN;
}
} else {
// The caller did provide a stack, so remember we're not supposed to free it.
thread->attr.flags |= PTHREAD_ATTR_FLAG_USER_ALLOCATED_STACK;
}
// Make room for the TLS area.
// The child stack is the same address, just growing in the opposite direction.
// At offsets >= 0, we have the TLS slots.
// At offsets < 0, we have the child stack.
thread->tls = reinterpret_cast<void**>(reinterpret_cast<uint8_t*>(thread->attr.stack_base) +
thread->attr.stack_size - BIONIC_ALIGN(BIONIC_TLS_SLOTS * sizeof(void*), 16));
void* child_stack = thread->tls;
__init_tls(thread);
// Create a mutex for the thread in TLS to wait on once it starts so we can keep
// it from doing anything until after we notify the debugger about it
//
// This also provides the memory barrier we need to ensure that all
// memory accesses previously performed by this thread are visible to
// the new thread.
pthread_mutex_init(&thread->startup_handshake_mutex, NULL);
pthread_mutex_lock(&thread->startup_handshake_mutex);
thread->start_routine = start_routine;
thread->start_routine_arg = arg;
thread->set_cached_pid(getpid());
int flags = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID;
void* tls = thread->tls;
#if defined(__i386__)
// On x86 (but not x86-64), CLONE_SETTLS takes a pointer to a struct user_desc rather than
// a pointer to the TLS itself.
user_desc tls_descriptor;
__init_user_desc(&tls_descriptor, false, tls);
tls = &tls_descriptor;
#endif
int rc = clone(__pthread_start, child_stack, flags, thread, &(thread->tid), tls, &(thread->tid));
if (rc == -1) {
int clone_errno = errno;
// We don't have to unlock the mutex at all because clone(2) failed so there's no child waiting to
// be unblocked, but we're about to unmap the memory the mutex is stored in, so this serves as a
// reminder that you can't rewrite this function to use a ScopedPthreadMutexLocker.
pthread_mutex_unlock(&thread->startup_handshake_mutex);
if (!thread->user_allocated_stack()) {
munmap(thread->attr.stack_base, thread->attr.stack_size);
}
__free_thread_struct(thread);
__libc_format_log(ANDROID_LOG_WARN, "libc", "pthread_create failed: clone failed: %s", strerror(errno));
return clone_errno;
}
int init_errno = __init_thread(thread, true);
if (init_errno != 0) {
// Mark the thread detached and replace its start_routine with a no-op.
// Letting the thread run is the easiest way to clean up its resources.
thread->attr.flags |= PTHREAD_ATTR_FLAG_DETACHED;
thread->start_routine = __do_nothing;
pthread_mutex_unlock(&thread->startup_handshake_mutex);
return init_errno;
}
// Publish the pthread_t and unlock the mutex to let the new thread start running.
*thread_out = reinterpret_cast<pthread_t>(thread);
pthread_mutex_unlock(&thread->startup_handshake_mutex);
return 0;
}
开发者ID:ijie,项目名称:platform_bionic,代码行数:99,代码来源:pthread_create.cpp
示例5: __local_spawn_cb
static ct_process_t __local_spawn_cb(ct_handler_t h, ct_process_desc_t ph, int (*cb)(void *), void *arg, bool is_exec)
{
struct container *ct = cth2ct(h);
struct process_desc *p = prh2pr(ph);
int ret = -1, pid, aux;
struct ct_clone_arg ca;
if (ct->state != CT_STOPPED)
return ERR_PTR(-LCTERR_BADCTSTATE);
ret = fs_mount(ct);
if (ret)
return ERR_PTR(ret);
if ((ct->flags & CT_KILLABLE) && !(ct->nsmask & CLONE_NEWPID)) {
if (add_service_controller(ct))
goto err_cg;
}
ret = cgroups_create(ct);
if (ret)
goto err_cg;
ret = -1;
if (pipe(ca.child_wait_pipe))
goto err_pipe;
if (pipe(ca.parent_wait_pipe))
goto err_pipe2;
ca.cb = cb;
ca.arg = arg;
ca.ct = ct;
ca.p = p;
ca.is_exec = is_exec;
pid = clone(ct_clone, &ca.stack_ptr, ct->nsmask | SIGCHLD, &ca);
if (pid < 0)
goto err_clone;
ct->p.pid = pid;
close(ca.child_wait_pipe[0]);
close(ca.parent_wait_pipe[1]);
if (ct->nsmask & CLONE_NEWUSER) {
if (write_id_mappings(pid, &ct->uid_map, "uid_map"))
goto err_net;
if (write_id_mappings(pid, &ct->gid_map, "gid_map"))
goto err_net;
}
if (net_start(ct))
goto err_net;
spawn_wake_and_close(ca.child_wait_pipe, 0);
aux = spawn_wait(ca.parent_wait_pipe);
if (aux != 0) {
ret = aux;
goto err_ch;
}
aux = spawn_wait_and_close(ca.parent_wait_pipe);
if (aux != INT_MIN) {
ret = -1;
goto err_ch;
}
ct->state = CT_RUNNING;
return &ct->p.h;
err_ch:
net_stop(ct);
err_net:
spawn_wake_and_close(ca.child_wait_pipe, -1);
libct_process_wait(&ct->p.h, NULL);
err_clone:
close(ca.parent_wait_pipe[0]);
close(ca.parent_wait_pipe[1]);
err_pipe2:
close(ca.child_wait_pipe[0]);
close(ca.child_wait_pipe[1]);
err_pipe:
cgroups_destroy(ct);
err_cg:
fs_umount(ct);
return ERR_PTR(ret);
}
开发者ID:mkatkar,项目名称:libct,代码行数:88,代码来源:ct.c
示例6: Rect
//.........这里部分代码省略.........
spriteIntroImg->runAction(FadeIn::create(0.2));
spriteIntroText->runAction(FadeIn::create(0.2));
}
else
{
if(target == spriteButtonStory)
{
spriteButtonIntroP->runAction(FadeOut::create(0.2));
spriteIntroImg->runAction(FadeOut::create(0.2));
spriteIntroText->runAction(FadeOut::create(0.2));
}
}
/*
if (target == spriteButtonBg)
{
spriteButtonBgP->runAction(FadeIn::create(0.2));
}
else
{
spriteButtonBgP->runAction(FadeOut::create(0.2));
}*/
if (target == spriteButtonStory)
{
spriteButtonStoryP->runAction(FadeIn::create(0.2));
spriteStoryImg->runAction(FadeIn::create(0.2));
spriteStoryText->runAction(FadeIn::create(0.2));
}
else
{
if(target == spriteButtonIntro)
{
spriteButtonStoryP->runAction(FadeOut::create(0.2));
spriteStoryImg->runAction(FadeOut::create(0.2));
spriteStoryText->runAction(FadeOut::create(0.2));
}
}
return true;
}
return false;
};
// 当移动触控的时候
listener->onTouchMoved = [=](Touch* touch, Event* event)
{
auto target = static_cast<Sprite*>(event->getCurrentTarget());
auto delta = touch->getDelta();
delta.x=0;
log("x=%f,y=%f",target->getPositionX(),target->getPositionY());
auto tmp = target->getPositionY()+delta.y;
if (target == spriteStoryText)
{
if(tmp<1150 && tmp > 439)
{
//target->runAction(MoveTo::create(0,Vec2(tmp,768)));
target->setPositionY(tmp);
}
}
};
// 结束
listener->onTouchEnded = [=](Touch* touch, Event* event)
{
auto target = static_cast<Sprite*>(event->getCurrentTarget());
log("sprite onTouchesEnded.. ");
//target->setOpacity(255);
if (target == spriteBackButton)
{
Director::getInstance()->popScene();
CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("se//back.mp3");
}
};
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener->clone(), spriteBackButton);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, spriteButtonIntro);
//_eventDispatcher->addEventListenerWithSceneGraphPriority(listener->clone(), spriteButtonBg);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener->clone(), spriteButtonStory);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener->clone(), spriteStoryText);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener->clone(), spriteIntroText);
return true;
}
开发者ID:Eidosper,项目名称:shiku,代码行数:101,代码来源:ShikudetailScene.cpp
示例7: clone
/*--------------------------------------------*/
void Effect_Class::initEditMode()
{
clone();
}
开发者ID:stevenlitt,项目名称:fu2_baby,代码行数:5,代码来源:Effect_Class.cpp
示例8: opacity
StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInheritedData& o)
: RefCounted<StyleRareNonInheritedData>()
, opacity(o.opacity)
, m_aspectRatioDenominator(o.m_aspectRatioDenominator)
, m_aspectRatioNumerator(o.m_aspectRatioNumerator)
, m_perspective(o.m_perspective)
, m_perspectiveOriginX(o.m_perspectiveOriginX)
, m_perspectiveOriginY(o.m_perspectiveOriginY)
, lineClamp(o.lineClamp)
, m_draggableRegionMode(o.m_draggableRegionMode)
, m_deprecatedFlexibleBox(o.m_deprecatedFlexibleBox)
, m_flexibleBox(o.m_flexibleBox)
, m_marquee(o.m_marquee)
, m_multiCol(o.m_multiCol)
, m_transform(o.m_transform)
, m_willChange(o.m_willChange)
, m_filter(o.m_filter)
, m_grid(o.m_grid)
, m_gridItem(o.m_gridItem)
, m_content(o.m_content ? o.m_content->clone() : nullptr)
, m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
, m_boxShadow(o.m_boxShadow)
, m_boxReflect(o.m_boxReflect)
, m_animations(o.m_animations ? CSSAnimationData::create(*o.m_animations) : nullptr)
, m_transitions(o.m_transitions ? CSSTransitionData::create(*o.m_transitions) : nullptr)
, m_mask(o.m_mask)
, m_maskBoxImage(o.m_maskBoxImage)
, m_pageSize(o.m_pageSize)
, m_shapeOutside(o.m_shapeOutside)
, m_shapeMargin(o.m_shapeMargin)
, m_shapeImageThreshold(o.m_shapeImageThreshold)
, m_clipPath(o.m_clipPath)
, m_textDecorationColor(o.m_textDecorationColor)
, m_visitedLinkTextDecorationColor(o.m_visitedLinkTextDecorationColor)
, m_visitedLinkBackgroundColor(o.m_visitedLinkBackgroundColor)
, m_visitedLinkOutlineColor(o.m_visitedLinkOutlineColor)
, m_visitedLinkBorderLeftColor(o.m_visitedLinkBorderLeftColor)
, m_visitedLinkBorderRightColor(o.m_visitedLinkBorderRightColor)
, m_visitedLinkBorderTopColor(o.m_visitedLinkBorderTopColor)
, m_visitedLinkBorderBottomColor(o.m_visitedLinkBorderBottomColor)
, m_order(o.m_order)
, m_objectPosition(o.m_objectPosition)
, m_pageSizeType(o.m_pageSizeType)
, m_transformStyle3D(o.m_transformStyle3D)
, m_backfaceVisibility(o.m_backfaceVisibility)
, m_alignContent(o.m_alignContent)
, m_alignItems(o.m_alignItems)
, m_alignItemsOverflowAlignment(o.m_alignItemsOverflowAlignment)
, m_alignSelf(o.m_alignSelf)
, m_alignSelfOverflowAlignment(o.m_alignSelfOverflowAlignment)
, m_justifyContent(o.m_justifyContent)
, userDrag(o.userDrag)
, textOverflow(o.textOverflow)
, marginBeforeCollapse(o.marginBeforeCollapse)
, marginAfterCollapse(o.marginAfterCollapse)
, m_appearance(o.m_appearance)
, m_borderFit(o.m_borderFit)
, m_textCombine(o.m_textCombine)
, m_textDecorationStyle(o.m_textDecorationStyle)
, m_wrapFlow(o.m_wrapFlow)
, m_wrapThrough(o.m_wrapThrough)
, m_hasCurrentOpacityAnimation(o.m_hasCurrentOpacityAnimation)
, m_hasCurrentTransformAnimation(o.m_hasCurrentTransformAnimation)
, m_hasCurrentFilterAnimation(o.m_hasCurrentFilterAnimation)
, m_runningOpacityAnimationOnCompositor(o.m_runningOpacityAnimationOnCompositor)
, m_runningTransformAnimationOnCompositor(o.m_runningTransformAnimationOnCompositor)
, m_runningFilterAnimationOnCompositor(o.m_runningFilterAnimationOnCompositor)
, m_hasAspectRatio(o.m_hasAspectRatio)
, m_effectiveBlendMode(o.m_effectiveBlendMode)
, m_touchAction(o.m_touchAction)
, m_objectFit(o.m_objectFit)
, m_isolation(o.m_isolation)
, m_justifyItems(o.m_justifyItems)
, m_justifyItemsOverflowAlignment(o.m_justifyItemsOverflowAlignment)
, m_justifyItemsPositionType(o.m_justifyItemsPositionType)
, m_justifySelf(o.m_justifySelf)
, m_justifySelfOverflowAlignment(o.m_justifySelfOverflowAlignment)
, m_scrollBehavior(o.m_scrollBehavior)
, m_requiresAcceleratedCompositingForExternalReasons(o.m_requiresAcceleratedCompositingForExternalReasons)
, m_hasInlineTransform(o.m_hasInlineTransform)
{
}
开发者ID:smil-in-javascript,项目名称:blink,代码行数:82,代码来源:StyleRareNonInheritedData.cpp
示例9:
CStalkerAnimationState::CStalkerAnimationState (const CStalkerAnimationState &stalker_animation_state)
{
clone (stalker_animation_state.m_in_place,m_in_place);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:4,代码来源:stalker_animation_state.cpp
示例10: stl_sort
Rcpp::IntegerVector stl_sort(Rcpp::IntegerVector x) {
//http://gallery.rcpp.org/articles/sorting/
Rcpp::IntegerVector y = clone(x);
std::sort(y.begin(), y.end());
return y;
}
开发者ID:justinpenz,项目名称:mrgsolve,代码行数:6,代码来源:mrgsolve.cpp
示例11: trie
trie(const trie &rhs) : charset_size{rhs.charset_size}, start_char{rhs.start_char}
{
root = clone(rhs.root);
}
开发者ID:sevengram,项目名称:adsl,代码行数:4,代码来源:trie.hpp
示例12: clone
/**
* Clones the tile stamp. Changes made to the clone do not affect the original
* stamp.
*/
TileStamp TileStamp::clone() const
{
TileStamp clone(*this);
clone.d.detach();
return clone;
}
开发者ID:Shorttail,项目名称:tiled,代码行数:10,代码来源:tilestamp.cpp
示例13: AbstractMessage
IMUMessage::IMUMessage(const IMUMessage& x)
: AbstractMessage(x) {
m_msg = NULL;
clone(x);
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:5,代码来源:cpp_imu.cpp
示例14: Q_UNUSED
QgsLineString* QgsLineString::curveToLine( double tolerance, SegmentationToleranceType toleranceType ) const
{
Q_UNUSED( tolerance );
Q_UNUSED( toleranceType );
return static_cast<QgsLineString*>( clone() );
}
开发者ID:fritsvanveen,项目名称:QGIS,代码行数:6,代码来源:qgslinestring.cpp
示例15: clone
QgsPolygonV2 *QgsPolygonV2::surfaceToPolygon() const
{
return clone();
}
开发者ID:giohappy,项目名称:QGIS,代码行数:4,代码来源:qgspolygon.cpp
示例16: QgsCompoundCurve
QgsAbstractGeometry* QgsLineString::toCurveType() const
{
QgsCompoundCurve* compoundCurve = new QgsCompoundCurve();
compoundCurve->addCurve( clone() );
return compoundCurve;
}
开发者ID:fritsvanveen,项目名称:QGIS,代码行数:6,代码来源:qgslinestring.cpp
示例17: SkNEW
SkPicture* SkPicture::clone() const {
SkPicture* clonedPicture = SkNEW(SkPicture);
clone(clonedPicture, 1);
return clonedPicture;
}
开发者ID:RobbinZhu,项目名称:context2d,代码行数:5,代码来源:SkPicture.cpp
示例18: clone
void Datasetore_Session_Persister_Buffer::flush()
{
vector<SessionPersistence_Content> clone(_buffer);
_persister->persist(clone);
_buffer.clear();
}
开发者ID:1Mir,项目名称:GazeTracking,代码行数:6,代码来源:Persistence.cpp
示例19: request_mput
request_mput(request_mput &packet)
{
clone(packet, packet.alloc);
}
开发者ID:DengzhiLiu,项目名称:tair,代码行数:4,代码来源:put_packet.hpp
示例20: main
int main(int argc, char **argv) {
char * stack = (char*) malloc(STACK_SIZE);
stack += STACK_SIZE;
childTime = 0;
parentTime = 0;
struct tms tt;
double clk = (double) sysconf(_SC_CLK_TCK);
if (argc < 2) {
printf("y u no give enough arguments?\n");
printHelp();
free(stack);
return 1;
}
N = atoi(argv[1]);
NK = N;
if (N < 0) {
printf("y u no give correct number?\n");
printHelp();
free(stack);
return 2;
}
long startPoint = times(NULL);
while (N--) {
parentTime = times(NULL);
#ifdef FORK
childPID = fork();
#elif VFORK
childPID = vfork();
#elif CLONE
childPID = clone(fn, stack, SIGCHLD, NULL);
#elif VCLONE
childPID = clone(fn, stack, SIGCHLD | CLONE_VM | CLONE_VFORK, NULL);
#endif
if (childPID < 0) {
printf("Blad fork()\n");
return 3;
} else if (childPID == 0) {
fn(NULL);
} else {
int status = -1;
wait(&status);
childTime += WEXITSTATUS(status);
}
}
long now = times(&tt);
parentTime = now - startPoint;
printf("Counter = %d\n\n", counter);
printf("Parent times:\n");
printf("real: %lf[s]\n", (double)parentTime / clk);
printf("user: %lf[s]\n", (double)tt.tms_utime / clk);
printf("sys: %lf[s]\n", (double)tt.tms_stime / clk);
printf("\nChildren times:\n");
printf("real: %lf[s]\n", (double)childTime / clk);
printf("user: %lf[s]\n", (double)tt.tms_cutime / clk);
printf("sys: %lf[s]\n", (double)tt.tms_cstime / clk);
double rc = ((double)(childTime))/clk;
double uc = ((double)(tt.tms_cutime))/clk;
double sc = ((double)(tt.tms_cstime))/clk;
double rp = ((double)(parentTime))/clk;
double up = (double)(tt.tms_utime)/clk;
double sp = (double)(tt.tms_stime)/clk;
FILE* fd = fopen("vclone.tmp","a+");
fprintf(fd,"ChildCount\t%d\tRealTimeSum\t%.2f\tUserTimeSum\t%.2f\tSystemTimeSum\t%.2f\tSys+UsTimeSum\t%.2f\tRealTimeChild\t%.2f\tUserTimeChild\t%.2f\tSystemTimeChild\t%.2f\tSys+UsTimeCh\t%.2f\tRealTimeParent\t%.2f\tUserTimeParent\t%.2f\tSystemTimePar.\t%.2f\tSys+UsTimePar\t%.2f\n",
NK,rc+rp,uc+up,sc+sp,uc+up+sc+sp,rc,uc,sc,uc+sc,rp,up,sp,up+sp);
fclose(fd);
return 0;
}
开发者ID:turu,项目名称:sysopy,代码行数:78,代码来源:zad1.c
注:本文中的clone函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论