File: RefHandle.h

package info (click to toggle)
storm-lang 0.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,004 kB
  • sloc: ansic: 261,462; cpp: 140,405; sh: 14,891; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (87 lines) | stat: -rw-r--r-- 2,117 bytes parent folder | download | duplicates (2)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#pragma once
#include "Core/Handle.h"
#include "Code/Reference.h"
#include "Code/MemberRef.h"
#include "Code/Binary.h"

namespace storm {
	STORM_PKG(core.lang);

	class Function;

	/**
	 * A handle where all members are updated using references.
	 */
	class RefHandle : public Handle {
		STORM_CLASS;
	public:
		// Create. 'inside' is used to create references.
		STORM_CTOR RefHandle(code::Content *inside);

		// Set copy ctor.
		void STORM_FN setCopyCtor(code::Ref ref);
		void STORM_FN setCopyCtor(code::Binary *thunk);

		// Set destructor.
		void STORM_FN setDestroy(code::Ref ref);
		void STORM_FN setDestroy(code::Binary *thunk);

		// Set deep copy function.
		void STORM_FN setDeepCopy(code::Ref ref);
		void STORM_FN setDeepCopy(code::Binary *thunk);

		// Set to string function.
		void STORM_FN setToS(code::Ref ref);
		void STORM_FN setToS(code::Binary *thunk);

		// Set hash function.
		void STORM_FN setHash(code::Ref ref);
		void STORM_FN setHash(code::Binary *thunk);

		// Set equality function.
		void STORM_FN setEqual(code::Ref ref);
		void STORM_FN setEqual(code::Binary *thunk);

		// Set less-than function.
		void STORM_FN setLess(code::Ref ref);
		void STORM_FN setLess(code::Binary *thunk);

		// Set the type-info function.
		void STORM_FN setSerializedType(code::Ref ref);
		void STORM_FN setSerializedType(code::Binary *thunk);

	private:
		// Content to use when creating references.
		code::Content *content;

		// Ref to copy ctor (may be null).
		code::MemberRef *copyRef;

		// Ref to dtor (may be null).
		code::MemberRef *destroyRef;

		// Ref to deep copy fn.
		code::MemberRef *deepCopyRef;

		// Ref to toS fn.
		code::MemberRef *toSRef;

		// Ref to hash fn.
		code::MemberRef *hashRef;

		// Ref to equality fn.
		code::MemberRef *equalRef;

		// Ref to less-than fn.
		code::MemberRef *lessRef;

		// Ref to type-info fn.
		code::MemberRef *serializedTypeRef;
	};


	// Manual population of functions for some of the handles in the system. Will only fill in
	// function pointers, so fill in the proper references later on.
	void populateHandle(Type *type, Handle *h);

}