OODuck  0.5
C Oriented Object framework with duck-typing support
Value Class Reference

Classic C types encapsulation. More...

Inheritance diagram for Value:
Object

Public Member Functions

void * __constructor__ (void *self, void *ptr, size_t size)
 Build new value from pointer. More...
 
void get (const void *self, void *dest, size_t size)
 Copy encapsulated object to dest. More...
 
void set (void *self, void *src, size_t size)
 Encapsulate new object from src. More...
 
- Public Member Functions inherited from Object
void * ref (void *self)
 Increment object's reference counter. More...
 
void unref (void *self)
 Decrement object's reference counter, if equals 0, delete the object. More...
 
bool equal (const void *self, const void *other)
 Check objects equality. More...
 

Detailed Description

Classic C types encapsulation.

Using memcpy() to copy memory of C object to OODuck object. Using memcmp() to determine equality.

Member Function Documentation

void * __constructor__ ( void *  self,
void *  ptr,
size_t  size 
)

Build new value from pointer.

Parameters
selfValue instance.
ptrPointer to the C object to copy.
sizeSize of the C object to copy.
Returns
Initialized instance.

Calls Value::set().

void get ( const void *  self,
void *  dest,
size_t  size 
)

Copy encapsulated object to dest.

Parameters
selfValue instance.
destDestination (must be pre-allocated).
sizeSize of the C object.
void set ( void *  self,
void *  src,
size_t  size 
)

Encapsulate new object from src.

Parameters
selfValue instance.
srcC object to copy.
sizeSize of the C object.