• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PyObject_NEW函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: pycorba_any_new

PyObject *
pycorba_any_new(CORBA_any *any)
{
    PyCORBA_Any *self;

    self =  PyObject_NEW(PyCORBA_Any, &PyCORBA_Any_Type);
    if (!self)
	return NULL;
    self->any._type = (CORBA_TypeCode)CORBA_Object_duplicate((CORBA_Object)any->_type, NULL);
    self->any._value = MateCORBA_copy_value(any->_value, any->_type);
    self->any._release = CORBA_FALSE;

    return (PyObject *)self;
}
开发者ID:fatman2021,项目名称:python-corba,代码行数:14,代码来源:pycorba-any.c


示例2: pyjiterator_new

/*
 * News up a pyjiterator, which is just a pyjobject for iterators.
 */
PyJiterator_Object* pyjiterator_new() {
    /*
     * MSVC requires tp_base to be set here
     * See https://docs.python.org/2/extending/newtypes.html
     */
    if(!PyJiterator_Type.tp_base) {
        PyJiterator_Type.tp_base = &PyJobject_Type;
    }

    if(PyType_Ready(&PyJiterator_Type) < 0)
        return NULL;

    return PyObject_NEW(PyJiterator_Object, &PyJiterator_Type);
}
开发者ID:kulkarnikv,项目名称:jep,代码行数:17,代码来源:pyjiterator.c


示例3: alloc_ClientObject

static ClientObject*
alloc_ClientObject(void)
{
    ClientObject *client;
    if (client_numfree) {
        client = client_free_list[--client_numfree];
        _Py_NewReference((PyObject *)client);
        GDEBUG("use pooled %p", client);
    }else{
        client = PyObject_NEW(ClientObject, &ClientObjectType);
        GDEBUG("alloc %p", client);
    }
    return client;
}
开发者ID:19emtuck,项目名称:meinheld,代码行数:14,代码来源:client.c


示例4: FileWrapperObject_new

static PyObject *
FileWrapperObject_new(PyObject *self, PyObject *filelike, size_t blksize)
{
    FileWrapperObject *f;
    f = PyObject_NEW(FileWrapperObject, &FileWrapperType);
    if(f == NULL){
        return NULL;
    }

    f->filelike = filelike;
    Py_INCREF(f->filelike);
    GDEBUG("alloc FileWrapperObject %p", f);
    return (PyObject *)f;
}
开发者ID:yosisa,项目名称:meinheld,代码行数:14,代码来源:response.c


示例5: ilugi_FromIdentityInfo

PyObject *
ilugi_FromIdentityInfo (ilu_IdentityInfo id)
{
  IlugiObject *	v	= PyObject_NEW(IlugiObject, &Ilugi_Type);

  if (v == 0)
    return 0;
  if (id->ii_type != ilu_GSSIdentity)
    return 0;
  v->id = id;
  v->name = ILU_NIL;
  v->localp = ilu_FALSE;
  return (PyObject *) v;
}
开发者ID:spchamp,项目名称:ilu,代码行数:14,代码来源:ilugiobject.c


示例6: _pygtk_style_helper_new

PyObject *
_pygtk_style_helper_new(GtkStyle *style, int type, gpointer array)
{
    PyGtkStyleHelper_Object *self;

    self = (PyGtkStyleHelper_Object *)PyObject_NEW(PyGtkStyleHelper_Object,
						   &PyGtkStyleHelper_Type);
    if (self == NULL)
	return NULL;

    self->style = g_object_ref(style);
    self->type = type;
    self->array = array;
    return (PyObject *)self;
}
开发者ID:Chiheb-Nexus,项目名称:pygtk,代码行数:15,代码来源:gtk-types.c


示例7: _pygtk_tree_model_row_iter_new

PyObject *
_pygtk_tree_model_row_iter_new(GtkTreeModel *model, GtkTreeIter *parent_iter)
{
    PyGtkTreeModelRowIter *self;

    self = (PyGtkTreeModelRowIter *) PyObject_NEW(PyGtkTreeModelRowIter,
						  &PyGtkTreeModelRowIter_Type);
    if (self == NULL)
	return NULL;
    self->model = g_object_ref(model);
    /* iterate through child nodes */
    self->has_more = gtk_tree_model_iter_children(self->model, &self->iter,
						  parent_iter);
    return (PyObject *)self;
}
开发者ID:Chiheb-Nexus,项目名称:pygtk,代码行数:15,代码来源:gtk-types.c


示例8: vectors_bezier_stroke_new

static PyObject *
vectors_bezier_stroke_new(PyGimpVectors *vectors, int stroke)
{
    PyGimpVectorsStroke *self;

    self = PyObject_NEW(PyGimpVectorsStroke, &PyGimpVectorsBezierStroke_Type);

    if (self == NULL)
        return NULL;

    self->vectors_ID = vectors->ID;
    self->stroke = stroke;

    return (PyObject *)self;
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:15,代码来源:pygimp-vectors.c


示例9: pyglib_option_context_new

/**
 * pyglib_option_context_new:
 * @context: a GOptionContext
 *
 * Returns: A new GOptionContext wrapper.
 */
PyObject * 
pyglib_option_context_new (GOptionContext *context)
{
    PyGOptionContext *self;

    self = (PyGOptionContext *)PyObject_NEW(PyGOptionContext,
					    &PyGOptionContext_Type);
    if (self == NULL)
	return NULL;

    self->context = context;
    self->main_group = NULL;
    
    return (PyObject *)self;
}
开发者ID:tizenorg,项目名称:platform.upstream.pygobject2,代码行数:21,代码来源:pyglib.c


示例10: PySwigPacked_FromDataAndDesc

SWIGRUNTIME PyObject *
PySwigPacked_FromDataAndDesc(void *ptr, size_t size, const char *desc)
{
  PySwigPacked *self = PyObject_NEW(PySwigPacked, PySwigPacked_GetType());
  if (self == NULL) {
    return NULL;
  } else {
    void *pack = malloc(size);
    memcpy(pack, ptr, size);
    self->pack = pack;
    self->desc = desc;
    self->size = size;
    return (PyObject *) self;
  }
}
开发者ID:Complex501,项目名称:visionegg,代码行数:15,代码来源:win32_getrefresh_wrap.c


示例11: PySymbolicExpression

      PyObject* PySymbolicExpression(triton::engines::symbolic::SymbolicExpression* symExpr) {
        SymbolicExpression_Object* object;

        if (symExpr == nullptr) {
          Py_INCREF(Py_None);
          return Py_None;
        }

        PyType_Ready(&SymbolicExpression_Type);
        object = PyObject_NEW(SymbolicExpression_Object, &SymbolicExpression_Type);
        if (object != NULL)
          object->symExpr = symExpr;

        return (PyObject*)object;
      }
开发者ID:chubbymaggie,项目名称:Triton,代码行数:15,代码来源:pySymbolicExpression.cpp


示例12: _pygtk_rc_style_helper_new

PyObject *
_pygtk_rc_style_helper_new(GtkRcStyle *rc_style, int type, gpointer array, GtkRcFlags is_set_flag)
{
    PyGtkRcStyleHelper_Object *self;

    self = (PyGtkRcStyleHelper_Object *)PyObject_NEW(PyGtkRcStyleHelper_Object,
                                                     &PyGtkRcStyleHelper_Type);
    if (self == NULL)
	return NULL;

    self->rc_style = g_object_ref(rc_style);
    self->type = type;
    self->array = array;
    self->is_set_flag = is_set_flag;
    return (PyObject *)self;
}
开发者ID:Chiheb-Nexus,项目名称:pygtk,代码行数:16,代码来源:gtk-types.c


示例13: newiciobject

static iciobject *
newiciobject(OSType creator)
{
	iciobject *self;
	OSStatus err;
	
	self = PyObject_NEW(iciobject, &Icitype);
	if (self == NULL)
		return NULL;
	if ((err=ICStart(&self->inst, creator)) != 0 ) {
		(void)PyMac_Error(err);
		PyObject_DEL(self);
		return NULL;
	}
	return self;
}
开发者ID:JupiterSmalltalk,项目名称:openqwaq,代码行数:16,代码来源:icgluemodule.c


示例14: createMyPyObject

static PyObject *
createMyPyObject (
  PyObject * self_dummy,
  PyObject * args ) {
  MyPyObject * self;
  char * string;
    self = PyObject_NEW(MyPyObject, & MyPyObjectClass);
    if (! self) {
        return (NULL);
    }
    if (! (PyArg_ParseTuple(args, "|s", & string))) {
        return ((void *) 0);
    }
    self->string = strdup(string);
    return ((PyObject *) self);
}
开发者ID:knaka,项目名称:src,代码行数:16,代码来源:mypyobject.c


示例15: pyglib_option_group_new

/**
 * pyglib_option_group_new:
 * @group: a GOptionGroup
 *
 * The returned GOptionGroup can't be used to set any hooks, translation domains
 * or add entries. It's only intend is, to use for GOptionContext.add_group().
 *
 * Returns: the GOptionGroup wrapper.
 */
PyObject * 
pyglib_option_group_new (GOptionGroup *group)
{
    PyGOptionGroup *self;

    self = (PyGOptionGroup *)PyObject_NEW(PyGOptionGroup,
					  &PyGOptionGroup_Type);
    if (self == NULL)
	return NULL;

    self->group = group;
    self->other_owner = TRUE;
    self->is_in_context = FALSE;
        
    return (PyObject *)self;
}
开发者ID:tizenorg,项目名称:platform.upstream.pygobject2,代码行数:25,代码来源:pyglib.c


示例16: FileWrapper_New

static PyObject*
FileWrapper_New(PyObject* self, PyObject* args, PyObject* kwargs)
{
  PyObject* file;
  if(!PyArg_ParseTuple(args, "O:FileWrapper", &file))
    return NULL;
  if(!PyFile_Check(file)) {
    TYPE_ERROR("FileWrapper argument", "file", file);
    return NULL;
  }
  Py_INCREF(file);
  FileWrapper* wrapper = PyObject_NEW(FileWrapper, &FileWrapper_Type);
  PyFile_IncUseCount((PyFileObject*)file);
  wrapper->file = file;
  return (PyObject*)wrapper;
}
开发者ID:ybrs,项目名称:the-giant,代码行数:16,代码来源:filewrapper.c


示例17: PyObject_NEW

PyObject *cmd_alloc(CS_CONNECTIONObj *conn)
{
    CS_COMMANDObj *self;
    CS_RETCODE status;
    CS_COMMAND *cmd;

    self = PyObject_NEW(CS_COMMANDObj, &CS_COMMANDType);
    if (self == NULL)
	return NULL;
    SY_LEAK_REG(self);
    self->is_eed = 0;
    self->cmd = NULL;
    self->conn = NULL;
    self->strip = conn->strip;
    self->debug = conn->debug;
    self->serial = cmd_serial++;

    /* PyErr_Clear(); */

    SY_CONN_BEGIN_THREADS(conn);
    status = ct_cmd_alloc(conn->conn, &cmd);
    SY_CONN_END_THREADS(conn);

    if (self->debug)
	debug_msg("ct_cmd_alloc(conn%d, &cmd) -> %s",
		  conn->serial, value_str(VAL_STATUS, status));
    if (PyErr_Occurred()) {
	if (self->debug)
	    debug_msg("\n");
	Py_DECREF(self);
	return NULL;
    }

    if (status != CS_SUCCEED) {
	Py_DECREF(self);
	if (self->debug)
	    debug_msg(", None\n");
	return Py_BuildValue("iO", status, Py_None);
    }

    self->cmd = cmd;
    self->conn = conn;
    Py_INCREF(self->conn);
    if (self->debug)
	debug_msg(", cmd%d\n", self->serial);
    return Py_BuildValue("iN", CS_SUCCEED, self);
}
开发者ID:fbessho,项目名称:python-sybase,代码行数:47,代码来源:cmd.c


示例18: NewStatisticalTrendsAttributes

static PyObject *
NewStatisticalTrendsAttributes(int useCurrent)
{
    StatisticalTrendsAttributesObject *newObject;
    newObject = PyObject_NEW(StatisticalTrendsAttributesObject, &StatisticalTrendsAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new StatisticalTrendsAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new StatisticalTrendsAttributes(*defaultAtts);
    else
        newObject->data = new StatisticalTrendsAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:17,代码来源:PyStatisticalTrendsAttributes.C


示例19: NewExternalSurfaceAttributes

static PyObject *
NewExternalSurfaceAttributes(int useCurrent)
{
    ExternalSurfaceAttributesObject *newObject;
    newObject = PyObject_NEW(ExternalSurfaceAttributesObject, &ExternalSurfaceAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new ExternalSurfaceAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new ExternalSurfaceAttributes(*defaultAtts);
    else
        newObject->data = new ExternalSurfaceAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:17,代码来源:PyExternalSurfaceAttributes.C


示例20: NewFiveFoldTetSubdivisionAttributes

static PyObject *
NewFiveFoldTetSubdivisionAttributes(int useCurrent)
{
    FiveFoldTetSubdivisionAttributesObject *newObject;
    newObject = PyObject_NEW(FiveFoldTetSubdivisionAttributesObject, &FiveFoldTetSubdivisionAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new FiveFoldTetSubdivisionAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new FiveFoldTetSubdivisionAttributes(*defaultAtts);
    else
        newObject->data = new FiveFoldTetSubdivisionAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:17,代码来源:PyFiveFoldTetSubdivisionAttributes.C



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PyObject_New函数代码示例发布时间:2022-05-30
下一篇:
C++ PyObject_IsTrue函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap