Coconut Framework  beta
Classes | Typedefs | Functions | Variables
CNObject.h File Reference

Define CNObject data structure. More...

#include "CNResource.h"
#include "CNForwarders.h"
#include <stdlib.h>
#include <assert.h>

Go to the source code of this file.

Classes

struct  CNObjectMethods
 Methods for CNObject. More...
 
struct  CNObject
 Root object. More...
 

Typedefs

typedef void(* CNDeallocateObjectFuncRef )(struct CNObject *dst)
 

Functions

static struct CNObjectCNAllocateObject (size_t size, const struct CNObjectMethods *methods, struct CNResource *resource)
 Allocate object. More...
 
static void CNRetainObject (struct CNObject *dst)
 Retain the object. More...
 
void CNReleaseObject (struct CNObject *dst)
 Release the object. More...
 
static struct CNResource * CNResourceOfObject (struct CNObject *src)
 Get resource for the object. More...
 
static struct CNObjectMethodsCNMethodsOfObject (const struct CNObject *src)
 Get methods for the object. More...
 
static size_t CNSizeOfObject (const struct CNObject *src)
 Get size of object. More...
 

Variables

static const unsigned long CNReferenceCountForStaticObject = ((unsigned long) -1)
 

Detailed Description

Define CNObject data structure.

Copyright
Copyright (C) 2012 Steel Wheels Project

Typedef Documentation

typedef void(* CNDeallocateObjectFuncRef)(struct CNObject *dst)

Pointer of the function to deallocate object

Function Documentation

static struct CNObject* CNAllocateObject ( size_t  size,
const struct CNObjectMethods methods,
struct CNResource *  resource 
)
static

Allocate object.

Return values
objAllocated object
NULLAllocation failed
Parameters
sizeSize of this object. Size will be defined by the subclass.
methodsMethods for this object. It will be defind by the subclass.
resourceResouce for this object

References CNAllocateData(), CNObject::methods, CNObject::referenceCount, CNObject::resource, and CNObject::sizeOfObject.

Referenced by CNAllocateTextElement().

static void CNRetainObject ( struct CNObject dst)
inlinestatic
void CNReleaseObject ( struct CNObject dst)
static struct CNResource* CNResourceOfObject ( struct CNObject src)
static

Get resource for the object.

Returns
Resource for the object
Parameters
srcSource object

References CNObject::resource.

Referenced by CNResourceOfEdge(), CNResourceOfGraph(), CNResourceOfNode(), and CNResourceOfText().

static struct CNObjectMethods* CNMethodsOfObject ( const struct CNObject src)
static

Get methods for the object.

Returns
Methods for the object
Parameters
srcSource object

References CNObject::methods.

Referenced by CNPrintEdge(), CNPrintNode(), and CNPrintTextElement().

static size_t CNSizeOfObject ( const struct CNObject src)
inlinestatic

Get size of object.

Returns
Size of object
Parameters
srcSource object

References CNObject::sizeOfObject.

Variable Documentation

const unsigned long CNReferenceCountForStaticObject = ((unsigned long) -1)
static

The reference count for the static object. The context of the object which has this value for the reference count is NEVER released.

Referenced by CNRetainObject().