-
Notifications
You must be signed in to change notification settings - Fork 1
/
mem.h
54 lines (44 loc) · 1.07 KB
/
mem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// -*- mode:c++ -*-
#ifndef ICI_MEM_H
#define ICI_MEM_H
#include "object.h"
namespace ici
{
/*
* The following portion of this file exports to ici.h. --ici.h-start--
*/
struct mem : object
{
void *m_base;
size_t m_length; /* In m_accessz units. */
int m_accessz; /* Read/write size in bytes - 1, 2, 4 or 8. */
void (*m_free)(void *);
};
inline mem *memof(object *o)
{
return o->as<mem>();
}
inline bool ismem(object *o)
{
return o->hastype(TC_MEM);
}
class mem_type : public type
{
public:
mem_type() : type("mem", sizeof(struct mem))
{
}
void free(object *o) override;
int cmp(object *o1, object *o2) override;
unsigned long hash(object *o) override;
int assign(object *o, object *k, object *v) override;
object *fetch(object *o, object *k) override;
int save(archiver *, object *) override;
object *restore(archiver *) override;
int64_t len(object *) override;
};
/*
* End of ici.h export. --ici.h-end--
*/
} // namespace ici
#endif /* ICI_MEM_H */