1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicscomposition/openwfcompositionengine/common/src/owfobject.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,63 @@
1.4 +/* Copyright (c) 2009 The Khronos Group Inc.
1.5 + *
1.6 + * Permission is hereby granted, free of charge, to any person obtaining a
1.7 + * copy of this software and/or associated documentation files (the
1.8 + * "Materials"), to deal in the Materials without restriction, including
1.9 + * without limitation the rights to use, copy, modify, merge, publish,
1.10 + * distribute, sublicense, and/or sell copies of the Materials, and to
1.11 + * permit persons to whom the Materials are furnished to do so, subject to
1.12 + * the following conditions:
1.13 + *
1.14 + * The above copyright notice and this permission notice shall be included
1.15 + * in all copies or substantial portions of the Materials.
1.16 + *
1.17 + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1.18 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1.19 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1.20 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
1.21 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
1.22 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
1.23 + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
1.24 + */
1.25 +
1.26 +#include "owfobject.h"
1.27 +#include "owftypes.h"
1.28 +#include "owfmemory.h"
1.29 +
1.30 +
1.31 +#ifdef __cplusplus
1.32 +extern "C"
1.33 +{
1.34 +#endif
1.35 +
1.36 +
1.37 +
1.38 +OWF_API_CALL void*
1.39 +OWF_Object_Construct(size_t size,
1.40 + const char* type,
1.41 + CONSTRUCTOR ctor,
1.42 + DESTRUCTOR dtor)
1.43 +{
1.44 + OWF_OBJECT* obu = (OWF_OBJECT*) xalloc(sizeof(OWF_OBJECT) + size, 1);
1.45 +
1.46 + if (obu)
1.47 + {
1.48 + obu->type = type;
1.49 + obu->destructor = dtor;
1.50 + obu->referenceCount = 1;
1.51 + if (ctor)
1.52 + {
1.53 + ctor(&obu->payload);
1.54 + }
1.55 + DPRINT(("CREATE: created %s object (%p)\n", type, &obu->payload));
1.56 + return &obu->payload;
1.57 + }
1.58 +
1.59 + return NULL;
1.60 +}
1.61 +
1.62 +
1.63 +
1.64 +#ifdef __cplusplus
1.65 +}
1.66 +#endif