nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
Singleton 객체 helper

싱글톤 객체를 사용하는 경우가 잦기 때문에 구현되었다. More...

Data Structures

struct  ston_ops
 

Functions

void * ston_create (struct ston *ston, const void *key)
 객체를 생성하거나, 이미 생성된 것을 찾는다. More...
 
int ston_destroy (struct ston *ston, void *obj)
 객체를 소멸 시킨다. (실제 소멸은 refcnt 에 따른다) More...
 
int ston_fini (struct ston *ston)
 Singleton 객체 관리자를 소멸 시킨다. More...
 
struct stonston_init (struct ston_ops *ops)
 Singleton 객체 관리자를 초기화 한다. More...
 

Detailed Description

싱글톤 객체를 사용하는 경우가 잦기 때문에 구현되었다.

Author
Sung-jae Park nices.nosp@m.j@ni.nosp@m.cesj..nosp@m.com
Date
2012-4-26

ston init 을 하면서 필요한 연산자들을 정의한다.

ston_create 는 객체를 생성할 때, key 를 보고, 동일한 key 가 있는지 확인하여(compare연산자 이용) 새로 만들지, 기존에 만들어진 것을 쓸지 결정한다.

Function Documentation

void* ston_create ( struct ston ston,
const void *  key 
)

객체를 생성하거나, 이미 생성된 것을 찾는다.

Parameters
[in]ston
[in]key
Returns
void *

Definition at line 99 of file ston.c.

References ston_ops::create, ston_item::head, items, ston_item::key, malloc(), NULL, ston_item::obj, ops, and ston_item::refcnt.

Referenced by fdc_single_get().

Here is the call graph for this function:

Here is the caller graph for this function:

int ston_destroy ( struct ston ston,
void *  obj 
)

객체를 소멸 시킨다. (실제 소멸은 refcnt 에 따른다)

Parameters
[in]ston
[in]obj
Returns
int

Definition at line 121 of file ston.c.

References ston_ops::destroy, ENOENT, free(), ston_item::head, ops, and ston_item::refcnt.

Referenced by fdc_single_put().

Here is the call graph for this function:

Here is the caller graph for this function:

int ston_fini ( struct ston ston)

Singleton 객체 관리자를 소멸 시킨다.

Parameters
[in]ston
Returns
int

Definition at line 41 of file ston.c.

References ston_ops::destroy, free(), ston_item::head, items, list_entry, list_for_each_safe, ston_item::obj, and ops.

Referenced by fdc_single_fini().

Here is the call graph for this function:

Here is the caller graph for this function:

struct ston* ston_init ( struct ston_ops ops)

Singleton 객체 관리자를 초기화 한다.

Parameters
[in]ops
Returns
ston

Definition at line 26 of file ston.c.

References items, malloc(), memcpy(), NULL, and ops.

Referenced by fdc_single_init().

Here is the call graph for this function:

Here is the caller graph for this function: