CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
ssdtreeobj.h
1#pragma once
2// This header file is auto-generated!
3// Do not make changes to this file or they will be overwritten.
4// clang-format off
5#include <cx/obj.h>
6#include <cx/struct.h>
7#include <cx/ssdtree/ssdshared.h>
8#include <cx/thread/mutex.h>
9
10CX_C_BEGIN
11
12typedef struct SSDTree SSDTree;
13typedef struct SSDTree_WeakRef SSDTree_WeakRef;
14saDeclarePtr(SSDTree);
15saDeclarePtr(SSDTree_WeakRef);
16#define _sti_SSDTree _sti_object
17#define SType_SSDTree SSDTree*
18#define STStorageType_SSDTree SSDTree*
19#define STypeArg_SSDTree(type, val) stgeneric(object, (ObjInst*)objInstCheckClass(SSDTree, val))
20#define STypeArgPtr_SSDTree(type, val) (stgeneric*)objInstCheckClassPtr(SSDTree, val)
21#define STypeCheckedArg_SSDTree(type, val) stType(type), stArg(type, val)
22#define STypeCheckedPtrArg_SSDTree(type, val) stType(type), stArgPtr(type, val)
23
24#ifdef SSD_LOCK_DEBUG
25typedef struct SSDTreeDebug {
26 Mutex mtx;
27 sa_SSDLockDebug readlocks;
28 sa_SSDLockDebug writelocks;
29} SSDTreeDebug;
30#else
31typedef struct SSDTreeDebug {
32 uint32 _dummy;
33} SSDTreeDebug;
34#endif
35
36typedef struct SSDTree_ClassIf {
37 ObjIface* _implements;
38 ObjIface* _parent;
39 size_t _size;
40
41 _objfactory_guaranteed SSDNode* (*createNode)(_In_ void* self, _In_range_(SSD_Create_None+1, SSD_Create_Count-1) SSDCreateType crtype);
42} SSDTree_ClassIf;
43extern SSDTree_ClassIf SSDTree_ClassIf_tmpl;
44
45typedef struct SSDTree {
46 union {
47 SSDTree_ClassIf* _;
48 void* _is_SSDTree;
49 void* _is_ObjInst;
50 };
51 ObjClassInfo* _clsinfo;
52 atomic(uintptr) _ref;
53 atomic(ptr) _weakref;
54
55 RWLock lock;
56 SSDTreeDebug dbg;
57 uint32 flags;
58 int64 modified; // The most recent last-modified timestamp of any node in the tree
59 SSDNodeFactory factories[SSD_Create_Count]; // Factory functions for if this tree wants to use derived node classes
60} SSDTree;
61extern ObjClassInfo SSDTree_clsinfo;
62#define SSDTree(inst) objInstCheckClass(SSDTree, inst)
63#define SSDTreeNone ((SSDTree*)NULL)
64
65typedef struct SSDTree_WeakRef {
66 union {
67 ObjInst* _inst;
68 void* _is_SSDTree_WeakRef;
69 void* _is_ObjInst_WeakRef;
70 };
71 atomic(uintptr) _ref;
72 RWLock _lock;
73} SSDTree_WeakRef;
74#define SSDTree_WeakRef(inst) objWeakRefCheckClass(SSDTree, inst)
75
76_objfactory_guaranteed SSDTree* SSDTree_create(uint32 flags);
77// SSDTree* ssdtreeCreate(uint32 flags);
78#define ssdtreeCreate(flags) SSDTree_create(flags)
79
80// SSDNode* ssdtreeCreateNode(SSDTree* self, SSDCreateType crtype);
81#define ssdtreeCreateNode(self, crtype) (self)->_->createNode(SSDTree(self), crtype)
82
83CX_C_END
#define saDeclarePtr(name)
Definition sarray.h:100
#define _objfactory_guaranteed
Definition objimpl.h:106
enum SSD_CREATE_TYPE_ENUM SSDCreateType
Node creation types for specifying which kind of node to create.
@ SSD_Create_None
Do not create a node.
Definition ssdshared.h:27
@ SSD_Create_Count
Total number of creation types (internal use)
Definition ssdshared.h:32
CX Struct System - Introspectable, serializable POD structures in C.
Mutex synchronization primitive.
CX Object System - Object-oriented programming in C.
Definition mutex.h:60