31#ifndef _UCOMMON_PROTOCOLS_H_
32#define _UCOMMON_PROTOCOLS_H_
34#ifndef _UCOMMON_CPR_H_
43class __EXPORT MemoryProtocol
46 friend class MemoryRedirect;
55 virtual void *_alloc(
size_t size) = 0;
58 virtual ~MemoryProtocol();
65 inline void *alloc(
size_t size) {
76 void *zalloc(
size_t size);
84 char *
dup(
const char *
string);
92 void *
dup(
void *memory,
size_t size);
103 MemoryProtocol *target;
108 virtual void *_alloc(
size_t size) __OVERRIDE;
121 virtual void _lock(
void);
122 virtual void _unlock(
void);
142 virtual const char *
_print(
void)
const = 0;
217 virtual int keytype(
void)
const = 0;
229 virtual bool equal(
const KeyProtocol& compare)
const;
231 inline bool operator!=(
const KeyProtocol& compare)
const {
232 return !equal(compare);
Common namespace for all ucommon objects.
T * dup(const T &object)
Convenience function to duplicate object pointer to heap.
A redirection base class for the memory protocol.
Used for forming stream output.
virtual const char * _print(void) const =0
Extract formatted string for object.
Used for processing input.
virtual int _input(int code)=0
Extract formatted string for object.
A common base class for all managed objects.
virtual void release(void)=0
Method to release (or decrease retention) of an object.
void operator--(void)
Decrease retention operator.
void operator++(void)
Increase retention operator.
virtual ~ObjectProtocol()
Required virtual destructor.
ObjectProtocol * copy(void)
Retain (increase retention of) object when copying.
virtual void retain(void)=0
Method to retain (or increase retention) of an object.
Key data protocol used for things like maps and ordered lists.
virtual size_t keysize(void) const =0
Size of key data.
virtual const void * keydata(void) const =0
Buffer of key value.